Test Failed
Push — master ( dd4895...40f0f8 )
by Stiofan
08:27
created
geodirectory-admin/admin_hooks_actions.php 3 patches
Indentation   +1479 added lines, -1479 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@  discard block
 block discarded – undo
10 10
 
11 11
 add_action('admin_init', 'geodir_admin_init');
12 12
 if (!function_exists('geodir_admin_init')) {
13
-    /**
14
-     * Adds GD setting pages in admin.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global string $current_tab The current settings tab name.
19
-     */
20
-    function geodir_admin_init()
21
-    {
22
-
23
-        if (is_admin()):
24
-            global $current_tab;
25
-            geodir_redirect_to_admin_panel_on_installed();
26
-            $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
29
-            /**
30
-             * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31
-             *
32
-             * @since 1.0.0
33
-             */
34
-            do_action('admin_panel_init');
35
-            add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
36
-
37
-
38
-        endif;
39
-    }
13
+	/**
14
+	 * Adds GD setting pages in admin.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global string $current_tab The current settings tab name.
19
+	 */
20
+	function geodir_admin_init()
21
+	{
22
+
23
+		if (is_admin()):
24
+			global $current_tab;
25
+			geodir_redirect_to_admin_panel_on_installed();
26
+			$current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
+			if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
+				geodir_handle_option_form_submit($current_tab); // located in admin function.php
29
+			/**
30
+			 * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31
+			 *
32
+			 * @since 1.0.0
33
+			 */
34
+			do_action('admin_panel_init');
35
+			add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
36
+
37
+
38
+		endif;
39
+	}
40 40
 }
41 41
 
42 42
 /**
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_redirect_to_admin_panel_on_installed()
49 49
 {
50
-    if (get_option('geodir_installation_redirect', false)) {
51
-        delete_option('geodir_installation_redirect');
52
-        wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
53
-    }
50
+	if (get_option('geodir_installation_redirect', false)) {
51
+		delete_option('geodir_installation_redirect');
52
+		wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
53
+	}
54 54
 }
55 55
 
56 56
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+	geodir_admin_option_form($current_tab);// defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_conditional_admin_script_load()
87 87
 {
88
-    global $pagenow;
88
+	global $pagenow;
89 89
 	
90 90
 	// Get the current post type
91 91
 	$post_type = geodir_admin_current_post_type();
92 92
 	$geodir_post_types = geodir_get_posttypes();
93 93
     
94 94
 	if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
95
-        add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
96
-        add_action('admin_enqueue_scripts', 'geodir_admin_styles');
97
-        add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
98
-    }
95
+		add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
96
+		add_action('admin_enqueue_scripts', 'geodir_admin_styles');
97
+		add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
98
+	}
99 99
 
100
-    add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
100
+	add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
101 101
 
102 102
 }
103 103
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function create_default_admin_main_nav()
133 133
 {
134
-    add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
135
-    add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
136
-    add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
137
-    add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
138
-    add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
139
-    //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
134
+	add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
135
+	add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
136
+	add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
137
+	add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
138
+	add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
139
+	//add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
140 140
 
141 141
 }
142 142
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function geodir_admin_list_columns()
151 151
 {
152
-    if ($post_types = geodir_get_posttypes()) {
152
+	if ($post_types = geodir_get_posttypes()) {
153 153
 
154
-        foreach ($post_types as $post_type):
155
-            add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
156
-            //Filter-Payment-Manager to show Package
157
-            add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
154
+		foreach ($post_types as $post_type):
155
+			add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
156
+			//Filter-Payment-Manager to show Package
157
+			add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
158 158
 
159
-            add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
160
-        endforeach;
161
-    }
159
+			add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
160
+		endforeach;
161
+	}
162 162
 }
163 163
 
164 164
 /**
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function geodir_default_admin_main_tabs($tabs)
173 173
 {
174
-    return $tabs = array(
175
-        'general_settings' => array('label' => __('General', 'geodirectory')),
176
-        'design_settings' => array('label' => __('Design', 'geodirectory')),
177
-        'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
178
-        'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
179
-        'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
180
-        'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
181
-
182
-    );
174
+	return $tabs = array(
175
+		'general_settings' => array('label' => __('General', 'geodirectory')),
176
+		'design_settings' => array('label' => __('Design', 'geodirectory')),
177
+		'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
178
+		'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
179
+		'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
180
+		'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
181
+
182
+	);
183 183
 }
184 184
 
185 185
 add_action('do_meta_boxes', 'geodir_remove_image_box');
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
  */
193 193
 function geodir_remove_image_box()
194 194
 {
195
-    global $post;
195
+	global $post;
196 196
 
197
-    $geodir_posttypes = geodir_get_posttypes();
197
+	$geodir_posttypes = geodir_get_posttypes();
198 198
 
199
-    if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
199
+	if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
200 200
 
201
-        remove_meta_box('postimagediv', $post->post_type, 'side');
202
-        remove_meta_box('revisionsdiv', $post->post_type, 'normal');
201
+		remove_meta_box('postimagediv', $post->post_type, 'side');
202
+		remove_meta_box('revisionsdiv', $post->post_type, 'normal');
203 203
 
204
-    endif;
204
+	endif;
205 205
 
206 206
 }
207 207
 
@@ -216,26 +216,26 @@  discard block
 block discarded – undo
216 216
  */
217 217
 function geodir_meta_box_add()
218 218
 {
219
-    global $post;
219
+	global $post;
220 220
 
221
-    $geodir_post_types = geodir_get_posttypes('array');
222
-    $geodir_posttypes = array_keys($geodir_post_types);
221
+	$geodir_post_types = geodir_get_posttypes('array');
222
+	$geodir_posttypes = array_keys($geodir_post_types);
223 223
 
224
-    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
224
+	if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
225 225
 
226
-        $geodir_posttype = $post->post_type;
227
-        $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
226
+		$geodir_posttype = $post->post_type;
227
+		$post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']);
228 228
 
229
-        // Filter-Payment-Manager
229
+		// Filter-Payment-Manager
230 230
 
231
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
231
+		add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
232 232
 
233
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
233
+		add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
234 234
 
235
-        // no need of this box as all fields moved to main information box
236
-        //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
235
+		// no need of this box as all fields moved to main information box
236
+		//add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
237 237
 
238
-    endif;
238
+	endif;
239 239
 
240 240
 }
241 241
 
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 function geodir_hide_post_taxonomy_meta_boxes()
260 260
 {
261 261
 
262
-    $geodir_post_types = get_option('geodir_post_types');
262
+	$geodir_post_types = get_option('geodir_post_types');
263 263
 
264
-    if (!empty($geodir_post_types)) {
265
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
264
+	if (!empty($geodir_post_types)) {
265
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
266 266
 
267
-            $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
267
+			$gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
268 268
 
269
-            if(!empty($gd_taxonomy)) {
270
-                foreach ($gd_taxonomy as $tax) {
269
+			if(!empty($gd_taxonomy)) {
270
+				foreach ($gd_taxonomy as $tax) {
271 271
 
272
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
272
+					remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
273 273
 
274
-                }
275
-            }
274
+				}
275
+			}
276 276
 
277
-        }
278
-    }
277
+		}
278
+	}
279 279
 }
280 280
 
281 281
 add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
  */
290 290
 function geodir_add_listing_map_restrict($map_restirct)
291 291
 {
292
-    if (is_admin()) {
293
-        if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
294
-            $map_restirct = false;
295
-        }
296
-    }
297
-    return $map_restirct;
292
+	if (is_admin()) {
293
+		if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
294
+			$map_restirct = false;
295
+		}
296
+	}
297
+	return $map_restirct;
298 298
 }
299 299
 
300 300
 
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 function geodir_enable_editor_on_notifications($notification)
314 314
 {
315 315
 
316
-    if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
316
+	if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
317 317
 
318
-        foreach ($notification as $key => $value) {
319
-            if ($value['type'] == 'textarea')
320
-                $notification[$key]['type'] = 'editor';
321
-        }
318
+		foreach ($notification as $key => $value) {
319
+			if ($value['type'] == 'textarea')
320
+				$notification[$key]['type'] = 'editor';
321
+		}
322 322
 
323
-    }
323
+	}
324 324
 
325
-    return $notification;
325
+	return $notification;
326 326
 }
327 327
 
328 328
 
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
 function geodir_enable_editor_on_design_settings($design_setting)
340 340
 {
341 341
 
342
-    if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
342
+	if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
343 343
 
344
-        foreach ($design_setting as $key => $value) {
345
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
-                $design_setting[$key]['type'] = 'editor';
347
-        }
344
+		foreach ($design_setting as $key => $value) {
345
+			if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
+				$design_setting[$key]['type'] = 'editor';
347
+		}
348 348
 
349
-    }
349
+	}
350 350
 
351
-    return $design_setting;
351
+	return $design_setting;
352 352
 }
353 353
 
354 354
 /* ----------- START MANAGE CUSTOM FIELDS ---------------- */
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
357 357
 
358 358
 function geodir_manage_available_fields_predefined($sub_tab){
359
-    if($sub_tab=='custom_fields'){
360
-        geodir_custom_available_fields('predefined');
361
-    }
359
+	if($sub_tab=='custom_fields'){
360
+		geodir_custom_available_fields('predefined');
361
+	}
362 362
 }
363 363
 
364 364
 function geodir_manage_available_fields_custom($sub_tab){
365
-    if($sub_tab=='custom_fields'){
366
-        geodir_custom_available_fields('custom');
367
-    }
365
+	if($sub_tab=='custom_fields'){
366
+		geodir_custom_available_fields('custom');
367
+	}
368 368
 }
369 369
 
370 370
 
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 function geodir_manage_available_fields($sub_tab)
384 384
 {
385 385
 
386
-    switch ($sub_tab) {
387
-        case 'custom_fields':
388
-            geodir_custom_available_fields();
389
-            break;
386
+	switch ($sub_tab) {
387
+		case 'custom_fields':
388
+			geodir_custom_available_fields();
389
+			break;
390 390
 
391
-        case 'sorting_options':
392
-            geodir_sorting_options_available_fields();
393
-            break;
391
+		case 'sorting_options':
392
+			geodir_sorting_options_available_fields();
393
+			break;
394 394
 
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 
@@ -408,16 +408,16 @@  discard block
 block discarded – undo
408 408
 function geodir_manage_selected_fields($sub_tab)
409 409
 {
410 410
 
411
-    switch ($sub_tab) {
412
-        case 'custom_fields':
413
-            geodir_custom_selected_fields();
414
-            break;
411
+	switch ($sub_tab) {
412
+		case 'custom_fields':
413
+			geodir_custom_selected_fields();
414
+			break;
415 415
 
416
-        case 'sorting_options':
417
-            geodir_sorting_options_selected_fields();
418
-            break;
416
+		case 'sorting_options':
417
+			geodir_sorting_options_selected_fields();
418
+			break;
419 419
 
420
-    }
420
+	}
421 421
 }
422 422
 
423 423
 /**
@@ -429,52 +429,52 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_sorting_options_available_fields()
431 431
 {
432
-    global $wpdb;
433
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
434
-    ?>
432
+	global $wpdb;
433
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
434
+	?>
435 435
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
436 436
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
437 437
     <ul>
438 438
     <?php
439
-        $sort_options = geodir_get_custom_sort_options($listing_type);
439
+		$sort_options = geodir_get_custom_sort_options($listing_type);
440 440
         
441
-        foreach ($sort_options as $key => $val) {
442
-            $val = stripslashes_deep($val); // strip slashes
443
-
444
-            $check_html_variable = $wpdb->get_var(
445
-                $wpdb->prepare(
446
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447
-                    array($val['htmlvar_name'], $listing_type, $val['field_type'])
448
-                )
449
-            );
441
+		foreach ($sort_options as $key => $val) {
442
+			$val = stripslashes_deep($val); // strip slashes
443
+
444
+			$check_html_variable = $wpdb->get_var(
445
+				$wpdb->prepare(
446
+					"SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447
+					array($val['htmlvar_name'], $listing_type, $val['field_type'])
448
+				)
449
+			);
450 450
             
451
-            $display = $check_html_variable ? ' style="display:none;"' : '';
452
-           ?>
451
+			$display = $check_html_variable ? ' style="display:none;"' : '';
452
+		   ?>
453 453
 
454 454
             <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
455 455
                 <?php
456
-                if(isset($val['description']) && $val['description']){
457
-                    echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
458
-                }?>
456
+				if(isset($val['description']) && $val['description']){
457
+					echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
458
+				}?>
459 459
 
460 460
                 <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>"  data-field-type="<?php echo $val['field_type'];?>"
461 461
                    title="<?php echo $val['site_title'];?>"
462 462
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
463 463
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
464
-                        echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
466
-                        echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
-                    }else{
468
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469
-                    }?>
464
+						echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
+					}elseif(isset($val['field_icon']) && $val['field_icon'] ){
466
+						echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
+					}else{
468
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469
+					}?>
470 470
                     <?php echo $val['site_title'];?>
471 471
                 </a>
472 472
             </li>
473 473
 
474 474
 
475 475
             <?php
476
-        }
477
-    ?>
476
+		}
477
+	?>
478 478
     </ul>
479 479
     <?php
480 480
 }
@@ -488,28 +488,28 @@  discard block
 block discarded – undo
488 488
  */
489 489
 function geodir_sorting_options_selected_fields()
490 490
 {
491
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
492
-    ?>
491
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
492
+	?>
493 493
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
494 494
     <ul class="core">
495 495
     <?php 
496
-        global $wpdb;
496
+		global $wpdb;
497 497
         
498
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
498
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
499 499
 
500
-        if (!empty($fields)) {
501
-            foreach ($fields as $field) {
502
-                //$result_str = $field->id;
503
-                $result_str = $field;
504
-                $field_type = $field->field_type;
505
-                $field_ins_upd = 'display';
500
+		if (!empty($fields)) {
501
+			foreach ($fields as $field) {
502
+				//$result_str = $field->id;
503
+				$result_str = $field;
504
+				$field_type = $field->field_type;
505
+				$field_ins_upd = 'display';
506 506
 
507
-                $default = false;
507
+				$default = false;
508 508
 
509
-                geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
510
-            }
511
-        }
512
-    ?>
509
+				geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
510
+			}
511
+		}
512
+	?>
513 513
     </ul>
514 514
     <?php
515 515
 }
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
  */
523 523
 function geodir_custom_fields_custom($post_type=''){
524 524
 
525
-    $custom_fields = array();
525
+	$custom_fields = array();
526 526
 
527
-    /**
528
-     * @see `geodir_custom_fields`
529
-     */
530
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
527
+	/**
528
+	 * @see `geodir_custom_fields`
529
+	 */
530
+	return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
531 531
 }
532 532
 
533 533
 
@@ -540,139 +540,139 @@  discard block
 block discarded – undo
540 540
  */
541 541
 function geodir_custom_fields($post_type=''){
542 542
     
543
-    $custom_fields = array(
544
-        'text' => array(
545
-            'field_type'  =>  'text',
546
-            'class' =>  'gd-text',
547
-            'icon'  =>  'fa fa-minus',
548
-            'name'  =>  __('Text', 'geodirectory'),
549
-            'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
550
-        ),
551
-        'datepicker' => array(
552
-            'field_type'  =>  'datepicker',
553
-            'class' =>  'gd-datepicker',
554
-            'icon'  =>  'fa fa-calendar',
555
-            'name'  =>  __('Date', 'geodirectory'),
556
-            'description' =>  __('Adds a date picker.', 'geodirectory')
557
-        ),
558
-        'textarea' => array(
559
-            'field_type'  =>  'textarea',
560
-            'class' =>  'gd-textarea',
561
-            'icon'  =>  'fa fa-bars',
562
-            'name'  =>  __('Textarea', 'geodirectory'),
563
-            'description' =>  __('Adds a textarea', 'geodirectory')
564
-        ),
565
-        'time' => array(
566
-            'field_type'  =>  'time',
567
-            'class' =>  'gd-time',
568
-            'icon' =>  'fa fa-clock-o',
569
-            'name'  =>  __('Time', 'geodirectory'),
570
-            'description' =>  __('Adds a time picker', 'geodirectory')
571
-        ),
572
-        'checkbox' => array(
573
-            'field_type'  =>  'checkbox',
574
-            'class' =>  'gd-checkbox',
575
-            'icon' =>  'fa fa-check-square-o',
576
-            'name'  =>  __('Checkbox', 'geodirectory'),
577
-            'description' =>  __('Adds a checkbox', 'geodirectory')
578
-        ),
579
-        'phone' => array(
580
-            'field_type'  =>  'phone',
581
-            'class' =>  'gd-phone',
582
-            'icon' =>  'fa fa-phone',
583
-            'name'  =>  __('Phone', 'geodirectory'),
584
-            'description' =>  __('Adds a phone input', 'geodirectory')
585
-        ),
586
-        'radio' => array(
587
-            'field_type'  =>  'radio',
588
-            'class' =>  'gd-radio',
589
-            'icon' =>  'fa fa-dot-circle-o',
590
-            'name'  =>  __('Radio', 'geodirectory'),
591
-            'description' =>  __('Adds a radio input', 'geodirectory')
592
-        ),
593
-        'email' => array(
594
-            'field_type'  =>  'email',
595
-            'class' =>  'gd-email',
596
-            'icon' =>  'fa fa-envelope-o',
597
-            'name'  =>  __('Email', 'geodirectory'),
598
-            'description' =>  __('Adds a email input', 'geodirectory')
599
-        ),
600
-        'select' => array(
601
-            'field_type'  =>  'select',
602
-            'class' =>  'gd-select',
603
-            'icon' =>  'fa fa-caret-square-o-down',
604
-            'name'  =>  __('Select', 'geodirectory'),
605
-            'description' =>  __('Adds a select input', 'geodirectory')
606
-        ),
607
-        'multiselect' => array(
608
-            'field_type'  =>  'multiselect',
609
-            'class' =>  'gd-multiselect',
610
-            'icon' =>  'fa fa-caret-square-o-down',
611
-            'name'  =>  __('Multi Select', 'geodirectory'),
612
-            'description' =>  __('Adds a multiselect input', 'geodirectory')
613
-        ),
614
-        'url' => array(
615
-            'field_type'  =>  'url',
616
-            'class' =>  'gd-url',
617
-            'icon' =>  'fa fa-link',
618
-            'name'  =>  __('URL', 'geodirectory'),
619
-            'description' =>  __('Adds a url input', 'geodirectory')
620
-        ),
621
-        'html' => array(
622
-            'field_type'  =>  'html',
623
-            'class' =>  'gd-html',
624
-            'icon' =>  'fa fa-code',
625
-            'name'  =>  __('HTML', 'geodirectory'),
626
-            'description' =>  __('Adds a html input textarea', 'geodirectory')
627
-        ),
628
-        'file' => array(
629
-            'field_type'  =>  'file',
630
-            'class' =>  'gd-file',
631
-            'icon' =>  'fa fa-file',
632
-            'name'  =>  __('File Upload', 'geodirectory'),
633
-            'description' =>  __('Adds a file input', 'geodirectory')
634
-        )
635
-    );
636
-
637
-    /**
638
-     * Filter the custom fields array to be able to add or remove items.
639
-     * 
640
-     * @since 1.6.6
641
-     *
642
-     * @param array $custom_fields {
643
-     *     The custom fields array to be filtered.
644
-     *
645
-     *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
646
-     *     @type string $class The class for the field in backend.
647
-     *     @type string $icon Can be font-awesome class name or icon image url.
648
-     *     @type string $name The name of the field.
649
-     *     @type string $description A short description about the field.
650
-     *     @type array $defaults {
651
-     *                    Optional. Used to set the default value of the field.
652
-     *
653
-     *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
654
-     *                    @type string admin_title The admin title for the field.
655
-     *                    @type string site_title This will be the title for the field on the frontend.
656
-     *                    @type string admin_desc This will be shown below the field on the add listing form.
657
-     *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
658
-     *                    @type bool is_active If false the field will not be displayed anywhere.
659
-     *                    @type bool for_admin_use If true then only site admin can see and edit this field.
660
-     *                    @type string default_value The default value for the input on the add listing page.
661
-     *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
662
-     *                    @type bool is_required If true the field will be required on the add listing page.
663
-     *                    @type string option_values The option values for select and multiselect only
664
-     *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
665
-     *                    @type string validation_msg HTML5 validation message (text input only by default).
666
-     *                    @type string required_msg Required warning message.
667
-     *                    @type string field_icon Icon url or font awesome class.
668
-     *                    @type string css_class Field custom css class for field custom style.
669
-     *                    @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option.
670
-     *                    @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required)
671
-     *     }
672
-     * }
673
-     * @param string $post_type The post type requested.
674
-     */
675
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
543
+	$custom_fields = array(
544
+		'text' => array(
545
+			'field_type'  =>  'text',
546
+			'class' =>  'gd-text',
547
+			'icon'  =>  'fa fa-minus',
548
+			'name'  =>  __('Text', 'geodirectory'),
549
+			'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
550
+		),
551
+		'datepicker' => array(
552
+			'field_type'  =>  'datepicker',
553
+			'class' =>  'gd-datepicker',
554
+			'icon'  =>  'fa fa-calendar',
555
+			'name'  =>  __('Date', 'geodirectory'),
556
+			'description' =>  __('Adds a date picker.', 'geodirectory')
557
+		),
558
+		'textarea' => array(
559
+			'field_type'  =>  'textarea',
560
+			'class' =>  'gd-textarea',
561
+			'icon'  =>  'fa fa-bars',
562
+			'name'  =>  __('Textarea', 'geodirectory'),
563
+			'description' =>  __('Adds a textarea', 'geodirectory')
564
+		),
565
+		'time' => array(
566
+			'field_type'  =>  'time',
567
+			'class' =>  'gd-time',
568
+			'icon' =>  'fa fa-clock-o',
569
+			'name'  =>  __('Time', 'geodirectory'),
570
+			'description' =>  __('Adds a time picker', 'geodirectory')
571
+		),
572
+		'checkbox' => array(
573
+			'field_type'  =>  'checkbox',
574
+			'class' =>  'gd-checkbox',
575
+			'icon' =>  'fa fa-check-square-o',
576
+			'name'  =>  __('Checkbox', 'geodirectory'),
577
+			'description' =>  __('Adds a checkbox', 'geodirectory')
578
+		),
579
+		'phone' => array(
580
+			'field_type'  =>  'phone',
581
+			'class' =>  'gd-phone',
582
+			'icon' =>  'fa fa-phone',
583
+			'name'  =>  __('Phone', 'geodirectory'),
584
+			'description' =>  __('Adds a phone input', 'geodirectory')
585
+		),
586
+		'radio' => array(
587
+			'field_type'  =>  'radio',
588
+			'class' =>  'gd-radio',
589
+			'icon' =>  'fa fa-dot-circle-o',
590
+			'name'  =>  __('Radio', 'geodirectory'),
591
+			'description' =>  __('Adds a radio input', 'geodirectory')
592
+		),
593
+		'email' => array(
594
+			'field_type'  =>  'email',
595
+			'class' =>  'gd-email',
596
+			'icon' =>  'fa fa-envelope-o',
597
+			'name'  =>  __('Email', 'geodirectory'),
598
+			'description' =>  __('Adds a email input', 'geodirectory')
599
+		),
600
+		'select' => array(
601
+			'field_type'  =>  'select',
602
+			'class' =>  'gd-select',
603
+			'icon' =>  'fa fa-caret-square-o-down',
604
+			'name'  =>  __('Select', 'geodirectory'),
605
+			'description' =>  __('Adds a select input', 'geodirectory')
606
+		),
607
+		'multiselect' => array(
608
+			'field_type'  =>  'multiselect',
609
+			'class' =>  'gd-multiselect',
610
+			'icon' =>  'fa fa-caret-square-o-down',
611
+			'name'  =>  __('Multi Select', 'geodirectory'),
612
+			'description' =>  __('Adds a multiselect input', 'geodirectory')
613
+		),
614
+		'url' => array(
615
+			'field_type'  =>  'url',
616
+			'class' =>  'gd-url',
617
+			'icon' =>  'fa fa-link',
618
+			'name'  =>  __('URL', 'geodirectory'),
619
+			'description' =>  __('Adds a url input', 'geodirectory')
620
+		),
621
+		'html' => array(
622
+			'field_type'  =>  'html',
623
+			'class' =>  'gd-html',
624
+			'icon' =>  'fa fa-code',
625
+			'name'  =>  __('HTML', 'geodirectory'),
626
+			'description' =>  __('Adds a html input textarea', 'geodirectory')
627
+		),
628
+		'file' => array(
629
+			'field_type'  =>  'file',
630
+			'class' =>  'gd-file',
631
+			'icon' =>  'fa fa-file',
632
+			'name'  =>  __('File Upload', 'geodirectory'),
633
+			'description' =>  __('Adds a file input', 'geodirectory')
634
+		)
635
+	);
636
+
637
+	/**
638
+	 * Filter the custom fields array to be able to add or remove items.
639
+	 * 
640
+	 * @since 1.6.6
641
+	 *
642
+	 * @param array $custom_fields {
643
+	 *     The custom fields array to be filtered.
644
+	 *
645
+	 *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
646
+	 *     @type string $class The class for the field in backend.
647
+	 *     @type string $icon Can be font-awesome class name or icon image url.
648
+	 *     @type string $name The name of the field.
649
+	 *     @type string $description A short description about the field.
650
+	 *     @type array $defaults {
651
+	 *                    Optional. Used to set the default value of the field.
652
+	 *
653
+	 *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
654
+	 *                    @type string admin_title The admin title for the field.
655
+	 *                    @type string site_title This will be the title for the field on the frontend.
656
+	 *                    @type string admin_desc This will be shown below the field on the add listing form.
657
+	 *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
658
+	 *                    @type bool is_active If false the field will not be displayed anywhere.
659
+	 *                    @type bool for_admin_use If true then only site admin can see and edit this field.
660
+	 *                    @type string default_value The default value for the input on the add listing page.
661
+	 *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
662
+	 *                    @type bool is_required If true the field will be required on the add listing page.
663
+	 *                    @type string option_values The option values for select and multiselect only
664
+	 *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
665
+	 *                    @type string validation_msg HTML5 validation message (text input only by default).
666
+	 *                    @type string required_msg Required warning message.
667
+	 *                    @type string field_icon Icon url or font awesome class.
668
+	 *                    @type string css_class Field custom css class for field custom style.
669
+	 *                    @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option.
670
+	 *                    @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required)
671
+	 *     }
672
+	 * }
673
+	 * @param string $post_type The post type requested.
674
+	 */
675
+	return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
676 676
 }
677 677
 
678 678
 /**
@@ -685,19 +685,19 @@  discard block
 block discarded – undo
685 685
  */
686 686
 function geodir_custom_available_fields($type='')
687 687
 {
688
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
689
-    ?>
688
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
689
+	?>
690 690
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
691 691
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
692 692
 
693 693
         <?php
694
-        if($type=='predefined'){
695
-            $cfs = geodir_custom_fields_predefined($listing_type);
696
-        }elseif($type=='custom'){
697
-            $cfs = geodir_custom_fields_custom($listing_type);
698
-        }else{
699
-            $cfs = geodir_custom_fields($listing_type);
700
-            ?>
694
+		if($type=='predefined'){
695
+			$cfs = geodir_custom_fields_predefined($listing_type);
696
+		}elseif($type=='custom'){
697
+			$cfs = geodir_custom_fields_custom($listing_type);
698
+		}else{
699
+			$cfs = geodir_custom_fields($listing_type);
700
+			?>
701 701
             <ul class="full gd-cf-tooltip-wrap">
702 702
                 <li>
703 703
                     <div class="gdcf-tooltip">
@@ -718,18 +718,18 @@  discard block
 block discarded – undo
718 718
             </ul>
719 719
 
720 720
             <?php
721
-        }
721
+		}
722 722
 
723
-    if(!empty($cfs)) {
723
+	if(!empty($cfs)) {
724 724
 
725
-        foreach ( $cfs as $id => $cf ) {
726
-            ?>
725
+		foreach ( $cfs as $id => $cf ) {
726
+			?>
727 727
             <ul>
728 728
             <li class="gd-cf-tooltip-wrap">
729 729
                 <?php
730
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
731
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
732
-                } ?>
730
+				if ( isset( $cf['description'] ) && $cf['description'] ) {
731
+					echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
732
+				} ?>
733 733
 
734 734
                 <a id="gd-<?php echo $id; ?>"
735 735
                    data-field-custom-type="<?php echo $type; ?>"
@@ -739,21 +739,21 @@  discard block
 block discarded – undo
739 739
                    href="javascript:void(0);">
740 740
 
741 741
                     <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
742
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
743
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
744
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
745
-                    } else {
746
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
747
-                    } ?>
742
+						echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
743
+					} elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
744
+						echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
745
+					} else {
746
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
747
+					} ?>
748 748
                     <?php echo $cf['name']; ?>
749 749
                 </a>
750 750
             </li>
751 751
             <?php
752
-        }
753
-    }else{
754
-        _e('There are no custom fields here yet.', 'geodirectory');
755
-    }
756
-        ?>
752
+		}
753
+	}else{
754
+		_e('There are no custom fields here yet.', 'geodirectory');
755
+	}
756
+		?>
757 757
 
758 758
 
759 759
     </ul>
@@ -772,26 +772,26 @@  discard block
 block discarded – undo
772 772
  */
773 773
 function geodir_custom_selected_fields()
774 774
 {
775
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
776
-    ?>
775
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
776
+	?>
777 777
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
778 778
     <ul class="core">
779 779
     <?php 
780
-        global $wpdb;
781
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
782
-
783
-        if (!empty($fields)) {
784
-            foreach ($fields as $field) {
785
-                //$result_str = $field->id;
786
-                $result_str = $field;
787
-                $field_type = $field->field_type;
788
-                $field_type_key = $field->field_type_key;
789
-                $field_ins_upd = 'display';
790
-
791
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
792
-            }
793
-        }
794
-        ?></ul>
780
+		global $wpdb;
781
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
782
+
783
+		if (!empty($fields)) {
784
+			foreach ($fields as $field) {
785
+				//$result_str = $field->id;
786
+				$result_str = $field;
787
+				$field_type = $field->field_type;
788
+				$field_type_key = $field->field_type_key;
789
+				$field_ins_upd = 'display';
790
+
791
+				geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
792
+			}
793
+		}
794
+		?></ul>
795 795
 <?php
796 796
 
797 797
 }
@@ -810,16 +810,16 @@  discard block
 block discarded – undo
810 810
 function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type)
811 811
 {
812 812
 
813
-    switch ($sub_tab) {
814
-        case 'custom_fields':
815
-            $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
816
-            break;
813
+	switch ($sub_tab) {
814
+		case 'custom_fields':
815
+			$heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
816
+			break;
817 817
 
818
-        case 'sorting_options':
819
-            $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
820
-            break;
821
-    }
822
-    return $heading;
818
+		case 'sorting_options':
819
+			$heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
820
+			break;
821
+	}
822
+	return $heading;
823 823
 }
824 824
 
825 825
 
@@ -837,16 +837,16 @@  discard block
 block discarded – undo
837 837
 function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type)
838 838
 {
839 839
 
840
-    switch ($sub_tab) {
841
-        case 'custom_fields':
842
-            $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
843
-            break;
840
+	switch ($sub_tab) {
841
+		case 'custom_fields':
842
+			$heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
843
+			break;
844 844
 
845
-        case 'sorting_options':
846
-            $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
847
-            break;
848
-    }
849
-    return $heading;
845
+		case 'sorting_options':
846
+			$heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
847
+			break;
848
+	}
849
+	return $heading;
850 850
 }
851 851
 
852 852
 
@@ -864,16 +864,16 @@  discard block
 block discarded – undo
864 864
 function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type)
865 865
 {
866 866
 
867
-    switch ($sub_tab) {
868
-        case 'custom_fields':
869
-            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
870
-            break;
867
+	switch ($sub_tab) {
868
+		case 'custom_fields':
869
+			$note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
870
+			break;
871 871
 
872
-        case 'sorting_options':
873
-            $note = sprintf(__('Click on any box below to make it appear in sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
874
-            break;
875
-    }
876
-    return $note;
872
+		case 'sorting_options':
873
+			$note = sprintf(__('Click on any box below to make it appear in sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
874
+			break;
875
+	}
876
+	return $note;
877 877
 }
878 878
 
879 879
 
@@ -891,16 +891,16 @@  discard block
 block discarded – undo
891 891
 function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type)
892 892
 {
893 893
 
894
-    switch ($sub_tab) {
895
-        case 'custom_fields':
896
-            $heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
897
-            break;
894
+	switch ($sub_tab) {
895
+		case 'custom_fields':
896
+			$heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
897
+			break;
898 898
 
899
-        case 'sorting_options':
900
-            $heading = sprintf(__('List of fields those will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
901
-            break;
902
-    }
903
-    return $heading;
899
+		case 'sorting_options':
900
+			$heading = sprintf(__('List of fields those will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
901
+			break;
902
+	}
903
+	return $heading;
904 904
 }
905 905
 
906 906
 
@@ -918,16 +918,16 @@  discard block
 block discarded – undo
918 918
 function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type)
919 919
 {
920 920
 
921
-    switch ($sub_tab) {
922
-        case 'custom_fields':
923
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
924
-            break;
921
+	switch ($sub_tab) {
922
+		case 'custom_fields':
923
+			$note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
924
+			break;
925 925
 
926
-        case 'sorting_options':
927
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
928
-            break;
929
-    }
930
-    return $note;
926
+		case 'sorting_options':
927
+			$note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
928
+			break;
929
+	}
930
+	return $note;
931 931
 }
932 932
 
933 933
 
@@ -943,16 +943,16 @@  discard block
 block discarded – undo
943 943
  */
944 944
 function geodir_remove_unnecessary_fields()
945 945
 {
946
-    global $wpdb, $plugin_prefix;
946
+	global $wpdb, $plugin_prefix;
947 947
 
948
-    if (!get_option('geodir_remove_unnecessary_fields')) {
948
+	if (!get_option('geodir_remove_unnecessary_fields')) {
949 949
 
950
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
951
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
950
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
951
+			$wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
952 952
 
953
-        update_option('geodir_remove_unnecessary_fields', '1');
953
+		update_option('geodir_remove_unnecessary_fields', '1');
954 954
 
955
-    }
955
+	}
956 956
 
957 957
 }
958 958
 
@@ -970,25 +970,25 @@  discard block
 block discarded – undo
970 970
  */
971 971
 function geodir_admin_ajax_handler()
972 972
 {
973
-    if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
974
-        $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
975
-        switch ($geodir_admin_ajax_action) {
976
-            case 'diagnosis' :
977
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
978
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
979
-                call_user_func('geodir_diagnose_' . $diagnose_this);
980
-                exit();
981
-                break;
982
-
983
-            case 'diagnosis-fix' :
984
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
985
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
986
-                call_user_func('geodir_diagnose_' . $diagnose_this);
987
-                exit();
988
-                break;
989
-        }
990
-    }
991
-    exit();
973
+	if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
974
+		$geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
975
+		switch ($geodir_admin_ajax_action) {
976
+			case 'diagnosis' :
977
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
978
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
979
+				call_user_func('geodir_diagnose_' . $diagnose_this);
980
+				exit();
981
+				break;
982
+
983
+			case 'diagnosis-fix' :
984
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
985
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
986
+				call_user_func('geodir_diagnose_' . $diagnose_this);
987
+				exit();
988
+				break;
989
+		}
990
+	}
991
+	exit();
992 992
 }
993 993
 
994 994
 
@@ -1006,127 +1006,127 @@  discard block
 block discarded – undo
1006 1006
  */
1007 1007
 function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix)
1008 1008
 {
1009
-    global $wpdb;
1010
-    //$filter_arr['output_str'] .='###'.$table.'###';
1011
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1012
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1013
-        $filter_arr['is_error_during_diagnose'] = true;
1014
-
1015
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1016
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1017
-        $filter_arr['is_error_during_diagnose'] = true;
1018
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1019
-        $filter_arr['is_error_during_diagnose'] = true;
1020
-
1021
-        if ($fix) {
1022
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1023
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1024
-
1025
-            if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1026
-                //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1027
-
1028
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1029
-
1030
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1031
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1032
-                } else {
1033
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1034
-                }
1035
-
1036
-            } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1037
-
1038
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1039
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1040
-
1041
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1042
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1043
-                } else {
1044
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1045
-                }
1046
-
1047
-            } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1048
-
1049
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1050
-
1051
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1052
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1053
-                } else {
1054
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1055
-                }
1056
-
1057
-            }
1058
-
1059
-        }
1060
-
1061
-
1062
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1063
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1064
-        $filter_arr['is_error_during_diagnose'] = true;
1065
-
1066
-        if ($fix) {
1067
-            if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1068
-                if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1069
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1070
-                } else {
1071
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1072
-                }
1073
-
1074
-            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1075
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1076
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1077
-                } else {
1078
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1079
-                }
1080
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1081
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1082
-                } else {
1083
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1084
-                }
1085
-            } else {// else rename the original table to _ms_bak
1086
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1087
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1088
-                } else {
1089
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1090
-                }
1091
-            }
1092
-        }
1093
-
1094
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1095
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1096
-        $filter_arr['is_error_during_diagnose'] = true;
1097
-
1098
-        if ($fix) {
1099
-            // if original table exists but new does not, rename
1100
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1101
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1102
-            } else {
1103
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1104
-            }
1105
-
1106
-        }
1107
-
1108
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1109
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1110
-        $filter_arr['is_error_during_diagnose'] = true;
1111
-
1112
-        if ($fix) {
1113
-            // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1114
-            delete_option('geodirlocation_db_version');
1115
-            delete_option('geodirevents_db_version');
1116
-            delete_option('geodir_reviewrating_db_version');
1117
-            delete_option('gdevents_db_version');
1118
-            delete_option('geodirectory_db_version');
1119
-            delete_option('geodirclaim_db_version');
1120
-            delete_option('geodir_custom_posts_db_version');
1121
-            delete_option('geodir_reviewratings_db_version');
1122
-            delete_option('geodiradvancesearch_db_version');
1123
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1124
-        }
1125
-
1126
-    } else {
1127
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1128
-    }
1129
-    return $filter_arr;
1009
+	global $wpdb;
1010
+	//$filter_arr['output_str'] .='###'.$table.'###';
1011
+	if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1012
+		$filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1013
+		$filter_arr['is_error_during_diagnose'] = true;
1014
+
1015
+	} elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1016
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1017
+		$filter_arr['is_error_during_diagnose'] = true;
1018
+		$filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1019
+		$filter_arr['is_error_during_diagnose'] = true;
1020
+
1021
+		if ($fix) {
1022
+			$ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1023
+			$new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1024
+
1025
+			if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1026
+				//$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1027
+
1028
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1029
+
1030
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1031
+					$filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1032
+				} else {
1033
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1034
+				}
1035
+
1036
+			} elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1037
+
1038
+				$wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1039
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1040
+
1041
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1042
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1043
+				} else {
1044
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1045
+				}
1046
+
1047
+			} elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1048
+
1049
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1050
+
1051
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1052
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1053
+				} else {
1054
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1055
+				}
1056
+
1057
+			}
1058
+
1059
+		}
1060
+
1061
+
1062
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1063
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1064
+		$filter_arr['is_error_during_diagnose'] = true;
1065
+
1066
+		if ($fix) {
1067
+			if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1068
+				if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1069
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1070
+				} else {
1071
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1072
+				}
1073
+
1074
+			} elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1075
+				if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1076
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1077
+				} else {
1078
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1079
+				}
1080
+				if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1081
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1082
+				} else {
1083
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1084
+				}
1085
+			} else {// else rename the original table to _ms_bak
1086
+				if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1087
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1088
+				} else {
1089
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1090
+				}
1091
+			}
1092
+		}
1093
+
1094
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1095
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1096
+		$filter_arr['is_error_during_diagnose'] = true;
1097
+
1098
+		if ($fix) {
1099
+			// if original table exists but new does not, rename
1100
+			if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1101
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1102
+			} else {
1103
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1104
+			}
1105
+
1106
+		}
1107
+
1108
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1109
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1110
+		$filter_arr['is_error_during_diagnose'] = true;
1111
+
1112
+		if ($fix) {
1113
+			// if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1114
+			delete_option('geodirlocation_db_version');
1115
+			delete_option('geodirevents_db_version');
1116
+			delete_option('geodir_reviewrating_db_version');
1117
+			delete_option('gdevents_db_version');
1118
+			delete_option('geodirectory_db_version');
1119
+			delete_option('geodirclaim_db_version');
1120
+			delete_option('geodir_custom_posts_db_version');
1121
+			delete_option('geodir_reviewratings_db_version');
1122
+			delete_option('geodiradvancesearch_db_version');
1123
+			$filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1124
+		}
1125
+
1126
+	} else {
1127
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1128
+	}
1129
+	return $filter_arr;
1130 1130
 }
1131 1131
 
1132 1132
 
@@ -1140,53 +1140,53 @@  discard block
 block discarded – undo
1140 1140
  */
1141 1141
 function geodir_diagnose_tags_sync()
1142 1142
 {
1143
-    global $wpdb, $plugin_prefix;
1144
-    $fix = isset($_POST['fix']) ? true : false;
1145
-
1146
-    //if($fix){echo 'true';}else{echo 'false';}
1147
-    $is_error_during_diagnose = false;
1148
-    $output_str = '';
1149
-
1150
-
1151
-    $all_postypes = geodir_get_posttypes();
1152
-
1153
-    if (!empty($all_postypes)) {
1154
-        foreach ($all_postypes as $key) {
1155
-            // update each GD CPT
1156
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1157
-
1158
-            if (!empty($posts)) {
1159
-
1160
-                foreach ($posts as $p) {
1161
-                    $p->post_type = $key;
1162
-                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1163
-                    if (empty($raw_tags)) {
1164
-                        $post_tags = '';
1165
-                    } else {
1166
-                        $post_tags = implode(",", $raw_tags);
1167
-                    }
1168
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1169
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1170
-
1171
-                }
1172
-                $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1173
-            }
1174
-
1175
-        }
1176
-
1177
-    }
1178
-
1179
-    if ($is_error_during_diagnose) {
1180
-        $info_div_class = "geodir_problem_info";
1181
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1182
-    } else {
1183
-        $info_div_class = "geodir_noproblem_info";
1184
-        $fix_button_txt = '';
1185
-    }
1186
-    echo "<ul class='$info_div_class'>";
1187
-    echo $output_str;
1188
-    echo $fix_button_txt;
1189
-    echo "</ul>";
1143
+	global $wpdb, $plugin_prefix;
1144
+	$fix = isset($_POST['fix']) ? true : false;
1145
+
1146
+	//if($fix){echo 'true';}else{echo 'false';}
1147
+	$is_error_during_diagnose = false;
1148
+	$output_str = '';
1149
+
1150
+
1151
+	$all_postypes = geodir_get_posttypes();
1152
+
1153
+	if (!empty($all_postypes)) {
1154
+		foreach ($all_postypes as $key) {
1155
+			// update each GD CPT
1156
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1157
+
1158
+			if (!empty($posts)) {
1159
+
1160
+				foreach ($posts as $p) {
1161
+					$p->post_type = $key;
1162
+					$raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1163
+					if (empty($raw_tags)) {
1164
+						$post_tags = '';
1165
+					} else {
1166
+						$post_tags = implode(",", $raw_tags);
1167
+					}
1168
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1169
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1170
+
1171
+				}
1172
+				$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1173
+			}
1174
+
1175
+		}
1176
+
1177
+	}
1178
+
1179
+	if ($is_error_during_diagnose) {
1180
+		$info_div_class = "geodir_problem_info";
1181
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1182
+	} else {
1183
+		$info_div_class = "geodir_noproblem_info";
1184
+		$fix_button_txt = '';
1185
+	}
1186
+	echo "<ul class='$info_div_class'>";
1187
+	echo $output_str;
1188
+	echo $fix_button_txt;
1189
+	echo "</ul>";
1190 1190
 
1191 1191
 }
1192 1192
 
@@ -1202,75 +1202,75 @@  discard block
 block discarded – undo
1202 1202
  */
1203 1203
 function geodir_diagnose_cats_sync()
1204 1204
 {
1205
-    global $wpdb, $plugin_prefix;
1206
-    $fix = isset($_POST['fix']) ? true : false;
1205
+	global $wpdb, $plugin_prefix;
1206
+	$fix = isset($_POST['fix']) ? true : false;
1207 1207
 
1208
-    //if($fix){echo 'true';}else{echo 'false';}
1209
-    $is_error_during_diagnose = false;
1210
-    $output_str = '';
1208
+	//if($fix){echo 'true';}else{echo 'false';}
1209
+	$is_error_during_diagnose = false;
1210
+	$output_str = '';
1211 1211
 
1212 1212
 
1213
-    $all_postypes = geodir_get_posttypes();
1213
+	$all_postypes = geodir_get_posttypes();
1214 1214
 
1215
-    if (!empty($all_postypes)) {
1216
-        foreach ($all_postypes as $key) {
1217
-            // update each GD CTP
1218
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1215
+	if (!empty($all_postypes)) {
1216
+		foreach ($all_postypes as $key) {
1217
+			// update each GD CTP
1218
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1219 1219
 
1220
-            if (!empty($posts)) {
1220
+			if (!empty($posts)) {
1221 1221
 
1222
-                foreach ($posts as $p) {
1223
-                    $p->post_type = $key;
1224
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1222
+				foreach ($posts as $p) {
1223
+					$p->post_type = $key;
1224
+					$raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1225 1225
 
1226
-                    if (empty($raw_cats)) {
1227
-                        $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1226
+					if (empty($raw_cats)) {
1227
+						$post_categories = get_post_meta($p->post_id, 'post_categories', true);
1228 1228
 
1229
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1230
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1231
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1232
-                                if (is_numeric($cat_part)) {
1233
-                                    $raw_cats[] = (int)$cat_part;
1234
-                                }
1235
-                            }
1229
+						if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1230
+							$post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1231
+							foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1232
+								if (is_numeric($cat_part)) {
1233
+									$raw_cats[] = (int)$cat_part;
1234
+								}
1235
+							}
1236 1236
 
1237
-                        }
1237
+						}
1238 1238
 
1239
-                        if (!empty($raw_cats)) {
1240
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1239
+						if (!empty($raw_cats)) {
1240
+							$term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1241 1241
 
1242
-                        }
1242
+						}
1243 1243
 
1244
-                    }
1244
+					}
1245 1245
 
1246 1246
 
1247
-                    if (empty($raw_cats)) {
1248
-                        $post_cats = '';
1249
-                    } else {
1250
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1251
-                    }
1252
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1253
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1254
-                }
1247
+					if (empty($raw_cats)) {
1248
+						$post_cats = '';
1249
+					} else {
1250
+						$post_cats = ',' . implode(",", $raw_cats) . ',';
1251
+					}
1252
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1253
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1254
+				}
1255 1255
 
1256
-            }
1257
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1256
+			}
1257
+			$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1258 1258
 
1259
-        }
1259
+		}
1260 1260
 
1261
-    }
1261
+	}
1262 1262
 
1263
-    if ($is_error_during_diagnose) {
1264
-        $info_div_class = "geodir_problem_info";
1265
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1266
-    } else {
1267
-        $info_div_class = "geodir_noproblem_info";
1268
-        $fix_button_txt = '';
1269
-    }
1270
-    echo "<ul class='$info_div_class'>";
1271
-    echo $output_str;
1272
-    echo $fix_button_txt;
1273
-    echo "</ul>";
1263
+	if ($is_error_during_diagnose) {
1264
+		$info_div_class = "geodir_problem_info";
1265
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1266
+	} else {
1267
+		$info_div_class = "geodir_noproblem_info";
1268
+		$fix_button_txt = '';
1269
+	}
1270
+	echo "<ul class='$info_div_class'>";
1271
+	echo $output_str;
1272
+	echo $fix_button_txt;
1273
+	echo "</ul>";
1274 1274
 
1275 1275
 }
1276 1276
 
@@ -1284,61 +1284,61 @@  discard block
 block discarded – undo
1284 1284
  */
1285 1285
 function geodir_diagnose_version_clear()
1286 1286
 {
1287
-    global $wpdb, $plugin_prefix;
1288
-    $fix = isset($_POST['fix']) ? true : false;
1289
-
1290
-    //if($fix){echo 'true';}else{echo 'false';}
1291
-    $is_error_during_diagnose = false;
1292
-    $output_str = '';
1293
-
1294
-
1295
-    $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1296
-        'Payment Manager' => 'geodir_payments_db_version',
1297
-        'GeoDirectory Framework' => 'gdf_db_version',
1298
-        'Advanced Search' => 'geodiradvancesearch_db_version',
1299
-        'Review Rating Manager' => 'geodir_reviewratings_db_version',
1300
-        'Claim Manager' => 'geodirclaim_db_version',
1301
-        'CPT Manager' => 'geodir_custom_posts_db_version',
1302
-        'Location Manager' => 'geodirlocation_db_version',
1303
-        'Payment Manager' => 'geodir_payments_db_version',
1304
-        'Events Manager' => 'geodirevents_db_version',
1305
-    );
1306
-
1307
-    /**
1308
-     * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1309
-     *
1310
-     * @since 1.0.0
1311
-     * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1312
-     */
1313
-    $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1314
-
1315
-    if (!empty($ver_arr)) {
1316
-        foreach ($ver_arr as $key => $val) {
1317
-            if (delete_option($val)) {
1318
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1319
-            } else {
1320
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1321
-            }
1322
-
1323
-        }
1324
-
1325
-        if ($output_str) {
1326
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1327
-        }
1328
-
1329
-    }
1330
-
1331
-    if ($is_error_during_diagnose) {
1332
-        $info_div_class = "geodir_problem_info";
1333
-        $fix_button_txt = "";
1334
-    } else {
1335
-        $info_div_class = "geodir_noproblem_info";
1336
-        $fix_button_txt = '';
1337
-    }
1338
-    echo "<ul class='$info_div_class'>";
1339
-    echo $output_str;
1340
-    echo $fix_button_txt;
1341
-    echo "</ul>";
1287
+	global $wpdb, $plugin_prefix;
1288
+	$fix = isset($_POST['fix']) ? true : false;
1289
+
1290
+	//if($fix){echo 'true';}else{echo 'false';}
1291
+	$is_error_during_diagnose = false;
1292
+	$output_str = '';
1293
+
1294
+
1295
+	$gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1296
+		'Payment Manager' => 'geodir_payments_db_version',
1297
+		'GeoDirectory Framework' => 'gdf_db_version',
1298
+		'Advanced Search' => 'geodiradvancesearch_db_version',
1299
+		'Review Rating Manager' => 'geodir_reviewratings_db_version',
1300
+		'Claim Manager' => 'geodirclaim_db_version',
1301
+		'CPT Manager' => 'geodir_custom_posts_db_version',
1302
+		'Location Manager' => 'geodirlocation_db_version',
1303
+		'Payment Manager' => 'geodir_payments_db_version',
1304
+		'Events Manager' => 'geodirevents_db_version',
1305
+	);
1306
+
1307
+	/**
1308
+	 * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1309
+	 *
1310
+	 * @since 1.0.0
1311
+	 * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1312
+	 */
1313
+	$ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1314
+
1315
+	if (!empty($ver_arr)) {
1316
+		foreach ($ver_arr as $key => $val) {
1317
+			if (delete_option($val)) {
1318
+				$output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1319
+			} else {
1320
+				$output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1321
+			}
1322
+
1323
+		}
1324
+
1325
+		if ($output_str) {
1326
+			$output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1327
+		}
1328
+
1329
+	}
1330
+
1331
+	if ($is_error_during_diagnose) {
1332
+		$info_div_class = "geodir_problem_info";
1333
+		$fix_button_txt = "";
1334
+	} else {
1335
+		$info_div_class = "geodir_noproblem_info";
1336
+		$fix_button_txt = '';
1337
+	}
1338
+	echo "<ul class='$info_div_class'>";
1339
+	echo $output_str;
1340
+	echo $fix_button_txt;
1341
+	echo "</ul>";
1342 1342
 
1343 1343
 }
1344 1344
 
@@ -1352,59 +1352,59 @@  discard block
 block discarded – undo
1352 1352
  */
1353 1353
 function geodir_diagnose_ratings()
1354 1354
 {
1355
-    global $wpdb;
1356
-    $fix = isset($_POST['fix']) ? true : false;
1357
-
1358
-    //if($fix){echo 'true';}else{echo 'false';}
1359
-    $is_error_during_diagnose = false;
1360
-    $output_str = '';
1361
-
1362
-    // check review locations
1363
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1364
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1365
-        $is_error_during_diagnose = true;
1366
-
1367
-        if ($fix) {
1368
-            if (geodir_fix_review_location()) {
1369
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1370
-            } else {
1371
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1372
-            }
1373
-        }
1374
-
1375
-    } else {
1376
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1377
-    }
1378
-
1379
-    // check review content
1380
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1381
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1382
-        $is_error_during_diagnose = true;
1383
-
1384
-        if ($fix) {
1385
-            if (geodir_fix_review_content()) {
1386
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1387
-            } else {
1388
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1389
-            }
1390
-        }
1391
-
1392
-    } else {
1393
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1394
-    }
1395
-
1396
-
1397
-    if ($is_error_during_diagnose) {
1398
-        $info_div_class = "geodir_problem_info";
1399
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1400
-    } else {
1401
-        $info_div_class = "geodir_noproblem_info";
1402
-        $fix_button_txt = '';
1403
-    }
1404
-    echo "<ul class='$info_div_class'>";
1405
-    echo $output_str;
1406
-    echo $fix_button_txt;
1407
-    echo "</ul>";
1355
+	global $wpdb;
1356
+	$fix = isset($_POST['fix']) ? true : false;
1357
+
1358
+	//if($fix){echo 'true';}else{echo 'false';}
1359
+	$is_error_during_diagnose = false;
1360
+	$output_str = '';
1361
+
1362
+	// check review locations
1363
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1364
+		$output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1365
+		$is_error_during_diagnose = true;
1366
+
1367
+		if ($fix) {
1368
+			if (geodir_fix_review_location()) {
1369
+				$output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1370
+			} else {
1371
+				$output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1372
+			}
1373
+		}
1374
+
1375
+	} else {
1376
+		$output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1377
+	}
1378
+
1379
+	// check review content
1380
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1381
+		$output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1382
+		$is_error_during_diagnose = true;
1383
+
1384
+		if ($fix) {
1385
+			if (geodir_fix_review_content()) {
1386
+				$output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1387
+			} else {
1388
+				$output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1389
+			}
1390
+		}
1391
+
1392
+	} else {
1393
+		$output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1394
+	}
1395
+
1396
+
1397
+	if ($is_error_during_diagnose) {
1398
+		$info_div_class = "geodir_problem_info";
1399
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1400
+	} else {
1401
+		$info_div_class = "geodir_noproblem_info";
1402
+		$fix_button_txt = '';
1403
+	}
1404
+	echo "<ul class='$info_div_class'>";
1405
+	echo $output_str;
1406
+	echo $fix_button_txt;
1407
+	echo "</ul>";
1408 1408
 
1409 1409
 }
1410 1410
 
@@ -1418,57 +1418,57 @@  discard block
 block discarded – undo
1418 1418
  */
1419 1419
 function geodir_diagnose_multisite_conversion()
1420 1420
 {
1421
-    global $wpdb;
1422
-    $fix = isset($_POST['fix']) ? true : false;
1423
-    //if($fix){echo 'true';}else{echo 'false';}
1424
-    $is_error_during_diagnose = false;
1425
-    $output_str = '';
1426
-
1427
-    $filter_arr = array();
1428
-    $filter_arr['output_str'] = $output_str;
1429
-    $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1430
-    $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1431
-        'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1432
-        'geodir_post_icon' => __('Post icon', 'geodirectory'),
1433
-        'geodir_attachments' => __('Attachments', 'geodirectory'),
1434
-        'geodir_post_review' => __('Reviews', 'geodirectory'),
1435
-        'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1436
-        'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1437
-    );
1438
-
1439
-    // allow other addons to hook in and add their checks
1440
-
1441
-    /**
1442
-     * Filter the array of tables.
1443
-     *
1444
-     * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks.
1445
-     *
1446
-     * @since 1.0.0
1447
-     * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1448
-     */
1449
-    $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1450
-
1451
-    foreach ($table_arr as $table => $table_name) {
1452
-        // Diagnose table
1453
-        $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1454
-    }
1455
-
1456
-
1457
-    $output_str = $filter_arr['output_str'];
1458
-    $is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1459
-
1460
-
1461
-    if ($is_error_during_diagnose) {
1462
-        $info_div_class = "geodir_problem_info";
1463
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1464
-    } else {
1465
-        $info_div_class = "geodir_noproblem_info";
1466
-        $fix_button_txt = '';
1467
-    }
1468
-    echo "<ul class='$info_div_class'>";
1469
-    echo $output_str;
1470
-    echo $fix_button_txt;
1471
-    echo "</ul>";
1421
+	global $wpdb;
1422
+	$fix = isset($_POST['fix']) ? true : false;
1423
+	//if($fix){echo 'true';}else{echo 'false';}
1424
+	$is_error_during_diagnose = false;
1425
+	$output_str = '';
1426
+
1427
+	$filter_arr = array();
1428
+	$filter_arr['output_str'] = $output_str;
1429
+	$filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1430
+	$table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1431
+		'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1432
+		'geodir_post_icon' => __('Post icon', 'geodirectory'),
1433
+		'geodir_attachments' => __('Attachments', 'geodirectory'),
1434
+		'geodir_post_review' => __('Reviews', 'geodirectory'),
1435
+		'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1436
+		'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1437
+	);
1438
+
1439
+	// allow other addons to hook in and add their checks
1440
+
1441
+	/**
1442
+	 * Filter the array of tables.
1443
+	 *
1444
+	 * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks.
1445
+	 *
1446
+	 * @since 1.0.0
1447
+	 * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1448
+	 */
1449
+	$table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1450
+
1451
+	foreach ($table_arr as $table => $table_name) {
1452
+		// Diagnose table
1453
+		$filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1454
+	}
1455
+
1456
+
1457
+	$output_str = $filter_arr['output_str'];
1458
+	$is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1459
+
1460
+
1461
+	if ($is_error_during_diagnose) {
1462
+		$info_div_class = "geodir_problem_info";
1463
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1464
+	} else {
1465
+		$info_div_class = "geodir_noproblem_info";
1466
+		$fix_button_txt = '';
1467
+	}
1468
+	echo "<ul class='$info_div_class'>";
1469
+	echo $output_str;
1470
+	echo $fix_button_txt;
1471
+	echo "</ul>";
1472 1472
 }
1473 1473
 
1474 1474
 /**
@@ -1486,39 +1486,39 @@  discard block
 block discarded – undo
1486 1486
  */
1487 1487
 function geodir_fix_virtual_page($slug, $page_title, $old_id, $option)
1488 1488
 {
1489
-    global $wpdb, $current_user;
1490
-
1491
-    if (!empty($old_id)) {
1492
-        wp_delete_post($old_id, true);
1493
-    }//delete post if already there
1494
-    else {
1495
-        $page_found = $wpdb->get_var(
1496
-            $wpdb->prepare(
1497
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1498
-                array($slug)
1499
-            )
1500
-        );
1501
-        wp_delete_post($page_found, true);
1502
-
1503
-    }
1504
-
1505
-    $page_data = array(
1506
-        'post_status' => 'publish',
1507
-        'post_type' => 'page',
1508
-        'post_author' => $current_user->ID,
1509
-        'post_name' => $slug,
1510
-        'post_title' => $page_title,
1511
-        'post_content' => '',
1512
-        'post_parent' => 0,
1513
-        'comment_status' => 'closed'
1514
-    );
1515
-    $page_id = wp_insert_post($page_data);
1516
-    update_option($option, $page_id);
1517
-    if ($page_id) {
1518
-        return true;
1519
-    } else {
1520
-        return false;
1521
-    }
1489
+	global $wpdb, $current_user;
1490
+
1491
+	if (!empty($old_id)) {
1492
+		wp_delete_post($old_id, true);
1493
+	}//delete post if already there
1494
+	else {
1495
+		$page_found = $wpdb->get_var(
1496
+			$wpdb->prepare(
1497
+				"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1498
+				array($slug)
1499
+			)
1500
+		);
1501
+		wp_delete_post($page_found, true);
1502
+
1503
+	}
1504
+
1505
+	$page_data = array(
1506
+		'post_status' => 'publish',
1507
+		'post_type' => 'page',
1508
+		'post_author' => $current_user->ID,
1509
+		'post_name' => $slug,
1510
+		'post_title' => $page_title,
1511
+		'post_content' => '',
1512
+		'post_parent' => 0,
1513
+		'comment_status' => 'closed'
1514
+	);
1515
+	$page_id = wp_insert_post($page_data);
1516
+	update_option($option, $page_id);
1517
+	if ($page_id) {
1518
+		return true;
1519
+	} else {
1520
+		return false;
1521
+	}
1522 1522
 }
1523 1523
 
1524 1524
 /**
@@ -1530,212 +1530,212 @@  discard block
 block discarded – undo
1530 1530
  */
1531 1531
 function geodir_diagnose_default_pages()
1532 1532
 {
1533
-    global $wpdb;
1534
-    $is_error_during_diagnose = false;
1535
-    $output_str = '';
1536
-    $fix = isset($_POST['fix']) ? true : false;
1537
-
1538
-    //////////////////////////////////
1539
-    /* Diagnose GD Home Page Starts */
1540
-    //////////////////////////////////
1541
-    $option_value = get_option('geodir_home_page');
1542
-    $page = get_post($option_value);
1543
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1544
-
1545
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1546
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1547
-    else {
1548
-        $is_error_during_diagnose = true;
1549
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1550
-        if ($fix) {
1551
-            if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1552
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1553
-            } else {
1554
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1555
-            }
1556
-        }
1557
-    }
1558
-
1559
-    ////////////////////////////////
1560
-    /* Diagnose GD Home Page Ends */
1561
-    ////////////////////////////////
1562
-
1563
-    //////////////////////////////////
1564
-    /* Diagnose Add Listing Page Starts */
1565
-    //////////////////////////////////
1566
-    $option_value = get_option('geodir_add_listing_page');
1567
-    $page = get_post($option_value);
1568
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1569
-
1570
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1571
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1572
-    else {
1573
-        $is_error_during_diagnose = true;
1574
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1575
-        if ($fix) {
1576
-            if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1577
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1578
-            } else {
1579
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1580
-            }
1581
-        }
1582
-    }
1583
-
1584
-    ////////////////////////////////
1585
-    /* Diagnose Add Listing Page Ends */
1586
-    ////////////////////////////////
1587
-
1588
-
1589
-    //////////////////////////////////
1590
-    /* Diagnose Listing Preview Page Starts */
1591
-    //////////////////////////////////
1592
-    $option_value = get_option('geodir_preview_page');
1593
-    $page = get_post($option_value);
1594
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1595
-
1596
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1597
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1598
-    else {
1599
-        $is_error_during_diagnose = true;
1600
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1601
-        if ($fix) {
1602
-            if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1603
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1604
-            } else {
1605
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1606
-            }
1607
-        }
1608
-    }
1609
-
1610
-    ////////////////////////////////
1611
-    /* Diagnose Listing Preview Page Ends */
1612
-    ////////////////////////////////
1613
-
1614
-    //////////////////////////////////
1615
-    /* Diagnose Listing Success Page Starts */
1616
-    //////////////////////////////////
1617
-    $option_value = get_option('geodir_success_page');
1618
-    $page = get_post($option_value);
1619
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1620
-
1621
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1622
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1623
-    else {
1624
-        $is_error_during_diagnose = true;
1625
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1626
-        if ($fix) {
1627
-            if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1628
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1629
-            } else {
1630
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1631
-            }
1632
-        }
1633
-    }
1634
-
1635
-    ////////////////////////////////
1636
-    /* Diagnose Listing Sucess Page Ends */
1637
-    ////////////////////////////////
1638
-
1639
-    //////////////////////////////////
1640
-    /* Diagnose Info Page Starts */
1641
-    //////////////////////////////////
1642
-    $option_value = get_option('geodir_info_page');
1643
-    $page = get_post($option_value);
1644
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1645
-
1646
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1647
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1648
-    else {
1649
-        $is_error_during_diagnose = true;
1650
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1651
-        if ($fix) {
1652
-            if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1653
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1654
-            } else {
1655
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1656
-            }
1657
-        }
1658
-    }
1659
-
1660
-    ////////////////////////////////
1661
-    /* Diagnose Info Page Ends */
1662
-    ////////////////////////////////
1663
-
1664
-    //////////////////////////////////
1665
-    /* Diagnose Login Page Starts */
1666
-    //////////////////////////////////
1667
-    $option_value = get_option('geodir_login_page');
1668
-    $page = get_post($option_value);
1669
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1670
-
1671
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1672
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1673
-    else {
1674
-        $is_error_during_diagnose = true;
1675
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1676
-        if ($fix) {
1677
-            if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1678
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1679
-            } else {
1680
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1681
-            }
1682
-        }
1683
-    }
1684
-
1685
-    ////////////////////////////////
1686
-    /* Diagnose Info Page Ends */
1687
-    ////////////////////////////////
1688
-
1689
-    //////////////////////////////////
1690
-    /* Diagnose Location Page Starts */
1691
-    //////////////////////////////////
1692
-    $option_value = get_option('geodir_location_page');
1693
-    $page = get_post($option_value);
1694
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1695
-
1696
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1697
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1698
-    else {
1699
-        $is_error_during_diagnose = true;
1700
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1701
-        if ($fix) {
1702
-            if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1703
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1704
-            } else {
1705
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1706
-            }
1707
-        }
1708
-    }
1709
-
1710
-    ////////////////////////////////
1711
-    /* Diagnose Location Page Ends */
1712
-    ////////////////////////////////
1713
-
1714
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1715
-    /**
1716
-     * This action is called at the end of the GD Tools page check function.
1717
-     *
1718
-     * @since 1.5.2
1719
-     */
1720
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1721
-
1722
-    $output_str = $page_chk_arr['output_str'];
1723
-    $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1724
-
1725
-    if ($is_error_during_diagnose) {
1726
-        if ($fix) {
1727
-            flush_rewrite_rules();
1728
-        }
1729
-        $info_div_class = "geodir_problem_info";
1730
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1731
-    } else {
1732
-        $info_div_class = "geodir_noproblem_info";
1733
-        $fix_button_txt = '';
1734
-    }
1735
-    echo "<ul class='$info_div_class'>";
1736
-    echo $output_str;
1737
-    echo $fix_button_txt;
1738
-    echo "</ul>";
1533
+	global $wpdb;
1534
+	$is_error_during_diagnose = false;
1535
+	$output_str = '';
1536
+	$fix = isset($_POST['fix']) ? true : false;
1537
+
1538
+	//////////////////////////////////
1539
+	/* Diagnose GD Home Page Starts */
1540
+	//////////////////////////////////
1541
+	$option_value = get_option('geodir_home_page');
1542
+	$page = get_post($option_value);
1543
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1544
+
1545
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1546
+		$output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1547
+	else {
1548
+		$is_error_during_diagnose = true;
1549
+		$output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1550
+		if ($fix) {
1551
+			if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1552
+				$output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1553
+			} else {
1554
+				$output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1555
+			}
1556
+		}
1557
+	}
1558
+
1559
+	////////////////////////////////
1560
+	/* Diagnose GD Home Page Ends */
1561
+	////////////////////////////////
1562
+
1563
+	//////////////////////////////////
1564
+	/* Diagnose Add Listing Page Starts */
1565
+	//////////////////////////////////
1566
+	$option_value = get_option('geodir_add_listing_page');
1567
+	$page = get_post($option_value);
1568
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1569
+
1570
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1571
+		$output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1572
+	else {
1573
+		$is_error_during_diagnose = true;
1574
+		$output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1575
+		if ($fix) {
1576
+			if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1577
+				$output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1578
+			} else {
1579
+				$output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1580
+			}
1581
+		}
1582
+	}
1583
+
1584
+	////////////////////////////////
1585
+	/* Diagnose Add Listing Page Ends */
1586
+	////////////////////////////////
1587
+
1588
+
1589
+	//////////////////////////////////
1590
+	/* Diagnose Listing Preview Page Starts */
1591
+	//////////////////////////////////
1592
+	$option_value = get_option('geodir_preview_page');
1593
+	$page = get_post($option_value);
1594
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1595
+
1596
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1597
+		$output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1598
+	else {
1599
+		$is_error_during_diagnose = true;
1600
+		$output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1601
+		if ($fix) {
1602
+			if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1603
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1604
+			} else {
1605
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1606
+			}
1607
+		}
1608
+	}
1609
+
1610
+	////////////////////////////////
1611
+	/* Diagnose Listing Preview Page Ends */
1612
+	////////////////////////////////
1613
+
1614
+	//////////////////////////////////
1615
+	/* Diagnose Listing Success Page Starts */
1616
+	//////////////////////////////////
1617
+	$option_value = get_option('geodir_success_page');
1618
+	$page = get_post($option_value);
1619
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1620
+
1621
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1622
+		$output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1623
+	else {
1624
+		$is_error_during_diagnose = true;
1625
+		$output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1626
+		if ($fix) {
1627
+			if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1628
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1629
+			} else {
1630
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1631
+			}
1632
+		}
1633
+	}
1634
+
1635
+	////////////////////////////////
1636
+	/* Diagnose Listing Sucess Page Ends */
1637
+	////////////////////////////////
1638
+
1639
+	//////////////////////////////////
1640
+	/* Diagnose Info Page Starts */
1641
+	//////////////////////////////////
1642
+	$option_value = get_option('geodir_info_page');
1643
+	$page = get_post($option_value);
1644
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1645
+
1646
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1647
+		$output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1648
+	else {
1649
+		$is_error_during_diagnose = true;
1650
+		$output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1651
+		if ($fix) {
1652
+			if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1653
+				$output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1654
+			} else {
1655
+				$output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1656
+			}
1657
+		}
1658
+	}
1659
+
1660
+	////////////////////////////////
1661
+	/* Diagnose Info Page Ends */
1662
+	////////////////////////////////
1663
+
1664
+	//////////////////////////////////
1665
+	/* Diagnose Login Page Starts */
1666
+	//////////////////////////////////
1667
+	$option_value = get_option('geodir_login_page');
1668
+	$page = get_post($option_value);
1669
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1670
+
1671
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1672
+		$output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1673
+	else {
1674
+		$is_error_during_diagnose = true;
1675
+		$output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1676
+		if ($fix) {
1677
+			if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1678
+				$output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1679
+			} else {
1680
+				$output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1681
+			}
1682
+		}
1683
+	}
1684
+
1685
+	////////////////////////////////
1686
+	/* Diagnose Info Page Ends */
1687
+	////////////////////////////////
1688
+
1689
+	//////////////////////////////////
1690
+	/* Diagnose Location Page Starts */
1691
+	//////////////////////////////////
1692
+	$option_value = get_option('geodir_location_page');
1693
+	$page = get_post($option_value);
1694
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1695
+
1696
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1697
+		$output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1698
+	else {
1699
+		$is_error_during_diagnose = true;
1700
+		$output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1701
+		if ($fix) {
1702
+			if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1703
+				$output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1704
+			} else {
1705
+				$output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1706
+			}
1707
+		}
1708
+	}
1709
+
1710
+	////////////////////////////////
1711
+	/* Diagnose Location Page Ends */
1712
+	////////////////////////////////
1713
+
1714
+	$page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1715
+	/**
1716
+	 * This action is called at the end of the GD Tools page check function.
1717
+	 *
1718
+	 * @since 1.5.2
1719
+	 */
1720
+	$page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1721
+
1722
+	$output_str = $page_chk_arr['output_str'];
1723
+	$is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1724
+
1725
+	if ($is_error_during_diagnose) {
1726
+		if ($fix) {
1727
+			flush_rewrite_rules();
1728
+		}
1729
+		$info_div_class = "geodir_problem_info";
1730
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1731
+	} else {
1732
+		$info_div_class = "geodir_noproblem_info";
1733
+		$fix_button_txt = '';
1734
+	}
1735
+	echo "<ul class='$info_div_class'>";
1736
+	echo $output_str;
1737
+	echo $fix_button_txt;
1738
+	echo "</ul>";
1739 1739
 
1740 1740
 }
1741 1741
 
@@ -1747,26 +1747,26 @@  discard block
 block discarded – undo
1747 1747
  * @global object $wpdb WordPress Database object.
1748 1748
  */
1749 1749
 function geodir_diagnose_load_db_language() {
1750
-    global $wpdb;
1750
+	global $wpdb;
1751 1751
 	
1752 1752
 	$is_error_during_diagnose = geodirectory_load_db_language();
1753 1753
 
1754
-    $output_str = '';
1755
-    $fix_button_txt = '';
1754
+	$output_str = '';
1755
+	$fix_button_txt = '';
1756 1756
 
1757
-    if ($is_error_during_diagnose) {
1758
-        $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1757
+	if ($is_error_during_diagnose) {
1758
+		$output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1759 1759
 		$info_div_class = "geodir_problem_info";
1760
-    } else {
1761
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1760
+	} else {
1761
+		$output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1762 1762
 		$info_div_class = "geodir_noproblem_info";
1763
-        $fix_button_txt = '';
1764
-    }
1763
+		$fix_button_txt = '';
1764
+	}
1765 1765
     
1766 1766
 	echo "<ul class='$info_div_class'>";
1767
-    echo $output_str;
1768
-    echo $fix_button_txt;
1769
-    echo "</ul>";
1767
+	echo $output_str;
1768
+	echo $fix_button_txt;
1769
+	echo "</ul>";
1770 1770
 
1771 1771
 }
1772 1772
 
@@ -1797,23 +1797,23 @@  discard block
 block discarded – undo
1797 1797
  */
1798 1798
 function geodir_posts_clauses_request($clauses)
1799 1799
 {
1800
-    global $wpdb, $wp_query, $plugin_prefix;
1800
+	global $wpdb, $wp_query, $plugin_prefix;
1801 1801
 
1802
-    if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1803
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1802
+	if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1803
+		$table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1804 1804
 
1805
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1806
-        $clauses['join'] = $join;
1805
+		$join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1806
+		$clauses['join'] = $join;
1807 1807
 
1808
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1809
-        $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1810
-        $clauses['fields'] = $fields;
1808
+		$fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1809
+		$fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1810
+		$clauses['fields'] = $fields;
1811 1811
 
1812
-        $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1813
-        $orderby = 'gd_expire ' . $order;
1814
-        $clauses['orderby'] = $orderby;
1815
-    }
1816
-    return $clauses;
1812
+		$order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1813
+		$orderby = 'gd_expire ' . $order;
1814
+		$clauses['orderby'] = $orderby;
1815
+	}
1816
+	return $clauses;
1817 1817
 }
1818 1818
 
1819 1819
 
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  */
1835 1835
 function gd_theme_switch_compat_check()
1836 1836
 {
1837
-    gd_set_theme_compat();
1837
+	gd_set_theme_compat();
1838 1838
 }
1839 1839
 
1840 1840
 /**
@@ -1847,27 +1847,27 @@  discard block
 block discarded – undo
1847 1847
  */
1848 1848
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
1849 1849
 {
1850
-    if (function_exists('str_getcsv')) {
1851
-        $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1852
-    } else {
1853
-        global $current_user;
1854
-        $upload_dir = wp_upload_dir();
1855
-
1856
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1857
-        $handle = fopen($file, 'w');
1858
-
1859
-        fwrite($handle, $input);
1860
-        fclose($handle);
1861
-
1862
-        $handle = fopen($file, 'rt');
1863
-        if (PHP_VERSION >= '5.3.0') {
1864
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1865
-        } else {
1866
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1867
-        }
1868
-        fclose($handle);
1869
-    }
1870
-    return $fgetcsv;
1850
+	if (function_exists('str_getcsv')) {
1851
+		$fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1852
+	} else {
1853
+		global $current_user;
1854
+		$upload_dir = wp_upload_dir();
1855
+
1856
+		$file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1857
+		$handle = fopen($file, 'w');
1858
+
1859
+		fwrite($handle, $input);
1860
+		fclose($handle);
1861
+
1862
+		$handle = fopen($file, 'rt');
1863
+		if (PHP_VERSION >= '5.3.0') {
1864
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1865
+		} else {
1866
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1867
+		}
1868
+		fclose($handle);
1869
+	}
1870
+	return $fgetcsv;
1871 1871
 }
1872 1872
 
1873 1873
 add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
@@ -1882,375 +1882,375 @@  discard block
 block discarded – undo
1882 1882
  */
1883 1883
 function geodir_ajax_import_csv()
1884 1884
 {
1885
-    error_reporting(0); // hide error to get clean json response
1885
+	error_reporting(0); // hide error to get clean json response
1886 1886
 
1887
-    global $wpdb, $plugin_prefix, $current_user;
1888
-    $uploads = wp_upload_dir();
1889
-    ini_set('auto_detect_line_endings', true);
1887
+	global $wpdb, $plugin_prefix, $current_user;
1888
+	$uploads = wp_upload_dir();
1889
+	ini_set('auto_detect_line_endings', true);
1890 1890
 	
1891 1891
 	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1892 1892
 
1893
-    $task = isset($_POST['task']) ? $_POST['task'] : '';
1894
-    $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1895
-    $filename = $uploadedFile;
1896
-
1897
-    $uploads = wp_upload_dir();
1898
-    $uploads_dir = $uploads['path'];
1899
-    $image_name_arr = explode('/', $filename);
1900
-    $filename = end($image_name_arr);
1901
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1902
-    $return = array();
1903
-    $return['file'] = $uploadedFile;
1904
-    $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1905
-
1906
-    if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1907
-        $wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1908
-
1909
-        if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1910
-            $return['error'] = NULL;
1911
-
1912
-            $return['rows'] = 0;
1913
-
1914
-
1915
-
1916
-                if (($handle = fopen($target_path, "r")) !== FALSE) {
1917
-                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1918
-                        if(is_array($data) && !empty($data)) {
1919
-                            $file[] = '"' . implode('","', $data) . '"';
1920
-                        }
1921
-                    }
1922
-                    fclose($handle);
1923
-                    $file = $file;
1924
-                }
1925
-
1926
-
1927
-
1928
-                $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1929
-
1930
-
1931
-            if (!$return['rows'] > 0) {
1932
-                $return['error'] = __('No data found in csv file.', 'geodirectory');
1933
-            }
1934
-        }
1935
-    }
1936
-    if ($task == 'prepare' || !empty($return['error'])) {
1937
-        echo json_encode($return);
1938
-        exit;
1939
-    }
1940
-
1941
-    $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1942
-    $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1943
-    $count = $importlimit;
1944
-    $requested_limit = $importlimit;
1945
-    $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1946
-
1947
-    if ($count < $totRecords) {
1948
-        $count = $tmpCnt + $count;
1949
-        if ($count > $totRecords) {
1950
-            $count = $totRecords;
1951
-        }
1952
-    } else {
1953
-        $count = $totRecords;
1954
-    }
1955
-
1956
-    $total_records = 0;
1957
-    $rowcount = 0;
1958
-    $address_invalid = 0;
1959
-    $blank_address = 0;
1960
-    $upload_files = 0;
1961
-    $invalid_post_type = 0;
1962
-    $invalid_title = 0;
1963
-    $customKeyarray = array();
1964
-    $gd_post_info = array();
1965
-    $post_location = array();
1966
-    $countpost = 0;
1967
-
1968
-    if (!empty($file)) {
1969
-        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1970
-        $customKeyarray = $columns;
1971
-
1972
-        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1973
-            $return['error'] = CSV_INVAILD_FILE;
1974
-            echo json_encode($return);
1975
-            exit;
1976
-        }
1977
-
1978
-        for ($i = 1; $i <= $importlimit; $i++) {
1979
-            $current_index = $tmpCnt + $i;
1980
-            if (isset($file[$current_index])) {
1981
-                $total_records++;
1982
-
1983
-                $buffer = geodir_str_getcsv($file[$current_index]);
1984
-                $post_title = addslashes($buffer[0]);
1985
-                $current_post_author = $buffer[1];
1986
-                $post_desc = addslashes($buffer[2]);
1987
-                $post_cat = array();
1988
-                $catids_arr = array();
1989
-                $post_cat = trim($buffer[3]); // comma seperated category name
1990
-
1991
-                if ($post_cat) {
1992
-                    $post_cat_arr = explode(',', $post_cat);
1993
-
1994
-                    for ($c = 0; $c < count($post_cat_arr); $c++) {
1995
-                        $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1996
-
1997
-                        if (!empty($buffer[5])) {
1998
-                            if (in_array($buffer[5], geodir_get_posttypes())) {
1999
-
2000
-                                $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2001
-
2002
-                                if (get_term_by('name', $catid, $p_taxonomy[0])) {
2003
-                                    $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2004
-                                    $catids_arr[] = $cat->slug;
2005
-                                } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2006
-                                    $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2007
-                                    $catids_arr[] = $cat->slug;
2008
-                                } else {
2009
-                                    $ret = wp_insert_term($catid, $p_taxonomy[0]);
2010
-                                    if ($ret && !is_wp_error($ret)) {
2011
-                                        if (get_term_by('name', $catid, $p_taxonomy[0])) {
2012
-                                            $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2013
-                                            $catids_arr[] = $cat->slug;
2014
-                                        } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2015
-                                            $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2016
-                                            $catids_arr[] = $cat->slug;
2017
-                                        }
2018
-                                    }
2019
-                                }
2020
-                            }
2021
-                        }
2022
-                    }
2023
-                }
2024
-
2025
-                if (!$catids_arr) {
2026
-                    $catids_arr[] = 1;
2027
-                }
2028
-
2029
-                $post_tags = trim($buffer[4]); // comma seperated tags
2030
-
2031
-                $tag_arr = '';
2032
-                if ($post_tags) {
2033
-                    $tag_arr = explode(',', $post_tags);
2034
-                }
2035
-
2036
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2037
-
2038
-                $error = '';
2039
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2040
-                    $invalid_post_type++;
2041
-                    continue;
2042
-                }
2043
-
2044
-                if ($post_title != '') {
2045
-                    $menu_order = 0;
2046
-                    $image_folder_name = 'uplaod/';
2047
-
2048
-                    $image_names = array();
2049
-
2050
-                    for ($c = 5; $c < count($customKeyarray); $c++) {
2051
-                        $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2052
-
2053
-                        if ($customKeyarray[$c] == 'IMAGE') {
2054
-                            $buffer[$c] = trim($buffer[$c]);
2055
-
2056
-                            if (!empty($buffer[$c])) {
2057
-                                $image_names[] = $buffer[$c];
2058
-                            }
2059
-                        }
2060
-
2061
-                        if ($customKeyarray[$c] == 'alive_days') {
2062
-                            if ($buffer[$c] != '0' && $buffer[$c] != '') {
2063
-                                $submitdata = date('Y-m-d');
2064
-
2065
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2066
-                            } else {
2067
-                                $gd_post_info['expire_date'] = 'Never';
2068
-                            }
2069
-                        }
2070
-
2071
-                        if ($customKeyarray[$c] == 'post_city') {
2072
-                            $post_city = addslashes($buffer[$c]);
2073
-                        }
2074
-
2075
-                        if ($customKeyarray[$c] == 'post_region') {
2076
-                            $post_region = addslashes($buffer[$c]);
2077
-                        }
2078
-
2079
-                        if ($customKeyarray[$c] == 'post_country') {
2080
-                            $post_country = addslashes($buffer[$c]);
2081
-                        }
2082
-
2083
-                        if ($customKeyarray[$c] == 'post_latitude') {
2084
-                            $post_latitude = addslashes($buffer[$c]);
2085
-                        }
2086
-
2087
-                        if ($customKeyarray[$c] == 'post_longitude') {
2088
-                            $post_longitude = addslashes($buffer[$c]);
2089
-                        }
1893
+	$task = isset($_POST['task']) ? $_POST['task'] : '';
1894
+	$uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1895
+	$filename = $uploadedFile;
1896
+
1897
+	$uploads = wp_upload_dir();
1898
+	$uploads_dir = $uploads['path'];
1899
+	$image_name_arr = explode('/', $filename);
1900
+	$filename = end($image_name_arr);
1901
+	$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1902
+	$return = array();
1903
+	$return['file'] = $uploadedFile;
1904
+	$return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1905
+
1906
+	if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1907
+		$wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1908
+
1909
+		if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1910
+			$return['error'] = NULL;
1911
+
1912
+			$return['rows'] = 0;
1913
+
1914
+
1915
+
1916
+				if (($handle = fopen($target_path, "r")) !== FALSE) {
1917
+					while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1918
+						if(is_array($data) && !empty($data)) {
1919
+							$file[] = '"' . implode('","', $data) . '"';
1920
+						}
1921
+					}
1922
+					fclose($handle);
1923
+					$file = $file;
1924
+				}
1925
+
1926
+
1927
+
1928
+				$return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1929
+
1930
+
1931
+			if (!$return['rows'] > 0) {
1932
+				$return['error'] = __('No data found in csv file.', 'geodirectory');
1933
+			}
1934
+		}
1935
+	}
1936
+	if ($task == 'prepare' || !empty($return['error'])) {
1937
+		echo json_encode($return);
1938
+		exit;
1939
+	}
1940
+
1941
+	$totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
1942
+	$importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
1943
+	$count = $importlimit;
1944
+	$requested_limit = $importlimit;
1945
+	$tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
1946
+
1947
+	if ($count < $totRecords) {
1948
+		$count = $tmpCnt + $count;
1949
+		if ($count > $totRecords) {
1950
+			$count = $totRecords;
1951
+		}
1952
+	} else {
1953
+		$count = $totRecords;
1954
+	}
1955
+
1956
+	$total_records = 0;
1957
+	$rowcount = 0;
1958
+	$address_invalid = 0;
1959
+	$blank_address = 0;
1960
+	$upload_files = 0;
1961
+	$invalid_post_type = 0;
1962
+	$invalid_title = 0;
1963
+	$customKeyarray = array();
1964
+	$gd_post_info = array();
1965
+	$post_location = array();
1966
+	$countpost = 0;
1967
+
1968
+	if (!empty($file)) {
1969
+		$columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1970
+		$customKeyarray = $columns;
1971
+
1972
+		if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1973
+			$return['error'] = CSV_INVAILD_FILE;
1974
+			echo json_encode($return);
1975
+			exit;
1976
+		}
1977
+
1978
+		for ($i = 1; $i <= $importlimit; $i++) {
1979
+			$current_index = $tmpCnt + $i;
1980
+			if (isset($file[$current_index])) {
1981
+				$total_records++;
1982
+
1983
+				$buffer = geodir_str_getcsv($file[$current_index]);
1984
+				$post_title = addslashes($buffer[0]);
1985
+				$current_post_author = $buffer[1];
1986
+				$post_desc = addslashes($buffer[2]);
1987
+				$post_cat = array();
1988
+				$catids_arr = array();
1989
+				$post_cat = trim($buffer[3]); // comma seperated category name
1990
+
1991
+				if ($post_cat) {
1992
+					$post_cat_arr = explode(',', $post_cat);
1993
+
1994
+					for ($c = 0; $c < count($post_cat_arr); $c++) {
1995
+						$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
1996
+
1997
+						if (!empty($buffer[5])) {
1998
+							if (in_array($buffer[5], geodir_get_posttypes())) {
1999
+
2000
+								$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2001
+
2002
+								if (get_term_by('name', $catid, $p_taxonomy[0])) {
2003
+									$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2004
+									$catids_arr[] = $cat->slug;
2005
+								} else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2006
+									$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2007
+									$catids_arr[] = $cat->slug;
2008
+								} else {
2009
+									$ret = wp_insert_term($catid, $p_taxonomy[0]);
2010
+									if ($ret && !is_wp_error($ret)) {
2011
+										if (get_term_by('name', $catid, $p_taxonomy[0])) {
2012
+											$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2013
+											$catids_arr[] = $cat->slug;
2014
+										} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2015
+											$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2016
+											$catids_arr[] = $cat->slug;
2017
+										}
2018
+									}
2019
+								}
2020
+							}
2021
+						}
2022
+					}
2023
+				}
2024
+
2025
+				if (!$catids_arr) {
2026
+					$catids_arr[] = 1;
2027
+				}
2028
+
2029
+				$post_tags = trim($buffer[4]); // comma seperated tags
2030
+
2031
+				$tag_arr = '';
2032
+				if ($post_tags) {
2033
+					$tag_arr = explode(',', $post_tags);
2034
+				}
2035
+
2036
+				$table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2037
+
2038
+				$error = '';
2039
+				if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2040
+					$invalid_post_type++;
2041
+					continue;
2042
+				}
2043
+
2044
+				if ($post_title != '') {
2045
+					$menu_order = 0;
2046
+					$image_folder_name = 'uplaod/';
2047
+
2048
+					$image_names = array();
2049
+
2050
+					for ($c = 5; $c < count($customKeyarray); $c++) {
2051
+						$gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2052
+
2053
+						if ($customKeyarray[$c] == 'IMAGE') {
2054
+							$buffer[$c] = trim($buffer[$c]);
2055
+
2056
+							if (!empty($buffer[$c])) {
2057
+								$image_names[] = $buffer[$c];
2058
+							}
2059
+						}
2060
+
2061
+						if ($customKeyarray[$c] == 'alive_days') {
2062
+							if ($buffer[$c] != '0' && $buffer[$c] != '') {
2063
+								$submitdata = date('Y-m-d');
2064
+
2065
+								$gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2066
+							} else {
2067
+								$gd_post_info['expire_date'] = 'Never';
2068
+							}
2069
+						}
2070
+
2071
+						if ($customKeyarray[$c] == 'post_city') {
2072
+							$post_city = addslashes($buffer[$c]);
2073
+						}
2074
+
2075
+						if ($customKeyarray[$c] == 'post_region') {
2076
+							$post_region = addslashes($buffer[$c]);
2077
+						}
2078
+
2079
+						if ($customKeyarray[$c] == 'post_country') {
2080
+							$post_country = addslashes($buffer[$c]);
2081
+						}
2082
+
2083
+						if ($customKeyarray[$c] == 'post_latitude') {
2084
+							$post_latitude = addslashes($buffer[$c]);
2085
+						}
2086
+
2087
+						if ($customKeyarray[$c] == 'post_longitude') {
2088
+							$post_longitude = addslashes($buffer[$c]);
2089
+						}
2090 2090
 						
2091 2091
 						// Post status
2092 2092
 						if ($customKeyarray[$c] == 'post_status') {
2093
-                            $post_status = sanitize_key( $buffer[$c] );
2094
-                        }
2095
-                    }
2096
-
2097
-                    /* ================ before array create ============== */
2098
-                    $location_result = geodir_get_default_location();
2099
-                    if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
2100
-                        $blank_address++;
2101
-                        continue;
2102
-                    } else if ($location_result->location_id == 0) {
2103
-                        if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
2104
-                            $address_invalid++;
2105
-                            continue;
2106
-                        }
2107
-                    }
2093
+							$post_status = sanitize_key( $buffer[$c] );
2094
+						}
2095
+					}
2096
+
2097
+					/* ================ before array create ============== */
2098
+					$location_result = geodir_get_default_location();
2099
+					if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
2100
+						$blank_address++;
2101
+						continue;
2102
+					} else if ($location_result->location_id == 0) {
2103
+						if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
2104
+							$address_invalid++;
2105
+							continue;
2106
+						}
2107
+					}
2108 2108
 					
2109 2109
 					// Default post status
2110 2110
 					$default_status = 'publish';
2111 2111
 					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2112 2112
 					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2113 2113
 
2114
-                    $my_post['post_title'] = $post_title;
2115
-                    $my_post['post_content'] = $post_desc;
2116
-                    $my_post['post_type'] = addslashes($buffer[5]);
2117
-                    $my_post['post_author'] = $current_post_author;
2118
-                    $my_post['post_status'] = $post_status;
2119
-                    $my_post['post_category'] = $catids_arr;
2120
-                    $my_post['post_tags'] = $tag_arr;
2121
-
2122
-                    $gd_post_info['post_tags'] = $tag_arr;
2123
-                    $gd_post_info['post_title'] = $post_title;
2124
-                    $gd_post_info['post_status'] = $post_status;
2125
-                    $gd_post_info['submit_time'] = time();
2126
-                    $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2127
-
2128
-                    $last_postid = wp_insert_post($my_post);
2129
-                    $countpost++;
2130
-
2131
-                    // Check if we need to save post location as new location
2132
-                    if ($location_result->location_id > 0) {
2133
-                        if (isset($post_city) && isset($post_region)) {
2134
-                            $request_info['post_location'] = array(
2135
-                                'city' => $post_city,
2136
-                                'region' => $post_region,
2137
-                                'country' => $post_country,
2138
-                                'geo_lat' => $post_latitude,
2139
-                                'geo_lng' => $post_longitude
2140
-                            );
2141
-
2142
-                            $post_location_info = $request_info['post_location'];
2143
-                            if ($location_id = geodir_add_new_location($post_location_info))
2144
-                                $post_location_id = $location_id;
2145
-                        } else {
2146
-                            $post_location_id = 0;
2147
-                        }
2148
-                    } else {
2149
-                        $post_location_id = 0;
2150
-                    }
2151
-
2152
-                    /* ------- get default package info ----- */
2153
-                    $payment_info = array();
2154
-                    $package_info = array();
2155
-
2156
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2157
-                    $package_id = '';
2158
-                    if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2159
-                        $package_id = $gd_post_info['package_id'];
2160
-                    }
2161
-
2162
-                    if (!empty($package_info)) {
2163
-                        $payment_info['package_id'] = $package_info['pid'];
2164
-
2165
-                        if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2166
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2167
-                        } else {
2168
-                            $payment_info['expire_date'] = 'Never';
2169
-                        }
2170
-
2171
-                        $gd_post_info = array_merge($gd_post_info, $payment_info);
2172
-                    }
2173
-
2174
-                    $gd_post_info['post_location_id'] = $post_location_id;
2175
-
2176
-                    $post_type = get_post_type($last_postid);
2177
-
2178
-                    $table = $plugin_prefix . $post_type . '_detail';
2179
-
2180
-                    geodir_save_post_info($last_postid, $gd_post_info);
2181
-
2182
-                    if (!empty($image_names)) {
2183
-                        $upload_files++;
2184
-                        $menu_order = 1;
2185
-
2186
-                        foreach ($image_names as $image_name) {
2187
-                            $img_name_arr = explode('.', $image_name);
2188
-
2189
-                            $uploads = wp_upload_dir();
2190
-                            $sub_dir = $uploads['subdir'];
2191
-
2192
-                            $arr_file_type = wp_check_filetype($image_name);
2193
-                            $uploaded_file_type = $arr_file_type['type'];
2194
-
2195
-                            $attachment = array();
2196
-                            $attachment['post_id'] = $last_postid;
2197
-                            $attachment['title'] = $img_name_arr[0];
2198
-                            $attachment['content'] = '';
2199
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2200
-                            $attachment['mime_type'] = $uploaded_file_type;
2201
-                            $attachment['menu_order'] = $menu_order;
2202
-                            $attachment['is_featured'] = 0;
2203
-
2204
-                            $attachment_set = '';
2205
-
2206
-                            foreach ($attachment as $key => $val) {
2207
-                                if ($val != '')
2208
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2209
-                            }
2210
-                            $attachment_set = trim($attachment_set, ", ");
2211
-
2212
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2213
-
2214
-                            if ($menu_order == 1) {
2215
-                                $post_type = get_post_type($last_postid);
2216
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2217
-                            }
2218
-                            $menu_order++;
2219
-                        }
2220
-                    }
2221
-
2222
-                    $gd_post_info['package_id'] = $package_id;
2223
-
2224
-                    /** This action is documented in geodirectory-functions/post-functions.php */
2225
-                    do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2226
-
2227
-                    if (!empty($buffer[5])) {
2228
-                        if (in_array($buffer[5], geodir_get_posttypes())) {
2229
-                            $taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2230
-                            wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2231
-                            wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2232
-
2233
-                            $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2234
-                            $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2235
-                            geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2236
-                        }
2237
-                    }
2238
-                } else {
2239
-                    $invalid_title++;
2240
-                }
2241
-            }
2242
-        }
2243
-    }
2244
-    $return['rowcount'] = $countpost;
2245
-    $return['invalidcount'] = $address_invalid;
2246
-    $return['blank_address'] = $blank_address;
2247
-    $return['upload_files'] = $upload_files;
2248
-    $return['invalid_post_type'] = $invalid_post_type;
2249
-    $return['invalid_title'] = $invalid_title;
2250
-    $return['total_records'] = $total_records;
2251
-
2252
-    echo json_encode($return);
2253
-    exit;
2114
+					$my_post['post_title'] = $post_title;
2115
+					$my_post['post_content'] = $post_desc;
2116
+					$my_post['post_type'] = addslashes($buffer[5]);
2117
+					$my_post['post_author'] = $current_post_author;
2118
+					$my_post['post_status'] = $post_status;
2119
+					$my_post['post_category'] = $catids_arr;
2120
+					$my_post['post_tags'] = $tag_arr;
2121
+
2122
+					$gd_post_info['post_tags'] = $tag_arr;
2123
+					$gd_post_info['post_title'] = $post_title;
2124
+					$gd_post_info['post_status'] = $post_status;
2125
+					$gd_post_info['submit_time'] = time();
2126
+					$gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2127
+
2128
+					$last_postid = wp_insert_post($my_post);
2129
+					$countpost++;
2130
+
2131
+					// Check if we need to save post location as new location
2132
+					if ($location_result->location_id > 0) {
2133
+						if (isset($post_city) && isset($post_region)) {
2134
+							$request_info['post_location'] = array(
2135
+								'city' => $post_city,
2136
+								'region' => $post_region,
2137
+								'country' => $post_country,
2138
+								'geo_lat' => $post_latitude,
2139
+								'geo_lng' => $post_longitude
2140
+							);
2141
+
2142
+							$post_location_info = $request_info['post_location'];
2143
+							if ($location_id = geodir_add_new_location($post_location_info))
2144
+								$post_location_id = $location_id;
2145
+						} else {
2146
+							$post_location_id = 0;
2147
+						}
2148
+					} else {
2149
+						$post_location_id = 0;
2150
+					}
2151
+
2152
+					/* ------- get default package info ----- */
2153
+					$payment_info = array();
2154
+					$package_info = array();
2155
+
2156
+					$package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2157
+					$package_id = '';
2158
+					if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2159
+						$package_id = $gd_post_info['package_id'];
2160
+					}
2161
+
2162
+					if (!empty($package_info)) {
2163
+						$payment_info['package_id'] = $package_info['pid'];
2164
+
2165
+						if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2166
+							$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2167
+						} else {
2168
+							$payment_info['expire_date'] = 'Never';
2169
+						}
2170
+
2171
+						$gd_post_info = array_merge($gd_post_info, $payment_info);
2172
+					}
2173
+
2174
+					$gd_post_info['post_location_id'] = $post_location_id;
2175
+
2176
+					$post_type = get_post_type($last_postid);
2177
+
2178
+					$table = $plugin_prefix . $post_type . '_detail';
2179
+
2180
+					geodir_save_post_info($last_postid, $gd_post_info);
2181
+
2182
+					if (!empty($image_names)) {
2183
+						$upload_files++;
2184
+						$menu_order = 1;
2185
+
2186
+						foreach ($image_names as $image_name) {
2187
+							$img_name_arr = explode('.', $image_name);
2188
+
2189
+							$uploads = wp_upload_dir();
2190
+							$sub_dir = $uploads['subdir'];
2191
+
2192
+							$arr_file_type = wp_check_filetype($image_name);
2193
+							$uploaded_file_type = $arr_file_type['type'];
2194
+
2195
+							$attachment = array();
2196
+							$attachment['post_id'] = $last_postid;
2197
+							$attachment['title'] = $img_name_arr[0];
2198
+							$attachment['content'] = '';
2199
+							$attachment['file'] = $sub_dir . '/' . $image_name;
2200
+							$attachment['mime_type'] = $uploaded_file_type;
2201
+							$attachment['menu_order'] = $menu_order;
2202
+							$attachment['is_featured'] = 0;
2203
+
2204
+							$attachment_set = '';
2205
+
2206
+							foreach ($attachment as $key => $val) {
2207
+								if ($val != '')
2208
+									$attachment_set .= $key . " = '" . $val . "', ";
2209
+							}
2210
+							$attachment_set = trim($attachment_set, ", ");
2211
+
2212
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2213
+
2214
+							if ($menu_order == 1) {
2215
+								$post_type = get_post_type($last_postid);
2216
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2217
+							}
2218
+							$menu_order++;
2219
+						}
2220
+					}
2221
+
2222
+					$gd_post_info['package_id'] = $package_id;
2223
+
2224
+					/** This action is documented in geodirectory-functions/post-functions.php */
2225
+					do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2226
+
2227
+					if (!empty($buffer[5])) {
2228
+						if (in_array($buffer[5], geodir_get_posttypes())) {
2229
+							$taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2230
+							wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2231
+							wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2232
+
2233
+							$post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2234
+							$post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2235
+							geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2236
+						}
2237
+					}
2238
+				} else {
2239
+					$invalid_title++;
2240
+				}
2241
+			}
2242
+		}
2243
+	}
2244
+	$return['rowcount'] = $countpost;
2245
+	$return['invalidcount'] = $address_invalid;
2246
+	$return['blank_address'] = $blank_address;
2247
+	$return['upload_files'] = $upload_files;
2248
+	$return['invalid_post_type'] = $invalid_post_type;
2249
+	$return['invalid_title'] = $invalid_title;
2250
+	$return['total_records'] = $total_records;
2251
+
2252
+	echo json_encode($return);
2253
+	exit;
2254 2254
 }
2255 2255
 
2256 2256
 // Add the tab in left sidebar menu fro import & export page.
@@ -2270,9 +2270,9 @@  discard block
 block discarded – undo
2270 2270
  * @param $post object $post The post object of the post being saved.
2271 2271
  */
2272 2272
 function geodir_update_location_prefix($post_id,$post){
2273
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2274
-        update_option('geodir_location_prefix',$post->post_name);
2275
-    }
2273
+	if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2274
+		update_option('geodir_location_prefix',$post->post_name);
2275
+	}
2276 2276
 
2277 2277
 }
2278 2278
 
@@ -2283,50 +2283,50 @@  discard block
 block discarded – undo
2283 2283
 function geodir_ga_callback(){
2284 2284
 
2285 2285
 if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2286
-    $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2287
-    $code = "code=".$_REQUEST['code'];
2288
-    $grant_type = "&grant_type=authorization_code";
2289
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2290
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2291
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2286
+	$oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2287
+	$code = "code=".$_REQUEST['code'];
2288
+	$grant_type = "&grant_type=authorization_code";
2289
+	$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2290
+	$client_id = "&client_id=".get_option('geodir_ga_client_id');
2291
+	$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2292 2292
 
2293
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2293
+	$auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2294 2294
 
2295
-    $response = wp_remote_post($auth_url, array('timeout' => 15));
2295
+	$response = wp_remote_post($auth_url, array('timeout' => 15));
2296 2296
 
2297
-    //print_r($response);
2297
+	//print_r($response);
2298 2298
 
2299
-    $error_msg =  __('Something went wrong','geodirectory');
2300
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2299
+	$error_msg =  __('Something went wrong','geodirectory');
2300
+	if(!empty($response['response']['code']) && $response['response']['code']==200){
2301 2301
 
2302
-        $parts = json_decode($response['body']);
2303
-        //print_r($parts);
2304
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2305
-        else{
2302
+		$parts = json_decode($response['body']);
2303
+		//print_r($parts);
2304
+		if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2305
+		else{
2306 2306
 
2307
-            update_option('gd_ga_access_token', $parts->access_token);
2308
-            update_option('gd_ga_refresh_token', $parts->refresh_token);
2309
-            ?><script>window.close();</script><?php
2310
-        }
2307
+			update_option('gd_ga_access_token', $parts->access_token);
2308
+			update_option('gd_ga_refresh_token', $parts->refresh_token);
2309
+			?><script>window.close();</script><?php
2310
+		}
2311 2311
 
2312 2312
 
2313
-    }
2314
-    elseif(!empty($response['response']['code'])) {
2315
-        $parts = json_decode($response['body']);
2313
+	}
2314
+	elseif(!empty($response['response']['code'])) {
2315
+		$parts = json_decode($response['body']);
2316 2316
 
2317
-        if(isset($parts->error)){
2318
-            echo $parts->error.": ".$parts->error_description;exit;
2319
-        }else{
2320
-            echo $error_msg." - #2";exit;
2321
-        }
2317
+		if(isset($parts->error)){
2318
+			echo $parts->error.": ".$parts->error_description;exit;
2319
+		}else{
2320
+			echo $error_msg." - #2";exit;
2321
+		}
2322 2322
 
2323
-    }else{
2323
+	}else{
2324 2324
 
2325
-        echo $error_msg." - #3";exit;
2325
+		echo $error_msg." - #3";exit;
2326 2326
 
2327
-    }
2327
+	}
2328 2328
 }
2329
-    exit;
2329
+	exit;
2330 2330
 }
2331 2331
 
2332 2332
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
Please login to merge, or discard this patch.
Spacing   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+    geodir_admin_option_form($current_tab); // defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
71 71
 add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
72 72
 add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
73
-add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
73
+add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
74 74
 
75 75
 //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
76 76
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 
229 229
         // Filter-Payment-Manager
230 230
 
231
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
231
+        add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
232 232
 
233
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
233
+        add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
234 234
 
235 235
         // no need of this box as all fields moved to main information box
236 236
         //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 }
241 241
 
242
-add_action('save_post', 'geodir_post_information_save',10,2);
242
+add_action('save_post', 'geodir_post_information_save', 10, 2);
243 243
 
244 244
 
245 245
 
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 
267 267
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
268 268
 
269
-            if(!empty($gd_taxonomy)) {
269
+            if (!empty($gd_taxonomy)) {
270 270
                 foreach ($gd_taxonomy as $tax) {
271 271
 
272
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
272
+                    remove_meta_box($tax.'div', $geodir_post_type, 'normal');
273 273
 
274 274
                 }
275 275
             }
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
 add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
356 356
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
357 357
 
358
-function geodir_manage_available_fields_predefined($sub_tab){
359
-    if($sub_tab=='custom_fields'){
358
+function geodir_manage_available_fields_predefined($sub_tab) {
359
+    if ($sub_tab == 'custom_fields') {
360 360
         geodir_custom_available_fields('predefined');
361 361
     }
362 362
 }
363 363
 
364
-function geodir_manage_available_fields_custom($sub_tab){
365
-    if($sub_tab=='custom_fields'){
364
+function geodir_manage_available_fields_custom($sub_tab) {
365
+    if ($sub_tab == 'custom_fields') {
366 366
         geodir_custom_available_fields('custom');
367 367
     }
368 368
 }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     global $wpdb;
433 433
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
434 434
     ?>
435
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
435
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
436 436
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
437 437
     <ul>
438 438
     <?php
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
             $check_html_variable = $wpdb->get_var(
445 445
                 $wpdb->prepare(
446
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
446
+                    "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
447 447
                     array($val['htmlvar_name'], $listing_type, $val['field_type'])
448 448
                 )
449 449
             );
@@ -451,23 +451,23 @@  discard block
 block discarded – undo
451 451
             $display = $check_html_variable ? ' style="display:none;"' : '';
452 452
            ?>
453 453
 
454
-            <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
454
+            <li   class="gd-cf-tooltip-wrap" <?php echo $display; ?>>
455 455
                 <?php
456
-                if(isset($val['description']) && $val['description']){
456
+                if (isset($val['description']) && $val['description']) {
457 457
                     echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
458 458
                 }?>
459 459
 
460
-                <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>"  data-field-type="<?php echo $val['field_type'];?>"
461
-                   title="<?php echo $val['site_title'];?>"
462
-                   class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
460
+                <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>"  data-field-type="<?php echo $val['field_type']; ?>"
461
+                   title="<?php echo $val['site_title']; ?>"
462
+                   class="gd-draggable-form-items  gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);">
463 463
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
464 464
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
465
+                    }elseif (isset($val['field_icon']) && $val['field_icon']) {
466 466
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
-                    }else{
467
+                    } else {
468 468
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469 469
                     }?>
470
-                    <?php echo $val['site_title'];?>
470
+                    <?php echo $val['site_title']; ?>
471 471
                 </a>
472 472
             </li>
473 473
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     <?php 
496 496
         global $wpdb;
497 497
         
498
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
498
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
499 499
 
500 500
         if (!empty($fields)) {
501 501
             foreach ($fields as $field) {
@@ -520,14 +520,14 @@  discard block
 block discarded – undo
520 520
  * @since 1.6.9
521 521
  * @package GeoDirectory
522 522
  */
523
-function geodir_custom_fields_custom($post_type=''){
523
+function geodir_custom_fields_custom($post_type = '') {
524 524
 
525 525
     $custom_fields = array();
526 526
 
527 527
     /**
528 528
      * @see `geodir_custom_fields`
529 529
      */
530
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
530
+    return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
531 531
 }
532 532
 
533 533
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  * @since 1.6.6
539 539
  * @package GeoDirectory
540 540
  */
541
-function geodir_custom_fields($post_type=''){
541
+function geodir_custom_fields($post_type = '') {
542 542
     
543 543
     $custom_fields = array(
544 544
         'text' => array(
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      * }
673 673
      * @param string $post_type The post type requested.
674 674
      */
675
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
675
+    return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
676 676
 }
677 677
 
678 678
 /**
@@ -683,25 +683,25 @@  discard block
 block discarded – undo
683 683
  * @param string $type The custom field type, predefined, custom or blank for default
684 684
  * @package GeoDirectory
685 685
  */
686
-function geodir_custom_available_fields($type='')
686
+function geodir_custom_available_fields($type = '')
687 687
 {
688 688
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
689 689
     ?>
690
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
690
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
691 691
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
692 692
 
693 693
         <?php
694
-        if($type=='predefined'){
694
+        if ($type == 'predefined') {
695 695
             $cfs = geodir_custom_fields_predefined($listing_type);
696
-        }elseif($type=='custom'){
696
+        }elseif ($type == 'custom') {
697 697
             $cfs = geodir_custom_fields_custom($listing_type);
698
-        }else{
698
+        } else {
699 699
             $cfs = geodir_custom_fields($listing_type);
700 700
             ?>
701 701
             <ul class="full gd-cf-tooltip-wrap">
702 702
                 <li>
703 703
                     <div class="gdcf-tooltip">
704
-                        <?php _e('This adds a section separator with a title.', 'geodirectory');?>
704
+                        <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
705 705
                     </div>
706 706
                     <a id="gt-fieldset"
707 707
                        class="gd-draggable-form-items gt-fieldset"
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
                         <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
714 714
                         <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
715
-                        <?php _e('Fieldset (section separator)', 'geodirectory');?>
715
+                        <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
716 716
                     </a>
717 717
                 </li>
718 718
             </ul>
@@ -720,15 +720,15 @@  discard block
 block discarded – undo
720 720
             <?php
721 721
         }
722 722
 
723
-    if(!empty($cfs)) {
723
+    if (!empty($cfs)) {
724 724
 
725
-        foreach ( $cfs as $id => $cf ) {
725
+        foreach ($cfs as $id => $cf) {
726 726
             ?>
727 727
             <ul>
728 728
             <li class="gd-cf-tooltip-wrap">
729 729
                 <?php
730
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
731
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
730
+                if (isset($cf['description']) && $cf['description']) {
731
+                    echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>';
732 732
                 } ?>
733 733
 
734 734
                 <a id="gd-<?php echo $id; ?>"
@@ -738,10 +738,10 @@  discard block
 block discarded – undo
738 738
                    class="gd-draggable-form-items <?php echo $cf['class']; ?>"
739 739
                    href="javascript:void(0);">
740 740
 
741
-                    <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
742
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
743
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
744
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
741
+                    <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
742
+                        echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
743
+                    } elseif (isset($cf['icon']) && $cf['icon']) {
744
+                        echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
745 745
                     } else {
746 746
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
747 747
                     } ?>
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
             </li>
751 751
             <?php
752 752
         }
753
-    }else{
753
+    } else {
754 754
         _e('There are no custom fields here yet.', 'geodirectory');
755 755
     }
756 756
         ?>
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     <ul class="core">
779 779
     <?php 
780 780
         global $wpdb;
781
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
781
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
782 782
 
783 783
         if (!empty($fields)) {
784 784
             foreach ($fields as $field) {
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                 $field_type_key = $field->field_type_key;
789 789
                 $field_ins_upd = 'display';
790 790
 
791
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
791
+                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key);
792 792
             }
793 793
         }
794 794
         ?></ul>
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
     switch ($sub_tab) {
868 868
         case 'custom_fields':
869
-            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
869
+            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
870 870
             break;
871 871
 
872 872
         case 'sorting_options':
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 
921 921
     switch ($sub_tab) {
922 922
         case 'custom_fields':
923
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
923
+            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
924 924
             break;
925 925
 
926 926
         case 'sorting_options':
@@ -947,8 +947,8 @@  discard block
 block discarded – undo
947 947
 
948 948
     if (!get_option('geodir_remove_unnecessary_fields')) {
949 949
 
950
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
951
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
950
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
951
+            $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
952 952
 
953 953
         update_option('geodir_remove_unnecessary_fields', '1');
954 954
 
@@ -976,14 +976,14 @@  discard block
 block discarded – undo
976 976
             case 'diagnosis' :
977 977
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
978 978
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
979
-                call_user_func('geodir_diagnose_' . $diagnose_this);
979
+                call_user_func('geodir_diagnose_'.$diagnose_this);
980 980
                 exit();
981 981
                 break;
982 982
 
983 983
             case 'diagnosis-fix' :
984 984
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
985 985
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
986
-                call_user_func('geodir_diagnose_' . $diagnose_this);
986
+                call_user_func('geodir_diagnose_'.$diagnose_this);
987 987
                 exit();
988 988
                 break;
989 989
         }
@@ -1008,50 +1008,50 @@  discard block
 block discarded – undo
1008 1008
 {
1009 1009
     global $wpdb;
1010 1010
     //$filter_arr['output_str'] .='###'.$table.'###';
1011
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1012
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1011
+    if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
1012
+        $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
1013 1013
         $filter_arr['is_error_during_diagnose'] = true;
1014 1014
 
1015
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1016
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1015
+    } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1016
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
1017 1017
         $filter_arr['is_error_during_diagnose'] = true;
1018
-        $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
1018
+        $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
1019 1019
         $filter_arr['is_error_during_diagnose'] = true;
1020 1020
 
1021 1021
         if ($fix) {
1022
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1023
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1022
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
1023
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
1024 1024
 
1025 1025
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1026 1026
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1027 1027
 
1028
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1028
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
1029 1029
 
1030
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1031
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1030
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1031
+                    $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
1032 1032
                 } else {
1033
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1033
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1034 1034
                 }
1035 1035
 
1036 1036
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1037 1037
 
1038
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1039
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1038
+                $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
1039
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
1040 1040
 
1041
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1042
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1041
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1042
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
1043 1043
                 } else {
1044
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1044
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1045 1045
                 }
1046 1046
 
1047 1047
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1048 1048
 
1049
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1049
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
1050 1050
 
1051
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1052
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1051
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1052
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
1053 1053
                 } else {
1054
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1054
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1055 1055
                 }
1056 1056
 
1057 1057
             }
@@ -1059,54 +1059,54 @@  discard block
 block discarded – undo
1059 1059
         }
1060 1060
 
1061 1061
 
1062
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1063
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1062
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1063
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
1064 1064
         $filter_arr['is_error_during_diagnose'] = true;
1065 1065
 
1066 1066
         if ($fix) {
1067 1067
             if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1068 1068
                 if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1069
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1069
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
1070 1070
                 } else {
1071
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1071
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
1072 1072
                 }
1073 1073
 
1074
-            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
1075
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1076
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1074
+            } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
1075
+                if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
1076
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1077 1077
                 } else {
1078
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1078
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1079 1079
                 }
1080
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1081
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1080
+                if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1081
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1082 1082
                 } else {
1083
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1083
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1084 1084
                 }
1085 1085
             } else {// else rename the original table to _ms_bak
1086
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1087
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1086
+                if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1087
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1088 1088
                 } else {
1089
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
1089
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
1090 1090
                 }
1091 1091
             }
1092 1092
         }
1093 1093
 
1094
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1095
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1094
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1095
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
1096 1096
         $filter_arr['is_error_during_diagnose'] = true;
1097 1097
 
1098 1098
         if ($fix) {
1099 1099
             // if original table exists but new does not, rename
1100
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1101
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1100
+            if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1101
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1102 1102
             } else {
1103
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1103
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1104 1104
             }
1105 1105
 
1106 1106
         }
1107 1107
 
1108
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1109
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1108
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1109
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
1110 1110
         $filter_arr['is_error_during_diagnose'] = true;
1111 1111
 
1112 1112
         if ($fix) {
@@ -1120,11 +1120,11 @@  discard block
 block discarded – undo
1120 1120
             delete_option('geodir_custom_posts_db_version');
1121 1121
             delete_option('geodir_reviewratings_db_version');
1122 1122
             delete_option('geodiradvancesearch_db_version');
1123
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1123
+            $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
1124 1124
         }
1125 1125
 
1126 1126
     } else {
1127
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1127
+        $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
1128 1128
     }
1129 1129
     return $filter_arr;
1130 1130
 }
@@ -1153,23 +1153,23 @@  discard block
 block discarded – undo
1153 1153
     if (!empty($all_postypes)) {
1154 1154
         foreach ($all_postypes as $key) {
1155 1155
             // update each GD CPT
1156
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
1156
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d");
1157 1157
 
1158 1158
             if (!empty($posts)) {
1159 1159
 
1160 1160
                 foreach ($posts as $p) {
1161 1161
                     $p->post_type = $key;
1162
-                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1162
+                    $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1163 1163
                     if (empty($raw_tags)) {
1164 1164
                         $post_tags = '';
1165 1165
                     } else {
1166 1166
                         $post_tags = implode(",", $raw_tags);
1167 1167
                     }
1168
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1169
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1168
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1169
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1170 1170
 
1171 1171
                 }
1172
-                $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1172
+                $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1173 1173
             }
1174 1174
 
1175 1175
         }
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
     if ($is_error_during_diagnose) {
1180 1180
         $info_div_class = "geodir_problem_info";
1181
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1181
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1182 1182
     } else {
1183 1183
         $info_div_class = "geodir_noproblem_info";
1184 1184
         $fix_button_txt = '';
@@ -1215,29 +1215,29 @@  discard block
 block discarded – undo
1215 1215
     if (!empty($all_postypes)) {
1216 1216
         foreach ($all_postypes as $key) {
1217 1217
             // update each GD CTP
1218
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1218
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
1219 1219
 
1220 1220
             if (!empty($posts)) {
1221 1221
 
1222 1222
                 foreach ($posts as $p) {
1223 1223
                     $p->post_type = $key;
1224
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1224
+                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
1225 1225
 
1226 1226
                     if (empty($raw_cats)) {
1227 1227
                         $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1228 1228
 
1229
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1230
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1231
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1229
+                        if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
1230
+                            $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
1231
+                            foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
1232 1232
                                 if (is_numeric($cat_part)) {
1233
-                                    $raw_cats[] = (int)$cat_part;
1233
+                                    $raw_cats[] = (int) $cat_part;
1234 1234
                                 }
1235 1235
                             }
1236 1236
 
1237 1237
                         }
1238 1238
 
1239 1239
                         if (!empty($raw_cats)) {
1240
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1240
+                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category');
1241 1241
 
1242 1242
                         }
1243 1243
 
@@ -1247,14 +1247,14 @@  discard block
 block discarded – undo
1247 1247
                     if (empty($raw_cats)) {
1248 1248
                         $post_cats = '';
1249 1249
                     } else {
1250
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1250
+                        $post_cats = ','.implode(",", $raw_cats).',';
1251 1251
                     }
1252
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1253
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1252
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1253
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1254 1254
                 }
1255 1255
 
1256 1256
             }
1257
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1257
+            $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1258 1258
 
1259 1259
         }
1260 1260
 
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
     if ($is_error_during_diagnose) {
1264 1264
         $info_div_class = "geodir_problem_info";
1265
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1265
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1266 1266
     } else {
1267 1267
         $info_div_class = "geodir_noproblem_info";
1268 1268
         $fix_button_txt = '';
@@ -1315,15 +1315,15 @@  discard block
 block discarded – undo
1315 1315
     if (!empty($ver_arr)) {
1316 1316
         foreach ($ver_arr as $key => $val) {
1317 1317
             if (delete_option($val)) {
1318
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1318
+                $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
1319 1319
             } else {
1320
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1320
+                $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
1321 1321
             }
1322 1322
 
1323 1323
         }
1324 1324
 
1325 1325
         if ($output_str) {
1326
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1326
+            $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
1327 1327
         }
1328 1328
 
1329 1329
     }
@@ -1360,43 +1360,43 @@  discard block
 block discarded – undo
1360 1360
     $output_str = '';
1361 1361
 
1362 1362
     // check review locations
1363
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1364
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1363
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
1364
+        $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
1365 1365
         $is_error_during_diagnose = true;
1366 1366
 
1367 1367
         if ($fix) {
1368 1368
             if (geodir_fix_review_location()) {
1369
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1369
+                $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
1370 1370
             } else {
1371
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1371
+                $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
1372 1372
             }
1373 1373
         }
1374 1374
 
1375 1375
     } else {
1376
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1376
+        $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
1377 1377
     }
1378 1378
 
1379 1379
     // check review content
1380
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1381
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1380
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
1381
+        $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
1382 1382
         $is_error_during_diagnose = true;
1383 1383
 
1384 1384
         if ($fix) {
1385 1385
             if (geodir_fix_review_content()) {
1386
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1386
+                $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
1387 1387
             } else {
1388
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1388
+                $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
1389 1389
             }
1390 1390
         }
1391 1391
 
1392 1392
     } else {
1393
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1393
+        $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
1394 1394
     }
1395 1395
 
1396 1396
 
1397 1397
     if ($is_error_during_diagnose) {
1398 1398
         $info_div_class = "geodir_problem_info";
1399
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1399
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1400 1400
     } else {
1401 1401
         $info_div_class = "geodir_noproblem_info";
1402 1402
         $fix_button_txt = '';
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
     if ($is_error_during_diagnose) {
1462 1462
         $info_div_class = "geodir_problem_info";
1463
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1463
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1464 1464
     } else {
1465 1465
         $info_div_class = "geodir_noproblem_info";
1466 1466
         $fix_button_txt = '';
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
     else {
1495 1495
         $page_found = $wpdb->get_var(
1496 1496
             $wpdb->prepare(
1497
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1497
+                "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
1498 1498
                 array($slug)
1499 1499
             )
1500 1500
         );
@@ -1540,18 +1540,18 @@  discard block
 block discarded – undo
1540 1540
     //////////////////////////////////
1541 1541
     $option_value = get_option('geodir_home_page');
1542 1542
     $page = get_post($option_value);
1543
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1543
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1544 1544
 
1545
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1546
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1545
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1546
+        $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
1547 1547
     else {
1548 1548
         $is_error_during_diagnose = true;
1549
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1549
+        $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
1550 1550
         if ($fix) {
1551 1551
             if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1552
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1552
+                $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
1553 1553
             } else {
1554
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1554
+                $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
1555 1555
             }
1556 1556
         }
1557 1557
     }
@@ -1565,18 +1565,18 @@  discard block
 block discarded – undo
1565 1565
     //////////////////////////////////
1566 1566
     $option_value = get_option('geodir_add_listing_page');
1567 1567
     $page = get_post($option_value);
1568
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1568
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1569 1569
 
1570
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1571
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1570
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1571
+        $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
1572 1572
     else {
1573 1573
         $is_error_during_diagnose = true;
1574
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1574
+        $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
1575 1575
         if ($fix) {
1576 1576
             if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1577
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1577
+                $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
1578 1578
             } else {
1579
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1579
+                $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
1580 1580
             }
1581 1581
         }
1582 1582
     }
@@ -1591,18 +1591,18 @@  discard block
 block discarded – undo
1591 1591
     //////////////////////////////////
1592 1592
     $option_value = get_option('geodir_preview_page');
1593 1593
     $page = get_post($option_value);
1594
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1594
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1595 1595
 
1596
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1597
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1596
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1597
+        $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
1598 1598
     else {
1599 1599
         $is_error_during_diagnose = true;
1600
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1600
+        $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
1601 1601
         if ($fix) {
1602 1602
             if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1603
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1603
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
1604 1604
             } else {
1605
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1605
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
1606 1606
             }
1607 1607
         }
1608 1608
     }
@@ -1616,18 +1616,18 @@  discard block
 block discarded – undo
1616 1616
     //////////////////////////////////
1617 1617
     $option_value = get_option('geodir_success_page');
1618 1618
     $page = get_post($option_value);
1619
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1619
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1620 1620
 
1621
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1622
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1621
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1622
+        $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
1623 1623
     else {
1624 1624
         $is_error_during_diagnose = true;
1625
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1625
+        $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
1626 1626
         if ($fix) {
1627 1627
             if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1628
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1628
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
1629 1629
             } else {
1630
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1630
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
1631 1631
             }
1632 1632
         }
1633 1633
     }
@@ -1641,18 +1641,18 @@  discard block
 block discarded – undo
1641 1641
     //////////////////////////////////
1642 1642
     $option_value = get_option('geodir_info_page');
1643 1643
     $page = get_post($option_value);
1644
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1644
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1645 1645
 
1646
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1647
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1646
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1647
+        $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
1648 1648
     else {
1649 1649
         $is_error_during_diagnose = true;
1650
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1650
+        $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
1651 1651
         if ($fix) {
1652 1652
             if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1653
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1653
+                $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
1654 1654
             } else {
1655
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1655
+                $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
1656 1656
             }
1657 1657
         }
1658 1658
     }
@@ -1666,18 +1666,18 @@  discard block
 block discarded – undo
1666 1666
     //////////////////////////////////
1667 1667
     $option_value = get_option('geodir_login_page');
1668 1668
     $page = get_post($option_value);
1669
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1669
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1670 1670
 
1671
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1672
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1671
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1672
+        $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
1673 1673
     else {
1674 1674
         $is_error_during_diagnose = true;
1675
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1675
+        $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
1676 1676
         if ($fix) {
1677 1677
             if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1678
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1678
+                $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
1679 1679
             } else {
1680
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1680
+                $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
1681 1681
             }
1682 1682
         }
1683 1683
     }
@@ -1691,18 +1691,18 @@  discard block
 block discarded – undo
1691 1691
     //////////////////////////////////
1692 1692
     $option_value = get_option('geodir_location_page');
1693 1693
     $page = get_post($option_value);
1694
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1694
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1695 1695
 
1696
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1697
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1696
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1697
+        $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
1698 1698
     else {
1699 1699
         $is_error_during_diagnose = true;
1700
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1700
+        $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
1701 1701
         if ($fix) {
1702 1702
             if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1703
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1703
+                $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
1704 1704
             } else {
1705
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1705
+                $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
1706 1706
             }
1707 1707
         }
1708 1708
     }
@@ -1711,13 +1711,13 @@  discard block
 block discarded – undo
1711 1711
     /* Diagnose Location Page Ends */
1712 1712
     ////////////////////////////////
1713 1713
 
1714
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1714
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1715 1715
     /**
1716 1716
      * This action is called at the end of the GD Tools page check function.
1717 1717
      *
1718 1718
      * @since 1.5.2
1719 1719
      */
1720
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1720
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1721 1721
 
1722 1722
     $output_str = $page_chk_arr['output_str'];
1723 1723
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
             flush_rewrite_rules();
1728 1728
         }
1729 1729
         $info_div_class = "geodir_problem_info";
1730
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1730
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1731 1731
     } else {
1732 1732
         $info_div_class = "geodir_noproblem_info";
1733 1733
         $fix_button_txt = '';
@@ -1755,10 +1755,10 @@  discard block
 block discarded – undo
1755 1755
     $fix_button_txt = '';
1756 1756
 
1757 1757
     if ($is_error_during_diagnose) {
1758
-        $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1758
+        $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
1759 1759
 		$info_div_class = "geodir_problem_info";
1760 1760
     } else {
1761
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1761
+        $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
1762 1762
 		$info_div_class = "geodir_noproblem_info";
1763 1763
         $fix_button_txt = '';
1764 1764
     }
@@ -1800,17 +1800,17 @@  discard block
 block discarded – undo
1800 1800
     global $wpdb, $wp_query, $plugin_prefix;
1801 1801
 
1802 1802
     if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
1803
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1803
+        $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
1804 1804
 
1805
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1805
+        $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
1806 1806
         $clauses['join'] = $join;
1807 1807
 
1808
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1808
+        $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
1809 1809
         $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire';
1810 1810
         $clauses['fields'] = $fields;
1811 1811
 
1812 1812
         $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1813
-        $orderby = 'gd_expire ' . $order;
1813
+        $orderby = 'gd_expire '.$order;
1814 1814
         $clauses['orderby'] = $orderby;
1815 1815
     }
1816 1816
     return $clauses;
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
         global $current_user;
1854 1854
         $upload_dir = wp_upload_dir();
1855 1855
 
1856
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1856
+        $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
1857 1857
         $handle = fopen($file, 'w');
1858 1858
 
1859 1859
         fwrite($handle, $input);
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
     $uploads_dir = $uploads['path'];
1899 1899
     $image_name_arr = explode('/', $filename);
1900 1900
     $filename = end($image_name_arr);
1901
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1901
+    $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1902 1902
     $return = array();
1903 1903
     $return['file'] = $uploadedFile;
1904 1904
     $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
 
1916 1916
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1917 1917
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1918
-                        if(is_array($data) && !empty($data)) {
1919
-                            $file[] = '"' . implode('","', $data) . '"';
1918
+                        if (is_array($data) && !empty($data)) {
1919
+                            $file[] = '"'.implode('","', $data).'"';
1920 1920
                         }
1921 1921
                     }
1922 1922
                     fclose($handle);
@@ -2033,10 +2033,10 @@  discard block
 block discarded – undo
2033 2033
                     $tag_arr = explode(',', $post_tags);
2034 2034
                 }
2035 2035
 
2036
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2036
+                $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
2037 2037
 
2038 2038
                 $error = '';
2039
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2039
+                if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
2040 2040
                     $invalid_post_type++;
2041 2041
                     continue;
2042 2042
                 }
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
                             if ($buffer[$c] != '0' && $buffer[$c] != '') {
2063 2063
                                 $submitdata = date('Y-m-d');
2064 2064
 
2065
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2065
+                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
2066 2066
                             } else {
2067 2067
                                 $gd_post_info['expire_date'] = 'Never';
2068 2068
                             }
@@ -2090,7 +2090,7 @@  discard block
 block discarded – undo
2090 2090
 						
2091 2091
 						// Post status
2092 2092
 						if ($customKeyarray[$c] == 'post_status') {
2093
-                            $post_status = sanitize_key( $buffer[$c] );
2093
+                            $post_status = sanitize_key($buffer[$c]);
2094 2094
                         }
2095 2095
                     }
2096 2096
 
@@ -2108,8 +2108,8 @@  discard block
 block discarded – undo
2108 2108
 					
2109 2109
 					// Default post status
2110 2110
 					$default_status = 'publish';
2111
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2112
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2111
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
2112
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
2113 2113
 
2114 2114
                     $my_post['post_title'] = $post_title;
2115 2115
                     $my_post['post_content'] = $post_desc;
@@ -2153,7 +2153,7 @@  discard block
 block discarded – undo
2153 2153
                     $payment_info = array();
2154 2154
                     $package_info = array();
2155 2155
 
2156
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2156
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2157 2157
                     $package_id = '';
2158 2158
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2159 2159
                         $package_id = $gd_post_info['package_id'];
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
                         $payment_info['package_id'] = $package_info['pid'];
2164 2164
 
2165 2165
                         if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2166
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2166
+                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
2167 2167
                         } else {
2168 2168
                             $payment_info['expire_date'] = 'Never';
2169 2169
                         }
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
 
2176 2176
                     $post_type = get_post_type($last_postid);
2177 2177
 
2178
-                    $table = $plugin_prefix . $post_type . '_detail';
2178
+                    $table = $plugin_prefix.$post_type.'_detail';
2179 2179
 
2180 2180
                     geodir_save_post_info($last_postid, $gd_post_info);
2181 2181
 
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
                             $attachment['post_id'] = $last_postid;
2197 2197
                             $attachment['title'] = $img_name_arr[0];
2198 2198
                             $attachment['content'] = '';
2199
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2199
+                            $attachment['file'] = $sub_dir.'/'.$image_name;
2200 2200
                             $attachment['mime_type'] = $uploaded_file_type;
2201 2201
                             $attachment['menu_order'] = $menu_order;
2202 2202
                             $attachment['is_featured'] = 0;
@@ -2205,15 +2205,15 @@  discard block
 block discarded – undo
2205 2205
 
2206 2206
                             foreach ($attachment as $key => $val) {
2207 2207
                                 if ($val != '')
2208
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2208
+                                    $attachment_set .= $key." = '".$val."', ";
2209 2209
                             }
2210 2210
                             $attachment_set = trim($attachment_set, ", ");
2211 2211
 
2212
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2212
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
2213 2213
 
2214 2214
                             if ($menu_order == 1) {
2215 2215
                                 $post_type = get_post_type($last_postid);
2216
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2216
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
2217 2217
                             }
2218 2218
                             $menu_order++;
2219 2219
                         }
@@ -2254,11 +2254,11 @@  discard block
 block discarded – undo
2254 2254
 }
2255 2255
 
2256 2256
 // Add the tab in left sidebar menu fro import & export page.
2257
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2257
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2258 2258
 
2259 2259
 // Handle ajax request for import/export.
2260
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2261
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2260
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2261
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2262 2262
 
2263 2263
 
2264 2264
 /**
@@ -2269,40 +2269,40 @@  discard block
 block discarded – undo
2269 2269
  * @param $post_id int $post_id The post ID of the post being saved.
2270 2270
  * @param $post object $post The post object of the post being saved.
2271 2271
  */
2272
-function geodir_update_location_prefix($post_id,$post){
2273
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2274
-        update_option('geodir_location_prefix',$post->post_name);
2272
+function geodir_update_location_prefix($post_id, $post) {
2273
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2274
+        update_option('geodir_location_prefix', $post->post_name);
2275 2275
     }
2276 2276
 
2277 2277
 }
2278 2278
 
2279
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2279
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2280 2280
 
2281
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2281
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2282 2282
 
2283
-function geodir_ga_callback(){
2283
+function geodir_ga_callback() {
2284 2284
 
2285
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2285
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2286 2286
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2287 2287
     $code = "code=".$_REQUEST['code'];
2288 2288
     $grant_type = "&grant_type=authorization_code";
2289
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2289
+    $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
2290 2290
     $client_id = "&client_id=".get_option('geodir_ga_client_id');
2291 2291
     $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2292 2292
 
2293
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2293
+    $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
2294 2294
 
2295 2295
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2296 2296
 
2297 2297
     //print_r($response);
2298 2298
 
2299
-    $error_msg =  __('Something went wrong','geodirectory');
2300
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2299
+    $error_msg = __('Something went wrong', 'geodirectory');
2300
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2301 2301
 
2302 2302
         $parts = json_decode($response['body']);
2303 2303
         //print_r($parts);
2304
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2305
-        else{
2304
+        if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
2305
+        else {
2306 2306
 
2307 2307
             update_option('gd_ga_access_token', $parts->access_token);
2308 2308
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2311,25 +2311,25 @@  discard block
 block discarded – undo
2311 2311
 
2312 2312
 
2313 2313
     }
2314
-    elseif(!empty($response['response']['code'])) {
2314
+    elseif (!empty($response['response']['code'])) {
2315 2315
         $parts = json_decode($response['body']);
2316 2316
 
2317
-        if(isset($parts->error)){
2318
-            echo $parts->error.": ".$parts->error_description;exit;
2319
-        }else{
2320
-            echo $error_msg." - #2";exit;
2317
+        if (isset($parts->error)) {
2318
+            echo $parts->error.": ".$parts->error_description; exit;
2319
+        } else {
2320
+            echo $error_msg." - #2"; exit;
2321 2321
         }
2322 2322
 
2323
-    }else{
2323
+    } else {
2324 2324
 
2325
-        echo $error_msg." - #3";exit;
2325
+        echo $error_msg." - #3"; exit;
2326 2326
 
2327 2327
     }
2328 2328
 }
2329 2329
     exit;
2330 2330
 }
2331 2331
 
2332
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2332
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2333 2333
 
2334 2334
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2335 2335
 	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
Please login to merge, or discard this patch.
Braces   +63 added lines, -55 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+            	// this will avoid Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -316,8 +319,9 @@  discard block
 block discarded – undo
316 319
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
317 320
 
318 321
         foreach ($notification as $key => $value) {
319
-            if ($value['type'] == 'textarea')
320
-                $notification[$key]['type'] = 'editor';
322
+            if ($value['type'] == 'textarea') {
323
+                            $notification[$key]['type'] = 'editor';
324
+            }
321 325
         }
322 326
 
323 327
     }
@@ -342,8 +346,9 @@  discard block
 block discarded – undo
342 346
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
343 347
 
344 348
         foreach ($design_setting as $key => $value) {
345
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
346
-                $design_setting[$key]['type'] = 'editor';
349
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
350
+                            $design_setting[$key]['type'] = 'editor';
351
+            }
347 352
         }
348 353
 
349 354
     }
@@ -462,9 +467,9 @@  discard block
 block discarded – undo
462 467
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
463 468
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
464 469
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
465
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
470
+                    } elseif(isset($val['field_icon']) && $val['field_icon'] ){
466 471
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
467
-                    }else{
472
+                    } else{
468 473
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
469 474
                     }?>
470 475
                     <?php echo $val['site_title'];?>
@@ -693,9 +698,9 @@  discard block
 block discarded – undo
693 698
         <?php
694 699
         if($type=='predefined'){
695 700
             $cfs = geodir_custom_fields_predefined($listing_type);
696
-        }elseif($type=='custom'){
701
+        } elseif($type=='custom'){
697 702
             $cfs = geodir_custom_fields_custom($listing_type);
698
-        }else{
703
+        } else{
699 704
             $cfs = geodir_custom_fields($listing_type);
700 705
             ?>
701 706
             <ul class="full gd-cf-tooltip-wrap">
@@ -750,7 +755,7 @@  discard block
 block discarded – undo
750 755
             </li>
751 756
             <?php
752 757
         }
753
-    }else{
758
+    } else{
754 759
         _e('There are no custom fields here yet.', 'geodirectory');
755 760
     }
756 761
         ?>
@@ -947,8 +952,9 @@  discard block
 block discarded – undo
947 952
 
948 953
     if (!get_option('geodir_remove_unnecessary_fields')) {
949 954
 
950
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
951
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
955
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
956
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
957
+        }
952 958
 
953 959
         update_option('geodir_remove_unnecessary_fields', '1');
954 960
 
@@ -974,15 +980,17 @@  discard block
 block discarded – undo
974 980
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
975 981
         switch ($geodir_admin_ajax_action) {
976 982
             case 'diagnosis' :
977
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
978
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
983
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
984
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
985
+                }
979 986
                 call_user_func('geodir_diagnose_' . $diagnose_this);
980 987
                 exit();
981 988
                 break;
982 989
 
983 990
             case 'diagnosis-fix' :
984
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
985
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
991
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
992
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
993
+                }
986 994
                 call_user_func('geodir_diagnose_' . $diagnose_this);
987 995
                 exit();
988 996
                 break;
@@ -1540,11 +1548,11 @@  discard block
 block discarded – undo
1540 1548
     //////////////////////////////////
1541 1549
     $option_value = get_option('geodir_home_page');
1542 1550
     $page = get_post($option_value);
1543
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1551
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1544 1552
 
1545
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1546
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1547
-    else {
1553
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1554
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1555
+    } else {
1548 1556
         $is_error_during_diagnose = true;
1549 1557
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1550 1558
         if ($fix) {
@@ -1565,11 +1573,11 @@  discard block
 block discarded – undo
1565 1573
     //////////////////////////////////
1566 1574
     $option_value = get_option('geodir_add_listing_page');
1567 1575
     $page = get_post($option_value);
1568
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1576
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1569 1577
 
1570
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1571
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1572
-    else {
1578
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1579
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1580
+    } else {
1573 1581
         $is_error_during_diagnose = true;
1574 1582
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1575 1583
         if ($fix) {
@@ -1591,11 +1599,11 @@  discard block
 block discarded – undo
1591 1599
     //////////////////////////////////
1592 1600
     $option_value = get_option('geodir_preview_page');
1593 1601
     $page = get_post($option_value);
1594
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1602
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1595 1603
 
1596
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1597
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1598
-    else {
1604
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1605
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1606
+    } else {
1599 1607
         $is_error_during_diagnose = true;
1600 1608
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1601 1609
         if ($fix) {
@@ -1616,11 +1624,11 @@  discard block
 block discarded – undo
1616 1624
     //////////////////////////////////
1617 1625
     $option_value = get_option('geodir_success_page');
1618 1626
     $page = get_post($option_value);
1619
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1627
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1620 1628
 
1621
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1622
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1623
-    else {
1629
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1630
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1631
+    } else {
1624 1632
         $is_error_during_diagnose = true;
1625 1633
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1626 1634
         if ($fix) {
@@ -1641,11 +1649,11 @@  discard block
 block discarded – undo
1641 1649
     //////////////////////////////////
1642 1650
     $option_value = get_option('geodir_info_page');
1643 1651
     $page = get_post($option_value);
1644
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1652
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1645 1653
 
1646
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1647
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1648
-    else {
1654
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1655
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1656
+    } else {
1649 1657
         $is_error_during_diagnose = true;
1650 1658
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1651 1659
         if ($fix) {
@@ -1666,11 +1674,11 @@  discard block
 block discarded – undo
1666 1674
     //////////////////////////////////
1667 1675
     $option_value = get_option('geodir_login_page');
1668 1676
     $page = get_post($option_value);
1669
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1677
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1670 1678
 
1671
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1672
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1673
-    else {
1679
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1680
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1681
+    } else {
1674 1682
         $is_error_during_diagnose = true;
1675 1683
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1676 1684
         if ($fix) {
@@ -1691,11 +1699,11 @@  discard block
 block discarded – undo
1691 1699
     //////////////////////////////////
1692 1700
     $option_value = get_option('geodir_location_page');
1693 1701
     $page = get_post($option_value);
1694
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1702
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1695 1703
 
1696
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1697
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1698
-    else {
1704
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1705
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1706
+    } else {
1699 1707
         $is_error_during_diagnose = true;
1700 1708
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1701 1709
         if ($fix) {
@@ -2140,8 +2148,9 @@  discard block
 block discarded – undo
2140 2148
                             );
2141 2149
 
2142 2150
                             $post_location_info = $request_info['post_location'];
2143
-                            if ($location_id = geodir_add_new_location($post_location_info))
2144
-                                $post_location_id = $location_id;
2151
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2152
+                                                            $post_location_id = $location_id;
2153
+                            }
2145 2154
                         } else {
2146 2155
                             $post_location_id = 0;
2147 2156
                         }
@@ -2204,8 +2213,9 @@  discard block
 block discarded – undo
2204 2213
                             $attachment_set = '';
2205 2214
 
2206 2215
                             foreach ($attachment as $key => $val) {
2207
-                                if ($val != '')
2208
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2216
+                                if ($val != '') {
2217
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2218
+                                }
2209 2219
                             }
2210 2220
                             $attachment_set = trim($attachment_set, ", ");
2211 2221
 
@@ -2301,8 +2311,7 @@  discard block
 block discarded – undo
2301 2311
 
2302 2312
         $parts = json_decode($response['body']);
2303 2313
         //print_r($parts);
2304
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2305
-        else{
2314
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2306 2315
 
2307 2316
             update_option('gd_ga_access_token', $parts->access_token);
2308 2317
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2310,17 +2319,16 @@  discard block
 block discarded – undo
2310 2319
         }
2311 2320
 
2312 2321
 
2313
-    }
2314
-    elseif(!empty($response['response']['code'])) {
2322
+    } elseif(!empty($response['response']['code'])) {
2315 2323
         $parts = json_decode($response['body']);
2316 2324
 
2317 2325
         if(isset($parts->error)){
2318 2326
             echo $parts->error.": ".$parts->error_description;exit;
2319
-        }else{
2327
+        } else{
2320 2328
             echo $error_msg." - #2";exit;
2321 2329
         }
2322 2330
 
2323
-    }else{
2331
+    } else{
2324 2332
 
2325 2333
         echo $error_msg." - #3";exit;
2326 2334
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 2 patches
Indentation   +529 added lines, -529 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
338
-            geodir_admin_fields($geodir_settings['design_settings']);
337
+		case 'design_settings' :
338
+			geodir_admin_fields($geodir_settings['design_settings']);
339 339
 
340 340
 
341 341
 
342
-            ?>
342
+			?>
343 343
 			<p class="submit">
344 344
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
345 345
 			<input type="hidden" name="subtab" id="last_tab" />
346 346
 			</p>
347 347
 			</div>
348 348
         <?php break;
349
-        case 'permalink_settings' :
350
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
349
+		case 'permalink_settings' :
350
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351 351
             <p class="submit">
352 352
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
353 353
             <input type="hidden" name="subtab" id="last_tab" />
354 354
             </p>
355 355
             </div>	
356 356
 		<?php break;
357
-        case 'title_meta_settings' :
358
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
357
+		case 'title_meta_settings' :
358
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359 359
             <p class="submit">
360 360
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
361 361
             <input type="hidden" name="subtab" id="last_tab" />
362 362
             </p>
363 363
             </div>
364 364
 		<?php break;
365
-        case 'notifications_settings' :
366
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
365
+		case 'notifications_settings' :
366
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367 367
 			
368 368
 			<p class="submit">
369 369
 				
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
 			</div>
374 374
 			
375 375
 		<?php break;
376
-        case 'default_location_settings' :
377
-            ?>
376
+		case 'default_location_settings' :
377
+			?>
378 378
             <div class="inner_content_tab_main">
379 379
                 <div class="gd-content-heading">
380 380
                     <?php global $wpdb;
381 381
 
382 382
 
383
-                    $location_result = geodir_get_default_location();
383
+					$location_result = geodir_get_default_location();
384 384
 
385
-                    $prefix = '';
385
+					$prefix = '';
386 386
 
387 387
 
388
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
-                    $city = isset($location_result->city) ? $location_result->city : '';
391
-                    $region = isset($location_result->region) ? $location_result->region : '';
392
-                    $country = isset($location_result->country) ? $location_result->country : '';
388
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
+					$city = isset($location_result->city) ? $location_result->city : '';
391
+					$region = isset($location_result->region) ? $location_result->region : '';
392
+					$country = isset($location_result->country) ? $location_result->country : '';
393 393
 
394 394
 
395
-                    $map_title = __("Set Address On Map", 'geodirectory');
395
+					$map_title = __("Set Address On Map", 'geodirectory');
396 396
 
397
-                    ?>
397
+					?>
398 398
 
399 399
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
403 403
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
404
-                        echo $location_result->location_id;
405
-                    } ?>">
404
+						echo $location_result->location_id;
405
+					} ?>">
406 406
 
407 407
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
408 408
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+											   echo $location_result->city;
419
+										   } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+											   echo $location_result->region;
435
+										   } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
448 448
 
449
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
450
-                                    ?>
449
+									$country_result = isset($location_result->country) ? $location_result->country : '';
450
+									?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453 453
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473
-                                /**
474
-                                 * Contains add listing page map functions.
475
-                                 *
476
-                                 * @since 1.0.0
477
-                                 */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
473
+								/**
474
+								 * Contains add listing page map functions.
475
+								 *
476
+								 * @since 1.0.0
477
+								 */
478
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+											   echo $location_result->city_latitude;
489
+										   } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+											   echo $location_result->city_longitude;
506
+										   } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+		case $listing_type . '_fields_settings' :
539 539
 
540
-            geodir_custom_post_type_form();
540
+			geodir_custom_post_type_form();
541 541
 
542
-            break;
543
-        case 'tools_settings' :
544
-            geodir_diagnostic_tools_setting_page();
545
-            break;
546
-        case 'compatibility_settings' :
547
-            geodir_theme_compatibility_setting_page();
548
-            break;		
542
+			break;
543
+		case 'tools_settings' :
544
+			geodir_diagnostic_tools_setting_page();
545
+			break;
546
+		case 'compatibility_settings' :
547
+			geodir_theme_compatibility_setting_page();
548
+			break;		
549 549
 		case 'import_export' :
550
-            geodir_import_export_page();
551
-            break;
550
+			geodir_import_export_page();
551
+			break;
552 552
 
553
-    }// end of switch
553
+	}// end of switch
554 554
 }
555 555
 
556 556
 
@@ -590,170 +590,170 @@  discard block
 block discarded – undo
590 590
 function geodir_update_options_compatibility_settings()
591 591
 {
592 592
 
593
-    global $wpdb;
593
+	global $wpdb;
594 594
 
595 595
 
596
-    $theme_settings = array();
596
+	$theme_settings = array();
597 597
 
598
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
598
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
601 601
 
602
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
602
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
604
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
607 607
 
608
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
608
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
609 609
 
610
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
610
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
613 613
 
614
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
614
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
615 615
 
616
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
616
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
619 619
 
620
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
620
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
622
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
625 625
 
626
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
626
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
627 627
 
628
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
628
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
631 631
 
632
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
632
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
633 633
 
634 634
 // Other Actions
635
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
635
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637 637
 
638 638
 // Filters
639
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
639
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
649 649
 //location manager filters
650
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
650
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
654 654
 
655 655
 
656 656
 // theme required css
657
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
657
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
658 658
 
659 659
 // theme required js
660
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
660
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
661 661
 
662 662
 // theme compat name
663
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
-    if ($theme_settings['gd_theme_compat'] == '') {
665
-        update_option('gd_theme_compat', '');
666
-        update_option('theme_compatibility_setting', '');
667
-        return;
668
-    }
663
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
+	if ($theme_settings['gd_theme_compat'] == '') {
665
+		update_option('gd_theme_compat', '');
666
+		update_option('theme_compatibility_setting', '');
667
+		return;
668
+	}
669 669
 
670 670
 // theme default options
671
-    $theme_settings['geodir_theme_compat_default_options'] = '';
671
+	$theme_settings['geodir_theme_compat_default_options'] = '';
672 672
 
673 673
 
674 674
 //supported theme code
675
-    $theme_settings['geodir_theme_compat_code'] = false;
676
-
677
-    $theme = wp_get_theme();
678
-
679
-    if ($theme->parent()) {
680
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
-    } else {
682
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
683
-    }
684
-
685
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
687
-    }
688
-
689
-
690
-    $theme_name = $theme_name . "_custom";
691
-    $theme_arr = get_option('gd_theme_compats');
692
-    update_option('gd_theme_compat', $theme_name);
693
-    /**
694
-     * Called before the theme compatibility settings are saved to the DB.
695
-     *
696
-     * @since 1.4.0
697
-     * @param array $theme_settings {
698
-     *    Attributes of the theme compatibility settings array.
699
-     *
700
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
-     *    @type string $geodir_article_open_id Geodir article open html id.
709
-     *    @type string $geodir_article_open_class Geodir article open html class.
710
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
711
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
712
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
-     *    @type string $geodir_top_content_add Geodir top content add.
725
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
726
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
-     *    @type string $geodir_before_title_filter Geodir before title filter.
730
-     *    @type string $geodir_after_title_filter Geodir after title filter.
731
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
-     *    @type string $gd_theme_compat Gd theme compatibility.
743
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
-     *
746
-     * }
747
-     */
748
-    do_action('gd_compat_save_settings', $theme_settings);
675
+	$theme_settings['geodir_theme_compat_code'] = false;
676
+
677
+	$theme = wp_get_theme();
678
+
679
+	if ($theme->parent()) {
680
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
+	} else {
682
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
683
+	}
684
+
685
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
687
+	}
688
+
689
+
690
+	$theme_name = $theme_name . "_custom";
691
+	$theme_arr = get_option('gd_theme_compats');
692
+	update_option('gd_theme_compat', $theme_name);
693
+	/**
694
+	 * Called before the theme compatibility settings are saved to the DB.
695
+	 *
696
+	 * @since 1.4.0
697
+	 * @param array $theme_settings {
698
+	 *    Attributes of the theme compatibility settings array.
699
+	 *
700
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
+	 *    @type string $geodir_article_open_id Geodir article open html id.
709
+	 *    @type string $geodir_article_open_class Geodir article open html class.
710
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
711
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
712
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
+	 *    @type string $geodir_top_content_add Geodir top content add.
725
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
726
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
730
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
731
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
+	 *    @type string $gd_theme_compat Gd theme compatibility.
743
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
+	 *
746
+	 * }
747
+	 */
748
+	do_action('gd_compat_save_settings', $theme_settings);
749 749
 
750 750
 //if($_POST['gd_theme_compat'])==
751
-    $theme_arr[$theme_name] = $theme_settings;
752
-    update_option('gd_theme_compats', $theme_arr);
751
+	$theme_arr[$theme_name] = $theme_settings;
752
+	update_option('gd_theme_compats', $theme_arr);
753 753
 
754 754
 
755 755
 //print_r($theme_settings);exit;
756
-    update_option('theme_compatibility_setting', $theme_settings);
756
+	update_option('theme_compatibility_setting', $theme_settings);
757 757
 
758 758
 }
759 759
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_theme_compatibility_setting_page()
768 768
 {
769
-    global $wpdb;
770
-    $tc = get_option('theme_compatibility_setting');
771
-    //print_r($tc);
772
-    //print_r(wp_get_theme());
769
+	global $wpdb;
770
+	$tc = get_option('theme_compatibility_setting');
771
+	//print_r($tc);
772
+	//print_r(wp_get_theme());
773 773
 
774
-    ?>
774
+	?>
775 775
     <div class="inner_content_tab_main">
776 776
         <div class="gd-content-heading">
777 777
 
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814 814
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815 815
                 <?php
816
-                $theme_arr = get_option('gd_theme_compats');
817
-                $theme_active = get_option('gd_theme_compat');
818
-                if (is_array($theme_arr)) {
819
-                    foreach ($theme_arr as $key => $theme) {
820
-                        $sel = '';
821
-                        if ($theme_active == $key) {
822
-                            $sel = "selected";
823
-                        }
824
-                        echo "<option $sel>$key</option>";
825
-                    }
816
+				$theme_arr = get_option('gd_theme_compats');
817
+				$theme_active = get_option('gd_theme_compat');
818
+				if (is_array($theme_arr)) {
819
+					foreach ($theme_arr as $key => $theme) {
820
+						$sel = '';
821
+						if ($theme_active == $key) {
822
+							$sel = "selected";
823
+						}
824
+						echo "<option $sel>$key</option>";
825
+					}
826 826
 
827 827
 
828
-                }
828
+				}
829 829
 
830
-                ?>
830
+				?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833 833
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
                         <small>geodir_wrapper_open</small>
937 937
                     </td>
938 938
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
939
-                            echo $tc['geodir_wrapper_open_id'];
940
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
939
+							echo $tc['geodir_wrapper_open_id'];
940
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941 941
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
942
-                            echo $tc['geodir_wrapper_open_class'];
943
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
942
+							echo $tc['geodir_wrapper_open_class'];
943
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944 944
                 </tr>
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
                         <span><?php _e('Output:', 'geodirectory');?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951
-                                echo $tc['geodir_wrapper_open_replace'];
952
-                            }?></textarea>
951
+								echo $tc['geodir_wrapper_open_replace'];
952
+							}?></textarea>
953 953
                     </td>
954 954
                 </tr>
955 955
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                         <span><?php _e('Output:', 'geodirectory');?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972
-                                echo $tc['geodir_wrapper_close_replace'];
973
-                            }?></textarea>
972
+								echo $tc['geodir_wrapper_close_replace'];
973
+							}?></textarea>
974 974
                     </td>
975 975
                 </tr>
976 976
 
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
                         <small>geodir_wrapper_content_open</small>
981 981
                     </td>
982 982
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
983
-                            echo $tc['geodir_wrapper_content_open_id'];
984
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
983
+							echo $tc['geodir_wrapper_content_open_id'];
984
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985 985
                     </td>
986 986
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
987
-                            echo $tc['geodir_wrapper_content_open_class'];
988
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
987
+							echo $tc['geodir_wrapper_content_open_class'];
988
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989 989
                 </tr>
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
                         <span><?php _e('Output:', 'geodirectory');?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996
-                                echo $tc['geodir_wrapper_content_open_replace'];
997
-                            }?></textarea>
996
+								echo $tc['geodir_wrapper_content_open_replace'];
997
+							}?></textarea>
998 998
                     </td>
999 999
                 </tr>
1000 1000
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
                         <span><?php _e('Output:', 'geodirectory');?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017
-                                echo $tc['geodir_wrapper_content_close_replace'];
1018
-                            }?></textarea>
1017
+								echo $tc['geodir_wrapper_content_close_replace'];
1018
+							}?></textarea>
1019 1019
                     </td>
1020 1020
                 </tr>
1021 1021
 
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
                         <small>geodir_article_open</small>
1025 1025
                     </td>
1026 1026
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1027
-                            echo $tc['geodir_article_open_id'];
1028
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1027
+							echo $tc['geodir_article_open_id'];
1028
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029 1029
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1030
-                            echo $tc['geodir_article_open_class'];
1031
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1030
+							echo $tc['geodir_article_open_class'];
1031
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032 1032
                 </tr>
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
                         <span><?php _e('Output:', 'geodirectory');?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039
-                                echo $tc['geodir_article_open_replace'];
1040
-                            }?></textarea>
1039
+								echo $tc['geodir_article_open_replace'];
1040
+							}?></textarea>
1041 1041
                     </td>
1042 1042
                 </tr>
1043 1043
 
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                         <span><?php _e('Output:', 'geodirectory');?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059
-                                echo $tc['geodir_article_close_replace'];
1060
-                            }?></textarea>
1059
+								echo $tc['geodir_article_close_replace'];
1060
+							}?></textarea>
1061 1061
                     </td>
1062 1062
                 </tr>
1063 1063
 
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
                         <small>geodir_sidebar_right_open</small>
1067 1067
                     </td>
1068 1068
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1069
-                            echo $tc['geodir_sidebar_right_open_id'];
1070
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1069
+							echo $tc['geodir_sidebar_right_open_id'];
1070
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071 1071
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1072
-                            echo $tc['geodir_sidebar_right_open_class'];
1073
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1072
+							echo $tc['geodir_sidebar_right_open_class'];
1073
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1074 1074
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1075 1075
                 </tr>
1076 1076
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
                         <span><?php _e('Output:', 'geodirectory');?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082
-                                echo $tc['geodir_sidebar_right_open_replace'];
1083
-                            }?></textarea>
1082
+								echo $tc['geodir_sidebar_right_open_replace'];
1083
+							}?></textarea>
1084 1084
                     </td>
1085 1085
                 </tr>
1086 1086
 
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
                         <span><?php _e('Output:', 'geodirectory');?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102
-                                echo $tc['geodir_sidebar_right_close_replace'];
1103
-                            }?></textarea>
1102
+								echo $tc['geodir_sidebar_right_close_replace'];
1103
+							}?></textarea>
1104 1104
                     </td>
1105 1105
                 </tr>
1106 1106
 
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
                         <small>geodir_sidebar_left_open</small>
1111 1111
                     </td>
1112 1112
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1113
-                            echo $tc['geodir_sidebar_left_open_id'];
1114
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1113
+							echo $tc['geodir_sidebar_left_open_id'];
1114
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115 1115
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1116
-                            echo $tc['geodir_sidebar_left_open_class'];
1117
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1116
+							echo $tc['geodir_sidebar_left_open_class'];
1117
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1118 1118
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1119 1119
                 </tr>
1120 1120
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
                         <span><?php _e('Output:', 'geodirectory');?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126
-                                echo $tc['geodir_sidebar_left_open_replace'];
1127
-                            }?></textarea>
1126
+								echo $tc['geodir_sidebar_left_open_replace'];
1127
+							}?></textarea>
1128 1128
                     </td>
1129 1129
                 </tr>
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
                         <span><?php _e('Output:', 'geodirectory');?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146
-                                echo $tc['geodir_sidebar_left_close_replace'];
1147
-                            }?></textarea>
1146
+								echo $tc['geodir_sidebar_left_close_replace'];
1147
+							}?></textarea>
1148 1148
                     </td>
1149 1149
                 </tr>
1150 1150
 
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
                         <small>geodir_main_content_open</small>
1154 1154
                     </td>
1155 1155
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1156
-                            echo $tc['geodir_main_content_open_id'];
1157
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1156
+							echo $tc['geodir_main_content_open_id'];
1157
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158 1158
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1159
-                            echo $tc['geodir_main_content_open_class'];
1160
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1159
+							echo $tc['geodir_main_content_open_class'];
1160
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161 1161
                 </tr>
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                         <span><?php _e('Output:', 'geodirectory');?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168
-                                echo $tc['geodir_main_content_open_replace'];
1169
-                            }?></textarea>
1168
+								echo $tc['geodir_main_content_open_replace'];
1169
+							}?></textarea>
1170 1170
                     </td>
1171 1171
                 </tr>
1172 1172
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
                         <span><?php _e('Output:', 'geodirectory');?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188
-                                echo $tc['geodir_main_content_close_replace'];
1189
-                            }?></textarea>
1188
+								echo $tc['geodir_main_content_close_replace'];
1189
+							}?></textarea>
1190 1190
                     </td>
1191 1191
                 </tr>
1192 1192
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
                     </td>
1211 1211
                     <td><textarea name="geodir_top_content_add"
1212 1212
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1213
-                                echo $tc['geodir_top_content_add'];
1214
-                            }?></textarea></td>
1213
+								echo $tc['geodir_top_content_add'];
1214
+							}?></textarea></td>
1215 1215
                 </tr>
1216 1216
 
1217 1217
                 <tr>
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     </td>
1221 1221
                     <td><textarea name="geodir_before_main_content_add"
1222 1222
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1223
-                                echo $tc['geodir_before_main_content_add'];
1224
-                            }?></textarea></td>
1223
+								echo $tc['geodir_before_main_content_add'];
1224
+							}?></textarea></td>
1225 1225
                 </tr>
1226 1226
 
1227 1227
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
                     </td>
1245 1245
                     <td><textarea name="geodir_full_page_class_filter"
1246 1246
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1247
-                                echo $tc['geodir_full_page_class_filter'];
1248
-                            }?></textarea></td>
1247
+								echo $tc['geodir_full_page_class_filter'];
1248
+							}?></textarea></td>
1249 1249
                 </tr>
1250 1250
 
1251 1251
                 <tr>
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
                     </td>
1255 1255
                     <td><textarea name="geodir_before_widget_filter"
1256 1256
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1257
-                                echo $tc['geodir_before_widget_filter'];
1258
-                            }?></textarea></td>
1257
+								echo $tc['geodir_before_widget_filter'];
1258
+							}?></textarea></td>
1259 1259
                 </tr>
1260 1260
 
1261 1261
                 <tr>
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                     </td>
1265 1265
                     <td><textarea name="geodir_after_widget_filter"
1266 1266
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1267
-                                echo $tc['geodir_after_widget_filter'];
1268
-                            }?></textarea></td>
1267
+								echo $tc['geodir_after_widget_filter'];
1268
+							}?></textarea></td>
1269 1269
                 </tr>
1270 1270
 
1271 1271
                 <tr>
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
                     </td>
1275 1275
                     <td><textarea name="geodir_before_title_filter"
1276 1276
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1277
-                                echo $tc['geodir_before_title_filter'];
1278
-                            }?></textarea></td>
1277
+								echo $tc['geodir_before_title_filter'];
1278
+							}?></textarea></td>
1279 1279
                 </tr>
1280 1280
 
1281 1281
                 <tr>
@@ -1284,8 +1284,8 @@  discard block
 block discarded – undo
1284 1284
                     </td>
1285 1285
                     <td><textarea name="geodir_after_title_filter"
1286 1286
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1287
-                                echo $tc['geodir_after_title_filter'];
1288
-                            }?></textarea></td>
1287
+								echo $tc['geodir_after_title_filter'];
1288
+							}?></textarea></td>
1289 1289
                 </tr>
1290 1290
 
1291 1291
                 <tr>
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
                     </td>
1295 1295
                     <td><textarea name="geodir_menu_li_class_filter"
1296 1296
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1297
-                                echo $tc['geodir_menu_li_class_filter'];
1298
-                            }?></textarea></td>
1297
+								echo $tc['geodir_menu_li_class_filter'];
1298
+							}?></textarea></td>
1299 1299
                 </tr>
1300 1300
 
1301 1301
                 <tr>
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
                     </td>
1305 1305
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1306 1306
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1307
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1308
-                            }?></textarea></td>
1307
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1308
+							}?></textarea></td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <tr>
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
                     </td>
1315 1315
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1316 1316
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1317
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1318
-                            }?></textarea></td>
1317
+								echo $tc['geodir_sub_menu_li_class_filter'];
1318
+							}?></textarea></td>
1319 1319
                 </tr>
1320 1320
 
1321 1321
                 <tr>
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                     </td>
1325 1325
                     <td><textarea name="geodir_menu_a_class_filter"
1326 1326
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1327
-                                echo $tc['geodir_menu_a_class_filter'];
1328
-                            }?></textarea></td>
1327
+								echo $tc['geodir_menu_a_class_filter'];
1328
+							}?></textarea></td>
1329 1329
                 </tr>
1330 1330
 
1331 1331
                 <tr>
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
                     </td>
1335 1335
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1336 1336
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1337
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1338
-                            }?></textarea></td>
1337
+								echo $tc['geodir_sub_menu_a_class_filter'];
1338
+							}?></textarea></td>
1339 1339
                 </tr>
1340 1340
 
1341 1341
 
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
                     </td>
1346 1346
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1347 1347
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1348
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
-                            }?></textarea></td>
1348
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
+							}?></textarea></td>
1350 1350
                 </tr>
1351 1351
 
1352 1352
                 <tr>
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
                     </td>
1356 1356
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1357 1357
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1358
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
-                            }?></textarea></td>
1358
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
+							}?></textarea></td>
1360 1360
                 </tr>
1361 1361
 
1362 1362
                 <tr>
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                     </td>
1366 1366
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1367 1367
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1368
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
-                            }?></textarea></td>
1368
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
+							}?></textarea></td>
1370 1370
                 </tr>
1371 1371
 
1372 1372
                 <tr>
@@ -1375,21 +1375,21 @@  discard block
 block discarded – undo
1375 1375
                     </td>
1376 1376
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1377 1377
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1378
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
-                            }?></textarea></td>
1378
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
+							}?></textarea></td>
1380 1380
                 </tr>
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
                 <?php
1385
-                /**
1386
-                 * Allows more filter setting to be added to theme compatibility settings page.
1387
-                 *
1388
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
-                 *
1390
-                 * @since 1.4.0
1391
-                 */
1392
-                do_action('gd_compat_other_filters');?>
1385
+				/**
1386
+				 * Allows more filter setting to be added to theme compatibility settings page.
1387
+				 *
1388
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
+				 *
1390
+				 * @since 1.4.0
1391
+				 */
1392
+				do_action('gd_compat_other_filters');?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
                 <tr>
1403 1403
                     <td><textarea name="geodir_theme_compat_css"
1404 1404
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1405
-                                echo $tc['geodir_theme_compat_css'];
1406
-                            }?></textarea></td>
1405
+								echo $tc['geodir_theme_compat_css'];
1406
+							}?></textarea></td>
1407 1407
                 </tr>
1408 1408
 
1409 1409
 
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
                 <tr>
1418 1418
                     <td><textarea name="geodir_theme_compat_js"
1419 1419
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1420
-                                echo $tc['geodir_theme_compat_js'];
1421
-                            }?></textarea></td>
1420
+								echo $tc['geodir_theme_compat_js'];
1421
+							}?></textarea></td>
1422 1422
                 </tr>
1423 1423
 
1424 1424
 
@@ -1445,23 +1445,23 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_custom_post_type_form()
1447 1447
 {
1448
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1448
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1449 1449
 
1450
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1450
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1451 1451
 
1452 1452
 
1453
-    ?>
1453
+	?>
1454 1454
 
1455 1455
     <div class="gd-content-heading">
1456 1456
         <?php
1457
-        /**
1458
-         * Filter custom fields panel heading.
1459
-         *
1460
-         * @since 1.0.0
1461
-         * @param string $sub_tab Sub tab name.
1462
-         * @param string $listing_type Post type.
1463
-         */
1464
-        ?>
1457
+		/**
1458
+		 * Filter custom fields panel heading.
1459
+		 *
1460
+		 * @since 1.0.0
1461
+		 * @param string $sub_tab Sub tab name.
1462
+		 * @param string $listing_type Post type.
1463
+		 */
1464
+		?>
1465 1465
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
             <div class="side-sortables" id="geodir-available-fields">
1471 1471
                 <?php
1472
-                /**
1473
-                 * Filter custom field available fields heading.
1474
-                 *
1475
-                 * @since 1.0.0
1476
-                 * @param string $sub_tab Sub tab name.
1477
-                 * @param string $listing_type Post type.
1478
-                 */
1479
-                ?>
1472
+				/**
1473
+				 * Filter custom field available fields heading.
1474
+				 *
1475
+				 * @since 1.0.0
1476
+				 * @param string $sub_tab Sub tab name.
1477
+				 * @param string $listing_type Post type.
1478
+				 */
1479
+				?>
1480 1480
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483
-                /**
1484
-                 * Filter custom field available fields note text.
1485
-                 *
1486
-                 * @since 1.0.0
1487
-                 * @param string $sub_tab Sub tab name.
1488
-                 * @param string $listing_type Post type.
1489
-                 */
1490
-                ?>
1483
+				/**
1484
+				 * Filter custom field available fields note text.
1485
+				 *
1486
+				 * @since 1.0.0
1487
+				 * @param string $sub_tab Sub tab name.
1488
+				 * @param string $listing_type Post type.
1489
+				 */
1490
+				?>
1491 1491
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1492 1492
 
1493 1493
                 <h3><?php _e('Setup New Field','geodirectory');?></h3>
@@ -1496,13 +1496,13 @@  discard block
 block discarded – undo
1496 1496
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1497 1497
 
1498 1498
                         <?php
1499
-                        /**
1500
-                         * Adds the available fields to the custom fields settings page per post type.
1501
-                         *
1502
-                         * @since 1.0.0
1503
-                         * @param string $sub_tab The current settings tab name.
1504
-                         */
1505
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1499
+						/**
1500
+						 * Adds the available fields to the custom fields settings page per post type.
1501
+						 *
1502
+						 * @since 1.0.0
1503
+						 * @param string $sub_tab The current settings tab name.
1504
+						 */
1505
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1506 1506
 
1507 1507
                         <div style="clear:both"></div>
1508 1508
                     </div>
@@ -1515,13 +1515,13 @@  discard block
 block discarded – undo
1515 1515
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1516 1516
 
1517 1517
                         <?php
1518
-                        /**
1519
-                         * Adds the available fields to the custom fields predefined settings page per post type.
1520
-                         *
1521
-                         * @since 1.6.9
1522
-                         * @param string $sub_tab The current settings tab name.
1523
-                         */
1524
-                        do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1518
+						/**
1519
+						 * Adds the available fields to the custom fields predefined settings page per post type.
1520
+						 *
1521
+						 * @since 1.6.9
1522
+						 * @param string $sub_tab The current settings tab name.
1523
+						 */
1524
+						do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1525 1525
 
1526 1526
                         <div style="clear:both"></div>
1527 1527
                     </div>
@@ -1534,13 +1534,13 @@  discard block
 block discarded – undo
1534 1534
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1535 1535
 
1536 1536
                         <?php
1537
-                        /**
1538
-                         * Adds the available fields to the custom fields custom added settings page per post type.
1539
-                         *
1540
-                         * @since 1.6.9
1541
-                         * @param string $sub_tab The current settings tab name.
1542
-                         */
1543
-                        do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1537
+						/**
1538
+						 * Adds the available fields to the custom fields custom added settings page per post type.
1539
+						 *
1540
+						 * @since 1.6.9
1541
+						 * @param string $sub_tab The current settings tab name.
1542
+						 */
1543
+						do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1544 1544
 
1545 1545
                         <div style="clear:both"></div>
1546 1546
                     </div>
@@ -1554,25 +1554,25 @@  discard block
 block discarded – undo
1554 1554
             <div class="side-sortables" id="geodir-selected-fields">
1555 1555
                 <h3 class="hndle">
1556 1556
                     <?php
1557
-                    /**
1558
-                     * Filter custom field selected fields heading.
1559
-                     *
1560
-                     * @since 1.0.0
1561
-                     * @param string $sub_tab Sub tab name.
1562
-                     * @param string $listing_type Post type.
1563
-                     */
1564
-                    ?>
1557
+					/**
1558
+					 * Filter custom field selected fields heading.
1559
+					 *
1560
+					 * @since 1.0.0
1561
+					 * @param string $sub_tab Sub tab name.
1562
+					 * @param string $listing_type Post type.
1563
+					 */
1564
+					?>
1565 1565
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1566 1566
                 </h3>
1567 1567
                 <?php
1568
-                /**
1569
-                 * Filter custom field selected fields note text.
1570
-                 *
1571
-                 * @since 1.0.0
1572
-                 * @param string $sub_tab Sub tab name.
1573
-                 * @param string $listing_type Post type.
1574
-                 */
1575
-                ?>
1568
+				/**
1569
+				 * Filter custom field selected fields note text.
1570
+				 *
1571
+				 * @since 1.0.0
1572
+				 * @param string $sub_tab Sub tab name.
1573
+				 * @param string $listing_type Post type.
1574
+				 */
1575
+				?>
1576 1576
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1577 1577
 
1578 1578
                 <div class="inside">
@@ -1580,13 +1580,13 @@  discard block
 block discarded – undo
1580 1580
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1581 1581
                         <div class="field_row_main">
1582 1582
                             <?php
1583
-                            /**
1584
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1585
-                             *
1586
-                             * @since 1.0.0
1587
-                             * @param string $sub_tab The current settings tab name.
1588
-                             */
1589
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1583
+							/**
1584
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1585
+							 *
1586
+							 * @since 1.0.0
1587
+							 * @param string $sub_tab The current settings tab name.
1588
+							 */
1589
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1590 1590
                         </div>
1591 1591
                         <div style="clear:both"></div>
1592 1592
                     </div>
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
  */
1610 1610
 function geodir_diagnostic_tools_setting_page()
1611 1611
 {
1612
-    ?>
1612
+	?>
1613 1613
     <div class="inner_content_tab_main">
1614 1614
         <div class="gd-content-heading">
1615 1615
 
@@ -1711,13 +1711,13 @@  discard block
 block discarded – undo
1711 1711
 					</td>
1712 1712
 				</tr>
1713 1713
                 <?php
1714
-                /**
1715
-                 * Allows you to add more setting to the GD>Tools settings page.
1716
-                 *
1717
-                 * Called after the last setting on the GD>Tools page.
1718
-                 * @since 1.0.0
1719
-                 */
1720
-                do_action('geodir_diagnostic_tool');?>
1714
+				/**
1715
+				 * Allows you to add more setting to the GD>Tools settings page.
1716
+				 *
1717
+				 * Called after the last setting on the GD>Tools page.
1718
+				 * @since 1.0.0
1719
+				 */
1720
+				do_action('geodir_diagnostic_tool');?>
1721 1721
 
1722 1722
                 </tbody>
1723 1723
             </table>
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                          * @param array $tabs The array of tabs to display.
53 53
                          */
54 54
                         $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
55
+                        update_option('geodir_tabs', $tabs); // Important to show settings menu dropdown
56 56
 
57 57
                         foreach ($tabs as $name => $args) :
58 58
                             $label = $args['label'];
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 
64 64
                                 $subtabs = $args['subtabs'];
65 65
 
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
66
+                                $query_string = '&subtab='.$subtabs[0]['subtab'];
67 67
 
68 68
                             endif;
69 69
 
70 70
 
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
71
+                            $tab_link = admin_url('admin.php?page=geodirectory&tab='.$name.$query_string);
72 72
 
73 73
                             if (isset($args['url']) && $args['url'] != '') {
74 74
                                 $tab_link = $args['url'];
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                                 $tab_link = geodir_getlink($tab_link, $args['request']);
79 79
 
80 80
                             if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
81
+                                $tab_target = " target='".sanitize_text_field($args['target'])."' ";
82 82
                             } else
83 83
                                 $tab_target = '';
84 84
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                              * @see 'geodir_after_settings_tabs'
94 94
                              */
95 95
                             do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
96
+                            echo '<li '.$tab_active.' ><a href="'.esc_url($tab_link).'"  '.$tab_target.' >'.$label.'</a></li>';
97 97
                             /**
98 98
                              * Called after the individual settings tabs are output.
99 99
                              *
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
                                         $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138 138
                                     }
139 139
 
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
140
+                                    $sub_tabs_link = admin_url().'admin.php?page=geodirectory&tab='.$current_tab.'&subtab='.$sub['subtab'];
141 141
                                     if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142 142
                                         $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143 143
                                     }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
144
+                                    echo '<dd '.$subtab_active.' id="claim_listing"><a href="'.esc_url($sub_tabs_link).'" >'.sanitize_text_field($sub['label']).'</a></dd>';
145 145
                                 }
146 146
                                 ?>
147 147
                             </dl>
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                             echo "inner_contet_tabs";
152 152
                         } ?>">
153 153
                             <form method="post" id="mainform"
154
-                                  class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
154
+                                  class="geodir_optionform <?php echo $current_tab.' '; ?><?php if (isset($sub['subtab'])) {
155 155
                                       echo sanitize_text_field($sub['subtab']);
156 156
                                   } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                                            echo sanitize_text_field($_REQUEST['active_tab']);
160 160
                                        } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162
-                                <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
162
+                                <?php wp_nonce_field('geodir-settings-'.$current_tab, '_wpnonce-'.$current_tab, true, true); ?>
163 163
                                 <?php
164 164
                                 /**
165 165
                                  * Used to call the content of each GD settings tab page.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 190
                      return false;*/
191 191
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery(\'ul.subsubsub li a[href="#' . sanitize_text_field($_GET['subtab']) . '"]\').click();'; ?>
192
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery(\'ul.subsubsub li a[href="#'.sanitize_text_field($_GET['subtab']).'"]\').click();'; ?>
193 193
                 // Countries
194 194
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 195
                     if (jQuery(this).val() == "specific") {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
223 223
                         if (changed) {
224 224
                             window.onbeforeunload = function () {
225
-                                return '<?php echo __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
225
+                                return '<?php echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
226 226
                             }
227 227
                         } else {
228 228
                             window.onbeforeunload = '';
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 
286 286
     //echo $tab_name.'_array.php' ;
287 287
     global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
288
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$tab_name.'_array.php')) {
289 289
         /**
290 290
          * Contains settings array for given tab.
291 291
          *
292 292
          * @since 1.0.0
293 293
          * @package GeoDirectory
294 294
          */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
295
+        include_once('option-pages/'.$tab_name.'_array.php');
296 296
     }
297 297
 
298 298
     $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ?>
328 328
 
329 329
             <p class="submit">
330
-            <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
330
+            <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
331 331
             <input type="hidden" name="subtab" id="last_tab" />
332 332
             </p>
333 333
             
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
                     ?>
398 398
 
399
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
399
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
                         echo $location_result->location_id;
405 405
                     } ?>">
406 406
 
407
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
407
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
408 408
 
409 409
                     <table class="form-table default_location_form">
410 410
                         <tbody>
411 411
                         <tr valign="top" class="single_select_page">
412
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
412
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
413 413
                             <td class="forminp">
414 414
                                 <div class="gtd-formfeild required">
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416
-                                           id="<?php echo $prefix;?>city" name="city"
416
+                                           id="<?php echo $prefix; ?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418 418
                                                echo $location_result->city;
419 419
                                            } ?>"/>
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
                             </td>
426 426
                         </tr>
427 427
                         <tr valign="top" class="single_select_page">
428
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
428
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
429 429
                             <td class="forminp">
430 430
                                 <div class="gtd-formfeild required">
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432
-                                           id="<?php echo $prefix;?>region" name="region"
432
+                                           id="<?php echo $prefix; ?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434 434
                                                echo $location_result->region;
435 435
                                            } ?>"/>
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                             </td>
442 442
                         </tr>
443 443
                         <tr valign="top" class="single_select_page">
444
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
444
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
445 445
                             <td class="forminp">
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                                     ?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
453
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
454 454
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
455 455
                                             data-showeverywhere="0">
456 456
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         </tr>
468 468
                         <tr valign="top" class="single_select_page gd-add-location-map">
469 469
                             <th class="titledesc"
470
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
470
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473 473
                                 /**
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
                                  *
476 476
                                  * @since 1.0.0
477 477
                                  */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
478
+                                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
482
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
482
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
483 483
                             <td class="forminp">
484 484
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
486
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488 488
                                                echo $location_result->city_latitude;
489 489
                                            } ?>"/>
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                         </tr>
497 497
                         <tr valign="top" class="single_select_page">
498 498
                             <th class="titledesc"
499
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
499
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
500 500
                             <td class="forminp">
501 501
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
503
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505 505
                                                echo $location_result->city_longitude;
506 506
                                            } ?>"/>
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+        case $listing_type.'_fields_settings' :
539 539
 
540 540
             geodir_custom_post_type_form();
541 541
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
     }
688 688
 
689 689
 
690
-    $theme_name = $theme_name . "_custom";
690
+    $theme_name = $theme_name."_custom";
691 691
     $theme_arr = get_option('gd_theme_compats');
692 692
     update_option('gd_theme_compat', $theme_name);
693 693
     /**
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
         <div class="gd-content-heading">
777 777
 
778 778
 
779
-            <h3><?php _e('Theme Compatibility Settings', 'geodirectory');?></h3>
779
+            <h3><?php _e('Theme Compatibility Settings', 'geodirectory'); ?></h3>
780 780
             <style>
781 781
                 .gd-theme-compat-table {
782 782
                     width: 100%;
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
                 </div>
808 808
             <?php }?>
809 809
 
810
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
810
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
811 811
 
812 812
             <select name="gd_theme_compat" id="gd_theme_compat">
813
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
813
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
814
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
815 815
                 <?php
816 816
                 $theme_arr = get_option('gd_theme_compats');
817 817
                 $theme_active = get_option('gd_theme_compat');
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
                 ?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
833
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
834 834
             <button onclick="gd_comp_import();" type="button"
835
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
836 836
 
837 837
             <div class="gd-comp-import-export">
838 838
                 <textarea id="gd-import-export-theme-comp"
839
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
839
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
840 840
             </div>
841 841
             <script>
842 842
 
843 843
                 function gd_comp_export() {
844 844
                     theme = jQuery('#gd_theme_compat').val();
845 845
                     if (theme == '' || theme == 'custom') {
846
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
846
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
847 847
                         return false;
848 848
                     }
849 849
                     jQuery('.gd-comp-import-export').show();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 
878 878
                     jQuery.post(ajaxurl, data, function (response) {
879 879
                         if (response == '0') {
880
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
880
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
881 881
                         } else {
882
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
882
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
883 883
                             jQuery('#gd-import-export-theme-comp').val('');
884 884
                             jQuery('.gd-comp-import-export').hide();
885 885
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 
921 921
             </script>
922 922
 
923
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
923
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
924 924
 
925 925
             <table class="form-table gd-theme-compat-table">
926 926
                 <tbody>
927 927
                 <tr>
928
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
929
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
930
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
928
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
929
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
930
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
931 931
                 </tr>
932 932
 
933 933
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
947 947
                     <td colspan="3">
948
-                        <span><?php _e('Output:', 'geodirectory');?></span>
948
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951 951
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
                         <small>geodir_wrapper_close</small>
960 960
                     </td>
961 961
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
962
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
962
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                 </tr>
966 966
 
967 967
                 <tr class="gd-theme-comp-out">
968 968
                     <td colspan="3">
969
-                        <span><?php _e('Output:', 'geodirectory');?></span>
969
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972 972
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
992 992
                     <td colspan="3">
993
-                        <span><?php _e('Output:', 'geodirectory');?></span>
993
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996 996
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                         <small>geodir_wrapper_content_close</small>
1005 1005
                     </td>
1006 1006
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1007
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1007
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                 </tr>
1011 1011
 
1012 1012
                 <tr class="gd-theme-comp-out">
1013 1013
                     <td colspan="3">
1014
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1014
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017 1017
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
1035 1035
                     <td colspan="3">
1036
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1036
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039 1039
                                 echo $tc['geodir_article_open_replace'];
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                         <small>geodir_article_close</small>
1047 1047
                     </td>
1048 1048
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1049
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1049
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                 </tr>
1053 1053
 
1054 1054
                 <tr class="gd-theme-comp-out">
1055 1055
                     <td colspan="3">
1056
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1056
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059 1059
                                 echo $tc['geodir_article_close_replace'];
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 <tr class="gd-theme-comp-out">
1078 1078
                     <td colspan="3">
1079
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1079
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082 1082
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
                         <small>geodir_sidebar_right_close</small>
1090 1090
                     </td>
1091 1091
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1092
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1092
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                 </tr>
1096 1096
 
1097 1097
                 <tr class="gd-theme-comp-out">
1098 1098
                     <td colspan="3">
1099
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1099
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102 1102
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
                 <tr class="gd-theme-comp-out">
1122 1122
                     <td colspan="3">
1123
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1123
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126 1126
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                         <small>geodir_sidebar_left_close</small>
1134 1134
                     </td>
1135 1135
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1136
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1136
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                 </tr>
1140 1140
 
1141 1141
                 <tr class="gd-theme-comp-out">
1142 1142
                     <td colspan="3">
1143
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1143
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146 1146
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
1164 1164
                     <td colspan="3">
1165
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1165
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168 1168
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                         <small>geodir_main_content_close</small>
1176 1176
                     </td>
1177 1177
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1178
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1178
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                 </tr>
1182 1182
 
1183 1183
                 <tr class="gd-theme-comp-out">
1184 1184
                     <td colspan="3">
1185
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1185
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188 1188
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1194,13 +1194,13 @@  discard block
 block discarded – undo
1194 1194
                 </tbody>
1195 1195
             </table>
1196 1196
 
1197
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1197
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1198 1198
 
1199 1199
             <table class="form-table gd-theme-compat-table">
1200 1200
                 <tbody>
1201 1201
                 <tr>
1202
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1203
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1202
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1203
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1204 1204
                 </tr>
1205 1205
 
1206 1206
 
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
             </table>
1230 1230
 
1231 1231
 
1232
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1232
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1233 1233
 
1234 1234
             <table class="form-table gd-theme-compat-table">
1235 1235
                 <tbody>
1236 1236
                 <tr>
1237
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1238
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1237
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1238
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1239 1239
                 </tr>
1240 1240
 
1241 1241
                 <tr>
@@ -1389,13 +1389,13 @@  discard block
 block discarded – undo
1389 1389
                  *
1390 1390
                  * @since 1.4.0
1391 1391
                  */
1392
-                do_action('gd_compat_other_filters');?>
1392
+                do_action('gd_compat_other_filters'); ?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
1396 1396
 
1397 1397
 
1398
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1398
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1399 1399
 
1400 1400
             <table class="form-table gd-theme-compat-table">
1401 1401
                 <tbody>
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 </tbody>
1411 1411
             </table>
1412 1412
 
1413
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1413
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1414 1414
 
1415 1415
             <table class="form-table gd-theme-compat-table">
1416 1416
                 <tbody>
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
             <p class="submit">
1430 1430
                 <input name="save" class="button-primary" type="submit"
1431
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1431
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1432 1432
             </p>
1433 1433
 
1434 1434
         </div>
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
          * @param string $listing_type Post type.
1463 1463
          */
1464 1464
         ?>
1465
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1465
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
1468 1468
         <div class="general-form-builder-frame">
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
                  * @param string $listing_type Post type.
1478 1478
                  */
1479 1479
                 ?>
1480
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1480
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483 1483
                 /**
@@ -1488,9 +1488,9 @@  discard block
 block discarded – undo
1488 1488
                  * @param string $listing_type Post type.
1489 1489
                  */
1490 1490
                 ?>
1491
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1491
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1492 1492
 
1493
-                <h3><?php _e('Setup New Field','geodirectory');?></h3>
1493
+                <h3><?php _e('Setup New Field', 'geodirectory'); ?></h3>
1494 1494
                 <div class="inside">
1495 1495
 
1496 1496
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 
1510 1510
                 </div>
1511 1511
 
1512
-                <h3><?php _e('Predefined Fields','geodirectory');?></h3>
1512
+                <h3><?php _e('Predefined Fields', 'geodirectory'); ?></h3>
1513 1513
                 <div class="inside">
1514 1514
 
1515 1515
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 
1529 1529
                 </div>
1530 1530
 
1531
-                <h3><?php _e('Custom Fields','geodirectory');?></h3>
1531
+                <h3><?php _e('Custom Fields', 'geodirectory'); ?></h3>
1532 1532
                 <div class="inside">
1533 1533
 
1534 1534
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
                      * @param string $listing_type Post type.
1563 1563
                      */
1564 1564
                     ?>
1565
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1565
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1566 1566
                 </h3>
1567 1567
                 <?php
1568 1568
                 /**
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
                  * @param string $listing_type Post type.
1574 1574
                  */
1575 1575
                 ?>
1576
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1576
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1577 1577
 
1578 1578
                 <div class="inside">
1579 1579
 
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
         <div class="gd-content-heading">
1615 1615
 
1616 1616
 
1617
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1617
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1618 1618
             <style>
1619 1619
                 .gd-tools-table {
1620 1620
                     width: 100%;
@@ -1633,81 +1633,81 @@  discard block
 block discarded – undo
1633 1633
             <table class="form-table gd-tools-table">
1634 1634
                 <tbody>
1635 1635
                 <tr>
1636
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1637
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1638
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1636
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1637
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1638
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1639 1639
                 </tr>
1640 1640
 
1641 1641
 
1642 1642
                 <tr>
1643
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1643
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1644 1644
                     <td>
1645
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1645
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1646 1646
                     </td>
1647 1647
                     <td>
1648
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1648
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1649 1649
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1650 1650
                     </td>
1651 1651
                 </tr>
1652 1652
 
1653 1653
 
1654 1654
                 <tr>
1655
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1655
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1656 1656
                     <td>
1657
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1657
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1658 1658
                     </td>
1659
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1659
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1660 1660
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1661 1661
                     </td>
1662 1662
                 </tr>
1663 1663
 
1664 1664
                 <tr>
1665
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1665
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1666 1666
                     <td>
1667
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1667
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1668 1668
                     </td>
1669
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1669
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1670 1670
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1671 1671
                     </td>
1672 1672
                 </tr>
1673 1673
 
1674 1674
                 <tr>
1675
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1675
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1676 1676
                     <td>
1677
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1677
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1678 1678
                     </td>
1679
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1679
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1680 1680
                                class="button-primary geodir_diagnosis_button" data-diagnose="tags_sync"/>
1681 1681
                     </td>
1682 1682
                 </tr>
1683 1683
 
1684 1684
                 <tr>
1685
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1685
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1686 1686
                     <td>
1687
-                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory');?></small>
1687
+                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory'); ?></small>
1688 1688
                     </td>
1689
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1689
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1690 1690
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1691 1691
                     </td>
1692 1692
                 </tr>
1693 1693
 
1694 1694
 
1695 1695
                 <tr>
1696
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1696
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1697 1697
                     <td>
1698
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1698
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1699 1699
                     </td>
1700
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1700
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1701 1701
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1702 1702
                     </td>
1703 1703
                 </tr>
1704 1704
 				<tr>
1705
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1705
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1706 1706
 					<td>
1707
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1707
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1708 1708
 					</td>
1709 1709
 					<td>
1710
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1710
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1711 1711
 					</td>
1712 1712
 				</tr>
1713 1713
                 <?php
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
                  * Called after the last setting on the GD>Tools page.
1718 1718
                  * @since 1.0.0
1719 1719
                  */
1720
-                do_action('geodir_diagnostic_tool');?>
1720
+                do_action('geodir_diagnostic_tool'); ?>
1721 1721
 
1722 1722
                 </tbody>
1723 1723
             </table>
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/design_settings_array.php 1 patch
Indentation   +953 added lines, -953 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_post_type_setting_fun()
19 19
 {
20
-    $post_type_arr = array();
20
+	$post_type_arr = array();
21 21
 
22
-    $post_types = geodir_get_posttypes('object');
22
+	$post_types = geodir_get_posttypes('object');
23 23
 
24
-    foreach ($post_types as $key => $post_types_obj) {
25
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
-    }
27
-    return $post_type_arr;
24
+	foreach ($post_types as $key => $post_types_obj) {
25
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
26
+	}
27
+	return $post_type_arr;
28 28
 }
29 29
 
30 30
 /**
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_theme_location_setting_fun()
37 37
 {
38
-    $post_type_arr = array();
39
-    $geodir_all_nav_locations = get_registered_nav_menus();
40
-    $geodir_active_nav_locations = get_nav_menu_locations();
41
-    if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
-        foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
-            if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
-                $post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
-        }
46
-    }
47
-
48
-    return $post_type_arr;
38
+	$post_type_arr = array();
39
+	$geodir_all_nav_locations = get_registered_nav_menus();
40
+	$geodir_active_nav_locations = get_nav_menu_locations();
41
+	if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
42
+		foreach ($geodir_active_nav_locations as $key => $theme_location) {
43
+			if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations))
44
+				$post_type_arr[$key] = $geodir_all_nav_locations[$key];
45
+		}
46
+	}
47
+
48
+	return $post_type_arr;
49 49
 }
50 50
 /**
51 51
  * Filter GD design settings array.
@@ -55,551 +55,551 @@  discard block
 block discarded – undo
55 55
  */
56 56
 $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
57 57
 
58
-    /* Home Layout Settings start */
59
-    array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
58
+	/* Home Layout Settings start */
59
+	array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
60 60
 
61 61
 
62
-    array('name' => __('Home Top Section Settings', 'geodirectory'),
63
-        'type' => 'sectionstart',
64
-        'desc' => '',
65
-        'id' => 'geodir_home_top_section'),
62
+	array('name' => __('Home Top Section Settings', 'geodirectory'),
63
+		'type' => 'sectionstart',
64
+		'desc' => '',
65
+		'id' => 'geodir_home_top_section'),
66 66
 
67
-    array(
68
-        'name' => __('Geodirectory home page', 'geodirectory'),
69
-        'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
-        'id' => 'geodir_set_as_home',
71
-        'type' => 'checkbox',
72
-        'std' => '0' // Default value to show home top section
73
-    ),
67
+	array(
68
+		'name' => __('Geodirectory home page', 'geodirectory'),
69
+		'desc' => __('Set geodirectory home page as your home. <b style="color:red;">This setting has been depreciated and will be removed in the next version, instead please set the GD home page in GD>Permalinks and then set this page to the front page under Settings>Reading>Front Page</b>', 'geodirectory'),
70
+		'id' => 'geodir_set_as_home',
71
+		'type' => 'checkbox',
72
+		'std' => '0' // Default value to show home top section
73
+	),
74 74
 
75
-    array(
76
-        'name' => __('Home top section', 'geodirectory'),
77
-        'desc' => __('Show the top section of home page', 'geodirectory'),
78
-        'id' => 'geodir_show_home_top_section',
79
-        'type' => 'checkbox',
80
-        'std' => '1' // Default value to show home top section
81
-    ),
75
+	array(
76
+		'name' => __('Home top section', 'geodirectory'),
77
+		'desc' => __('Show the top section of home page', 'geodirectory'),
78
+		'id' => 'geodir_show_home_top_section',
79
+		'type' => 'checkbox',
80
+		'std' => '1' // Default value to show home top section
81
+	),
82 82
 
83 83
 
84
-    array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
84
+	array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
85 85
 
86 86
 
87
-    array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
-        'type' => 'sectionstart',
89
-        'desc' => '',
90
-        'id' => 'geodir_home_layout'),
87
+	array('name' => __('Home Page Layout Settings', 'geodirectory'),
88
+		'type' => 'sectionstart',
89
+		'desc' => '',
90
+		'id' => 'geodir_home_layout'),
91 91
 
92
-    array(
93
-        'name' => __('Home right section', 'geodirectory'),
94
-        'desc' => __('Show the right section of home page', 'geodirectory'),
95
-        'id' => 'geodir_show_home_right_section',
96
-        'type' => 'checkbox',
97
-        'std' => '1' // Default value to show home top section
98
-    ),
92
+	array(
93
+		'name' => __('Home right section', 'geodirectory'),
94
+		'desc' => __('Show the right section of home page', 'geodirectory'),
95
+		'id' => 'geodir_show_home_right_section',
96
+		'type' => 'checkbox',
97
+		'std' => '1' // Default value to show home top section
98
+	),
99 99
 
100
-    array(
101
-        'name' => __('Width of home right section', 'geodirectory'),
102
-        'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
-        'id' => 'geodir_width_home_right_section',
104
-        'type' => 'text',
105
-        'css' => 'min-width:300px;',
106
-        'std' => '30' // Default value to show home top section
107
-    ),
100
+	array(
101
+		'name' => __('Width of home right section', 'geodirectory'),
102
+		'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
103
+		'id' => 'geodir_width_home_right_section',
104
+		'type' => 'text',
105
+		'css' => 'min-width:300px;',
106
+		'std' => '30' // Default value to show home top section
107
+	),
108 108
 
109
-    array(
110
-        'name' => __('Home content section', 'geodirectory'),
111
-        'desc' => __('Show the content section of home page', 'geodirectory'),
112
-        'id' => 'geodir_show_home_contant_section',
113
-        'type' => 'checkbox',
114
-        'std' => '1' // Default value to show home top section
115
-    ),
109
+	array(
110
+		'name' => __('Home content section', 'geodirectory'),
111
+		'desc' => __('Show the content section of home page', 'geodirectory'),
112
+		'id' => 'geodir_show_home_contant_section',
113
+		'type' => 'checkbox',
114
+		'std' => '1' // Default value to show home top section
115
+	),
116 116
 
117
-    array(
118
-        'name' => __('Width of home content section', 'geodirectory'),
119
-        'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
-        'id' => 'geodir_width_home_contant_section',
121
-        'type' => 'text',
122
-        'css' => 'min-width:300px;',
123
-        'std' => '63' // Default value to show home top section
124
-    ),
117
+	array(
118
+		'name' => __('Width of home content section', 'geodirectory'),
119
+		'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
120
+		'id' => 'geodir_width_home_contant_section',
121
+		'type' => 'text',
122
+		'css' => 'min-width:300px;',
123
+		'std' => '63' // Default value to show home top section
124
+	),
125 125
 
126
-    array(
127
-        'name' => __('Home left section', 'geodirectory'),
128
-        'desc' => __('Show the left section of home page', 'geodirectory'),
129
-        'id' => 'geodir_show_home_left_section',
130
-        'type' => 'checkbox',
131
-        'std' => '0' // Default value to show home top section
132
-    ),
126
+	array(
127
+		'name' => __('Home left section', 'geodirectory'),
128
+		'desc' => __('Show the left section of home page', 'geodirectory'),
129
+		'id' => 'geodir_show_home_left_section',
130
+		'type' => 'checkbox',
131
+		'std' => '0' // Default value to show home top section
132
+	),
133 133
 
134
-    array(
135
-        'name' => __('Width of home left section', 'geodirectory'),
136
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
-        'id' => 'geodir_width_home_left_section',
138
-        'type' => 'text',
139
-        'css' => 'min-width:300px;',
140
-        'std' => '30' // Default value to show home top section
141
-    ),
134
+	array(
135
+		'name' => __('Width of home left section', 'geodirectory'),
136
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
137
+		'id' => 'geodir_width_home_left_section',
138
+		'type' => 'text',
139
+		'css' => 'min-width:300px;',
140
+		'std' => '30' // Default value to show home top section
141
+	),
142 142
 
143
-    array(
144
-        'name' => __('Home bottom section', 'geodirectory'),
145
-        'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
-        'id' => 'geodir_show_home_bottom_section',
147
-        'type' => 'checkbox',
148
-        'std' => '0' // Default value to show home top section
149
-    ),
150
-    array(
151
-        'name' => __('Resize image large size', 'geodirectory'),
152
-        'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
-        'id' => 'geodir_use_wp_media_large_size',
154
-        'type' => 'checkbox',
155
-        'std' => '0'
156
-    ),
143
+	array(
144
+		'name' => __('Home bottom section', 'geodirectory'),
145
+		'desc' => __('Show the bottom section of home page', 'geodirectory'),
146
+		'id' => 'geodir_show_home_bottom_section',
147
+		'type' => 'checkbox',
148
+		'std' => '0' // Default value to show home top section
149
+	),
150
+	array(
151
+		'name' => __('Resize image large size', 'geodirectory'),
152
+		'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
153
+		'id' => 'geodir_use_wp_media_large_size',
154
+		'type' => 'checkbox',
155
+		'std' => '0'
156
+	),
157 157
 
158
-    array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
158
+	array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
159 159
 
160 160
 
161
-    /* Home Layout Settings end */
161
+	/* Home Layout Settings end */
162 162
 
163 163
 
164
-    /* Listing Layout Settings end */
164
+	/* Listing Layout Settings end */
165 165
 
166
-    array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
166
+	array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
167 167
 
168 168
 
169
-    array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
-        'type' => 'sectionstart',
171
-        'desc' => '',
172
-        'id' => 'geodir_listing_layout'),
169
+	array('name' => __('Listing Page Layout Settings', 'geodirectory'),
170
+		'type' => 'sectionstart',
171
+		'desc' => '',
172
+		'id' => 'geodir_listing_layout'),
173 173
 
174
-    array(
175
-        'name' => __('Listing top section', 'geodirectory'),
176
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
177
-        'id' => 'geodir_show_listing_top_section',
178
-        'type' => 'checkbox',
179
-        'std' => '1' // Default value to show home top section
180
-    ),
174
+	array(
175
+		'name' => __('Listing top section', 'geodirectory'),
176
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
177
+		'id' => 'geodir_show_listing_top_section',
178
+		'type' => 'checkbox',
179
+		'std' => '1' // Default value to show home top section
180
+	),
181 181
 
182
-    array(
183
-        'name' => __('Listing right section', 'geodirectory'),
184
-        'desc' => __('Show the right section of listing page', 'geodirectory'),
185
-        'id' => 'geodir_show_listing_right_section',
186
-        'type' => 'checkbox',
187
-        'std' => '1' // Default value to show home top section
188
-    ),
182
+	array(
183
+		'name' => __('Listing right section', 'geodirectory'),
184
+		'desc' => __('Show the right section of listing page', 'geodirectory'),
185
+		'id' => 'geodir_show_listing_right_section',
186
+		'type' => 'checkbox',
187
+		'std' => '1' // Default value to show home top section
188
+	),
189 189
 
190
-    array(
191
-        'name' => __('Width of listing right section', 'geodirectory'),
192
-        'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
-        'id' => 'geodir_width_listing_right_section',
194
-        'type' => 'text',
195
-        'css' => 'min-width:300px;',
196
-        'std' => '30' // Default value to show home top section
197
-    ),
190
+	array(
191
+		'name' => __('Width of listing right section', 'geodirectory'),
192
+		'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
193
+		'id' => 'geodir_width_listing_right_section',
194
+		'type' => 'text',
195
+		'css' => 'min-width:300px;',
196
+		'std' => '30' // Default value to show home top section
197
+	),
198 198
 
199 199
 
200
-    array(
201
-        'name' => __('Listing content section view', 'geodirectory'),
202
-        'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
-        'id' => 'geodir_listing_view',
204
-        'css' => 'min-width:300px;',
205
-        'std' => 'gridview_onehalf',
206
-        'type' => 'select',
207
-        'class' => 'chosen_select',
208
-        'options' => array_unique(array(
209
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
-            'listview' => __('List view', 'geodirectory'),
214
-        ))
215
-    ),
200
+	array(
201
+		'name' => __('Listing content section view', 'geodirectory'),
202
+		'desc' => __('Set the listing view of listing page', 'geodirectory'),
203
+		'id' => 'geodir_listing_view',
204
+		'css' => 'min-width:300px;',
205
+		'std' => 'gridview_onehalf',
206
+		'type' => 'select',
207
+		'class' => 'chosen_select',
208
+		'options' => array_unique(array(
209
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
210
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
211
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
212
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
213
+			'listview' => __('List view', 'geodirectory'),
214
+		))
215
+	),
216 216
 
217
-    array(
218
-        'name' => __('Width of listing content section', 'geodirectory'),
219
-        'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
-        'id' => 'geodir_width_listing_contant_section',
221
-        'type' => 'text',
222
-        'css' => 'min-width:300px;',
223
-        'std' => '63' // Default value to show home top section
224
-    ),
217
+	array(
218
+		'name' => __('Width of listing content section', 'geodirectory'),
219
+		'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
220
+		'id' => 'geodir_width_listing_contant_section',
221
+		'type' => 'text',
222
+		'css' => 'min-width:300px;',
223
+		'std' => '63' // Default value to show home top section
224
+	),
225 225
 
226
-    array(
227
-        'name' => __('Listing left section', 'geodirectory'),
228
-        'desc' => __('Show the left section of listing page', 'geodirectory'),
229
-        'id' => 'geodir_show_listing_left_section',
230
-        'type' => 'checkbox',
231
-        'std' => '0' // Default value to show home top section
232
-    ),
226
+	array(
227
+		'name' => __('Listing left section', 'geodirectory'),
228
+		'desc' => __('Show the left section of listing page', 'geodirectory'),
229
+		'id' => 'geodir_show_listing_left_section',
230
+		'type' => 'checkbox',
231
+		'std' => '0' // Default value to show home top section
232
+	),
233 233
 
234
-    array(
235
-        'name' => __('Width of listing left section', 'geodirectory'),
236
-        'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
-        'id' => 'geodir_width_listing_left_section',
238
-        'type' => 'text',
239
-        'css' => 'min-width:300px;',
240
-        'std' => '30' // Default value to show home top section
241
-    ),
234
+	array(
235
+		'name' => __('Width of listing left section', 'geodirectory'),
236
+		'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
237
+		'id' => 'geodir_width_listing_left_section',
238
+		'type' => 'text',
239
+		'css' => 'min-width:300px;',
240
+		'std' => '30' // Default value to show home top section
241
+	),
242 242
 
243
-    array(
244
-        'name' => __('Listing bottom section', 'geodirectory'),
245
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
-        'id' => 'geodir_show_listing_bottom_section',
247
-        'type' => 'checkbox',
248
-        'std' => '0' // Default value to show home top section
249
-    ),
243
+	array(
244
+		'name' => __('Listing bottom section', 'geodirectory'),
245
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
246
+		'id' => 'geodir_show_listing_bottom_section',
247
+		'type' => 'checkbox',
248
+		'std' => '0' // Default value to show home top section
249
+	),
250 250
 
251
-    array(
252
-        'name' => __('Upload listing no image', 'geodirectory'),
253
-        'desc' => '',
254
-        'id' => 'geodir_listing_no_img',
255
-        'type' => 'file',
256
-        'std' => '0' // Default value to show home top section
257
-    ),
251
+	array(
252
+		'name' => __('Upload listing no image', 'geodirectory'),
253
+		'desc' => '',
254
+		'id' => 'geodir_listing_no_img',
255
+		'type' => 'file',
256
+		'std' => '0' // Default value to show home top section
257
+	),
258 258
 
259
-    array(
260
-        'name' => __('Description word limit', 'geodirectory'),
261
-        'desc' => '',
262
-        'id' => 'geodir_desc_word_limit',
263
-        'type' => 'text',
264
-        'css' => 'min-width:300px;',
265
-        'std' => '50' // Default value to show home top section
266
-    ),
259
+	array(
260
+		'name' => __('Description word limit', 'geodirectory'),
261
+		'desc' => '',
262
+		'id' => 'geodir_desc_word_limit',
263
+		'type' => 'text',
264
+		'css' => 'min-width:300px;',
265
+		'std' => '50' // Default value to show home top section
266
+	),
267 267
 
268
-    array(
269
-        'name' => __('Hover listing map animation', 'geodirectory'),
270
-        'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
-        'id' => 'geodir_listing_hover_bounce_map_pin',
272
-        'type' => 'checkbox',
273
-        'std' => '1' // Default value to show home top section
274
-    ),
268
+	array(
269
+		'name' => __('Hover listing map animation', 'geodirectory'),
270
+		'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
271
+		'id' => 'geodir_listing_hover_bounce_map_pin',
272
+		'type' => 'checkbox',
273
+		'std' => '1' // Default value to show home top section
274
+	),
275 275
 
276
-    array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
276
+	array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
277 277
 
278 278
 
279
-    array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
279
+	array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
280 280
 
281
-    array(
282
-        'name' => __('New listing default status', 'geodirectory'),
283
-        'desc' => __('Select new listing default status.', 'geodirectory'),
284
-        'tip' => '',
285
-        'id' => 'geodir_new_post_default_status',
286
-        'css' => 'min-width:300px;',
287
-        'std' => 'publish',
288
-        'type' => 'select',
289
-        'class' => 'chosen_select',
290
-        'options' => array_unique(array(
291
-            'publish' => __('publish', 'geodirectory'),
292
-            'draft' => __('draft', 'geodirectory'),
293
-        ))
294
-    ),
281
+	array(
282
+		'name' => __('New listing default status', 'geodirectory'),
283
+		'desc' => __('Select new listing default status.', 'geodirectory'),
284
+		'tip' => '',
285
+		'id' => 'geodir_new_post_default_status',
286
+		'css' => 'min-width:300px;',
287
+		'std' => 'publish',
288
+		'type' => 'select',
289
+		'class' => 'chosen_select',
290
+		'options' => array_unique(array(
291
+			'publish' => __('publish', 'geodirectory'),
292
+			'draft' => __('draft', 'geodirectory'),
293
+		))
294
+	),
295 295
 
296
-    array(
297
-        'name' => __('New listings settings', 'geodirectory'),
298
-        'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
-        'id' => 'geodir_listing_new_days',
300
-        'type' => 'text',
301
-        'css' => 'min-width:300px;',
302
-        'std' => '30' // Default value for the page title - changed in settings
303
-    ),
296
+	array(
297
+		'name' => __('New listings settings', 'geodirectory'),
298
+		'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
299
+		'id' => 'geodir_listing_new_days',
300
+		'type' => 'text',
301
+		'css' => 'min-width:300px;',
302
+		'std' => '30' // Default value for the page title - changed in settings
303
+	),
304 304
 
305
-    array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
305
+	array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
306 306
 
307 307
 
308
-    array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
308
+	array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
309 309
 
310
-    array(
311
-        'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
-        'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
-        'id' => 'geodir_accept_term_condition',
314
-        'type' => 'checkbox',
315
-        'std' => '1' // Default value to show home top section
316
-    ),
310
+	array(
311
+		'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
312
+		'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
313
+		'id' => 'geodir_accept_term_condition',
314
+		'type' => 'checkbox',
315
+		'std' => '1' // Default value to show home top section
316
+	),
317 317
 
318 318
 
319
-    array(
320
-        'name' => __('Show description field as editor', 'geodirectory'),
321
-        'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
-        'tip' => '',
323
-        'id' => 'geodir_tiny_editor_on_add_listing',
324
-        'css' => 'min-width:300px;',
325
-        'std' => array(),
326
-        'type' => 'multiselect',
327
-        'placeholder_text' => __('Select post types', 'geodirectory'),
328
-        'class' => 'chosen_select',
329
-        'options' => array_unique(geodir_post_type_setting_fun())
330
-    ),
319
+	array(
320
+		'name' => __('Show description field as editor', 'geodirectory'),
321
+		'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
322
+		'tip' => '',
323
+		'id' => 'geodir_tiny_editor_on_add_listing',
324
+		'css' => 'min-width:300px;',
325
+		'std' => array(),
326
+		'type' => 'multiselect',
327
+		'placeholder_text' => __('Select post types', 'geodirectory'),
328
+		'class' => 'chosen_select',
329
+		'options' => array_unique(geodir_post_type_setting_fun())
330
+	),
331 331
 
332
-    array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
-    /* Listing Layout Settings end */
332
+	array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
333
+	/* Listing Layout Settings end */
334 334
 
335 335
 
336
-    /* Search Layout Settings end */
336
+	/* Search Layout Settings end */
337 337
 
338
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
338
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
339 339
 
340 340
 
341
-    array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
-        'type' => 'sectionstart',
343
-        'desc' => '',
344
-        'id' => 'geodir_search_layout'),
341
+	array('name' => __('Search Page Layout Settings', 'geodirectory'),
342
+		'type' => 'sectionstart',
343
+		'desc' => '',
344
+		'id' => 'geodir_search_layout'),
345 345
 
346
-    array(
347
-        'name' => __('Search top section', 'geodirectory'),
348
-        'desc' => __('Show the top section of search page', 'geodirectory'),
349
-        'id' => 'geodir_show_search_top_section',
350
-        'type' => 'checkbox',
351
-        'std' => '1' // Default value to show home top section
352
-    ),
346
+	array(
347
+		'name' => __('Search top section', 'geodirectory'),
348
+		'desc' => __('Show the top section of search page', 'geodirectory'),
349
+		'id' => 'geodir_show_search_top_section',
350
+		'type' => 'checkbox',
351
+		'std' => '1' // Default value to show home top section
352
+	),
353 353
 
354
-    array(
355
-        'name' => __('Search right section', 'geodirectory'),
356
-        'desc' => __('Show the right section of search page', 'geodirectory'),
357
-        'id' => 'geodir_show_search_right_section',
358
-        'type' => 'checkbox',
359
-        'std' => '1' // Default value to show home top section
360
-    ),
354
+	array(
355
+		'name' => __('Search right section', 'geodirectory'),
356
+		'desc' => __('Show the right section of search page', 'geodirectory'),
357
+		'id' => 'geodir_show_search_right_section',
358
+		'type' => 'checkbox',
359
+		'std' => '1' // Default value to show home top section
360
+	),
361 361
 
362
-    array(
363
-        'name' => __('Width of search right section', 'geodirectory'),
364
-        'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
-        'id' => 'geodir_width_search_right_section',
366
-        'type' => 'text',
367
-        'css' => 'min-width:300px;',
368
-        'std' => '30' // Default value to show home top section
369
-    ),
362
+	array(
363
+		'name' => __('Width of search right section', 'geodirectory'),
364
+		'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
365
+		'id' => 'geodir_width_search_right_section',
366
+		'type' => 'text',
367
+		'css' => 'min-width:300px;',
368
+		'std' => '30' // Default value to show home top section
369
+	),
370 370
 
371 371
 
372
-    array(
373
-        'name' => __('Search content section view', 'geodirectory'),
374
-        'desc' => __('Set the listing view of search page', 'geodirectory'),
375
-        'id' => 'geodir_search_view',
376
-        'css' => 'min-width:300px;',
377
-        'std' => 'gridview_onehalf',
378
-        'type' => 'select',
379
-        'class' => 'chosen_select',
380
-        'options' => array_unique(array(
381
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
-            'listview' => __('List view', 'geodirectory'),
386
-        ))
387
-    ),
372
+	array(
373
+		'name' => __('Search content section view', 'geodirectory'),
374
+		'desc' => __('Set the listing view of search page', 'geodirectory'),
375
+		'id' => 'geodir_search_view',
376
+		'css' => 'min-width:300px;',
377
+		'std' => 'gridview_onehalf',
378
+		'type' => 'select',
379
+		'class' => 'chosen_select',
380
+		'options' => array_unique(array(
381
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
382
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
383
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
384
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
385
+			'listview' => __('List view', 'geodirectory'),
386
+		))
387
+	),
388 388
 
389
-    array(
390
-        'name' => __('Width of search content section', 'geodirectory'),
391
-        'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
-        'id' => 'geodir_width_search_contant_section',
393
-        'type' => 'text',
394
-        'css' => 'min-width:300px;',
395
-        'std' => '63' // Default value to show home top section
396
-    ),
389
+	array(
390
+		'name' => __('Width of search content section', 'geodirectory'),
391
+		'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
392
+		'id' => 'geodir_width_search_contant_section',
393
+		'type' => 'text',
394
+		'css' => 'min-width:300px;',
395
+		'std' => '63' // Default value to show home top section
396
+	),
397 397
 
398
-    array(
399
-        'name' => __('Search left section', 'geodirectory'),
400
-        'desc' => __('Show the left section of search page', 'geodirectory'),
401
-        'id' => 'geodir_show_search_left_section',
402
-        'type' => 'checkbox',
403
-        'std' => '0' // Default value to show home top section
404
-    ),
398
+	array(
399
+		'name' => __('Search left section', 'geodirectory'),
400
+		'desc' => __('Show the left section of search page', 'geodirectory'),
401
+		'id' => 'geodir_show_search_left_section',
402
+		'type' => 'checkbox',
403
+		'std' => '0' // Default value to show home top section
404
+	),
405 405
 
406
-    array(
407
-        'name' => __('Width of search left section', 'geodirectory'),
408
-        'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
-        'id' => 'geodir_width_search_left_section',
410
-        'type' => 'text',
411
-        'css' => 'min-width:300px;',
412
-        'std' => '30' // Default value to show home top section
413
-    ),
406
+	array(
407
+		'name' => __('Width of search left section', 'geodirectory'),
408
+		'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
409
+		'id' => 'geodir_width_search_left_section',
410
+		'type' => 'text',
411
+		'css' => 'min-width:300px;',
412
+		'std' => '30' // Default value to show home top section
413
+	),
414 414
 
415
-    array(
416
-        'name' => __('Search bottom section', 'geodirectory'),
417
-        'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
-        'id' => 'geodir_show_search_bottom_section',
419
-        'type' => 'checkbox',
420
-        'std' => '0' // Default value to show home top section
421
-    ),
415
+	array(
416
+		'name' => __('Search bottom section', 'geodirectory'),
417
+		'desc' => __('Show the bottom section of search page', 'geodirectory'),
418
+		'id' => 'geodir_show_search_bottom_section',
419
+		'type' => 'checkbox',
420
+		'std' => '0' // Default value to show home top section
421
+	),
422 422
 	
423 423
 	array(
424
-        'name' => __('Show advanced pagination details', 'geodirectory'),
425
-        'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
-        'id' => 'geodir_pagination_advance_info',
427
-        'css' => 'min-width:300px;',
428
-        'std' => '',
429
-        'type' => 'select',
430
-        'class' => 'chosen_select',
431
-        'options' => array(
424
+		'name' => __('Show advanced pagination details', 'geodirectory'),
425
+		'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
426
+		'id' => 'geodir_pagination_advance_info',
427
+		'css' => 'min-width:300px;',
428
+		'std' => '',
429
+		'type' => 'select',
430
+		'class' => 'chosen_select',
431
+		'options' => array(
432 432
 						'' => __('Never Display', 'geodirectory'),
433 433
 						'after' => __('After Pagination', 'geodirectory'),
434 434
 						'before' => __('Before Pagination', 'geodirectory')
435 435
 					)
436
-    ),
436
+	),
437 437
 
438
-    array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
438
+	array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
439 439
 
440 440
 
441
-    array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
441
+	array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
442 442
 
443
-    array(
444
-        'name' => __('Use old non-styled form', 'geodirectory'),
445
-        'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
446
-        'id' => 'geodir_show_search_old_search_from',
447
-        'type' => 'checkbox',
448
-        'std' => '0' // Default value to show
449
-    ),
443
+	array(
444
+		'name' => __('Use old non-styled form', 'geodirectory'),
445
+		'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
446
+		'id' => 'geodir_show_search_old_search_from',
447
+		'type' => 'checkbox',
448
+		'std' => '0' // Default value to show
449
+	),
450 450
 
451
-    array(
452
-        'name' => __('Search field default value', 'geodirectory'),
453
-        'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
454
-        'id' => 'geodir_search_field_default_text',
455
-        'type' => 'text',
456
-        'css' => 'min-width:300px;',
457
-        'std' => 'Search for' // show on the listing page.
458
-    ),
451
+	array(
452
+		'name' => __('Search field default value', 'geodirectory'),
453
+		'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
454
+		'id' => 'geodir_search_field_default_text',
455
+		'type' => 'text',
456
+		'css' => 'min-width:300px;',
457
+		'std' => 'Search for' // show on the listing page.
458
+	),
459 459
 
460
-    array(
461
-        'name' => __('Near field default value', 'geodirectory'),
462
-        'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
463
-        'id' => 'geodir_near_field_default_text',
464
-        'type' => 'text',
465
-        'css' => 'min-width:300px;',
466
-        'std' => 'Near' // show on the listing page.
467
-    ),
460
+	array(
461
+		'name' => __('Near field default value', 'geodirectory'),
462
+		'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
463
+		'id' => 'geodir_near_field_default_text',
464
+		'type' => 'text',
465
+		'css' => 'min-width:300px;',
466
+		'std' => 'Near' // show on the listing page.
467
+	),
468 468
 
469
-    array(
470
-        'name' => __('Search button label', 'geodirectory'),
471
-        'desc' => __('Show the search button label on search form.', 'geodirectory'),
472
-        'id' => 'geodir_search_button_label',
473
-        'type' => 'text',
474
-        'css' => 'min-width:300px;',
475
-        'std' => 'Search' // show on the listing page.
476
-    ),
469
+	array(
470
+		'name' => __('Search button label', 'geodirectory'),
471
+		'desc' => __('Show the search button label on search form.', 'geodirectory'),
472
+		'id' => 'geodir_search_button_label',
473
+		'type' => 'text',
474
+		'css' => 'min-width:300px;',
475
+		'std' => 'Search' // show on the listing page.
476
+	),
477 477
 
478
-    array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
478
+	array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
479 479
 
480
-    /* Listing Layout Settings end */
480
+	/* Listing Layout Settings end */
481 481
 
482 482
 
483
-    /* Detail Layout Settings end */
483
+	/* Detail Layout Settings end */
484 484
 
485
-    array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
485
+	array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
486 486
 
487
-    array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
487
+	array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
488 488
 
489
-    array(
490
-        'name' => __('Detail top section', 'geodirectory'),
491
-        'desc' => __('Show the top section of listing page', 'geodirectory'),
492
-        'id' => 'geodir_show_detail_top_section',
493
-        'type' => 'checkbox',
494
-        'std' => '1' // Default value to show home top section
495
-    ),
489
+	array(
490
+		'name' => __('Detail top section', 'geodirectory'),
491
+		'desc' => __('Show the top section of listing page', 'geodirectory'),
492
+		'id' => 'geodir_show_detail_top_section',
493
+		'type' => 'checkbox',
494
+		'std' => '1' // Default value to show home top section
495
+	),
496 496
 
497
-    array(
498
-        'name' => __('Detail bottom section', 'geodirectory'),
499
-        'desc' => __('Show the bottom section of listing page', 'geodirectory'),
500
-        'id' => 'geodir_show_detail_bottom_section',
501
-        'type' => 'checkbox',
502
-        'std' => '1' // Default value to show home top section
503
-    ),
504
-    array(
505
-        'name' => __('Detail sidebar section on left side', 'geodirectory'),
506
-        'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
507
-        'id' => 'geodir_detail_sidebar_left_section',
508
-        'type' => 'checkbox',
509
-        'std' => '0'
510
-    ),
511
-    array(
512
-        'name' => __('Disable GD modal', 'geodirectory'),
513
-        'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
514
-        'id' => 'geodir_disable_gb_modal',
515
-        'type' => 'checkbox',
516
-        'std' => '0'
517
-    ),
518
-    array(
519
-        'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
520
-        'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
521
-        'id' => 'geodir_disable_tfg_buttons_section',
522
-        'type' => 'checkbox',
523
-        'std' => '0'
524
-    ),
525
-    array(
526
-        'name' => __('Disable share this button section', 'geodirectory'),
527
-        'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
528
-        'id' => 'geodir_disable_sharethis_button_section',
529
-        'type' => 'checkbox',
530
-        'std' => '0'
531
-    ),
532
-    array(
533
-        'name' => __('Disable Google Analytics section', 'geodirectory'),
534
-        'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
535
-        'id' => 'geodir_disable_google_analytics_section',
536
-        'type' => 'checkbox',
537
-        'std' => '0'
538
-    ),
539
-    array(
540
-        'name' => __('Disable User Links section', 'geodirectory'),
541
-        'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
542
-        'id' => 'geodir_disable_user_links_section',
543
-        'type' => 'checkbox',
544
-        'std' => '0'
545
-    ),
546
-    array(
547
-        'name' => __('Disable Rating Info section', 'geodirectory'),
548
-        'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
549
-        'id' => 'geodir_disable_rating_info_section',
550
-        'type' => 'checkbox',
551
-        'std' => '0'
552
-    ),
553
-    array(
554
-        'name' => __('Disable Listing Info section', 'geodirectory'),
555
-        'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
556
-        'id' => 'geodir_disable_listing_info_section',
557
-        'type' => 'checkbox',
558
-        'std' => '0'
559
-    ),
497
+	array(
498
+		'name' => __('Detail bottom section', 'geodirectory'),
499
+		'desc' => __('Show the bottom section of listing page', 'geodirectory'),
500
+		'id' => 'geodir_show_detail_bottom_section',
501
+		'type' => 'checkbox',
502
+		'std' => '1' // Default value to show home top section
503
+	),
504
+	array(
505
+		'name' => __('Detail sidebar section on left side', 'geodirectory'),
506
+		'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
507
+		'id' => 'geodir_detail_sidebar_left_section',
508
+		'type' => 'checkbox',
509
+		'std' => '0'
510
+	),
511
+	array(
512
+		'name' => __('Disable GD modal', 'geodirectory'),
513
+		'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
514
+		'id' => 'geodir_disable_gb_modal',
515
+		'type' => 'checkbox',
516
+		'std' => '0'
517
+	),
518
+	array(
519
+		'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
520
+		'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
521
+		'id' => 'geodir_disable_tfg_buttons_section',
522
+		'type' => 'checkbox',
523
+		'std' => '0'
524
+	),
525
+	array(
526
+		'name' => __('Disable share this button section', 'geodirectory'),
527
+		'desc' => __('Disable share this button section that displays on Detail page sidebar', 'geodirectory'),
528
+		'id' => 'geodir_disable_sharethis_button_section',
529
+		'type' => 'checkbox',
530
+		'std' => '0'
531
+	),
532
+	array(
533
+		'name' => __('Disable Google Analytics section', 'geodirectory'),
534
+		'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
535
+		'id' => 'geodir_disable_google_analytics_section',
536
+		'type' => 'checkbox',
537
+		'std' => '0'
538
+	),
539
+	array(
540
+		'name' => __('Disable User Links section', 'geodirectory'),
541
+		'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
542
+		'id' => 'geodir_disable_user_links_section',
543
+		'type' => 'checkbox',
544
+		'std' => '0'
545
+	),
546
+	array(
547
+		'name' => __('Disable Rating Info section', 'geodirectory'),
548
+		'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
549
+		'id' => 'geodir_disable_rating_info_section',
550
+		'type' => 'checkbox',
551
+		'std' => '0'
552
+	),
553
+	array(
554
+		'name' => __('Disable Listing Info section', 'geodirectory'),
555
+		'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
556
+		'id' => 'geodir_disable_listing_info_section',
557
+		'type' => 'checkbox',
558
+		'std' => '0'
559
+	),
560 560
 
561
-    array('type' => 'sectionend', 'id' => 'detail_page_settings'),
561
+	array('type' => 'sectionend', 'id' => 'detail_page_settings'),
562 562
 
563 563
 
564
-    /* ---------- DETAIL PAGE TAB SETTING START*/
564
+	/* ---------- DETAIL PAGE TAB SETTING START*/
565 565
 
566
-    array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
566
+	array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
567 567
 
568
-    array(
569
-        'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
570
-        'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
571
-        'tip' => '',
572
-        'id' => 'geodir_detail_page_tabs_excluded',
573
-        'css' => 'min-width:300px;',
574
-        'std' => geodir_get_posttypes(),
575
-        'type' => 'multiselect',
576
-        'placeholder_text' => __('Select tabs', 'geodirectory'),
577
-        'class' => 'chosen_select',
578
-        'options' => array_unique(geodir_detail_page_tabs_key_value_array())
579
-    ),
568
+	array(
569
+		'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
570
+		'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
571
+		'tip' => '',
572
+		'id' => 'geodir_detail_page_tabs_excluded',
573
+		'css' => 'min-width:300px;',
574
+		'std' => geodir_get_posttypes(),
575
+		'type' => 'multiselect',
576
+		'placeholder_text' => __('Select tabs', 'geodirectory'),
577
+		'class' => 'chosen_select',
578
+		'options' => array_unique(geodir_detail_page_tabs_key_value_array())
579
+	),
580 580
     
581
-    array(
582
-        'name' => __('Show as list', 'geodirectory'),
583
-        'desc' => __('Show as list instead of tabs', 'geodirectory'),
584
-        'id' => 'geodir_disable_tabs',
585
-        'type' => 'checkbox',
586
-        'std' => '0'
587
-    ),
581
+	array(
582
+		'name' => __('Show as list', 'geodirectory'),
583
+		'desc' => __('Show as list instead of tabs', 'geodirectory'),
584
+		'id' => 'geodir_disable_tabs',
585
+		'type' => 'checkbox',
586
+		'std' => '0'
587
+	),
588 588
 
589
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
590
-    /* ---------- DETAIL PAGE TAB SETTING END*/
589
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
590
+	/* ---------- DETAIL PAGE TAB SETTING END*/
591 591
 
592
-    /* START DEFAULT STAR IMAGE*/
593
-    array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
592
+	/* START DEFAULT STAR IMAGE*/
593
+	array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
594 594
 
595
-    array(
596
-        'name' => __('Upload default rating star icon', 'geodirectory'),
597
-        'desc' => '',
598
-        'id' => 'geodir_default_rating_star_icon',
599
-        'type' => 'file',
600
-        'std' => '0',
601
-        'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
602
-    ),
595
+	array(
596
+		'name' => __('Upload default rating star icon', 'geodirectory'),
597
+		'desc' => '',
598
+		'id' => 'geodir_default_rating_star_icon',
599
+		'type' => 'file',
600
+		'std' => '0',
601
+		'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section
602
+	),
603 603
 	array(
604 604
 		'name' => __('Enable Font Awesome', 'geodirectory'),
605 605
 		'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
@@ -615,369 +615,369 @@  discard block
 block discarded – undo
615 615
 		'std' => '#757575'
616 616
 	),
617 617
 
618
-    array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
618
+	array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
619 619
 
620
-    /* END DEFAULT STAR IMAGE*/
620
+	/* END DEFAULT STAR IMAGE*/
621 621
 
622
-    /* Detail related post settings start */
622
+	/* Detail related post settings start */
623 623
 
624
-    array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
624
+	array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
625 625
 
626
-    array(
627
-        'name' => __('Show related post listing on', 'geodirectory'),
628
-        'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
629
-        'tip' => '',
630
-        'id' => 'geodir_add_related_listing_posttypes',
631
-        'css' => 'min-width:300px;',
632
-        'std' => geodir_get_posttypes(),
633
-        'type' => 'multiselect',
634
-        'placeholder_text' => __('Select post types', 'geodirectory'),
635
-        'class' => 'chosen_select',
636
-        'options' => array_unique(geodir_post_type_setting_fun())
637
-    ),
626
+	array(
627
+		'name' => __('Show related post listing on', 'geodirectory'),
628
+		'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
629
+		'tip' => '',
630
+		'id' => 'geodir_add_related_listing_posttypes',
631
+		'css' => 'min-width:300px;',
632
+		'std' => geodir_get_posttypes(),
633
+		'type' => 'multiselect',
634
+		'placeholder_text' => __('Select post types', 'geodirectory'),
635
+		'class' => 'chosen_select',
636
+		'options' => array_unique(geodir_post_type_setting_fun())
637
+	),
638 638
 
639
-    array(
640
-        'name' => __('Relate to', 'geodirectory'),
641
-        'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
642
-        'id' => 'geodir_related_post_relate_to',
643
-        'css' => 'min-width:300px;',
644
-        'std' => 'category',
645
-        'type' => 'select',
646
-        'class' => 'chosen_select',
647
-        'options' => array_unique(array(
648
-            'category' => __('Categories', 'geodirectory'),
649
-            'tags' => __('Tags', 'geodirectory'),
650
-        ))
651
-    ),
639
+	array(
640
+		'name' => __('Relate to', 'geodirectory'),
641
+		'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
642
+		'id' => 'geodir_related_post_relate_to',
643
+		'css' => 'min-width:300px;',
644
+		'std' => 'category',
645
+		'type' => 'select',
646
+		'class' => 'chosen_select',
647
+		'options' => array_unique(array(
648
+			'category' => __('Categories', 'geodirectory'),
649
+			'tags' => __('Tags', 'geodirectory'),
650
+		))
651
+	),
652 652
 
653
-    array(
654
-        'name' => __('Layout', 'geodirectory'),
655
-        'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
656
-        'id' => 'geodir_related_post_listing_view',
657
-        'css' => 'min-width:300px;',
658
-        'std' => 'gridview_onehalf',
659
-        'type' => 'select',
660
-        'class' => 'chosen_select',
661
-        'options' => array_unique(array(
662
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
663
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
664
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
665
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
666
-            'listview' => __('List view', 'geodirectory'),
667
-        ))
668
-    ),
653
+	array(
654
+		'name' => __('Layout', 'geodirectory'),
655
+		'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
656
+		'id' => 'geodir_related_post_listing_view',
657
+		'css' => 'min-width:300px;',
658
+		'std' => 'gridview_onehalf',
659
+		'type' => 'select',
660
+		'class' => 'chosen_select',
661
+		'options' => array_unique(array(
662
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
663
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
664
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
665
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
666
+			'listview' => __('List view', 'geodirectory'),
667
+		))
668
+	),
669 669
 
670
-    array(
671
-        'name' => __('Sort by', 'geodirectory'),
672
-        'desc' => __('Set the related post listing sort by view', 'geodirectory'),
673
-        'id' => 'geodir_related_post_sortby',
674
-        'css' => 'min-width:300px;',
675
-        'std' => 'latest',
676
-        'type' => 'select',
677
-        'class' => 'chosen_select',
678
-        'options' => array_unique(array(
679
-            'latest' => __('Latest', 'geodirectory'),
680
-            'featured' => __('Featured', 'geodirectory'),
681
-            'high_review' => __('Review', 'geodirectory'),
682
-            'high_rating' => __('Rating', 'geodirectory'),
683
-            'random' => __('Random', 'geodirectory'),
684
-            'nearest' => __('Nearest', 'geodirectory'),
685
-        ))
686
-    ),
670
+	array(
671
+		'name' => __('Sort by', 'geodirectory'),
672
+		'desc' => __('Set the related post listing sort by view', 'geodirectory'),
673
+		'id' => 'geodir_related_post_sortby',
674
+		'css' => 'min-width:300px;',
675
+		'std' => 'latest',
676
+		'type' => 'select',
677
+		'class' => 'chosen_select',
678
+		'options' => array_unique(array(
679
+			'latest' => __('Latest', 'geodirectory'),
680
+			'featured' => __('Featured', 'geodirectory'),
681
+			'high_review' => __('Review', 'geodirectory'),
682
+			'high_rating' => __('Rating', 'geodirectory'),
683
+			'random' => __('Random', 'geodirectory'),
684
+			'nearest' => __('Nearest', 'geodirectory'),
685
+		))
686
+	),
687 687
 
688
-    array(
689
-        'name' => __('Number of posts:', 'geodirectory'),
690
-        'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
691
-        'id' => 'geodir_related_post_count',
692
-        'type' => 'text',
693
-        'css' => 'min-width:300px;',
694
-        'std' => '5' // Default value to show home top section
695
-    ),
688
+	array(
689
+		'name' => __('Number of posts:', 'geodirectory'),
690
+		'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
691
+		'id' => 'geodir_related_post_count',
692
+		'type' => 'text',
693
+		'css' => 'min-width:300px;',
694
+		'std' => '5' // Default value to show home top section
695
+	),
696 696
 
697
-    array(
698
-        'name' => __('Post excerpt', 'geodirectory'),
699
-        'desc' => __('Post content excerpt character count', 'geodirectory'),
700
-        'id' => 'geodir_related_post_excerpt',
701
-        'type' => 'text',
702
-        'css' => 'min-width:300px;',
703
-        'std' => '20' // Default value to show home top section
704
-    ),
697
+	array(
698
+		'name' => __('Post excerpt', 'geodirectory'),
699
+		'desc' => __('Post content excerpt character count', 'geodirectory'),
700
+		'id' => 'geodir_related_post_excerpt',
701
+		'type' => 'text',
702
+		'css' => 'min-width:300px;',
703
+		'std' => '20' // Default value to show home top section
704
+	),
705 705
 
706 706
 
707
-    array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
708
-    /* Detail Layout Settings end */
707
+	array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
708
+	/* Detail Layout Settings end */
709 709
 
710
-    /* Author Layout Settings Start */
710
+	/* Author Layout Settings Start */
711 711
 
712
-    array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
712
+	array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
713 713
 
714 714
 
715
-    array('name' => __('Author Page Layout Settings', 'geodirectory'),
716
-        'type' => 'sectionstart',
717
-        'desc' => '',
718
-        'id' => 'geodir_author_layout'),
715
+	array('name' => __('Author Page Layout Settings', 'geodirectory'),
716
+		'type' => 'sectionstart',
717
+		'desc' => '',
718
+		'id' => 'geodir_author_layout'),
719 719
 
720
-    array(
721
-        'name' => __('Author top section', 'geodirectory'),
722
-        'desc' => __('Show the top section of author page', 'geodirectory'),
723
-        'id' => 'geodir_show_author_top_section',
724
-        'type' => 'checkbox',
725
-        'std' => '1' // Default value to show home top section
726
-    ),
720
+	array(
721
+		'name' => __('Author top section', 'geodirectory'),
722
+		'desc' => __('Show the top section of author page', 'geodirectory'),
723
+		'id' => 'geodir_show_author_top_section',
724
+		'type' => 'checkbox',
725
+		'std' => '1' // Default value to show home top section
726
+	),
727 727
 
728
-    array(
729
-        'name' => __('Author right section', 'geodirectory'),
730
-        'desc' => __('Show the right section of author page', 'geodirectory'),
731
-        'id' => 'geodir_show_author_right_section',
732
-        'type' => 'checkbox',
733
-        'std' => '1' // Default value to show home top section
734
-    ),
728
+	array(
729
+		'name' => __('Author right section', 'geodirectory'),
730
+		'desc' => __('Show the right section of author page', 'geodirectory'),
731
+		'id' => 'geodir_show_author_right_section',
732
+		'type' => 'checkbox',
733
+		'std' => '1' // Default value to show home top section
734
+	),
735 735
 
736
-    array(
737
-        'name' => __('Width of author right section', 'geodirectory'),
738
-        'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
739
-        'id' => 'geodir_width_author_right_section',
740
-        'type' => 'text',
741
-        'css' => 'min-width:300px;',
742
-        'std' => '30' // Default value to show home top section
743
-    ),
736
+	array(
737
+		'name' => __('Width of author right section', 'geodirectory'),
738
+		'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
739
+		'id' => 'geodir_width_author_right_section',
740
+		'type' => 'text',
741
+		'css' => 'min-width:300px;',
742
+		'std' => '30' // Default value to show home top section
743
+	),
744 744
 
745
-    array(
746
-        'name' => __('Author content section view', 'geodirectory'),
747
-        'desc' => __('Set the listing view of author page', 'geodirectory'),
748
-        'id' => 'geodir_author_view',
749
-        'css' => 'min-width:300px;',
750
-        'std' => 'gridview_onehalf',
751
-        'type' => 'select',
752
-        'class' => 'chosen_select',
753
-        'options' => array_unique(array(
754
-            'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
755
-            'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
756
-            'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
757
-            'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
758
-            'listview' => __('List view', 'geodirectory'),
759
-        ))
760
-    ),
745
+	array(
746
+		'name' => __('Author content section view', 'geodirectory'),
747
+		'desc' => __('Set the listing view of author page', 'geodirectory'),
748
+		'id' => 'geodir_author_view',
749
+		'css' => 'min-width:300px;',
750
+		'std' => 'gridview_onehalf',
751
+		'type' => 'select',
752
+		'class' => 'chosen_select',
753
+		'options' => array_unique(array(
754
+			'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
755
+			'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
756
+			'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
757
+			'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
758
+			'listview' => __('List view', 'geodirectory'),
759
+		))
760
+	),
761 761
 
762
-    array(
763
-        'name' => __('Width of author content section', 'geodirectory'),
764
-        'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
765
-        'id' => 'geodir_width_author_contant_section',
766
-        'type' => 'text',
767
-        'css' => 'min-width:300px;',
768
-        'std' => '63' // Default value to show home top section
769
-    ),
762
+	array(
763
+		'name' => __('Width of author content section', 'geodirectory'),
764
+		'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
765
+		'id' => 'geodir_width_author_contant_section',
766
+		'type' => 'text',
767
+		'css' => 'min-width:300px;',
768
+		'std' => '63' // Default value to show home top section
769
+	),
770 770
 
771
-    array(
772
-        'name' => __('Author left section', 'geodirectory'),
773
-        'desc' => __('Show the left section of author page', 'geodirectory'),
774
-        'id' => 'geodir_show_author_left_section',
775
-        'type' => 'checkbox',
776
-        'std' => '0' // Default value to show home top section
777
-    ),
771
+	array(
772
+		'name' => __('Author left section', 'geodirectory'),
773
+		'desc' => __('Show the left section of author page', 'geodirectory'),
774
+		'id' => 'geodir_show_author_left_section',
775
+		'type' => 'checkbox',
776
+		'std' => '0' // Default value to show home top section
777
+	),
778 778
 
779
-    array(
780
-        'name' => __('Width of author left section', 'geodirectory'),
781
-        'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
782
-        'id' => 'geodir_width_author_left_section',
783
-        'type' => 'text',
784
-        'css' => 'min-width:300px;',
785
-        'std' => '30' // Default value to show home top section
786
-    ),
779
+	array(
780
+		'name' => __('Width of author left section', 'geodirectory'),
781
+		'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
782
+		'id' => 'geodir_width_author_left_section',
783
+		'type' => 'text',
784
+		'css' => 'min-width:300px;',
785
+		'std' => '30' // Default value to show home top section
786
+	),
787 787
 
788
-    array(
789
-        'name' => __('Author bottom section', 'geodirectory'),
790
-        'desc' => __('Show the bottom section of author page', 'geodirectory'),
791
-        'id' => 'geodir_show_author_bottom_section',
792
-        'type' => 'checkbox',
793
-        'std' => '0' // Default value to show home top section
794
-    ),
788
+	array(
789
+		'name' => __('Author bottom section', 'geodirectory'),
790
+		'desc' => __('Show the bottom section of author page', 'geodirectory'),
791
+		'id' => 'geodir_show_author_bottom_section',
792
+		'type' => 'checkbox',
793
+		'std' => '0' // Default value to show home top section
794
+	),
795 795
 
796 796
 
797
-    array(
798
-        'name' => __('Description word limit', 'geodirectory'),
799
-        'desc' => '',
800
-        'id' => 'geodir_author_desc_word_limit',
801
-        'type' => 'text',
802
-        'css' => 'min-width:300px;',
803
-        'std' => '50' // Default value to show home top section
804
-    ),
797
+	array(
798
+		'name' => __('Description word limit', 'geodirectory'),
799
+		'desc' => '',
800
+		'id' => 'geodir_author_desc_word_limit',
801
+		'type' => 'text',
802
+		'css' => 'min-width:300px;',
803
+		'std' => '50' // Default value to show home top section
804
+	),
805 805
 
806
-    array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
807
-    /* Author Layout Settings end */
806
+	array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
807
+	/* Author Layout Settings end */
808 808
 
809 809
 
810
-    /* Post Type Navigation Settings Start */
811
-    array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
810
+	/* Post Type Navigation Settings Start */
811
+	array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
812 812
 
813 813
 
814
-    /* Post Type Navigation Settings Start */
814
+	/* Post Type Navigation Settings Start */
815 815
 
816
-    array('name' => __('Navigation Locations', 'geodirectory'),
817
-        'type' => 'sectionstart',
818
-        'desc' => '',
819
-        'id' => 'geodir_navigation_locations'),
816
+	array('name' => __('Navigation Locations', 'geodirectory'),
817
+		'type' => 'sectionstart',
818
+		'desc' => '',
819
+		'id' => 'geodir_navigation_locations'),
820 820
 
821
-    array(
822
-        'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
823
-        'desc' => '',
824
-        'tip' => '',
825
-        'id' => 'geodir_theme_location_nav',
826
-        'css' => 'min-width:300px;',
827
-        'std' => array(),
828
-        'type' => 'multiselect',
829
-        'placeholder_text' => __('Select menu locations', 'geodirectory'),
830
-        'class' => 'chosen_select',
831
-        'options' => array_unique(geodir_theme_location_setting_fun())
832
-    ),
833
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
834
-
835
-
836
-    array('name' => __('Navigation Settings', 'geodirectory'),
837
-        'type' => 'sectionstart',
838
-        'desc' => '',
839
-        'id' => 'geodir_navigation_options'),
821
+	array(
822
+		'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
823
+		'desc' => '',
824
+		'tip' => '',
825
+		'id' => 'geodir_theme_location_nav',
826
+		'css' => 'min-width:300px;',
827
+		'std' => array(),
828
+		'type' => 'multiselect',
829
+		'placeholder_text' => __('Select menu locations', 'geodirectory'),
830
+		'class' => 'chosen_select',
831
+		'options' => array_unique(geodir_theme_location_setting_fun())
832
+	),
833
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
840 834
 
841 835
 
842
-    array(
843
-        'name' => __('Show add listing navigation in menu', 'geodirectory'),
844
-        'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
845
-        'id' => 'geodir_show_addlisting_nav',
846
-        'std' => '1',
847
-        'type' => 'checkbox'
848
-    ),
836
+	array('name' => __('Navigation Settings', 'geodirectory'),
837
+		'type' => 'sectionstart',
838
+		'desc' => '',
839
+		'id' => 'geodir_navigation_options'),
849 840
 
850
-    array(
851
-        'name' => __('Show listings navigation in menu', 'geodirectory'),
852
-        'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
853
-        'id' => 'geodir_show_listing_nav',
854
-        'std' => '1',
855
-        'type' => 'checkbox'
856
-    ),
857 841
 
858
-    array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
842
+	array(
843
+		'name' => __('Show add listing navigation in menu', 'geodirectory'),
844
+		'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
845
+		'id' => 'geodir_show_addlisting_nav',
846
+		'std' => '1',
847
+		'type' => 'checkbox'
848
+	),
859 849
 
850
+	array(
851
+		'name' => __('Show listings navigation in menu', 'geodirectory'),
852
+		'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
853
+		'id' => 'geodir_show_listing_nav',
854
+		'std' => '1',
855
+		'type' => 'checkbox'
856
+	),
860 857
 
861
-    array('name' => __('Post Type Navigation Settings', 'geodirectory'),
862
-        'type' => 'sectionstart',
863
-        'desc' => '',
864
-        'id' => 'geodir_post_type_navigation_layout'),
865
-    array(
866
-        'name' => __('Show listing link in main navigation', 'geodirectory'),
867
-        'desc' => '',
868
-        'tip' => '',
869
-        'id' => 'geodir_add_posttype_in_main_nav',
870
-        'css' => 'min-width:300px;',
871
-        'std' => array(),
872
-        'type' => 'multiselect',
873
-        'placeholder_text' => __('Select post types', 'geodirectory'),
874
-        'class' => 'chosen_select',
875
-        'options' => array_unique(geodir_post_type_setting_fun())
876
-    ),
858
+	array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
877 859
 
878
-    array(
879
-        'name' => __('Show listing link in listing navigation', 'geodirectory'),
880
-        'desc' => '',
881
-        'tip' => '',
882
-        'id' => 'geodir_add_posttype_in_listing_nav',
883
-        'css' => 'min-width:300px;',
884
-        'std' => geodir_get_posttypes(),
885
-        'type' => 'multiselect',
886
-        'placeholder_text' => __('Select post types', 'geodirectory'),
887
-        'class' => 'chosen_select',
888
-        'options' => array_unique(geodir_post_type_setting_fun())
889
-    ),
890 860
 
891
-    array(
892
-        'name' => __('Allow post type to add from frontend', 'geodirectory'),
893
-        'desc' => '',
894
-        'tip' => '',
895
-        'id' => 'geodir_allow_posttype_frontend',
896
-        'css' => 'min-width:300px;',
897
-        'std' => geodir_get_posttypes(),
898
-        'type' => 'multiselect',
899
-        'placeholder_text' => __('Select post types', 'geodirectory'),
900
-        'class' => 'chosen_select',
901
-        'options' => array_unique(geodir_post_type_setting_fun())
902
-    ),
861
+	array('name' => __('Post Type Navigation Settings', 'geodirectory'),
862
+		'type' => 'sectionstart',
863
+		'desc' => '',
864
+		'id' => 'geodir_post_type_navigation_layout'),
865
+	array(
866
+		'name' => __('Show listing link in main navigation', 'geodirectory'),
867
+		'desc' => '',
868
+		'tip' => '',
869
+		'id' => 'geodir_add_posttype_in_main_nav',
870
+		'css' => 'min-width:300px;',
871
+		'std' => array(),
872
+		'type' => 'multiselect',
873
+		'placeholder_text' => __('Select post types', 'geodirectory'),
874
+		'class' => 'chosen_select',
875
+		'options' => array_unique(geodir_post_type_setting_fun())
876
+	),
903 877
 
904
-    array(
905
-        'name' => __('Show add listing link in main navigation', 'geodirectory'),
906
-        'desc' => '',
907
-        'tip' => '',
908
-        'id' => 'geodir_add_listing_link_main_nav',
909
-        'css' => 'min-width:300px;',
910
-        'std' => array(),
911
-        'type' => 'multiselect',
912
-        'placeholder_text' => __('Select post types', 'geodirectory'),
913
-        'class' => 'chosen_select',
914
-        'options' => array_unique(geodir_post_type_setting_fun())
915
-    ),
878
+	array(
879
+		'name' => __('Show listing link in listing navigation', 'geodirectory'),
880
+		'desc' => '',
881
+		'tip' => '',
882
+		'id' => 'geodir_add_posttype_in_listing_nav',
883
+		'css' => 'min-width:300px;',
884
+		'std' => geodir_get_posttypes(),
885
+		'type' => 'multiselect',
886
+		'placeholder_text' => __('Select post types', 'geodirectory'),
887
+		'class' => 'chosen_select',
888
+		'options' => array_unique(geodir_post_type_setting_fun())
889
+	),
916 890
 
917
-    array(
918
-        'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
919
-        'desc' => '',
920
-        'tip' => '',
921
-        'id' => 'geodir_add_listing_link_add_listing_nav',
922
-        'css' => 'min-width:300px;',
923
-        'std' => geodir_get_posttypes(),
924
-        'type' => 'multiselect',
925
-        'class' => 'chosen_select',
926
-        'options' => array_unique(geodir_post_type_setting_fun())
927
-    ),
891
+	array(
892
+		'name' => __('Allow post type to add from frontend', 'geodirectory'),
893
+		'desc' => '',
894
+		'tip' => '',
895
+		'id' => 'geodir_allow_posttype_frontend',
896
+		'css' => 'min-width:300px;',
897
+		'std' => geodir_get_posttypes(),
898
+		'type' => 'multiselect',
899
+		'placeholder_text' => __('Select post types', 'geodirectory'),
900
+		'class' => 'chosen_select',
901
+		'options' => array_unique(geodir_post_type_setting_fun())
902
+	),
928 903
 
929
-    array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
904
+	array(
905
+		'name' => __('Show add listing link in main navigation', 'geodirectory'),
906
+		'desc' => '',
907
+		'tip' => '',
908
+		'id' => 'geodir_add_listing_link_main_nav',
909
+		'css' => 'min-width:300px;',
910
+		'std' => array(),
911
+		'type' => 'multiselect',
912
+		'placeholder_text' => __('Select post types', 'geodirectory'),
913
+		'class' => 'chosen_select',
914
+		'options' => array_unique(geodir_post_type_setting_fun())
915
+	),
930 916
 
917
+	array(
918
+		'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
919
+		'desc' => '',
920
+		'tip' => '',
921
+		'id' => 'geodir_add_listing_link_add_listing_nav',
922
+		'css' => 'min-width:300px;',
923
+		'std' => geodir_get_posttypes(),
924
+		'type' => 'multiselect',
925
+		'class' => 'chosen_select',
926
+		'options' => array_unique(geodir_post_type_setting_fun())
927
+	),
931 928
 
932
-    array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
929
+	array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
933 930
 
934 931
 
935
-    array(
936
-        'name' => __('Show add listing link in user dashboard', 'geodirectory'),
937
-        'desc' => '',
938
-        'tip' => '',
939
-        'id' => 'geodir_add_listing_link_user_dashboard',
940
-        'css' => 'min-width:300px;',
941
-        'std' => geodir_get_posttypes(),
942
-        'type' => 'multiselect',
943
-        'placeholder_text' => __('Select post types', 'geodirectory'),
944
-        'class' => 'chosen_select',
945
-        'options' => array_unique(geodir_post_type_setting_fun())
946
-    ),
932
+	array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
947 933
 
948
-    array(
949
-        'name' => __('Show favorite link in user dashboard', 'geodirectory'),
950
-        'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
951
-        'tip' => '',
952
-        'id' => 'geodir_favorite_link_user_dashboard',
953
-        'css' => 'min-width:300px;',
954
-        'std' => geodir_get_posttypes(),
955
-        'type' => 'multiselect',
956
-        'placeholder_text' => __('Select post types', 'geodirectory'),
957
-        'class' => 'chosen_select',
958
-        'options' => array_unique(geodir_post_type_setting_fun())
959
-    ),
960 934
 
961
-    array(
962
-        'name' => __('Show listing link in user dashboard', 'geodirectory'),
963
-        'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
964
-        'tip' => '',
965
-        'id' => 'geodir_listing_link_user_dashboard',
966
-        'css' => 'min-width:300px;',
967
-        'std' => geodir_get_posttypes(),
968
-        'type' => 'multiselect',
969
-        'placeholder_text' => __('Select post types', 'geodirectory'),
970
-        'class' => 'chosen_select',
971
-        'options' => array_unique(geodir_post_type_setting_fun())
972
-    ),
973
-
974
-    array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
975
-    /* Post Type Navigation Settings End */
976
-
977
-    /* Script Settings Start */
978
-    array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
979
-
980
-    /*
935
+	array(
936
+		'name' => __('Show add listing link in user dashboard', 'geodirectory'),
937
+		'desc' => '',
938
+		'tip' => '',
939
+		'id' => 'geodir_add_listing_link_user_dashboard',
940
+		'css' => 'min-width:300px;',
941
+		'std' => geodir_get_posttypes(),
942
+		'type' => 'multiselect',
943
+		'placeholder_text' => __('Select post types', 'geodirectory'),
944
+		'class' => 'chosen_select',
945
+		'options' => array_unique(geodir_post_type_setting_fun())
946
+	),
947
+
948
+	array(
949
+		'name' => __('Show favorite link in user dashboard', 'geodirectory'),
950
+		'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
951
+		'tip' => '',
952
+		'id' => 'geodir_favorite_link_user_dashboard',
953
+		'css' => 'min-width:300px;',
954
+		'std' => geodir_get_posttypes(),
955
+		'type' => 'multiselect',
956
+		'placeholder_text' => __('Select post types', 'geodirectory'),
957
+		'class' => 'chosen_select',
958
+		'options' => array_unique(geodir_post_type_setting_fun())
959
+	),
960
+
961
+	array(
962
+		'name' => __('Show listing link in user dashboard', 'geodirectory'),
963
+		'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
964
+		'tip' => '',
965
+		'id' => 'geodir_listing_link_user_dashboard',
966
+		'css' => 'min-width:300px;',
967
+		'std' => geodir_get_posttypes(),
968
+		'type' => 'multiselect',
969
+		'placeholder_text' => __('Select post types', 'geodirectory'),
970
+		'class' => 'chosen_select',
971
+		'options' => array_unique(geodir_post_type_setting_fun())
972
+	),
973
+
974
+	array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
975
+	/* Post Type Navigation Settings End */
976
+
977
+	/* Script Settings Start */
978
+	array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
979
+
980
+	/*
981 981
     array( 	'name' => __( 'Add/Remove Scripts', 'geodirectory' ),
982 982
                 'type' => 'sectionstart',
983 983
                 'desc' => '',
@@ -1003,190 +1003,190 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
     */
1005 1005
 
1006
-    array('name' => __('GD Lazy Load Images', 'geodirectory'),
1007
-        'type' => 'sectionstart',
1008
-        'desc' => '',
1009
-        'id' => 'geodir_gdll_settings'),
1006
+	array('name' => __('GD Lazy Load Images', 'geodirectory'),
1007
+		'type' => 'sectionstart',
1008
+		'desc' => '',
1009
+		'id' => 'geodir_gdll_settings'),
1010 1010
 
1011
-    array(
1012
-        'name' => __('Enable lazy load images?', 'geodirectory'),
1013
-        'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1014
-        'id' => 'geodir_lazy_load',
1015
-        'type' => 'checkbox',
1016
-        'std' => '1' // Default value to show home top section
1017
-    ),
1018
-    array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1011
+	array(
1012
+		'name' => __('Enable lazy load images?', 'geodirectory'),
1013
+		'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
1014
+		'id' => 'geodir_lazy_load',
1015
+		'type' => 'checkbox',
1016
+		'std' => '1' // Default value to show home top section
1017
+	),
1018
+	array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
1019 1019
     
1020 1020
 
1021
-    array('name' => __('Script Settings', 'geodirectory'),
1022
-        'type' => 'sectionstart',
1023
-        'desc' => '',
1024
-        'id' => 'geodir_script_settings'),
1021
+	array('name' => __('Script Settings', 'geodirectory'),
1022
+		'type' => 'sectionstart',
1023
+		'desc' => '',
1024
+		'id' => 'geodir_script_settings'),
1025 1025
 
1026
-    array(
1027
-        'name' => __('Custom style css code', 'geodirectory'),
1028
-        'desc' => '',
1029
-        'id' => 'geodir_coustem_css',
1030
-        'type' => 'textarea',
1031
-        'css' => 'min-width:300px;',
1032
-        'std' => '' // Default value for the page title - changed in settings
1033
-    ),
1026
+	array(
1027
+		'name' => __('Custom style css code', 'geodirectory'),
1028
+		'desc' => '',
1029
+		'id' => 'geodir_coustem_css',
1030
+		'type' => 'textarea',
1031
+		'css' => 'min-width:300px;',
1032
+		'std' => '' // Default value for the page title - changed in settings
1033
+	),
1034 1034
 
1035
-    array(
1036
-        'name' => __('Header script code', 'geodirectory'),
1037
-        'desc' => '',
1038
-        'id' => 'geodir_header_scripts',
1039
-        'type' => 'textarea',
1040
-        'css' => 'min-width:300px;',
1041
-        'std' => '' // Default value for the page title - changed in settings
1042
-    ),
1035
+	array(
1036
+		'name' => __('Header script code', 'geodirectory'),
1037
+		'desc' => '',
1038
+		'id' => 'geodir_header_scripts',
1039
+		'type' => 'textarea',
1040
+		'css' => 'min-width:300px;',
1041
+		'std' => '' // Default value for the page title - changed in settings
1042
+	),
1043 1043
 
1044
-    array(
1045
-        'name' => __('Footer script code', 'geodirectory'),
1046
-        'desc' => '',
1047
-        'id' => 'geodir_footer_scripts',
1048
-        'type' => 'textarea',
1049
-        'css' => 'min-width:300px;',
1050
-        'std' => '' // Default value for the page title - changed in settings
1051
-    ),
1044
+	array(
1045
+		'name' => __('Footer script code', 'geodirectory'),
1046
+		'desc' => '',
1047
+		'id' => 'geodir_footer_scripts',
1048
+		'type' => 'textarea',
1049
+		'css' => 'min-width:300px;',
1050
+		'std' => '' // Default value for the page title - changed in settings
1051
+	),
1052 1052
 
1053
-    array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1054
-    /* Script Settings End */
1053
+	array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
1054
+	/* Script Settings End */
1055 1055
 
1056
-    /* Map Settings Start */
1057
-    array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1056
+	/* Map Settings Start */
1057
+	array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
1058 1058
 
1059 1059
 
1060
-    // Google API key
1061
-    array(
1062
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1063
-        'type' => 'sectionstart',
1064
-        'desc' => '',
1065
-        'id' => 'geodir_google_api_key'
1066
-    ),
1067
-    array(
1068
-        'name' => __('Google Maps API KEY', 'geodirectory'),
1069
-        'desc' => sprintf(
1070
-            __('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1071
-            'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1072
-        'tip' => '',
1073
-        'id' => 'geodir_google_api_key',
1074
-        'css' => 'min-width:300px;',
1075
-        'std' => '',
1076
-        'type' => 'text',
1077
-    ),
1078
-    array(
1079
-        'type' => 'sectionend',
1080
-        'id' => 'geodir_google_api_key'
1081
-    ),
1060
+	// Google API key
1061
+	array(
1062
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1063
+		'type' => 'sectionstart',
1064
+		'desc' => '',
1065
+		'id' => 'geodir_google_api_key'
1066
+	),
1067
+	array(
1068
+		'name' => __('Google Maps API KEY', 'geodirectory'),
1069
+		'desc' => sprintf(
1070
+			__('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting.   (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
1071
+			'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ),
1072
+		'tip' => '',
1073
+		'id' => 'geodir_google_api_key',
1074
+		'css' => 'min-width:300px;',
1075
+		'std' => '',
1076
+		'type' => 'text',
1077
+	),
1078
+	array(
1079
+		'type' => 'sectionend',
1080
+		'id' => 'geodir_google_api_key'
1081
+	),
1082 1082
 
1083
-    /* Untick the category by default on home map */
1084
-    array(
1085
-        'name' => __('Home Map Settings', 'geodirectory'),
1086
-        'type' => 'sectionstart',
1087
-        'desc' => '',
1088
-        'id' => 'geodir_home_map_section'
1089
-    ),
1090
-    array(
1091
-        'name' => __('Select category to untick by default on map', 'geodirectory'),
1092
-        'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1093
-        'tip' => '',
1094
-        'id' => 'geodir_home_map_untick',
1095
-        'css' => 'min-width:300px;',
1096
-        'std' => '',
1097
-        'type' => 'multiselect',
1098
-        'placeholder_text' => __('Select category', 'geodirectory'),
1099
-        'class' => 'chosen_select',
1100
-        'options' => geodir_home_map_cats_key_value_array()
1101
-    ),
1102
-    array(
1103
-        'type' => 'sectionend',
1104
-        'id' => 'geodir_home_map_section'
1105
-    ),
1083
+	/* Untick the category by default on home map */
1084
+	array(
1085
+		'name' => __('Home Map Settings', 'geodirectory'),
1086
+		'type' => 'sectionstart',
1087
+		'desc' => '',
1088
+		'id' => 'geodir_home_map_section'
1089
+	),
1090
+	array(
1091
+		'name' => __('Select category to untick by default on map', 'geodirectory'),
1092
+		'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
1093
+		'tip' => '',
1094
+		'id' => 'geodir_home_map_untick',
1095
+		'css' => 'min-width:300px;',
1096
+		'std' => '',
1097
+		'type' => 'multiselect',
1098
+		'placeholder_text' => __('Select category', 'geodirectory'),
1099
+		'class' => 'chosen_select',
1100
+		'options' => geodir_home_map_cats_key_value_array()
1101
+	),
1102
+	array(
1103
+		'type' => 'sectionend',
1104
+		'id' => 'geodir_home_map_section'
1105
+	),
1106 1106
 
1107
-    array(
1108
-        'name' => __('Add Listing Map Settings', 'geodirectory'),
1109
-        'type' => 'sectionstart',
1110
-        'desc' => '',
1111
-        'id' => 'geodir_add_listing_map_section'
1112
-    ),
1113
-    array(
1114
-        'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1115
-        'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1116
-        'id' => 'geodir_add_listing_mouse_scroll',
1117
-        'type' => 'checkbox',
1118
-        'std' => '0' // Default value to show home top section
1119
-    ),
1120
-    array(
1121
-        'type' => 'sectionend',
1122
-        'id' => 'geodir_add_listing_map_section'
1123
-    ),
1107
+	array(
1108
+		'name' => __('Add Listing Map Settings', 'geodirectory'),
1109
+		'type' => 'sectionstart',
1110
+		'desc' => '',
1111
+		'id' => 'geodir_add_listing_map_section'
1112
+	),
1113
+	array(
1114
+		'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
1115
+		'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
1116
+		'id' => 'geodir_add_listing_mouse_scroll',
1117
+		'type' => 'checkbox',
1118
+		'std' => '0' // Default value to show home top section
1119
+	),
1120
+	array(
1121
+		'type' => 'sectionend',
1122
+		'id' => 'geodir_add_listing_map_section'
1123
+	),
1124 1124
 
1125 1125
 
1126
-    array('name' => __('Default map settings', 'geodirectory'),
1127
-        'type' => 'sectionstart',
1128
-        'desc' => '',
1129
-        'id' => 'geodir_map_default_settings'),
1126
+	array('name' => __('Default map settings', 'geodirectory'),
1127
+		'type' => 'sectionstart',
1128
+		'desc' => '',
1129
+		'id' => 'geodir_map_default_settings'),
1130 1130
 
1131
-    array(
1132
-        'name' => '',
1133
-        'desc' => '',
1134
-        'id' => 'map_default_settings',
1135
-        'type' => 'map_default_settings',
1136
-        'css' => 'min-width:300px;',
1137
-        'std' => '' // Default value for the page title - changed in settings
1138
-    ),
1131
+	array(
1132
+		'name' => '',
1133
+		'desc' => '',
1134
+		'id' => 'map_default_settings',
1135
+		'type' => 'map_default_settings',
1136
+		'css' => 'min-width:300px;',
1137
+		'std' => '' // Default value for the page title - changed in settings
1138
+	),
1139 1139
 
1140
-    array(
1141
-        'name' => __('Upload map default marker icon', 'geodirectory'),
1142
-        'desc' => '',
1143
-        'id' => 'geodir_default_marker_icon',
1144
-        'type' => 'file',
1145
-        'std' => '0',
1146
-        'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1147
-    ),
1148
-    // add option that allows enable/disable map dragging to phone devices
1149
-    array(
1150
-        'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1151
-        'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1152
-        'id' => 'geodir_map_onoff_dragging',
1153
-        'type' => 'checkbox',
1154
-        'std' => '0' // Default value to show home top section
1155
-    ),
1156
-    array(
1157
-        'name' => __('Select Maps API', 'geodirectory'),
1158
-        'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1159
-        'tip' => '',
1160
-        'id' => 'geodir_load_map',
1161
-        'css' => 'min-width:300px;',
1162
-        'std' => 'auto',
1163
-        'type' => 'select',
1164
-        'placeholder_text' => __('Select Map', 'geodirectory'),
1165
-        'options' => array(
1166
-                        'auto' => __('Load Automatic', 'geodirectory'),
1167
-                        'google' => __('Load Google Maps API', 'geodirectory'),
1168
-                        'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1169
-                        'none' => __('Disable Maps', 'geodirectory')
1170
-                    )
1171
-    ),
1172
-
1173
-    array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1174
-
1175
-    array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1176
-        'type' => 'sectionstart',
1177
-        'desc' => '',
1178
-        'id' => 'geodir_map_settings'),
1140
+	array(
1141
+		'name' => __('Upload map default marker icon', 'geodirectory'),
1142
+		'desc' => '',
1143
+		'id' => 'geodir_default_marker_icon',
1144
+		'type' => 'file',
1145
+		'std' => '0',
1146
+		'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section
1147
+	),
1148
+	// add option that allows enable/disable map dragging to phone devices
1149
+	array(
1150
+		'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
1151
+		'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
1152
+		'id' => 'geodir_map_onoff_dragging',
1153
+		'type' => 'checkbox',
1154
+		'std' => '0' // Default value to show home top section
1155
+	),
1156
+	array(
1157
+		'name' => __('Select Maps API', 'geodirectory'),
1158
+		'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
1159
+		'tip' => '',
1160
+		'id' => 'geodir_load_map',
1161
+		'css' => 'min-width:300px;',
1162
+		'std' => 'auto',
1163
+		'type' => 'select',
1164
+		'placeholder_text' => __('Select Map', 'geodirectory'),
1165
+		'options' => array(
1166
+						'auto' => __('Load Automatic', 'geodirectory'),
1167
+						'google' => __('Load Google Maps API', 'geodirectory'),
1168
+						'osm' => __('Load OpenStreetMap API', 'geodirectory'),
1169
+						'none' => __('Disable Maps', 'geodirectory')
1170
+					)
1171
+	),
1179 1172
 
1180
-    array(
1181
-        'name' => __('Select Map Category', 'geodirectory'),
1182
-        'desc' => '',
1183
-        'id' => 'geodir_map_settings',
1184
-        'type' => 'map',
1185
-        'css' => 'min-width:300px;',
1186
-        'std' => '' // Default value for the page title - changed in settings
1187
-    ),
1188
-
1189
-    array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1190
-    /* Map Settings End */
1173
+	array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
1174
+
1175
+	array('name' => __('Show / hide post type and category on map', 'geodirectory'),
1176
+		'type' => 'sectionstart',
1177
+		'desc' => '',
1178
+		'id' => 'geodir_map_settings'),
1179
+
1180
+	array(
1181
+		'name' => __('Select Map Category', 'geodirectory'),
1182
+		'desc' => '',
1183
+		'id' => 'geodir_map_settings',
1184
+		'type' => 'map',
1185
+		'css' => 'min-width:300px;',
1186
+		'std' => '' // Default value for the page title - changed in settings
1187
+	),
1188
+
1189
+	array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
1190
+	/* Map Settings End */
1191 1191
 
1192 1192
 )); // End Design settings
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 
15 15
 
16 16
 if (function_exists('geodir_location_geo_home_link')) {
17
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
18 18
 }
19 19
 $search_url = trailingslashit(get_home_url());
20 20
 if (function_exists('geodir_location_geo_home_link')) {
21
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
21
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
22 22
 }
23 23
 
24 24
 
25 25
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
26 26
 $form_class = 'geodir-listing-search';
27 27
 if($new_style){
28
-    $form_class .= ' gd-search-bar-style';
28
+	$form_class .= ' gd-search-bar-style';
29 29
 }
30 30
 ?>
31 31
 
@@ -44,56 +44,56 @@  discard block
 block discarded – undo
44 44
     <div class="geodir-loc-bar">
45 45
 
46 46
         <?php
47
-        /**
48
-         * Called inside the search form but before any of the fields.
49
-         *
50
-         * @since 1.0.0
51
-         */
52
-        do_action('geodir_before_search_form') ?>
47
+		/**
48
+		 * Called inside the search form but before any of the fields.
49
+		 *
50
+		 * @since 1.0.0
51
+		 */
52
+		do_action('geodir_before_search_form') ?>
53 53
 
54 54
         <div class="clearfix geodir-loc-bar-in">
55 55
             <div class="geodir-search">
56 56
 
57 57
                 <?php
58 58
 
59
-                /**
60
-                 * Adds the input fields to the search form.
61
-                 *
62
-                 * @since 1.6.9
63
-                 */
64
-                do_action('geodir_search_form_inputs');
59
+				/**
60
+				 * Adds the input fields to the search form.
61
+				 *
62
+				 * @since 1.6.9
63
+				 */
64
+				do_action('geodir_search_form_inputs');
65 65
 
66 66
 
67 67
 
68
-                /**
69
-                 * Called on the GD search form just before the search button.
70
-                 *
71
-                 * @since 1.0.0
72
-                 */
73
-                do_action('geodir_before_search_button');
68
+				/**
69
+				 * Called on the GD search form just before the search button.
70
+				 *
71
+				 * @since 1.0.0
72
+				 */
73
+				do_action('geodir_before_search_button');
74 74
 
75 75
                 
76
-                /**
77
-                 * Called on the GD search form just after the search button.
78
-                 *
79
-                 * @since 1.0.0
80
-                 */
81
-                do_action('geodir_after_search_button');
76
+				/**
77
+				 * Called on the GD search form just after the search button.
78
+				 *
79
+				 * @since 1.0.0
80
+				 */
81
+				do_action('geodir_after_search_button');
82 82
 
83 83
                 
84
-                ?>
84
+				?>
85 85
             </div>
86 86
 
87 87
 
88 88
         </div>
89 89
 
90 90
         <?php
91
-        /**
92
-         * Called inside the search form but after all the input fields.
93
-         *
94
-         * @since 1.0.0
95
-         */
96
-        do_action('geodir_after_search_form') ?>
91
+		/**
92
+		 * Called inside the search form but after all the input fields.
93
+		 *
94
+		 * @since 1.0.0
95
+		 */
96
+		do_action('geodir_after_search_form') ?>
97 97
 
98 98
 
99 99
     </div>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
26 26
 $form_class = 'geodir-listing-search';
27
-if($new_style){
27
+if ($new_style) {
28 28
     $form_class .= ' gd-search-bar-style';
29 29
 }
30 30
 ?>
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 $field_admin_title = '';
46 46
 if (isset($field_info->admin_title))
47
-    $field_admin_title = $field_info->admin_title;
47
+	$field_admin_title = $field_info->admin_title;
48 48
 
49 49
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
50 50
 
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 //print_r($field_info);
65 65
 
66 66
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
67
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68 68
 }elseif(isset($cf['icon']) && $cf['icon']){
69
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
69
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70 70
 }else{
71
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 72
 }
73 73
 
74 74
 if(isset($cf['name']) && $cf['name']){
75
-    $field_type_name = $cf['name'];
75
+	$field_type_name = $cf['name'];
76 76
 }else{
77
-    $field_type_name = $field_type;
77
+	$field_type_name = $field_type;
78 78
 }
79 79
 
80 80
 ?>
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
85 85
         <?php
86 86
 
87
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
88
-        ?>
87
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
88
+		?>
89 89
 
90 90
         <?php if ($default): ?>
91 91
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
@@ -94,37 +94,37 @@  discard block
 block discarded – undo
94 94
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
95 95
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
96 96
         <?php endif;
97
-        if ($field_type == 'fieldset') {
98
-            ?>
97
+		if ($field_type == 'fieldset') {
98
+			?>
99 99
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
100 100
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
101 101
             <b style="cursor:pointer;"
102 102
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
103 103
         <?php
104
-        } else {echo $field_icon;
105
-            ?>
104
+		} else {echo $field_icon;
105
+			?>
106 106
             <b style="cursor:pointer;"
107 107
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
108 108
         <?php
109
-        }
110
-        ?>
109
+		}
110
+		?>
111 111
     </div>
112 112
 
113 113
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
114 114
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
115 115
          style="display:<?php if ($field_ins_upd == 'submit') {
116
-             echo 'block;';
117
-         } else {
118
-             echo 'none;';
119
-         } ?>">
116
+			 echo 'block;';
117
+		 } else {
118
+			 echo 'none;';
119
+		 } ?>">
120 120
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
121 121
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
122 122
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
123 123
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
124 124
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
125 125
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
126
-            echo $field_info->data_type;
127
-        } ?>"/>
126
+			echo $field_info->data_type;
127
+		} ?>"/>
128 128
         <input type="hidden" name="is_active" id="is_active" value="1"/>
129 129
 
130 130
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -136,37 +136,37 @@  discard block
 block discarded – undo
136 136
 
137 137
             <?php
138 138
 
139
-            // data_type
140
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
139
+			// data_type
140
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
141 141
 
142
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
142
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
143 143
 
144
-            }else{
145
-                $value = '';
146
-                if (isset($field_info->data_type)) {
147
-                    $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149
-                    $value = $cf['defaults']['data_type'];
150
-                }
151
-                ?>
144
+			}else{
145
+				$value = '';
146
+				if (isset($field_info->data_type)) {
147
+					$value = esc_attr($field_info->data_type);
148
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149
+					$value = $cf['defaults']['data_type'];
150
+				}
151
+				?>
152 152
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
153 153
             <?php
154
-            }
154
+			}
155 155
 
156 156
 
157
-            // admin_title
158
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
157
+			// admin_title
158
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
159 159
 
160
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
160
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
161 161
 
162
-            }else{
163
-                $value = '';
164
-                if (isset($field_info->admin_title)) {
165
-                    $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167
-                    $value = $cf['defaults']['admin_title'];
168
-                }
169
-                ?>
162
+			}else{
163
+				$value = '';
164
+				if (isset($field_info->admin_title)) {
165
+					$value = esc_attr($field_info->admin_title);
166
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167
+					$value = $cf['defaults']['admin_title'];
168
+				}
169
+				?>
170 170
                 <li>
171 171
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
172 172
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -180,22 +180,22 @@  discard block
 block discarded – undo
180 180
                     </div>
181 181
                 </li>
182 182
                 <?php
183
-            }
183
+			}
184 184
 
185 185
 
186
-            // site_title
187
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
186
+			// site_title
187
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
188 188
 
189
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
189
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
190 190
 
191
-            }else{
192
-                $value = '';
193
-                if (isset($field_info->site_title)) {
194
-                    $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196
-                    $value = $cf['defaults']['site_title'];
197
-                }
198
-                ?>
191
+			}else{
192
+				$value = '';
193
+				if (isset($field_info->site_title)) {
194
+					$value = esc_attr($field_info->site_title);
195
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196
+					$value = $cf['defaults']['site_title'];
197
+				}
198
+				?>
199 199
                 <li>
200 200
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
201 201
                         <div class="gdcf-tooltip">
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
                     </div>
209 209
                 </li>
210 210
                 <?php
211
-            }
211
+			}
212 212
 
213 213
 
214
-            // admin_desc
215
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
214
+			// admin_desc
215
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
216 216
 
217
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
217
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
218 218
 
219
-            }else{
220
-                $value = '';
221
-                if (isset($field_info->admin_desc)) {
222
-                    $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224
-                    $value = $cf['defaults']['admin_desc'];
225
-                }
226
-                ?>
219
+			}else{
220
+				$value = '';
221
+				if (isset($field_info->admin_desc)) {
222
+					$value = esc_attr($field_info->admin_desc);
223
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224
+					$value = $cf['defaults']['admin_desc'];
225
+				}
226
+				?>
227 227
                 <li>
228 228
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
229 229
                         <div class="gdcf-tooltip">
@@ -235,23 +235,23 @@  discard block
 block discarded – undo
235 235
                     </div>
236 236
                 </li>
237 237
                 <?php
238
-            }
238
+			}
239 239
 
240 240
 
241 241
 
242
-            // htmlvar_name
243
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
242
+			// htmlvar_name
243
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
244 244
 
245
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
245
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
246 246
 
247
-            }else{
248
-                $value = '';
249
-                if (isset($field_info->htmlvar_name)) {
250
-                    $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252
-                    $value = $cf['defaults']['htmlvar_name'];
253
-                }
254
-                ?>
247
+			}else{
248
+				$value = '';
249
+				if (isset($field_info->htmlvar_name)) {
250
+					$value = esc_attr($field_info->htmlvar_name);
251
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252
+					$value = $cf['defaults']['htmlvar_name'];
253
+				}
254
+				?>
255 255
                 <li>
256 256
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
257 257
                         <div class="gdcf-tooltip">
@@ -261,29 +261,29 @@  discard block
 block discarded – undo
261 261
                     <div class="gd-cf-input-wrap">
262 262
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
263 263
                                value="<?php if ($value) {
264
-                                   echo preg_replace('/geodir_/', '', $value, 1);
265
-                               }?>" <?php if ($default) {
266
-                            echo 'readonly="readonly"';
267
-                        }?> />
264
+								   echo preg_replace('/geodir_/', '', $value, 1);
265
+							   }?>" <?php if ($default) {
266
+							echo 'readonly="readonly"';
267
+						}?> />
268 268
                     </div>
269 269
                 </li>
270 270
                 <?php
271
-            }
271
+			}
272 272
 
273 273
 
274
-            // is_active
275
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
274
+			// is_active
275
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
276 276
 
277
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
277
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
278 278
 
279
-            }else{
280
-                $value = '';
281
-                if (isset($field_info->is_active)) {
282
-                    $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284
-                    $value = $cf['defaults']['is_active'];
285
-                }
286
-                ?>
279
+			}else{
280
+				$value = '';
281
+				if (isset($field_info->is_active)) {
282
+					$value = esc_attr($field_info->is_active);
283
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284
+					$value = $cf['defaults']['is_active'];
285
+				}
286
+				?>
287 287
                 <li <?php echo $field_display; ?>>
288 288
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
289 289
                         <div class="gdcf-tooltip">
@@ -294,35 +294,35 @@  discard block
 block discarded – undo
294 294
 
295 295
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
296 296
                             <?php if ($value == '1') {
297
-                                echo 'checked';
298
-                            } ?>/>
297
+								echo 'checked';
298
+							} ?>/>
299 299
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
300 300
 
301 301
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
302 302
                             <?php if ($value == '0' || !$value) {
303
-                                echo 'checked';
304
-                            } ?>/>
303
+								echo 'checked';
304
+							} ?>/>
305 305
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
306 306
 
307 307
                     </div>
308 308
                 </li>
309 309
                 <?php
310
-            }
310
+			}
311 311
 
312 312
 
313
-            // for_admin_use
314
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
313
+			// for_admin_use
314
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
315 315
 
316
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
316
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
317 317
 
318
-            }else{
319
-                $value = '';
320
-                if (isset($field_info->for_admin_use)) {
321
-                    $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323
-                    $value = $cf['defaults']['for_admin_use'];
324
-                }
325
-                ?>
318
+			}else{
319
+				$value = '';
320
+				if (isset($field_info->for_admin_use)) {
321
+					$value = esc_attr($field_info->for_admin_use);
322
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323
+					$value = $cf['defaults']['for_admin_use'];
324
+				}
325
+				?>
326 326
                 <li>
327 327
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
328 328
                         <div class="gdcf-tooltip">
@@ -333,47 +333,47 @@  discard block
 block discarded – undo
333 333
 
334 334
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
335 335
                             <?php if ($value == '1') {
336
-                                echo 'checked';
337
-                            } ?>/>
336
+								echo 'checked';
337
+							} ?>/>
338 338
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
339 339
 
340 340
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
341 341
                             <?php if ($value == '0' || !$value) {
342
-                                echo 'checked';
343
-                            } ?>/>
342
+								echo 'checked';
343
+							} ?>/>
344 344
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
345 345
 
346 346
                     </div>
347 347
                 </li>
348 348
                 <?php
349
-            }
349
+			}
350 350
 
351 351
 
352
-            // default_value
353
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
352
+			// default_value
353
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
354 354
 
355
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
355
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
356 356
 
357
-            }else{
358
-                $value = '';
359
-                if (isset($field_info->default_value)) {
360
-                    $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362
-                    $value = $cf['defaults']['default_value'];
363
-                }
364
-                ?>
357
+			}else{
358
+				$value = '';
359
+				if (isset($field_info->default_value)) {
360
+					$value = esc_attr($field_info->default_value);
361
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362
+					$value = $cf['defaults']['default_value'];
363
+				}
364
+				?>
365 365
                 <li>
366 366
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
367 367
                         <div class="gdcf-tooltip">
368 368
                             <?php
369
-                            if ($field_type == 'checkbox') {
370
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
371
-                            } else if ($field_type == 'email') {
372
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
373
-                            } else {
374
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
375
-                            }
376
-                            ?>
369
+							if ($field_type == 'checkbox') {
370
+								_e('Should the checkbox be checked by default?', 'geodirectory');
371
+							} else if ($field_type == 'email') {
372
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
373
+							} else {
374
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
375
+							}
376
+							?>
377 377
                         </div>
378 378
                     </label>
379 379
                     <div class="gd-cf-input-wrap">
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
                     </div>
391 391
                 </li>
392 392
                 <?php
393
-            }
393
+			}
394 394
 
395 395
 
396
-            // show_in
397
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
396
+			// show_in
397
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
398 398
 
399
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
399
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
400 400
 
401
-            }else{
402
-                $value = '';
403
-                if (isset($field_info->show_in)) {
404
-                    $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406
-                    $value = esc_attr($cf['defaults']['show_in']);
407
-                }
408
-                ?>
401
+			}else{
402
+				$value = '';
403
+				if (isset($field_info->show_in)) {
404
+					$value = esc_attr($field_info->show_in);
405
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406
+					$value = esc_attr($cf['defaults']['show_in']);
407
+				}
408
+				?>
409 409
                 <li>
410 410
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
411 411
                         <div class="gdcf-tooltip">
@@ -416,42 +416,42 @@  discard block
 block discarded – undo
416 416
 
417 417
                         <?php
418 418
 
419
-                        /*
419
+						/*
420 420
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
421 421
 						 */
422
-                        $show_in_locations = array(
423
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
424
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
425
-                            "[listing]" => __("Listings page", 'geodirectory'),
426
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
427
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
428
-                        );
429
-
430
-                        /**
431
-                         * Filter the locations array for where to display custom fields.
432
-                         *
433
-                         * @since 1.6.6
434
-                         * @param array $show_in_locations The array of locations and descriptions.
435
-                         * @param object $field_info The field being displayed info.
436
-                         * @param string $field_info The type of field.
437
-                         */
438
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
422
+						$show_in_locations = array(
423
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
424
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
425
+							"[listing]" => __("Listings page", 'geodirectory'),
426
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
427
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
428
+						);
429
+
430
+						/**
431
+						 * Filter the locations array for where to display custom fields.
432
+						 *
433
+						 * @since 1.6.6
434
+						 * @param array $show_in_locations The array of locations and descriptions.
435
+						 * @param object $field_info The field being displayed info.
436
+						 * @param string $field_info The type of field.
437
+						 */
438
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
439 439
 
440 440
 
441
-                        // remove some locations for some field types
441
+						// remove some locations for some field types
442 442
 
443
-                        // don't show new tab option for some types
443
+						// don't show new tab option for some types
444 444
 
445
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
447
-                            unset($show_in_locations['[owntab]']);
448
-                        }
445
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
+						}else{
447
+							unset($show_in_locations['[owntab]']);
448
+						}
449 449
 
450
-                        if(!$display_on_listing){
451
-                            unset($show_in_locations['[listings]']);
452
-                        }
450
+						if(!$display_on_listing){
451
+							unset($show_in_locations['[listings]']);
452
+						}
453 453
 
454
-                        ?>
454
+						?>
455 455
 
456 456
                         <select multiple="multiple" name="show_in[]"
457 457
                                 id="show_in"
@@ -461,38 +461,38 @@  discard block
 block discarded – undo
461 461
                                 option-ajaxchosen="false">
462 462
                             <?php
463 463
 
464
-                            $show_in_values = explode(',',$value);
464
+							$show_in_values = explode(',',$value);
465 465
 
466
-                            foreach( $show_in_locations as $key => $val){
467
-                                $selected = '';
466
+							foreach( $show_in_locations as $key => $val){
467
+								$selected = '';
468 468
 
469
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
470
-                                    $selected = 'selected';
471
-                                }
469
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
470
+									$selected = 'selected';
471
+								}
472 472
 
473
-                                ?>
473
+								?>
474 474
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
475 475
                                 <?php
476
-                            }
477
-                            ?>
476
+							}
477
+							?>
478 478
                         </select>
479 479
                     </div>
480 480
                 </li>
481 481
                 <?php
482
-            }
482
+			}
483 483
 
484 484
 
485
-            // advanced_editor
486
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
485
+			// advanced_editor
486
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
487 487
 
488
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
488
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
489 489
 
490
-            }
490
+			}
491 491
 
492 492
 
493 493
 
494 494
 
495
-            ?>
495
+			?>
496 496
 
497 497
 
498 498
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -505,38 +505,38 @@  discard block
 block discarded – undo
505 505
 
506 506
             <?php
507 507
 
508
-            $pricearr = array();
509
-            if (isset($field_info->packages) && $field_info->packages != '') {
510
-                $pricearr = explode(',', trim($field_info->packages, ','));
511
-            } else {
512
-                $package_info = array();
508
+			$pricearr = array();
509
+			if (isset($field_info->packages) && $field_info->packages != '') {
510
+				$pricearr = explode(',', trim($field_info->packages, ','));
511
+			} else {
512
+				$package_info = array();
513 513
 
514
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
515
-                $pricearr[] = $package_info->pid;
516
-            }
514
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
515
+				$pricearr[] = $package_info->pid;
516
+			}
517 517
 
518
-            ob_start()
519
-            ?>
518
+			ob_start()
519
+			?>
520 520
 
521 521
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
522 522
                 <?php
523
-                if (!empty($pricearr)) {
524
-                    foreach ($pricearr as $val) {
525
-                        ?>
523
+				if (!empty($pricearr)) {
524
+					foreach ($pricearr as $val) {
525
+						?>
526 526
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
527
-                    }
528
-                }
529
-                ?>
527
+					}
528
+				}
529
+				?>
530 530
             </select>
531 531
 
532 532
             <?php
533
-            $html = ob_get_clean();
533
+			$html = ob_get_clean();
534 534
 
535 535
 			/**
536 536
 			 * Filter the price packages list.
537 537
 			 *
538 538
 			 * Filter the price packages list in custom field form in admin
539
-             * custom fields settings.
539
+			 * custom fields settings.
540 540
 			 *
541 541
 			 * @since 1.0.0
542 542
 			 *
@@ -545,25 +545,25 @@  discard block
 block discarded – undo
545 545
 			 */
546 546
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
547 547
 
548
-            ?>
548
+			?>
549 549
 
550 550
 
551 551
 
552 552
             <?php
553 553
 
554
-            // is_required
555
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
554
+			// is_required
555
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
556 556
 
557
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
557
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558 558
 
559
-            }else{
560
-                $value = '';
561
-                if (isset($field_info->is_required)) {
562
-                    $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564
-                    $value = $cf['defaults']['is_required'];
565
-                }
566
-                ?>
559
+			}else{
560
+				$value = '';
561
+				if (isset($field_info->is_required)) {
562
+					$value = esc_attr($field_info->is_required);
563
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564
+					$value = $cf['defaults']['is_required'];
565
+				}
566
+				?>
567 567
                 <li>
568 568
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
569 569
                         <div class="gdcf-tooltip">
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
 
576 576
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
577 577
                             <?php if ($value == '1') {
578
-                                echo 'checked';
579
-                            } ?>/>
578
+								echo 'checked';
579
+							} ?>/>
580 580
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
581 581
 
582 582
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
583 583
                             <?php if ($value == '0' || !$value) {
584
-                                echo 'checked';
585
-                            } ?>/>
584
+								echo 'checked';
585
+							} ?>/>
586 586
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
587 587
 
588 588
                     </div>
@@ -590,21 +590,21 @@  discard block
 block discarded – undo
590 590
                 </li>
591 591
 
592 592
                 <?php
593
-            }
593
+			}
594 594
 
595
-            // required_msg
596
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
595
+			// required_msg
596
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
597 597
 
598
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
598
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599 599
 
600
-            }else{
601
-                $value = '';
602
-                if (isset($field_info->required_msg)) {
603
-                    $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605
-                    $value = $cf['defaults']['required_msg'];
606
-                }
607
-                ?>
600
+			}else{
601
+				$value = '';
602
+				if (isset($field_info->required_msg)) {
603
+					$value = esc_attr($field_info->required_msg);
604
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605
+					$value = $cf['defaults']['required_msg'];
606
+				}
607
+				?>
608 608
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
609 609
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
610 610
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -618,38 +618,38 @@  discard block
 block discarded – undo
618 618
                     </div>
619 619
                 </li>
620 620
                 <?php
621
-            }
621
+			}
622 622
 
623 623
 
624
-            // required_msg
625
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
624
+			// required_msg
625
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
626 626
 
627
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
627
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
628 628
 
629
-            }
629
+			}
630 630
 
631 631
 
632
-            // extra_fields
633
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
632
+			// extra_fields
633
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
634 634
 
635
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
635
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
636 636
 
637
-            }
637
+			}
638 638
 
639 639
 
640
-            // field_icon
641
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
640
+			// field_icon
641
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
642 642
 
643
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
643
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644 644
 
645
-            }else{
646
-                $value = '';
647
-                if (isset($field_info->field_icon)) {
648
-                    $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650
-                    $value = $cf['defaults']['field_icon'];
651
-                }
652
-                ?>
645
+			}else{
646
+				$value = '';
647
+				if (isset($field_info->field_icon)) {
648
+					$value = esc_attr($field_info->field_icon);
649
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650
+					$value = $cf['defaults']['field_icon'];
651
+				}
652
+				?>
653 653
                 <li>
654 654
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
655 655
 
@@ -667,22 +667,22 @@  discard block
 block discarded – undo
667 667
 
668 668
                 </li>
669 669
                 <?php
670
-            }
670
+			}
671 671
 
672 672
 
673
-            // css_class
674
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
673
+			// css_class
674
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
675 675
 
676
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
676
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677 677
 
678
-            }else{
679
-                $value = '';
680
-                if (isset($field_info->css_class)) {
681
-                    $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683
-                    $value = $cf['defaults']['css_class'];
684
-                }
685
-                ?>
678
+			}else{
679
+				$value = '';
680
+				if (isset($field_info->css_class)) {
681
+					$value = esc_attr($field_info->css_class);
682
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683
+					$value = $cf['defaults']['css_class'];
684
+				}
685
+				?>
686 686
                 <li>
687 687
 
688 688
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -695,47 +695,47 @@  discard block
 block discarded – undo
695 695
                     <div class="gd-cf-input-wrap">
696 696
                         <input type="text" name="css_class" id="css_class"
697 697
                                value="<?php if (isset($field_info->css_class)) {
698
-                                   echo esc_attr($field_info->css_class);
699
-                               }?>"/>
698
+								   echo esc_attr($field_info->css_class);
699
+							   }?>"/>
700 700
                     </div>
701 701
                 </li>
702 702
                 <?php
703
-            }
703
+			}
704 704
 
705 705
 
706
-            // cat_sort
707
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
706
+			// cat_sort
707
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
708 708
 
709
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
709
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710 710
 
711
-            }else{
712
-                $value = '';
713
-                $hide_cat_sort  ='';
714
-                if (isset($field_info->cat_sort)) {
715
-                    $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717
-                    $value = $cf['defaults']['cat_sort'];
718
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719
-                }
711
+			}else{
712
+				$value = '';
713
+				$hide_cat_sort  ='';
714
+				if (isset($field_info->cat_sort)) {
715
+					$value = esc_attr($field_info->cat_sort);
716
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717
+					$value = $cf['defaults']['cat_sort'];
718
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719
+				}
720 720
 
721
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
722
-                ?>
721
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
722
+				?>
723 723
                 <li <?php echo $hide_cat_sort ;?>>
724 724
                     <h3><?php
725
-                        /**
726
-                         * Filter the section title.
727
-                         *
728
-                         * Filter the section title in custom field form in admin
729
-                         * custom fields settings.
730
-                         *
731
-                         * @since 1.0.0
732
-                         *
733
-                         * @param string $title Title of the section.
734
-                         * @param string $field_type Current field type.
735
-                         */
736
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
737
-
738
-                        ?></h3>
725
+						/**
726
+						 * Filter the section title.
727
+						 *
728
+						 * Filter the section title in custom field form in admin
729
+						 * custom fields settings.
730
+						 *
731
+						 * @since 1.0.0
732
+						 *
733
+						 * @param string $title Title of the section.
734
+						 * @param string $field_type Current field type.
735
+						 */
736
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
737
+
738
+						?></h3>
739 739
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
740 740
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
741 741
                         <div class="gdcf-tooltip">
@@ -747,42 +747,42 @@  discard block
 block discarded – undo
747 747
 
748 748
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
749 749
                             <?php if ($value == '1') {
750
-                                echo 'checked';
751
-                            } ?>/>
750
+								echo 'checked';
751
+							} ?>/>
752 752
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
753 753
 
754 754
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
755 755
                             <?php if (!$value) {
756
-                                echo 'checked';
757
-                            } ?>/>
756
+								echo 'checked';
757
+							} ?>/>
758 758
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
759 759
 
760 760
                     </div>
761 761
                 </li>
762 762
                 <?php
763
-            }
764
-
765
-
766
-
767
-            switch ($field_type):
768
-                case 'html':
769
-                case 'file':
770
-                case 'url':
771
-                case 'fieldset':
772
-                    break;
773
-                default:
774
-
775
-                    /**
776
-                     * Called at the end of the advanced custom fields settings page loop.
777
-                     *
778
-                     * Can be used to add or deal with different settings types.
779
-                     *
780
-                     * @since 1.0.0
781
-                     * @since 1.6.6 $cf param added.
782
-                     * @param object $field_info The current fields info.
783
-                     * @param array $cf The custom field settings
784
-                     */
785
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
763
+			}
764
+
765
+
766
+
767
+			switch ($field_type):
768
+				case 'html':
769
+				case 'file':
770
+				case 'url':
771
+				case 'fieldset':
772
+					break;
773
+				default:
774
+
775
+					/**
776
+					 * Called at the end of the advanced custom fields settings page loop.
777
+					 *
778
+					 * Can be used to add or deal with different settings types.
779
+					 *
780
+					 * @since 1.0.0
781
+					 * @since 1.6.6 $cf param added.
782
+					 * @param object $field_info The current fields info.
783
+					 * @param array $cf The custom field settings
784
+					 */
785
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
786 786
 
787 787
 
788 788
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
42 42
 
43
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
43
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
44 44
 
45 45
 $field_admin_title = '';
46 46
 if (isset($field_info->admin_title))
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 
66 66
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67 67
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68
-}elseif(isset($cf['icon']) && $cf['icon']){
68
+}elseif (isset($cf['icon']) && $cf['icon']) {
69 69
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70
-}else{
70
+} else {
71 71
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 72
 }
73 73
 
74
-if(isset($cf['name']) && $cf['name']){
74
+if (isset($cf['name']) && $cf['name']) {
75 75
     $field_type_name = $cf['name'];
76
-}else{
76
+} else {
77 77
     $field_type_name = $field_type;
78 78
 }
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
85 85
         <?php
86 86
 
87
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
87
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
88 88
         ?>
89 89
 
90 90
         <?php if ($default): ?>
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
100 100
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
101 101
             <b style="cursor:pointer;"
102
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
102
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
103 103
         <?php
104 104
         } else {echo $field_icon;
105 105
             ?>
106 106
             <b style="cursor:pointer;"
107
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
107
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
108 108
         <?php
109 109
         }
110 110
         ?>
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
         } ?>"/>
128 128
         <input type="hidden" name="is_active" id="is_active" value="1"/>
129 129
 
130
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
131
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
132
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
133
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
130
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
131
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
132
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
133
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
134 134
 
135 135
         <ul class="widefat post fixed" border="0" style="width:100%;">
136 136
 
137 137
             <?php
138 138
 
139 139
             // data_type
140
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
140
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
141 141
 
142
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
142
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
143 143
 
144
-            }else{
144
+            } else {
145 145
                 $value = '';
146 146
                 if (isset($field_info->data_type)) {
147 147
                     $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
148
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
149 149
                     $value = $cf['defaults']['data_type'];
150 150
                 }
151 151
                 ?>
152
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
152
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
153 153
             <?php
154 154
             }
155 155
 
156 156
 
157 157
             // admin_title
158
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
158
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
159 159
 
160
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
160
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
161 161
 
162
-            }else{
162
+            } else {
163 163
                 $value = '';
164 164
                 if (isset($field_info->admin_title)) {
165 165
                     $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
166
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
167 167
                     $value = $cf['defaults']['admin_title'];
168 168
                 }
169 169
                 ?>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </label>
177 177
                     <div class="gd-cf-input-wrap">
178 178
                         <input type="text" name="admin_title" id="admin_title"
179
-                               value="<?php echo $value;?>"/>
179
+                               value="<?php echo $value; ?>"/>
180 180
                     </div>
181 181
                 </li>
182 182
                 <?php
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 
185 185
 
186 186
             // site_title
187
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
187
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
188 188
 
189
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
189
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
190 190
 
191
-            }else{
191
+            } else {
192 192
                 $value = '';
193 193
                 if (isset($field_info->site_title)) {
194 194
                     $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
195
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
196 196
                     $value = $cf['defaults']['site_title'];
197 197
                 }
198 198
                 ?>
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 
213 213
 
214 214
             // admin_desc
215
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
215
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
216 216
 
217
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
217
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
218 218
 
219
-            }else{
219
+            } else {
220 220
                 $value = '';
221 221
                 if (isset($field_info->admin_desc)) {
222 222
                     $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
223
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
224 224
                     $value = $cf['defaults']['admin_desc'];
225 225
                 }
226 226
                 ?>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                         </div>
232 232
                     </label>
233 233
                     <div class="gd-cf-input-wrap">
234
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
234
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
235 235
                     </div>
236 236
                 </li>
237 237
                 <?php
@@ -240,26 +240,26 @@  discard block
 block discarded – undo
240 240
 
241 241
 
242 242
             // htmlvar_name
243
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
243
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
244 244
 
245
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
245
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
246 246
 
247
-            }else{
247
+            } else {
248 248
                 $value = '';
249 249
                 if (isset($field_info->htmlvar_name)) {
250 250
                     $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
251
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
252 252
                     $value = $cf['defaults']['htmlvar_name'];
253 253
                 }
254 254
                 ?>
255 255
                 <li>
256
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
256
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
257 257
                         <div class="gdcf-tooltip">
258 258
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
259 259
                         </div>
260 260
                     </label>
261 261
                     <div class="gd-cf-input-wrap">
262
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
262
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
263 263
                                value="<?php if ($value) {
264 264
                                    echo preg_replace('/geodir_/', '', $value, 1);
265 265
                                }?>" <?php if ($default) {
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 
273 273
 
274 274
             // is_active
275
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
275
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
276 276
 
277
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
277
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
278 278
 
279
-            }else{
279
+            } else {
280 280
                 $value = '';
281 281
                 if (isset($field_info->is_active)) {
282 282
                     $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
283
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
284 284
                     $value = $cf['defaults']['is_active'];
285 285
                 }
286 286
                 ?>
@@ -292,17 +292,17 @@  discard block
 block discarded – undo
292 292
                     </label>
293 293
                     <div class="gd-cf-input-wrap gd-switch">
294 294
 
295
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
295
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
296 296
                             <?php if ($value == '1') {
297 297
                                 echo 'checked';
298 298
                             } ?>/>
299
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
299
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
300 300
 
301
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
301
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
302 302
                             <?php if ($value == '0' || !$value) {
303 303
                                 echo 'checked';
304 304
                             } ?>/>
305
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
305
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
306 306
 
307 307
                     </div>
308 308
                 </li>
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 
312 312
 
313 313
             // for_admin_use
314
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
314
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
315 315
 
316
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
316
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
317 317
 
318
-            }else{
318
+            } else {
319 319
                 $value = '';
320 320
                 if (isset($field_info->for_admin_use)) {
321 321
                     $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
322
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
323 323
                     $value = $cf['defaults']['for_admin_use'];
324 324
                 }
325 325
                 ?>
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
                     </label>
332 332
                     <div class="gd-cf-input-wrap gd-switch">
333 333
 
334
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
334
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
335 335
                             <?php if ($value == '1') {
336 336
                                 echo 'checked';
337 337
                             } ?>/>
338
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
338
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
339 339
 
340
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
340
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
341 341
                             <?php if ($value == '0' || !$value) {
342 342
                                 echo 'checked';
343 343
                             } ?>/>
344
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
344
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
345 345
 
346 346
                     </div>
347 347
                 </li>
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
 
351 351
 
352 352
             // default_value
353
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
353
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
354 354
 
355
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
355
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
356 356
 
357
-            }else{
357
+            } else {
358 358
                 $value = '';
359 359
                 if (isset($field_info->default_value)) {
360 360
                     $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
361
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
362 362
                     $value = $cf['defaults']['default_value'];
363 363
                 }
364 364
                 ?>
365 365
                 <li>
366
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
366
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
367 367
                         <div class="gdcf-tooltip">
368 368
                             <?php
369 369
                             if ($field_type == 'checkbox') {
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
                         <?php if ($field_type == 'checkbox') { ?>
381 381
                             <select name="default_value" id="default_value">
382 382
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
383
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
383
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
384 384
                             </select>
385 385
                         <?php } else if ($field_type == 'email') { ?>
386
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
386
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
387 387
                         <?php } else { ?>
388
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
388
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
389 389
                         <?php } ?>
390 390
                     </div>
391 391
                 </li>
@@ -394,15 +394,15 @@  discard block
 block discarded – undo
394 394
 
395 395
 
396 396
             // show_in
397
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
397
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
398 398
 
399
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
399
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
400 400
 
401
-            }else{
401
+            } else {
402 402
                 $value = '';
403 403
                 if (isset($field_info->show_in)) {
404 404
                     $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
405
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
406 406
                     $value = esc_attr($cf['defaults']['show_in']);
407 407
                 }
408 408
                 ?>
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                          * @param object $field_info The field being displayed info.
436 436
                          * @param string $field_info The type of field.
437 437
                          */
438
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
438
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
439 439
 
440 440
 
441 441
                         // remove some locations for some field types
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
                         // don't show new tab option for some types
444 444
 
445 445
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
446
+                        } else {
447 447
                             unset($show_in_locations['[owntab]']);
448 448
                         }
449 449
 
450
-                        if(!$display_on_listing){
450
+                        if (!$display_on_listing) {
451 451
                             unset($show_in_locations['[listings]']);
452 452
                         }
453 453
 
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
                                 option-ajaxchosen="false">
462 462
                             <?php
463 463
 
464
-                            $show_in_values = explode(',',$value);
464
+                            $show_in_values = explode(',', $value);
465 465
 
466
-                            foreach( $show_in_locations as $key => $val){
466
+                            foreach ($show_in_locations as $key => $val) {
467 467
                                 $selected = '';
468 468
 
469
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
469
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
470 470
                                     $selected = 'selected';
471 471
                                 }
472 472
 
473 473
                                 ?>
474
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
474
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
475 475
                                 <?php
476 476
                             }
477 477
                             ?>
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
             // advanced_editor
486
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
486
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
487 487
 
488
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
488
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
489 489
 
490 490
             }
491 491
 
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 
497 497
 
498 498
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
499
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
499
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
500 500
 
501 501
             <?php // we dont need to show the sort order ?>
502
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
502
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
503 503
 
504 504
 
505 505
 
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
             <?php
553 553
 
554 554
             // is_required
555
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
555
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
556 556
 
557
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
557
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
558 558
 
559
-            }else{
559
+            } else {
560 560
                 $value = '';
561 561
                 if (isset($field_info->is_required)) {
562 562
                     $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
563
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
564 564
                     $value = $cf['defaults']['is_required'];
565 565
                 }
566 566
                 ?>
@@ -573,17 +573,17 @@  discard block
 block discarded – undo
573 573
 
574 574
                     <div class="gd-cf-input-wrap gd-switch">
575 575
 
576
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
576
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
577 577
                             <?php if ($value == '1') {
578 578
                                 echo 'checked';
579 579
                             } ?>/>
580
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
580
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
581 581
 
582
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
582
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
583 583
                             <?php if ($value == '0' || !$value) {
584 584
                                 echo 'checked';
585 585
                             } ?>/>
586
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
586
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
587 587
 
588 588
                     </div>
589 589
 
@@ -593,19 +593,19 @@  discard block
 block discarded – undo
593 593
             }
594 594
 
595 595
             // required_msg
596
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
596
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
597 597
 
598
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
598
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
599 599
 
600
-            }else{
600
+            } else {
601 601
                 $value = '';
602 602
                 if (isset($field_info->required_msg)) {
603 603
                     $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
604
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
605 605
                     $value = $cf['defaults']['required_msg'];
606 606
                 }
607 607
                 ?>
608
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
608
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
609 609
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
610 610
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
611 611
                         <div class="gdcf-tooltip">
@@ -622,31 +622,31 @@  discard block
 block discarded – undo
622 622
 
623 623
 
624 624
             // required_msg
625
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
625
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
626 626
 
627
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
627
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
628 628
 
629 629
             }
630 630
 
631 631
 
632 632
             // extra_fields
633
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
633
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
634 634
 
635
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
635
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
636 636
 
637 637
             }
638 638
 
639 639
 
640 640
             // field_icon
641
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
641
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
642 642
 
643
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
643
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
644 644
 
645
-            }else{
645
+            } else {
646 646
                 $value = '';
647 647
                 if (isset($field_info->field_icon)) {
648 648
                     $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
649
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
650 650
                     $value = $cf['defaults']['field_icon'];
651 651
                 }
652 652
                 ?>
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
658 658
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
659 659
                         <div class="gdcf-tooltip">
660
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
660
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
661 661
                         </div>
662 662
                     </label>
663 663
                     <div class="gd-cf-input-wrap">
664 664
                         <input type="text" name="field_icon" id="field_icon"
665
-                               value="<?php echo $value;?>"/>
665
+                               value="<?php echo $value; ?>"/>
666 666
                     </div>
667 667
 
668 668
                 </li>
@@ -671,15 +671,15 @@  discard block
 block discarded – undo
671 671
 
672 672
 
673 673
             // css_class
674
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
674
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
675 675
 
676
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
676
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
677 677
 
678
-            }else{
678
+            } else {
679 679
                 $value = '';
680 680
                 if (isset($field_info->css_class)) {
681 681
                     $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
682
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
683 683
                     $value = $cf['defaults']['css_class'];
684 684
                 }
685 685
                 ?>
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
                     <label for="css_class" class="gd-cf-tooltip-wrap">
689 689
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
690 690
                         <div class="gdcf-tooltip">
691
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
692
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
691
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
692
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
693 693
                         </div>
694 694
                     </label>
695 695
                     <div class="gd-cf-input-wrap">
@@ -704,23 +704,23 @@  discard block
 block discarded – undo
704 704
 
705 705
 
706 706
             // cat_sort
707
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
707
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
708 708
 
709
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
709
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
710 710
 
711
-            }else{
711
+            } else {
712 712
                 $value = '';
713
-                $hide_cat_sort  ='';
713
+                $hide_cat_sort = '';
714 714
                 if (isset($field_info->cat_sort)) {
715 715
                     $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
716
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
717 717
                     $value = $cf['defaults']['cat_sort'];
718
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
718
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
719 719
                 }
720 720
 
721
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
721
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
722 722
                 ?>
723
-                <li <?php echo $hide_cat_sort ;?>>
723
+                <li <?php echo $hide_cat_sort; ?>>
724 724
                     <h3><?php
725 725
                         /**
726 726
                          * Filter the section title.
@@ -739,23 +739,23 @@  discard block
 block discarded – undo
739 739
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
740 740
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
741 741
                         <div class="gdcf-tooltip">
742
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
742
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
743 743
                         </div>
744 744
                     </label>
745 745
 
746 746
                     <div class="gd-cf-input-wrap gd-switch">
747 747
 
748
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
748
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
749 749
                             <?php if ($value == '1') {
750 750
                                 echo 'checked';
751 751
                             } ?>/>
752
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
752
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
753 753
 
754
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
754
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
755 755
                             <?php if (!$value) {
756 756
                                 echo 'checked';
757 757
                             } ?>/>
758
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
758
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
759 759
 
760 760
                     </div>
761 761
                 </li>
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                      * @param object $field_info The current fields info.
783 783
                      * @param array $cf The custom field settings
784 784
                      */
785
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
785
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
786 786
 
787 787
 
788 788
                 <?php endswitch; ?>
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
                     <h3></h3>
795 795
                 </label>
796 796
                 <div class="gd-cf-input-wrap">
797
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
797
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
798 798
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
799 799
                     <?php if (!$default): ?>
800
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
800
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
801 801
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
802 802
                                                             class="button"/></a>
803 803
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -43,8 +44,9 @@  discard block
 block discarded – undo
43 44
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
44 45
 
45 46
 $field_admin_title = '';
46
-if (isset($field_info->admin_title))
47
-    $field_admin_title = $field_info->admin_title;
47
+if (isset($field_info->admin_title)) {
48
+    $field_admin_title = $field_info->admin_title;
49
+}
48 50
 
49 51
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
50 52
 
@@ -65,15 +67,15 @@  discard block
 block discarded – undo
65 67
 
66 68
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
67 69
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
68
-}elseif(isset($cf['icon']) && $cf['icon']){
70
+} elseif(isset($cf['icon']) && $cf['icon']){
69 71
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
70
-}else{
72
+} else{
71 73
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
72 74
 }
73 75
 
74 76
 if(isset($cf['name']) && $cf['name']){
75 77
     $field_type_name = $cf['name'];
76
-}else{
78
+} else{
77 79
     $field_type_name = $field_type;
78 80
 }
79 81
 
@@ -89,8 +91,11 @@  discard block
 block discarded – undo
89 91
 
90 92
         <?php if ($default): ?>
91 93
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
92
-        <?php else: ?>
93
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
94
+        <?php else {
95
+	: ?>
96
+            <div title="<?php _e('Click to remove field', 'geodirectory');
97
+}
98
+?>"
94 99
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
95 100
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
96 101
         <?php endif;
@@ -141,11 +146,11 @@  discard block
 block discarded – undo
141 146
 
142 147
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
143 148
 
144
-            }else{
149
+            } else{
145 150
                 $value = '';
146 151
                 if (isset($field_info->data_type)) {
147 152
                     $value = esc_attr($field_info->data_type);
148
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
149 154
                     $value = $cf['defaults']['data_type'];
150 155
                 }
151 156
                 ?>
@@ -159,11 +164,11 @@  discard block
 block discarded – undo
159 164
 
160 165
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
161 166
 
162
-            }else{
167
+            } else{
163 168
                 $value = '';
164 169
                 if (isset($field_info->admin_title)) {
165 170
                     $value = esc_attr($field_info->admin_title);
166
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
167 172
                     $value = $cf['defaults']['admin_title'];
168 173
                 }
169 174
                 ?>
@@ -188,11 +193,11 @@  discard block
 block discarded – undo
188 193
 
189 194
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
190 195
 
191
-            }else{
196
+            } else{
192 197
                 $value = '';
193 198
                 if (isset($field_info->site_title)) {
194 199
                     $value = esc_attr($field_info->site_title);
195
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
196 201
                     $value = $cf['defaults']['site_title'];
197 202
                 }
198 203
                 ?>
@@ -216,11 +221,11 @@  discard block
 block discarded – undo
216 221
 
217 222
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
218 223
 
219
-            }else{
224
+            } else{
220 225
                 $value = '';
221 226
                 if (isset($field_info->admin_desc)) {
222 227
                     $value = esc_attr($field_info->admin_desc);
223
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
224 229
                     $value = $cf['defaults']['admin_desc'];
225 230
                 }
226 231
                 ?>
@@ -244,11 +249,11 @@  discard block
 block discarded – undo
244 249
 
245 250
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
246 251
 
247
-            }else{
252
+            } else{
248 253
                 $value = '';
249 254
                 if (isset($field_info->htmlvar_name)) {
250 255
                     $value = esc_attr($field_info->htmlvar_name);
251
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
252 257
                     $value = $cf['defaults']['htmlvar_name'];
253 258
                 }
254 259
                 ?>
@@ -276,11 +281,11 @@  discard block
 block discarded – undo
276 281
 
277 282
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
278 283
 
279
-            }else{
284
+            } else{
280 285
                 $value = '';
281 286
                 if (isset($field_info->is_active)) {
282 287
                     $value = esc_attr($field_info->is_active);
283
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
284 289
                     $value = $cf['defaults']['is_active'];
285 290
                 }
286 291
                 ?>
@@ -315,11 +320,11 @@  discard block
 block discarded – undo
315 320
 
316 321
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
317 322
 
318
-            }else{
323
+            } else{
319 324
                 $value = '';
320 325
                 if (isset($field_info->for_admin_use)) {
321 326
                     $value = esc_attr($field_info->for_admin_use);
322
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
323 328
                     $value = $cf['defaults']['for_admin_use'];
324 329
                 }
325 330
                 ?>
@@ -354,11 +359,11 @@  discard block
 block discarded – undo
354 359
 
355 360
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
356 361
 
357
-            }else{
362
+            } else{
358 363
                 $value = '';
359 364
                 if (isset($field_info->default_value)) {
360 365
                     $value = esc_attr($field_info->default_value);
361
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
362 367
                     $value = $cf['defaults']['default_value'];
363 368
                 }
364 369
                 ?>
@@ -398,11 +403,11 @@  discard block
 block discarded – undo
398 403
 
399 404
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
400 405
 
401
-            }else{
406
+            } else{
402 407
                 $value = '';
403 408
                 if (isset($field_info->show_in)) {
404 409
                     $value = esc_attr($field_info->show_in);
405
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
406 411
                     $value = esc_attr($cf['defaults']['show_in']);
407 412
                 }
408 413
                 ?>
@@ -443,7 +448,7 @@  discard block
 block discarded – undo
443 448
                         // don't show new tab option for some types
444 449
 
445 450
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
446
-                        }else{
451
+                        } else{
447 452
                             unset($show_in_locations['[owntab]']);
448 453
                         }
449 454
 
@@ -556,11 +561,11 @@  discard block
 block discarded – undo
556 561
 
557 562
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
558 563
 
559
-            }else{
564
+            } else{
560 565
                 $value = '';
561 566
                 if (isset($field_info->is_required)) {
562 567
                     $value = esc_attr($field_info->is_required);
563
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
568
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
564 569
                     $value = $cf['defaults']['is_required'];
565 570
                 }
566 571
                 ?>
@@ -597,11 +602,11 @@  discard block
 block discarded – undo
597 602
 
598 603
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
599 604
 
600
-            }else{
605
+            } else{
601 606
                 $value = '';
602 607
                 if (isset($field_info->required_msg)) {
603 608
                     $value = esc_attr($field_info->required_msg);
604
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
609
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
605 610
                     $value = $cf['defaults']['required_msg'];
606 611
                 }
607 612
                 ?>
@@ -642,11 +647,11 @@  discard block
 block discarded – undo
642 647
 
643 648
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
644 649
 
645
-            }else{
650
+            } else{
646 651
                 $value = '';
647 652
                 if (isset($field_info->field_icon)) {
648 653
                     $value = esc_attr($field_info->field_icon);
649
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
654
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
650 655
                     $value = $cf['defaults']['field_icon'];
651 656
                 }
652 657
                 ?>
@@ -675,11 +680,11 @@  discard block
 block discarded – undo
675 680
 
676 681
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
677 682
 
678
-            }else{
683
+            } else{
679 684
                 $value = '';
680 685
                 if (isset($field_info->css_class)) {
681 686
                     $value = esc_attr($field_info->css_class);
682
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
687
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
683 688
                     $value = $cf['defaults']['css_class'];
684 689
                 }
685 690
                 ?>
@@ -708,12 +713,12 @@  discard block
 block discarded – undo
708 713
 
709 714
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
710 715
 
711
-            }else{
716
+            } else{
712 717
                 $value = '';
713 718
                 $hide_cat_sort  ='';
714 719
                 if (isset($field_info->cat_sort)) {
715 720
                     $value = esc_attr($field_info->cat_sort);
716
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
721
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
717 722
                     $value = $cf['defaults']['cat_sort'];
718 723
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
719 724
                 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2348,10 +2348,10 @@
 block discarded – undo
2348 2348
 	?>
2349 2349
 	<input class="search_text" name="s"
2350 2350
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2351
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2352
-	       } else {
2353
-		       echo $default_search_for_text;
2354
-	       } ?>" type="text"
2351
+			   echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2352
+		   } else {
2353
+			   echo $default_search_for_text;
2354
+		   } ?>" type="text"
2355 2355
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2356 2356
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2357 2357
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
Please login to merge, or discard this patch.
Spacing   +608 added lines, -608 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( mb_strlen( $excerpt ) > $charlength ) {
107
-		if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( mb_strlen( $excerpt_more ) );
109
-			$subex = mb_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) {
111
-				$subex = mb_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (mb_strlen($excerpt) > $charlength) {
107
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (mb_strlen($excerpt_more));
109
+			$subex = mb_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
111
+				$subex = mb_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = mb_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= mb_substr( $subex, 0, $excut );
115
+			$subex   = mb_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (mb_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= mb_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( mb_strlen( $excerpt_more ) );
136
-			$out .= mb_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (mb_strlen($excerpt_more));
136
+			$out .= mb_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = $post->post_latitude;
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,24 +893,24 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
900 900
 
901
-			query_posts( $query_args );
901
+			query_posts($query_args);
902 902
 
903
-			if ( strstr( $layout, 'gridview' ) ) {
904
-				$listing_view_exp = explode( '_', $layout );
903
+			if (strstr($layout, 'gridview')) {
904
+				$listing_view_exp = explode('_', $layout);
905 905
 				$gridview_columns = $layout;
906 906
 				$layout           = $listing_view_exp[0];
907
-			} else if ( $layout == 'list' ) {
907
+			} else if ($layout == 'list') {
908 908
 				$gridview_columns = '';
909 909
 			}
910 910
 			$related_posts = true;
911 911
 
912 912
 			$related_nearest = false;
913
-			if ( $list_sort == 'nearest' ) {
913
+			if ($list_sort == 'nearest') {
914 914
 				$related_nearest = true;
915 915
 			}
916 916
 
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 			 *
921 921
 			 * @since 1.0.0
922 922
 			 */
923
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
923
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
924 924
 
925 925
 			/**
926 926
 			 * Includes related listing listview template.
927 927
 			 *
928 928
 			 * @since 1.0.0
929 929
 			 */
930
-			include( $template );
930
+			include($template);
931 931
 
932 932
 			wp_reset_query();
933 933
 			$post            = $origi_post;
@@ -955,12 +955,12 @@  discard block
 block discarded – undo
955 955
 function geodir_category_count_script() {
956 956
 	global $geodir_post_category_str;
957 957
 
958
-	if ( ! empty( $geodir_post_category_str ) ) {
959
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
958
+	if (!empty($geodir_post_category_str)) {
959
+		$geodir_post_category_str = serialize($geodir_post_category_str);
960 960
 	}
961 961
 
962
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
963
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
962
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
963
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
964 964
 	echo '<script>';
965 965
 	echo $script;
966 966
 	echo '</script>';
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
  * @return string Returns the default language.
976 976
  */
977 977
 function geodir_get_map_default_language() {
978
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
979
-	if ( empty( $geodir_default_map_language ) ) {
978
+	$geodir_default_map_language = get_option('geodir_default_map_language');
979
+	if (empty($geodir_default_map_language)) {
980 980
 		$geodir_default_map_language = 'en';
981 981
 	}
982 982
 
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 	 *
988 988
 	 * @param string $geodir_default_map_language Default map language.
989 989
 	 */
990
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
990
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
991 991
 }
992 992
 
993 993
 /**
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
  * @return string Returns the api key.
999 999
  */
1000 1000
 function geodir_get_map_api_key() {
1001
-	$key = get_option( 'geodir_google_api_key' );
1001
+	$key = get_option('geodir_google_api_key');
1002 1002
 
1003 1003
 	/**
1004 1004
 	 * Filter Google maps api key.
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 	 *
1008 1008
 	 * @param string $key Google maps api key.
1009 1009
 	 */
1010
-	return apply_filters( 'geodir_google_api_key', $key );
1010
+	return apply_filters('geodir_google_api_key', $key);
1011 1011
 }
1012 1012
 
1013 1013
 
@@ -1026,20 +1026,20 @@  discard block
 block discarded – undo
1026 1026
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1027 1027
 
1028 1028
 	$is_geodir_page = geodir_is_geodir_page();
1029
-	if ( ! $is_geodir_page ) {
1029
+	if (!$is_geodir_page) {
1030 1030
 		return;
1031 1031
 	}// if non GD page, bail
1032 1032
 
1033 1033
 	$use_gd_meta = true;
1034
-	if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
1034
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1035 1035
 		$use_gd_meta = false;
1036 1036
 
1037
-		if ( geodir_is_page( 'search' ) ) {
1037
+		if (geodir_is_page('search')) {
1038 1038
 			$use_gd_meta = true;
1039 1039
 		}
1040 1040
 	}
1041 1041
 
1042
-	if ( ! $use_gd_meta ) {
1042
+	if (!$use_gd_meta) {
1043 1043
 		return;
1044 1044
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1045 1045
 
@@ -1047,170 +1047,170 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 	$all_postypes = geodir_get_posttypes();
1049 1049
 
1050
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1050
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1051 1051
 
1052 1052
 	$meta_desc = '';
1053 1053
 	$meta_key  = '';
1054
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1054
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1055 1055
 		/**
1056 1056
 		 * Filter SEO meta location description.
1057 1057
 		 *
1058 1058
 		 * @since 1.0.0
1059 1059
 		 */
1060
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1060
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1061 1061
 		$meta_desc .= '';
1062 1062
 	}
1063
-	if ( have_posts() && is_single() OR is_page() ) {
1064
-		while ( have_posts() ) {
1063
+	if (have_posts() && is_single() OR is_page()) {
1064
+		while (have_posts()) {
1065 1065
 			the_post();
1066 1066
 
1067
-			if ( has_excerpt() ) {
1068
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1069
-				if ( empty( $out_excerpt ) ) {
1070
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1067
+			if (has_excerpt()) {
1068
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1069
+				if (empty($out_excerpt)) {
1070
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1071 1071
 				}
1072
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1072
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1073 1073
 			} else {
1074
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1075
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1076
-				if ( empty( $out_excerpt ) ) {
1077
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1074
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1075
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1076
+				if (empty($out_excerpt)) {
1077
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1078 1078
 				}
1079
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1079
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1080 1080
 			}
1081 1081
 
1082 1082
 			$meta_desc .= $out_excerpt;
1083 1083
 		}
1084
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1085
-		if ( is_category() ) {
1086
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) );
1087
-		} elseif ( is_tag() ) {
1088
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) );
1084
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1085
+		if (is_category()) {
1086
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
1087
+		} elseif (is_tag()) {
1088
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
1089 1089
 		}
1090
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1091
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1090
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1091
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1092 1092
 	}
1093 1093
 
1094 1094
 
1095 1095
 	$geodir_post_type       = geodir_get_current_posttype();
1096
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1097
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1098
-
1099
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1100
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1101
-
1102
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1103
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1104
-
1105
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1106
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1107
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1108
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1109
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1110
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1111
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1112
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1096
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1097
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1098
+
1099
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1100
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1101
+
1102
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1103
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1104
+
1105
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1106
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1107
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1108
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1109
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1110
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1111
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1112
+	$replace_location        = __('Everywhere', 'geodirectory');
1113 1113
 	$location_id             = null;
1114
-	if ( $geodir_location_manager ) {
1115
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1116
-		$location_id   = (int) $wpdb->get_var( $sql );
1114
+	if ($geodir_location_manager) {
1115
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1116
+		$location_id   = (int) $wpdb->get_var($sql);
1117 1117
 		$location_type = geodir_what_is_current_location();
1118
-		if ( $location_type == 'city' ) {
1119
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1120
-		} elseif ( $location_type == 'region' ) {
1121
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1122
-		} elseif ( $location_type == 'country' ) {
1123
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1124
-			$replace_location = __( $replace_location, 'geodirectory' );
1118
+		if ($location_type == 'city') {
1119
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1120
+		} elseif ($location_type == 'region') {
1121
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1122
+		} elseif ($location_type == 'country') {
1123
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1124
+			$replace_location = __($replace_location, 'geodirectory');
1125 1125
 		}
1126
-		$country          = get_query_var( 'gd_country' );
1127
-		$region           = get_query_var( 'gd_region' );
1128
-		$city             = get_query_var( 'gd_city' );
1126
+		$country          = get_query_var('gd_country');
1127
+		$region           = get_query_var('gd_region');
1128
+		$city             = get_query_var('gd_city');
1129 1129
 		$current_location = '';
1130
-		if ( $country != '' ) {
1131
-			$current_location = get_actual_location_name( 'country', $country, true );
1130
+		if ($country != '') {
1131
+			$current_location = get_actual_location_name('country', $country, true);
1132 1132
 		}
1133
-		if ( $region != '' ) {
1134
-			$current_location = get_actual_location_name( 'region', $region );
1133
+		if ($region != '') {
1134
+			$current_location = get_actual_location_name('region', $region);
1135 1135
 		}
1136
-		if ( $city != '' ) {
1137
-			$current_location = get_actual_location_name( 'city', $city );
1136
+		if ($city != '') {
1137
+			$current_location = get_actual_location_name('city', $city);
1138 1138
 		}
1139 1139
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1140 1140
 	}
1141 1141
 
1142 1142
 	$geodir_meta_keys = '';
1143 1143
 	$geodir_meta_desc = '';
1144
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1145
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1146
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1144
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1145
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1146
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1147 1147
 
1148
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1149
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1148
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1149
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1150 1150
 
1151
-			if ( $geodir_is_category ) {
1152
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1153
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1151
+			if ($geodir_is_category) {
1152
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1153
+				if (isset($category->term_id) && !empty($category->term_id)) {
1154 1154
 					$category_id   = $category->term_id;
1155
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1156
-					if ( $location_id ) {
1157
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1158
-						$cat_loc_option = get_option( $option_name );
1159
-
1160
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1161
-						if ( ! $gd_cat_loc_default ) {
1162
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1163
-							$option        = get_option( $option_name );
1164
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1155
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1156
+					if ($location_id) {
1157
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1158
+						$cat_loc_option = get_option($option_name);
1159
+
1160
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1161
+						if (!$gd_cat_loc_default) {
1162
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1163
+							$option        = get_option($option_name);
1164
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1165 1165
 						}
1166 1166
 					}
1167
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1167
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
1168 1168
 				}
1169
-			} else if ( $geodir_is_tag ) {
1170
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1169
+			} else if ($geodir_is_tag) {
1170
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1171 1171
 			}
1172 1172
 		}
1173 1173
 	}
1174 1174
 
1175 1175
 
1176 1176
 	$gd_page = '';
1177
-	if ( geodir_is_page( 'home' ) ) {
1177
+	if (geodir_is_page('home')) {
1178 1178
 		$gd_page   = 'home';
1179
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1180
-	} elseif ( geodir_is_page( 'detail' ) ) {
1179
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1180
+	} elseif (geodir_is_page('detail')) {
1181 1181
 		$gd_page   = 'detail';
1182
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1183
-	} elseif ( geodir_is_page( 'pt' ) ) {
1182
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1183
+	} elseif (geodir_is_page('pt')) {
1184 1184
 		$gd_page   = 'pt';
1185
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1186
-	} elseif ( geodir_is_page( 'listing' ) ) {
1185
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1186
+	} elseif (geodir_is_page('listing')) {
1187 1187
 		$gd_page   = 'listing';
1188
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1189
-	} elseif ( geodir_is_page( 'location' ) ) {
1188
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1189
+	} elseif (geodir_is_page('location')) {
1190 1190
 		$gd_page   = 'location';
1191
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1192
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1191
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1192
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1193 1193
 
1194
-	} elseif ( geodir_is_page( 'search' ) ) {
1194
+	} elseif (geodir_is_page('search')) {
1195 1195
 		$gd_page   = 'search';
1196
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1197
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1196
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1197
+	} elseif (geodir_is_page('add-listing')) {
1198 1198
 		$gd_page   = 'add-listing';
1199
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1200
-	} elseif ( geodir_is_page( 'author' ) ) {
1199
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1200
+	} elseif (geodir_is_page('author')) {
1201 1201
 		$gd_page   = 'author';
1202
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1203
-	} elseif ( geodir_is_page( 'login' ) ) {
1202
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1203
+	} elseif (geodir_is_page('login')) {
1204 1204
 		$gd_page   = 'login';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1206
+	} elseif (geodir_is_page('listing-success')) {
1207 1207
 		$gd_page   = 'listing-success';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1208
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1209 1209
 	}
1210 1210
 
1211 1211
 
1212
-	if ( $meta_desc ) {
1213
-		$meta_desc = stripslashes_deep( $meta_desc );
1212
+	if ($meta_desc) {
1213
+		$meta_desc = stripslashes_deep($meta_desc);
1214 1214
 		/**
1215 1215
 		 * Filter page description to replace variables.
1216 1216
 		 *
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 		 * @param string $title   The page description including variables.
1220 1220
 		 * @param string $gd_page The GeoDirectory page type if any.
1221 1221
 		 */
1222
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1222
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1223 1223
 
1224 1224
 		/**
1225 1225
 		 * Filter SEO meta description.
@@ -1228,49 +1228,49 @@  discard block
 block discarded – undo
1228 1228
 		 *
1229 1229
 		 * @param string $meta_desc Meta description content.
1230 1230
 		 */
1231
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1231
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1232 1232
 	}
1233 1233
 
1234 1234
 	// meta keywords
1235
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1236
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1237
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1235
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1236
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1237
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1238 1238
 
1239
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1239
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1240 1240
 	} else {
1241 1241
 		$posttags = get_the_tags();
1242
-		if ( $posttags ) {
1243
-			foreach ( $posttags as $tag ) {
1244
-				$meta_key .= $tag->name . ' ';
1242
+		if ($posttags) {
1243
+			foreach ($posttags as $tag) {
1244
+				$meta_key .= $tag->name.' ';
1245 1245
 			}
1246 1246
 		} else {
1247
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1247
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1248 1248
 			$xt   = 1;
1249 1249
 
1250
-			foreach ( $tags as $tag ) {
1251
-				if ( $xt <= 20 ) {
1252
-					$meta_key .= $tag->name . ", ";
1250
+			foreach ($tags as $tag) {
1251
+				if ($xt <= 20) {
1252
+					$meta_key .= $tag->name.", ";
1253 1253
 				}
1254 1254
 
1255
-				$xt ++;
1255
+				$xt++;
1256 1256
 			}
1257 1257
 		}
1258 1258
 	}
1259 1259
 
1260
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1261
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1262
-	if ( $geodir_meta_keys != '' ) {
1263
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1264
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1265
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1266
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1267
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1260
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1261
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1262
+	if ($geodir_meta_keys != '') {
1263
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1264
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1265
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1266
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1267
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1268 1268
 
1269
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1269
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1270 1270
 	}
1271 1271
 
1272
-	if ( $meta_key ) {
1273
-		$meta_key = stripslashes_deep( $meta_key );
1272
+	if ($meta_key) {
1273
+		$meta_key = stripslashes_deep($meta_key);
1274 1274
 		/**
1275 1275
 		 * Filter SEO meta keywords.
1276 1276
 		 *
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 		 *
1279 1279
 		 * @param string $meta_desc Meta keywords.
1280 1280
 		 */
1281
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1281
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1282 1282
 	}
1283 1283
 
1284 1284
 }
@@ -1298,8 +1298,8 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1300 1300
 
1301
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1302
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1301
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1302
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1303 1303
 	}
1304 1304
 
1305 1305
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1321,57 +1321,57 @@  discard block
 block discarded – undo
1321 1321
 	 * @since 1.0.0
1322 1322
 	 */
1323 1323
 	$arr_tabs['post_profile'] = array(
1324
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1324
+		'heading_text'  => __('Profile', 'geodirectory'),
1325 1325
 		'is_active_tab' => true,
1326
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1326
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1327 1327
 		'tab_content'   => ''
1328 1328
 	);
1329
-	$arr_tabs['post_info']    = array(
1330
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1329
+	$arr_tabs['post_info'] = array(
1330
+		'heading_text'  => __('More Info', 'geodirectory'),
1331 1331
 		'is_active_tab' => false,
1332
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1332
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1333 1333
 		'tab_content'   => ''
1334 1334
 	);
1335 1335
 
1336 1336
 	$arr_tabs['post_images'] = array(
1337
-		'heading_text'  => __( 'Photo', 'geodirectory' ),
1337
+		'heading_text'  => __('Photo', 'geodirectory'),
1338 1338
 		'is_active_tab' => false,
1339
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1339
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1340 1340
 		'tab_content'   => ''
1341 1341
 	);
1342 1342
 
1343 1343
 	$arr_tabs['post_video'] = array(
1344
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1344
+		'heading_text'  => __('Video', 'geodirectory'),
1345 1345
 		'is_active_tab' => false,
1346
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1346
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1347 1347
 		'tab_content'   => ''
1348 1348
 	);
1349 1349
 
1350 1350
 	$arr_tabs['special_offers'] = array(
1351
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1351
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1352 1352
 		'is_active_tab' => false,
1353
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1353
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1354 1354
 		'tab_content'   => ''
1355 1355
 	);
1356 1356
 
1357 1357
 	$arr_tabs['post_map'] = array(
1358
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1358
+		'heading_text'  => __('Map', 'geodirectory'),
1359 1359
 		'is_active_tab' => false,
1360
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1360
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1361 1361
 		'tab_content'   => ''
1362 1362
 	);
1363 1363
 
1364 1364
 	$arr_tabs['reviews'] = array(
1365
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1365
+		'heading_text'  => __('Reviews', 'geodirectory'),
1366 1366
 		'is_active_tab' => false,
1367
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1367
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1368 1368
 		'tab_content'   => 'review display'
1369 1369
 	);
1370 1370
 
1371 1371
 	$arr_tabs['related_listing'] = array(
1372
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1372
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1373 1373
 		'is_active_tab' => false,
1374
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1374
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1375 1375
 		'tab_content'   => ''
1376 1376
 	);
1377 1377
 
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 	 *
1381 1381
 	 * @since 1.0.0
1382 1382
 	 */
1383
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1383
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1384 1384
 
1385 1385
 
1386 1386
 }
@@ -1394,13 +1394,13 @@  discard block
 block discarded – undo
1394 1394
  * @return mixed|array Tabs array.
1395 1395
  */
1396 1396
 function geodir_detail_page_tabs_list() {
1397
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1397
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1398 1398
 	$tabs_array    = geodir_detail_page_tabs_array();
1399 1399
 
1400
-	if ( ! empty( $tabs_excluded ) ) {
1401
-		foreach ( $tabs_excluded as $tab ) {
1402
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1403
-				unset( $tabs_array[ $tab ] );
1400
+	if (!empty($tabs_excluded)) {
1401
+		foreach ($tabs_excluded as $tab) {
1402
+			if (array_key_exists($tab, $tabs_array)) {
1403
+				unset($tabs_array[$tab]);
1404 1404
 			}
1405 1405
 		}
1406 1406
 	}
@@ -1424,58 +1424,58 @@  discard block
 block discarded – undo
1424 1424
 function geodir_show_detail_page_tabs() {
1425 1425
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1426 1426
 
1427
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1428
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1429
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1427
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1428
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1429
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1430 1430
 
1431
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1432
-		$post = geodir_get_post_info( $request_post_id );
1433
-		setup_postdata( $post );
1431
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1432
+		$post = geodir_get_post_info($request_post_id);
1433
+		setup_postdata($post);
1434 1434
 	}
1435 1435
 
1436
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1436
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1437 1437
 
1438 1438
 
1439
-	if ( geodir_is_page( 'detail' ) ) {
1440
-		$video                 = geodir_get_video( $post->ID );
1441
-		$special_offers        = geodir_get_special_offers( $post->ID );
1439
+	if (geodir_is_page('detail')) {
1440
+		$video                 = geodir_get_video($post->ID);
1441
+		$special_offers        = geodir_get_special_offers($post->ID);
1442 1442
 		$related_listing_array = array();
1443
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1444
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1443
+		if (get_option('geodir_add_related_listing_posttypes')) {
1444
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1445 1445
 		}
1446 1446
 
1447 1447
 
1448
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1449
-		if ( ! $excluded_tabs ) {
1448
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1449
+		if (!$excluded_tabs) {
1450 1450
 			$excluded_tabs = array();
1451 1451
 		}
1452 1452
 
1453 1453
 		$related_listing = '';
1454
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1454
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1455 1455
 			$request = array(
1456
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1457
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1458
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1459
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1460
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1461
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1456
+				'post_number'         => get_option('geodir_related_post_count'),
1457
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1458
+				'layout'              => get_option('geodir_related_post_listing_view'),
1459
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1460
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1461
+				'character_count'     => get_option('geodir_related_post_excerpt')
1462 1462
 			);
1463 1463
 
1464
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1465
-				$related_listing = geodir_get_detail_page_related_events( $request );
1464
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1465
+				$related_listing = geodir_get_detail_page_related_events($request);
1466 1466
 			} else {
1467
-				$related_listing = geodir_related_posts_display( $request );
1467
+				$related_listing = geodir_related_posts_display($request);
1468 1468
 			}
1469 1469
 
1470 1470
 		}
1471 1471
 
1472
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1472
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1473 1473
 		$thumb_image = '';
1474
-		if ( ! empty( $post_images ) ) {
1475
-			foreach ( $post_images as $image ) {
1476
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1477
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1478
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1474
+		if (!empty($post_images)) {
1475
+			foreach ($post_images as $image) {
1476
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1477
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1478
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1479 1479
 				$thumb_image .= '</a>';
1480 1480
 			}
1481 1481
 		}
@@ -1484,11 +1484,11 @@  discard block
 block discarded – undo
1484 1484
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1485 1485
 		$map_args['width']           = '600';
1486 1486
 		$map_args['height']          = '300';
1487
-		if ( $post->post_mapzoom ) {
1488
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1487
+		if ($post->post_mapzoom) {
1488
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1489 1489
 		}
1490 1490
 		$map_args['autozoom']                 = false;
1491
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1491
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1492 1492
 		$map_args['child_collapse']           = '0';
1493 1493
 		$map_args['enable_cat_filters']       = false;
1494 1494
 		$map_args['enable_text_search']       = false;
@@ -1497,43 +1497,43 @@  discard block
 block discarded – undo
1497 1497
 		$map_args['enable_jason_on_load']     = true;
1498 1498
 		$map_args['enable_map_direction']     = true;
1499 1499
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1500
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1501
-	} else if ( geodir_is_page( 'preview' ) ) {
1502
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1503
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1500
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1501
+	} else if (geodir_is_page('preview')) {
1502
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1503
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1504 1504
 
1505
-		if ( isset( $post->post_images ) ) {
1506
-			$post->post_images = trim( $post->post_images, "," );
1505
+		if (isset($post->post_images)) {
1506
+			$post->post_images = trim($post->post_images, ",");
1507 1507
 		}
1508 1508
 
1509
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1510
-			$post_images = explode( ",", $post->post_images );
1509
+		if (isset($post->post_images) && !empty($post->post_images)) {
1510
+			$post_images = explode(",", $post->post_images);
1511 1511
 		}
1512 1512
 
1513 1513
 		$thumb_image = '';
1514
-		if ( ! empty( $post_images ) ) {
1515
-			foreach ( $post_images as $image ) {
1516
-				if ( $image != '' ) {
1517
-					$thumb_image .= '<a href="' . $image . '">';
1518
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1514
+		if (!empty($post_images)) {
1515
+			foreach ($post_images as $image) {
1516
+				if ($image != '') {
1517
+					$thumb_image .= '<a href="'.$image.'">';
1518
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1519 1519
 					$thumb_image .= '</a>';
1520 1520
 				}
1521 1521
 			}
1522 1522
 		}
1523 1523
 
1524 1524
 		global $map_jason;
1525
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1526
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1527
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1525
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1526
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1527
+		$icon_size        = geodir_get_marker_size($marker_icon);
1528 1528
 		$marker_json['w'] = $icon_size['w'];
1529 1529
 		$marker_json['h'] = $icon_size['h'];
1530
-		$map_jason[]      = json_encode( $marker_json );
1530
+		$map_jason[]      = json_encode($marker_json);
1531 1531
 
1532
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1533
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1534
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1535
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1536
-		if ( ! $mapzoom ) {
1532
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1533
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1534
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1535
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1536
+		if (!$mapzoom) {
1537 1537
 			$mapzoom = 12;
1538 1538
 		}
1539 1539
 
@@ -1556,37 +1556,37 @@  discard block
 block discarded – undo
1556 1556
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1557 1557
 	}
1558 1558
 
1559
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1559
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1560 1560
 
1561 1561
 	$active_tab       = '';
1562 1562
 	$active_tab_name  = '';
1563 1563
 	$default_tab      = '';
1564 1564
 	$default_tab_name = '';
1565
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1566
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1565
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1566
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1567 1567
 			$active_tab      = $tab_index;
1568
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1568
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1569 1569
 		}
1570 1570
 
1571
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1571
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1572 1572
 			$default_tab      = $tab_index;
1573
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1573
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1574 1574
 		}
1575 1575
 	}
1576 1576
 
1577
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
1578
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1579
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1577
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1578
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1579
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1580 1580
 		}
1581 1581
 
1582
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1582
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1583 1583
 		$active_tab                                            = $default_tab;
1584 1584
 		$active_tab_name                                       = $default_tab_name;
1585 1585
 	}
1586
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1586
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1587 1587
 	?>
1588 1588
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1589
-		<?php if ( ! $tab_list ){ ?>
1589
+		<?php if (!$tab_list) { ?>
1590 1590
 		<div id="geodir-tab-mobile-menu">
1591 1591
 			<i class="fa fa-bars"></i>
1592 1592
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1601,26 +1601,26 @@  discard block
 block discarded – undo
1601 1601
 			 * @since 1.0.0
1602 1602
 			 * @see   'geodir_after_tab_list'
1603 1603
 			 */
1604
-			do_action( 'geodir_before_tab_list' ); ?>
1604
+			do_action('geodir_before_tab_list'); ?>
1605 1605
 			<?php
1606 1606
 
1607
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1608
-				if ( $detail_page_tab['is_display'] ) {
1607
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1608
+				if ($detail_page_tab['is_display']) {
1609 1609
 
1610
-					if ( ! $tab_list ) {
1610
+					if (!$tab_list) {
1611 1611
 						?>
1612 1612
 						<dt></dt> <!-- added to comply with validation -->
1613
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1613
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1614 1614
 								data-tab="#<?php echo $tab_index; ?>"
1615
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1615
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1616 1616
 						</dd>
1617 1617
 						<?php
1618 1618
 					}
1619 1619
 					ob_start() // start tab content buffering
1620 1620
 					?>
1621 1621
 					<li id="<?php echo $tab_index; ?>Tab">
1622
-						<?php if ( $tab_list ) {
1623
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1622
+						<?php if ($tab_list) {
1623
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1624 1624
 							/**
1625 1625
 							 * Filter the tab list title html.
1626 1626
 							 *
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 							 * @param string $tab_index      The tab index type.
1631 1631
 							 * @param array $detail_page_tab The array of values including title text.
1632 1632
 							 */
1633
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1633
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1634 1634
 						} ?>
1635 1635
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1636 1636
 						<?php
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 						 *
1642 1642
 						 * @param string $tab_index The tab name ID.
1643 1643
 						 */
1644
-						do_action( 'geodir_before_tab_content', $tab_index );
1644
+						do_action('geodir_before_tab_content', $tab_index);
1645 1645
 
1646 1646
 						/**
1647 1647
 						 * Called before the details tab content is output per tab.
@@ -1651,21 +1651,21 @@  discard block
 block discarded – undo
1651 1651
 						 * @since 1.0.0
1652 1652
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1653 1653
 						 */
1654
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1654
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1655 1655
 						/// write a code to generate content of each tab
1656
-						switch ( $tab_index ) {
1656
+						switch ($tab_index) {
1657 1657
 							case 'post_profile':
1658 1658
 								/**
1659 1659
 								 * Called before the listing description content on the details page tab.
1660 1660
 								 *
1661 1661
 								 * @since 1.0.0
1662 1662
 								 */
1663
-								do_action( 'geodir_before_description_on_listing_detail' );
1664
-								if ( geodir_is_page( 'detail' ) ) {
1663
+								do_action('geodir_before_description_on_listing_detail');
1664
+								if (geodir_is_page('detail')) {
1665 1665
 									the_content();
1666 1666
 								} else {
1667 1667
 									/** This action is documented in geodirectory_template_actions.php */
1668
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1668
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1669 1669
 								}
1670 1670
 
1671 1671
 								/**
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 								 *
1674 1674
 								 * @since 1.0.0
1675 1675
 								 */
1676
-								do_action( 'geodir_after_description_on_listing_detail' );
1676
+								do_action('geodir_after_description_on_listing_detail');
1677 1677
 								break;
1678 1678
 							case 'post_info':
1679 1679
 								echo $geodir_post_detail_fields;
@@ -1683,21 +1683,21 @@  discard block
 block discarded – undo
1683 1683
 								break;
1684 1684
 							case 'post_video':
1685 1685
 								// some browsers hide $_POST data if used for embeds so we repalce with a placeholder
1686
-								if ( $preview ) {
1687
-									if ( $video ) {
1688
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1686
+								if ($preview) {
1687
+									if ($video) {
1688
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1689 1689
 									}
1690 1690
 								} else {
1691 1691
 									/** This action is documented in geodirectory_template_actions.php */
1692
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1692
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1693 1693
 								}
1694 1694
 								break;
1695 1695
 							case 'special_offers':
1696
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1696
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1697 1697
 
1698 1698
 								break;
1699 1699
 							case 'post_map':
1700
-								geodir_draw_map( $map_args );
1700
+								geodir_draw_map($map_args);
1701 1701
 								break;
1702 1702
 							case 'reviews':
1703 1703
 								comments_template();
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 								echo $related_listing;
1707 1707
 								break;
1708 1708
 							default: {
1709
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1709
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1710 1710
 									echo $detail_page_tab['tab_content'];
1711 1711
 								}
1712 1712
 							}
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
 						 *
1719 1719
 						 * @since 1.0.0
1720 1720
 						 */
1721
-						do_action( 'geodir_after_tab_content', $tab_index );
1721
+						do_action('geodir_after_tab_content', $tab_index);
1722 1722
 
1723 1723
 						/**
1724 1724
 						 * Called after the details tab content is output per tab.
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 						 * @since 1.0.0
1729 1729
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1730 1730
 						 */
1731
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1731
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1732 1732
 						?> </li>
1733 1733
 					<?php
1734 1734
 					/**
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 					 *
1737 1737
 					 * @since 1.0.0
1738 1738
 					 */
1739
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1739
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1740 1740
 				} // end of if for is_display
1741 1741
 			}// end of foreach
1742 1742
 
@@ -1746,14 +1746,14 @@  discard block
 block discarded – undo
1746 1746
 			 * @since 1.0.0
1747 1747
 			 * @see   'geodir_before_tab_list'
1748 1748
 			 */
1749
-			do_action( 'geodir_after_tab_list' );
1749
+			do_action('geodir_after_tab_list');
1750 1750
 			?>
1751
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1752
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1751
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1752
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1753 1753
 		    style="position:relative;">
1754 1754
 			<?php
1755
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1756
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1755
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1756
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1757 1757
 					echo $detail_page_tab['tab_content'];
1758 1758
 				}// end of if
1759 1759
 			}// end of foreach
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
 			 *
1764 1764
 			 * @since 1.0.0
1765 1765
 			 */
1766
-			do_action( 'geodir_add_tab_content' ); ?>
1766
+			do_action('geodir_add_tab_content'); ?>
1767 1767
 		</ul>
1768 1768
 		<!--gd-tabs-content ul end-->
1769 1769
 	</div>
1770
-	<?php if ( ! $tab_list ) { ?>
1770
+	<?php if (!$tab_list) { ?>
1771 1771
 		<script>
1772 1772
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1773 1773
 				hashVal = window.location.hash;
@@ -1799,31 +1799,31 @@  discard block
 block discarded – undo
1799 1799
  *
1800 1800
  * @return mixed Image file.
1801 1801
  */
1802
-function geodir_exif( $file ) {
1803
-	if ( empty( $file ) || ! is_array( $file ) ) {
1802
+function geodir_exif($file) {
1803
+	if (empty($file) || !is_array($file)) {
1804 1804
 		return $file;
1805 1805
 	}
1806 1806
 
1807
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1808
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1807
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1808
+	if (!($file_path && file_exists($file_path))) {
1809 1809
 		return $file;
1810 1810
 	}
1811 1811
 	$file['file'] = $file_path;
1812 1812
 
1813
-	if ( ! file_is_valid_image( $file_path ) ) {
1813
+	if (!file_is_valid_image($file_path)) {
1814 1814
 		return $file; // Bail if file is not an image.
1815 1815
 	}
1816 1816
 
1817
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1817
+	if (!function_exists('wp_get_image_editor')) {
1818 1818
 		return $file;
1819 1819
 	}
1820 1820
 
1821 1821
 	$mime_type = $file['type'];
1822 1822
 	$exif      = array();
1823
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1823
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1824 1824
 		try {
1825
-			$exif = exif_read_data( $file_path );
1826
-		} catch ( Exception $e ) {
1825
+			$exif = exif_read_data($file_path);
1826
+		} catch (Exception $e) {
1827 1827
 			$exif = array();
1828 1828
 		}
1829 1829
 	}
@@ -1832,13 +1832,13 @@  discard block
 block discarded – undo
1832 1832
 	$flip        = false;
1833 1833
 	$modify      = false;
1834 1834
 	$orientation = 0;
1835
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1836
-		switch ( (int) $exif['Orientation'] ) {
1835
+	if (!empty($exif) && isset($exif['Orientation'])) {
1836
+		switch ((int) $exif['Orientation']) {
1837 1837
 			case 1:
1838 1838
 				// do nothing
1839 1839
 				break;
1840 1840
 			case 2:
1841
-				$flip   = array( false, true );
1841
+				$flip   = array(false, true);
1842 1842
 				$modify = true;
1843 1843
 				break;
1844 1844
 			case 3:
@@ -1847,13 +1847,13 @@  discard block
 block discarded – undo
1847 1847
 				$modify      = true;
1848 1848
 				break;
1849 1849
 			case 4:
1850
-				$flip   = array( true, false );
1850
+				$flip   = array(true, false);
1851 1851
 				$modify = true;
1852 1852
 				break;
1853 1853
 			case 5:
1854 1854
 				$orientation = - 90;
1855 1855
 				$rotate      = true;
1856
-				$flip        = array( false, true );
1856
+				$flip        = array(false, true);
1857 1857
 				$modify      = true;
1858 1858
 				break;
1859 1859
 			case 6:
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 			case 7:
1865 1865
 				$orientation = - 270;
1866 1866
 				$rotate      = true;
1867
-				$flip        = array( false, true );
1867
+				$flip        = array(false, true);
1868 1868
 				$modify      = true;
1869 1869
 				break;
1870 1870
 			case 8:
@@ -1890,31 +1890,31 @@  discard block
 block discarded – undo
1890 1890
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1891 1891
 	 * @param string $quality   Image mime type.
1892 1892
 	 */
1893
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1894
-	if ( $quality !== null ) {
1893
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1894
+	if ($quality !== null) {
1895 1895
 		$modify = true;
1896 1896
 	}
1897 1897
 
1898
-	if ( ! $modify ) {
1898
+	if (!$modify) {
1899 1899
 		return $file; // no change
1900 1900
 	}
1901 1901
 
1902
-	$image = wp_get_image_editor( $file_path );
1903
-	if ( ! is_wp_error( $image ) ) {
1904
-		if ( $rotate ) {
1905
-			$image->rotate( $orientation );
1902
+	$image = wp_get_image_editor($file_path);
1903
+	if (!is_wp_error($image)) {
1904
+		if ($rotate) {
1905
+			$image->rotate($orientation);
1906 1906
 		}
1907 1907
 
1908
-		if ( ! empty( $flip ) ) {
1909
-			$image->flip( $flip[0], $flip[1] );
1908
+		if (!empty($flip)) {
1909
+			$image->flip($flip[0], $flip[1]);
1910 1910
 		}
1911 1911
 
1912
-		if ( $quality !== null ) {
1913
-			$image->set_quality( (int) $quality );
1912
+		if ($quality !== null) {
1913
+			$image->set_quality((int) $quality);
1914 1914
 		}
1915 1915
 
1916
-		$result = $image->save( $file_path );
1917
-		if ( ! is_wp_error( $result ) ) {
1916
+		$result = $image->save($file_path);
1917
+		if (!is_wp_error($result)) {
1918 1918
 			$file['file']     = $result['path'];
1919 1919
 			$file['tmp_name'] = $result['path'];
1920 1920
 		}
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
  *
1942 1942
  * @return string Returns the recent reviews html.
1943 1943
  */
1944
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1944
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1945 1945
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1946 1946
 	$tablecomments = $wpdb->comments;
1947 1947
 	$tableposts    = $wpdb->posts;
@@ -1951,28 +1951,28 @@  discard block
 block discarded – undo
1951 1951
 	$region_filter  = '';
1952 1952
 	$country_filter = '';
1953 1953
 
1954
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1955
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1956
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1954
+	if ($gd_session->get('gd_multi_location')) {
1955
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1956
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1957 1957
 		}
1958 1958
 
1959
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1960
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1959
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1960
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1961 1961
 		}
1962 1962
 
1963
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1964
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1963
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1964
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1965 1965
 		}
1966 1966
 	}
1967 1967
 
1968 1968
 	$review_table = GEODIR_REVIEW_TABLE;
1969 1969
 	$request      = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1970 1970
 
1971
-	$comments = $wpdb->get_results( $request );
1971
+	$comments = $wpdb->get_results($request);
1972 1972
 
1973
-	foreach ( $comments as $comment ) {
1973
+	foreach ($comments as $comment) {
1974 1974
 		// Set the extra comment info needed.
1975
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
1975
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1976 1976
 		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1977 1977
 		$comment->comment_content      = $comment_extra->comment_content;
1978 1978
 		$comment->comment_author       = $comment_extra->comment_author;
@@ -1980,75 +1980,75 @@  discard block
 block discarded – undo
1980 1980
 
1981 1981
 		$comment_id      = '';
1982 1982
 		$comment_id      = $comment->comment_ID;
1983
-		$comment_content = strip_tags( $comment->comment_content );
1983
+		$comment_content = strip_tags($comment->comment_content);
1984 1984
 
1985
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
1985
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1986 1986
 
1987
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
1987
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
1988 1988
 		$comment_author_email = $comment->comment_author_email;
1989 1989
 		$comment_post_ID      = $comment->post_id;
1990 1990
 
1991 1991
 		$na = true;
1992
-		if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
1993
-			$comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false );
1994
-			if ( $comment_post_ID == $comment_post_ID2 ) {
1992
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1993
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1994
+			if ($comment_post_ID == $comment_post_ID2) {
1995 1995
 			} else {
1996 1996
 				$na = false;
1997 1997
 			}
1998 1998
 		}
1999 1999
 
2000
-		$post_title        = get_the_title( $comment_post_ID );
2001
-		$permalink         = get_permalink( $comment_post_ID );
2002
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2003
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2000
+		$post_title        = get_the_title($comment_post_ID);
2001
+		$permalink         = get_permalink($comment_post_ID);
2002
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2003
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2004 2004
 
2005
-		$comment_content_length = strlen( $comment_content );
2006
-		if ( $comment_content_length > $comment_lenth ) {
2007
-			$comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2005
+		$comment_content_length = strlen($comment_content);
2006
+		if ($comment_content_length > $comment_lenth) {
2007
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2008 2008
 		} else {
2009 2009
 			$comment_excerpt = $comment_content;
2010 2010
 		}
2011 2011
 
2012
-		if ( $comment->user_id ) {
2013
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2012
+		if ($comment->user_id) {
2013
+			$user_profile_url = get_author_posts_url($comment->user_id);
2014 2014
 		} else {
2015 2015
 			$user_profile_url = '';
2016 2016
 		}
2017 2017
 
2018
-		if ( $comment_id && $na ) {
2018
+		if ($comment_id && $na) {
2019 2019
 			$comments_echo .= '<li class="clearfix">';
2020
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2021
-			if ( function_exists( 'get_avatar' ) ) {
2022
-				if ( ! isset( $comment->comment_type ) ) {
2023
-					if ( $user_profile_url ) {
2024
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2020
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2021
+			if (function_exists('get_avatar')) {
2022
+				if (!isset($comment->comment_type)) {
2023
+					if ($user_profile_url) {
2024
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2025 2025
 					}
2026
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2027
-					if ( $user_profile_url ) {
2026
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2027
+					if ($user_profile_url) {
2028 2028
 						$comments_echo .= '</a>';
2029 2029
 					}
2030
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2031
-					if ( $user_profile_url ) {
2032
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2030
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2031
+					if ($user_profile_url) {
2032
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2033 2033
 					}
2034
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2034
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2035 2035
 				}
2036
-			} elseif ( function_exists( 'gravatar' ) ) {
2037
-				if ( $user_profile_url ) {
2038
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2036
+			} elseif (function_exists('gravatar')) {
2037
+				if ($user_profile_url) {
2038
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2039 2039
 				}
2040 2040
 				$comments_echo .= "<img src=\"";
2041
-				if ( '' == $comment->comment_type ) {
2042
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2043
-					if ( $user_profile_url ) {
2041
+				if ('' == $comment->comment_type) {
2042
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2043
+					if ($user_profile_url) {
2044 2044
 						$comments_echo .= '</a>';
2045 2045
 					}
2046
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2047
-					if ( $user_profile_url ) {
2048
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2046
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2047
+					if ($user_profile_url) {
2048
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2049 2049
 					}
2050
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2051
-					if ( $user_profile_url ) {
2050
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2051
+					if ($user_profile_url) {
2052 2052
 						$comments_echo .= '</a>';
2053 2053
 					}
2054 2054
 				}
@@ -2058,17 +2058,17 @@  discard block
 block discarded – undo
2058 2058
 			$comments_echo .= "</span>\n";
2059 2059
 
2060 2060
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2061
-			if ( $comment->user_id ) {
2062
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2061
+			if ($comment->user_id) {
2062
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2063 2063
 			}
2064
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2065
-			if ( $comment->user_id ) {
2064
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2065
+			if ($comment->user_id) {
2066 2066
 				$comments_echo .= '</a>';
2067 2067
 			}
2068
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2069
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2070
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2071
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2068
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2069
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2070
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2071
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2072 2072
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2073 2073
 			$comments_echo .= '</p>';
2074 2074
 
@@ -2088,25 +2088,25 @@  discard block
 block discarded – undo
2088 2088
  * @return array Returns post categories as an array.
2089 2089
  */
2090 2090
 function geodir_home_map_cats_key_value_array() {
2091
-	$post_types = geodir_get_posttypes( 'object' );
2091
+	$post_types = geodir_get_posttypes('object');
2092 2092
 
2093 2093
 	$return = array();
2094
-	if ( ! empty( $post_types ) ) {
2095
-		foreach ( $post_types as $key => $post_type ) {
2096
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2097
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2098
-			$taxonomies     = geodir_get_taxonomies( $key );
2099
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2100
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2101
-
2102
-			if ( ! empty( $cat_terms ) ) {
2103
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2104
-
2105
-				foreach ( $cat_terms as $cat_term ) {
2106
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2094
+	if (!empty($post_types)) {
2095
+		foreach ($post_types as $key => $post_type) {
2096
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2097
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2098
+			$taxonomies     = geodir_get_taxonomies($key);
2099
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2100
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2101
+
2102
+			if (!empty($cat_terms)) {
2103
+				$return['optgroup_start-'.$key] = $post_type_name;
2104
+
2105
+				foreach ($cat_terms as $cat_term) {
2106
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2107 2107
 				}
2108 2108
 
2109
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2109
+				$return['optgroup_end-'.$key] = $post_type_name;
2110 2110
 			}
2111 2111
 		}
2112 2112
 	}
@@ -2122,14 +2122,14 @@  discard block
 block discarded – undo
2122 2122
  * @package GeoDirectory
2123 2123
  */
2124 2124
 function geodir_twitter_tweet_button() {
2125
-	if ( isset( $_GET['gde'] ) ) {
2126
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2125
+	if (isset($_GET['gde'])) {
2126
+		$link = '?url='.urlencode(geodir_curPageURL());
2127 2127
 	} else {
2128 2128
 		$link = '';
2129 2129
 	}
2130 2130
 	?>
2131 2131
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2132
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2132
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2133 2133
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2134 2134
 	<?php
2135 2135
 }
@@ -2146,10 +2146,10 @@  discard block
 block discarded – undo
2146 2146
 function geodir_fb_like_button() {
2147 2147
 	global $post;
2148 2148
 	?>
2149
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2149
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2150 2150
 		echo 'allowtransparency="true"';
2151 2151
 	} ?> class="facebook"
2152
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2152
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2153 2153
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2154 2154
 	<?php
2155 2155
 }
@@ -2203,10 +2203,10 @@  discard block
 block discarded – undo
2203 2203
 			stWidget.addEntry({
2204 2204
 				"service": "sharethis",
2205 2205
 				"element": document.getElementById('st_sharethis'),
2206
-				"url": "<?php echo geodir_curPageURL();?>",
2207
-				"title": "<?php echo $post->post_title;?>",
2206
+				"url": "<?php echo geodir_curPageURL(); ?>",
2207
+				"title": "<?php echo $post->post_title; ?>",
2208 2208
 				"type": "chicklet",
2209
-				"text": "<?php _e( 'Share', 'geodirectory' );?>"
2209
+				"text": "<?php _e('Share', 'geodirectory'); ?>"
2210 2210
 			});
2211 2211
 		</script>
2212 2212
 	</div>
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 }
2215 2215
 
2216 2216
 function geodir_listing_bounce_map_pin_on_hover() {
2217
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2217
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2218 2218
 		?>
2219 2219
 		<script>
2220 2220
 			jQuery(function ($) {
@@ -2237,38 +2237,38 @@  discard block
 block discarded – undo
2237 2237
 	}
2238 2238
 }
2239 2239
 
2240
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2240
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2241 2241
 
2242
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2243
-function geodir_output_favourite_html_listings( $post_id ) {
2244
-	geodir_favourite_html( '', $post_id );
2242
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2243
+function geodir_output_favourite_html_listings($post_id) {
2244
+	geodir_favourite_html('', $post_id);
2245 2245
 }
2246 2246
 
2247
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2248
-function geodir_output_pinpoint_html_listings( $post_id, $post ) {
2247
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2248
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2249 2249
 	global $wp_query;
2250 2250
 
2251 2251
 	$show_pin_point = $wp_query->is_main_query();
2252 2252
 
2253
-	if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2254
-		$term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2255
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2253
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2254
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2255
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2256 2256
 		?>
2257 2257
 		<span class="geodir-pinpoint"
2258
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2258
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2259 2259
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2260 2260
 		   onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2261 2261
 		   onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2262
-		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2262
+		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2263 2263
 		<?php
2264 2264
 	}
2265 2265
 }
2266 2266
 
2267 2267
 function geodir_search_form_submit_button() {
2268 2268
 
2269
-	$default_search_button_label = __( '&#xf002;', 'geodirectory' );
2270
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2271
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2269
+	$default_search_button_label = __('&#xf002;', 'geodirectory');
2270
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2271
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2272 2272
 	}
2273 2273
 
2274 2274
 	/**
@@ -2280,83 +2280,83 @@  discard block
 block discarded – undo
2280 2280
 	 *
2281 2281
 	 * @param string $default_search_button_label The current search button text.
2282 2282
 	 */
2283
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2283
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2284 2284
 
2285 2285
 	$fa_class = '';
2286
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2286
+	if (strpos($default_search_button_label, '&#') !== false) {
2287 2287
 		$fa_class = 'fa';
2288 2288
 	}
2289 2289
 	?>
2290
-	<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2290
+	<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2291 2291
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2292 2292
 	<?php
2293 2293
 }
2294 2294
 
2295
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2295
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2296 2296
 
2297 2297
 function geodir_search_form_post_type_input() {
2298
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2298
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2299 2299
 	$curr_post_type = geodir_get_current_posttype();
2300
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ){
2300
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2301 2301
 
2302
-		$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2303
-		if ( $new_style ) {
2302
+		$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2303
+		if ($new_style) {
2304 2304
 			echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2305 2305
 		}
2306 2306
 		?>
2307 2307
 		<select name="stype" class="search_by_post">
2308
-			<?php foreach ( $post_types as $post_type => $info ):
2308
+			<?php foreach ($post_types as $post_type => $info):
2309 2309
 				global $wpdb;
2310 2310
 				$has_posts = '';
2311
-				$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2312
-				if ( ! $has_posts ) {
2311
+				$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2312
+				if (!$has_posts) {
2313 2313
 					continue;
2314 2314
 				}
2315 2315
 				?>
2316 2316
 
2317
-				<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2318
-				        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2319
-					if ( $post_type == $_REQUEST['stype'] ) {
2317
+				<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2318
+				        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2319
+					if ($post_type == $_REQUEST['stype']) {
2320 2320
 						echo 'selected="selected"';
2321 2321
 					}
2322
-				} elseif ( $curr_post_type == $post_type ) {
2322
+				} elseif ($curr_post_type == $post_type) {
2323 2323
 					echo 'selected="selected"';
2324
-				} ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2324
+				} ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
2325 2325
 
2326 2326
 			<?php endforeach; ?>
2327 2327
 		</select>
2328 2328
 		<?php
2329
-		if ( $new_style ) {
2329
+		if ($new_style) {
2330 2330
 			echo "</div>";
2331 2331
 		}
2332
-	}elseif ( ! empty( $post_types ) ) {
2333
-		echo '<input type="hidden" name="stype" value="' . key( $post_types ) . '"  />';
2332
+	}elseif (!empty($post_types)) {
2333
+		echo '<input type="hidden" name="stype" value="'.key($post_types).'"  />';
2334 2334
 	}
2335 2335
 }
2336 2336
 
2337 2337
 function geodir_search_form_search_input() {
2338 2338
 
2339 2339
 	$default_search_for_text = SEARCH_FOR_TEXT;
2340
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2341
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2340
+	if (get_option('geodir_search_field_default_text')) {
2341
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2342 2342
 	}
2343 2343
 
2344 2344
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2345
-	if($new_style){
2345
+	if ($new_style) {
2346 2346
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2347 2347
 	}
2348 2348
 	?>
2349 2349
 	<input class="search_text" name="s"
2350
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2351
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2350
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2351
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2352 2352
 	       } else {
2353 2353
 		       echo $default_search_for_text;
2354 2354
 	       } ?>" type="text"
2355
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2356
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2355
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2356
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2357 2357
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2358 2358
 	<?php
2359
-	if($new_style){
2359
+	if ($new_style) {
2360 2360
 		echo "</div>";
2361 2361
 	}
2362 2362
 }
@@ -2364,12 +2364,12 @@  discard block
 block discarded – undo
2364 2364
 function geodir_search_form_near_input() {
2365 2365
 
2366 2366
 	$default_near_text = NEAR_TEXT;
2367
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2368
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2367
+	if (get_option('geodir_near_field_default_text')) {
2368
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2369 2369
 	}
2370 2370
 
2371
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2372
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2371
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2372
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2373 2373
 	} else {
2374 2374
 		$near = $default_near_text;
2375 2375
 	}
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 	 * @param string $near              The current near value.
2384 2384
 	 * @param string $default_near_text The default near value.
2385 2385
 	 */
2386
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2386
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2387 2387
 	/**
2388 2388
 	 * Filter the default "Near" text value for the search form.
2389 2389
 	 *
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
 	 * @param string $near              The current near value.
2395 2395
 	 * @param string $default_near_text The default near value.
2396 2396
 	 */
2397
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2397
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2398 2398
 	/**
2399 2399
 	 * Filter the class for the near search input.
2400 2400
 	 *
@@ -2402,26 +2402,26 @@  discard block
 block discarded – undo
2402 2402
 	 *
2403 2403
 	 * @param string $class The class for the HTML near input, default is blank.
2404 2404
 	 */
2405
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2405
+	$near_class = apply_filters('geodir_search_near_class', '');
2406 2406
 
2407 2407
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2408
-	if($new_style){
2408
+	if ($new_style) {
2409 2409
 		echo "<div class='gd-search-input-wrapper gd-search-field-near'>";
2410 2410
 		echo "<div class='gd-append-near-wrapper'>";
2411 2411
 	}
2412 2412
 	?>
2413 2413
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2414
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2415
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2414
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2415
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2416 2416
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"/>
2417 2417
 	<?php
2418
-	if($new_style){
2418
+	if ($new_style) {
2419 2419
 		echo '<span class="near-compass gd-search-near-input" data-dropdown=".gd-near-me-dropdown" ><i class="fa fa-compass" aria-hidden="true"></i></span>';
2420 2420
 		echo "</div>";
2421 2421
 		echo "</div>";
2422 2422
 	}
2423 2423
 }
2424 2424
 
2425
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2426
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2427
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2428 2425
\ No newline at end of file
2426
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2427
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2428
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2429 2429
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2329,7 +2329,7 @@
 block discarded – undo
2329 2329
 		if ( $new_style ) {
2330 2330
 			echo "</div>";
2331 2331
 		}
2332
-	}elseif ( ! empty( $post_types ) ) {
2332
+	} elseif ( ! empty( $post_types ) ) {
2333 2333
 		echo '<input type="hidden" name="stype" value="' . key( $post_types ) . '"  />';
2334 2334
 	}
2335 2335
 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 3 patches
Indentation   +2133 added lines, -2133 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,705 +72,705 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query .= " and is_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *
291
-     * }
292
-     * @param bool $default Not yet implemented.
293
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-     */
295
-    function geodir_custom_field_save($request_field = array(), $default = false)
296
-    {
297
-
298
-        global $wpdb, $plugin_prefix;
299
-
300
-        $old_html_variable = '';
301
-
302
-        $data_type = trim($request_field['data_type']);
303
-
304
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
-
306
-        // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
-            $request_field['data_type'] = 'VARCHAR';
309
-        }
310
-
311
-        $cf = trim($result_str, '_');
312
-
313
-
314
-        /*-------- check dublicate validation --------*/
315
-
316
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
-        $post_type = $request_field['listing_type'];
318
-
319
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
-        }
322
-
323
-        $check_html_variable = $wpdb->get_var(
324
-            $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
-                array($cf, $cehhtmlvar_name, $post_type)
327
-            )
328
-        );
329
-
330
-
331
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
-
333
-            if ($cf != '') {
334
-
335
-                $post_meta_info = $wpdb->get_row(
336
-                    $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
-                        array($cf)
339
-                    )
340
-                );
341
-
342
-            }
343
-
344
-            if (!empty($post_meta_info)) {
345
-                $post_val = $post_meta_info;
346
-                $old_html_variable = $post_val->htmlvar_name;
347
-
348
-            }
349
-
350
-
351
-
352
-            if ($post_type == '') $post_type = 'gd_place';
353
-
354
-
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
356
-
357
-            $admin_title = $request_field['admin_title'];
358
-            $site_title = $request_field['site_title'];
359
-            $data_type = $request_field['data_type'];
360
-            $field_type = $request_field['field_type'];
361
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *
291
+	 * }
292
+	 * @param bool $default Not yet implemented.
293
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+	 */
295
+	function geodir_custom_field_save($request_field = array(), $default = false)
296
+	{
297
+
298
+		global $wpdb, $plugin_prefix;
299
+
300
+		$old_html_variable = '';
301
+
302
+		$data_type = trim($request_field['data_type']);
303
+
304
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
+
306
+		// some servers fail if a POST value is VARCHAR so we change it.
307
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+			$request_field['data_type'] = 'VARCHAR';
309
+		}
310
+
311
+		$cf = trim($result_str, '_');
312
+
313
+
314
+		/*-------- check dublicate validation --------*/
315
+
316
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
+		$post_type = $request_field['listing_type'];
318
+
319
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+		}
322
+
323
+		$check_html_variable = $wpdb->get_var(
324
+			$wpdb->prepare(
325
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+				array($cf, $cehhtmlvar_name, $post_type)
327
+			)
328
+		);
329
+
330
+
331
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
+
333
+			if ($cf != '') {
334
+
335
+				$post_meta_info = $wpdb->get_row(
336
+					$wpdb->prepare(
337
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+						array($cf)
339
+					)
340
+				);
341
+
342
+			}
343
+
344
+			if (!empty($post_meta_info)) {
345
+				$post_val = $post_meta_info;
346
+				$old_html_variable = $post_val->htmlvar_name;
347
+
348
+			}
349
+
350
+
351
+
352
+			if ($post_type == '') $post_type = 'gd_place';
353
+
354
+
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
356
+
357
+			$admin_title = $request_field['admin_title'];
358
+			$site_title = $request_field['site_title'];
359
+			$data_type = $request_field['data_type'];
360
+			$field_type = $request_field['field_type'];
361
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
+			}
407 407
 
408 408
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
409
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
410
+				$extra_fields = $request_field['extra'];
411 411
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
412
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
+				$is_default = $request_field['is_default'];
414
+			else
415
+				$is_default = '0';
416 416
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
417
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
+				$is_admin = $request_field['is_admin'];
419
+			else
420
+				$is_admin = '0';
421 421
 
422 422
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
423
+			if ($is_active == '') $is_active = 1;
424
+			if ($is_required == '') $is_required = 0;
425 425
 
426 426
 
427
-            if ($sort_order == '') {
427
+			if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
432
-            }
431
+				$sort_order = (int)$last_order + 1;
432
+			}
433 433
 
434
-            $default_value_add = '';
434
+			$default_value_add = '';
435 435
 
436 436
 
437
-            if (!empty($post_meta_info)) {
438
-                switch ($field_type):
437
+			if (!empty($post_meta_info)) {
438
+				switch ($field_type):
439 439
 
440
-                    case 'address':
440
+					case 'address':
441 441
 
442
-                        if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
444
-                        }
445
-                        $old_prefix = $old_html_variable . '_';
442
+						if ($htmlvar_name != '') {
443
+							$prefix = $htmlvar_name . '_';
444
+						}
445
+						$old_prefix = $old_html_variable . '_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449 449
 
450
-                        if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
-                        }
450
+						if ($default_value != '') {
451
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+						}
453 453
 
454
-                        $wpdb->query($meta_field_add);
454
+						$wpdb->query($meta_field_add);
455 455
 
456
-                        if ($extra_fields != '') {
456
+						if ($extra_fields != '') {
457 457
 
458
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
458
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
-                                if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+								if ($is_column) {
462
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463 463
 
464
-                                    if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
-                                    }
464
+									if ($default_value != '') {
465
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+									}
467 467
 
468
-                                    $wpdb->query($meta_field_add);
469
-                                } else {
468
+									$wpdb->query($meta_field_add);
469
+								} else {
470 470
 
471
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
472
-                                    if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
-                                    }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
471
+									$meta_field_add = "VARCHAR( 50 ) NULL";
472
+									if ($default_value != '') {
473
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+									}
475
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476 476
 
477
-                                }
477
+								}
478 478
 
479 479
 
480
-                            }
480
+							}
481 481
 
482 482
 
483
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
483
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486 486
 
487
-                                if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
487
+								if ($is_column) {
488
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489 489
 
490
-                                    if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
-                                    }
490
+									if ($default_value != '') {
491
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+									}
493 493
 
494
-                                    $wpdb->query($meta_field_add);
495
-                                } else {
496
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
497
-                                    if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
-                                    }
494
+									$wpdb->query($meta_field_add);
495
+								} else {
496
+									$meta_field_add = "VARCHAR( 50 ) NULL";
497
+									if ($default_value != '') {
498
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+									}
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
-                                }
501
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+								}
503 503
 
504
-                            }
505
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
504
+							}
505
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508 508
 
509
-                                if ($is_column) {
509
+								if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512 512
 
513
-                                    if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
-                                    }
513
+									if ($default_value != '') {
514
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+									}
516 516
 
517
-                                    $wpdb->query($meta_field_add);
518
-                                } else {
517
+									$wpdb->query($meta_field_add);
518
+								} else {
519 519
 
520
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
521
-                                    if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
-                                    }
520
+									$meta_field_add = "VARCHAR( 50 ) NULL";
521
+									if ($default_value != '') {
522
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+									}
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526 526
 
527
-                                }
527
+								}
528 528
 
529
-                            }
530
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
529
+							}
530
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533 533
 
534
-                                if ($is_column) {
534
+								if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537 537
 
538
-                                    if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
-                                    }
538
+									if ($default_value != '') {
539
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+									}
541 541
 
542
-                                    $wpdb->query($meta_field_add);
543
-                                } else {
542
+									$wpdb->query($meta_field_add);
543
+								} else {
544 544
 
545
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
546
-                                    if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
-                                    }
545
+									$meta_field_add = "VARCHAR( 50 ) NULL";
546
+									if ($default_value != '') {
547
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+									}
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551 551
 
552
-                                }
552
+								}
553 553
 
554
-                            }
555
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
554
+							}
555
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
-                                if ($is_column) {
557
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+								if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561 561
 
562
-                                    if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
-                                    }
562
+									if ($default_value != '') {
563
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+									}
565 565
 
566
-                                    $wpdb->query($meta_field_add);
567
-                                } else {
566
+									$wpdb->query($meta_field_add);
567
+								} else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
571
-                                    if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
-                                    }
569
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+									$meta_field_add = "VARCHAR( 20 ) NULL";
571
+									if ($default_value != '') {
572
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+									}
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576 576
 
577
-                                }
577
+								}
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581 581
 
582
-                                if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
582
+								if ($is_column) {
583
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584 584
 
585
-                                    if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
-                                    }
585
+									if ($default_value != '') {
586
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+									}
588 588
 
589
-                                    $wpdb->query($meta_field_add);
590
-                                } else {
589
+									$wpdb->query($meta_field_add);
590
+								} else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
594
-                                    if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
-                                    }
592
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+									$meta_field_add = "VARCHAR( 20 ) NULL";
594
+									if ($default_value != '') {
595
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+									}
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
-                                }
598
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+								}
600 600
 
601
-                            }
602
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
601
+							}
602
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605 605
 
606
-                                if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
606
+								if ($is_column) {
607
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608 608
 
609
-                                    if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
-                                    }
609
+									if ($default_value != '') {
610
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+									}
612 612
 
613
-                                    $wpdb->query($meta_field_add);
614
-                                } else {
613
+									$wpdb->query($meta_field_add);
614
+								} else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617 617
 
618
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
619
-                                    if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
-                                    }
618
+									$meta_field_add = "VARCHAR( 15 ) NULL";
619
+									if ($default_value != '') {
620
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+									}
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
-                                }
623
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+								}
625 625
 
626 626
 
627
-                            }
628
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
627
+							}
628
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
-                                if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+								if ($is_column) {
632
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634
-                                    if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
-                                    }
634
+									if ($default_value != '') {
635
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+									}
637 637
 
638
-                                    $wpdb->query($meta_field_add);
638
+									$wpdb->query($meta_field_add);
639 639
 
640
-                                } else {
640
+								} else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
645
-                                    if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
-                                    }
644
+									$meta_field_add = "VARCHAR( 3 ) NULL";
645
+									if ($default_value != '') {
646
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+									}
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
-                                }
649
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+								}
651 651
 
652
-                            }
653
-                            // show lat lng
654
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
652
+							}
653
+							// show lat lng
654
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656 656
 
657
-                                if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
-                                    $meta_field_add .= " DEFAULT '1'";
657
+								if ($is_column) {
658
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+									$meta_field_add .= " DEFAULT '1'";
660 660
 
661
-                                    $wpdb->query($meta_field_add);
662
-                                } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661
+									$wpdb->query($meta_field_add);
662
+								} else {
663
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664 664
 
665
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
666
-                                    $meta_field_add .= " DEFAULT '1'";
665
+									$meta_field_add = "VARCHAR( 3 ) NULL";
666
+									$meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
-                                }
668
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+								}
670 670
 
671
-                            }
672
-                        }// end extra
671
+							}
672
+						}// end extra
673 673
 
674
-                        break;
674
+						break;
675 675
 
676
-                    case 'checkbox':
677
-                    case 'multiselect':
678
-                    case 'select':
679
-                    case 'taxonomy':
676
+					case 'checkbox':
677
+					case 'multiselect':
678
+					case 'select':
679
+					case 'taxonomy':
680 680
 
681
-                        $op_size = '500';
681
+						$op_size = '500';
682 682
 
683
-                        // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
687
-                                $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
-                                }
691
-                                if($op_max){$op_size =$op_max; }
692
-                            }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
696
-                            }
697
-                        }
683
+						// only make the field as big as it needs to be.
684
+						if(isset($option_values) && $option_values && $field_type=='select'){
685
+							$option_values_arr = explode(',',$option_values);
686
+							if(is_array($option_values_arr)){
687
+								$op_max = 0;
688
+								foreach($option_values_arr as $op_val){
689
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
+								}
691
+								if($op_max){$op_size =$op_max; }
692
+							}
693
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
+							if(strlen($option_values)){
695
+								$op_size =  strlen($option_values);
696
+							}
697
+						}
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700 700
 
701
-                        if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
-                        }
701
+						if ($default_value != '') {
702
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+						}
704 704
 
705
-                        $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
708
-                        }
705
+						$alter_result = $wpdb->query($meta_field_add);
706
+						if($alter_result===false){
707
+							return __('Column change failed, you may have too many columns.','geodirectory');
708
+						}
709 709
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['cat_display_type']))
711
+							$extra_fields = $request_field['cat_display_type'];
712 712
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
713
+						if (isset($request_field['multi_display_type']))
714
+							$extra_fields = $request_field['multi_display_type'];
715 715
 
716 716
 
717
-                        break;
717
+						break;
718 718
 
719
-                    case 'textarea':
720
-                    case 'html':
721
-                    case 'url':
722
-                    case 'file':
719
+					case 'textarea':
720
+					case 'html':
721
+					case 'url':
722
+					case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
727
-                        }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
730
-
731
-                        break;
724
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
+						if($alter_result===false){
726
+							return __('Column change failed, you may have too many columns.','geodirectory');
727
+						}
728
+						if (isset($request_field['advanced_editor']))
729
+							$extra_fields = $request_field['advanced_editor'];
730
+
731
+						break;
732 732
 
733
-                    case 'fieldset':
734
-                        // Nothig happend for fieldset
735
-                        break;
733
+					case 'fieldset':
734
+						// Nothig happend for fieldset
735
+						break;
736 736
 
737
-                    default:
738
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
739
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
-                            } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
-                            }
744
-
745
-                            if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
-                            }
748
-                        } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
-                            if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
-                            }
753
-                        }
754
-
755
-                        $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
758
-                        }
759
-                        break;
760
-                endswitch;
761
-
762
-                $extra_field_query = '';
763
-                if (!empty($extra_fields)) {
764
-                    $extra_field_query = serialize($extra_fields);
765
-                }
766
-
767
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
-
769
-                $wpdb->query(
770
-
771
-                    $wpdb->prepare(
772
-
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
737
+					default:
738
+						if ($data_type != 'VARCHAR' && $data_type != '') {
739
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+							} else {
742
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+							}
744
+
745
+							if (is_numeric($default_value) && $default_value != '') {
746
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
747
+							}
748
+						} else {
749
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+							if ($default_value != '') {
751
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
752
+							}
753
+						}
754
+
755
+						$alter_result = $wpdb->query($default_value_add);
756
+						if($alter_result===false){
757
+							return __('Column change failed, you may have too many columns.','geodirectory');
758
+						}
759
+						break;
760
+				endswitch;
761
+
762
+				$extra_field_query = '';
763
+				if (!empty($extra_fields)) {
764
+					$extra_field_query = serialize($extra_fields);
765
+				}
766
+
767
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
+
769
+				$wpdb->query(
770
+
771
+					$wpdb->prepare(
772
+
773
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,308 +804,308 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
-                    )
807
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
808
+					)
809 809
 
810
-                );
810
+				);
811 811
 
812
-                $lastid = trim($cf);
812
+				$lastid = trim($cf);
813 813
 
814 814
 
815
-                $wpdb->query(
816
-                    $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
815
+				$wpdb->query(
816
+					$wpdb->prepare(
817
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820
-                        array($site_title, $post_type, $htmlvar_name)
821
-                    )
822
-                );
823
-
824
-
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
-
828
-
829
-                /**
830
-                 * Called after all custom fields are saved for a post.
831
-                 *
832
-                 * @since 1.0.0
833
-                 * @param int $lastid The post ID.
834
-                 */
835
-                do_action('geodir_after_custom_fields_updated', $lastid);
836
-
837
-            } else {
838
-
839
-                switch ($field_type):
840
-
841
-                    case 'address':
842
-
843
-                        $data_type = '';
844
-
845
-                        if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
847
-                        }
848
-                        $old_prefix = $old_html_variable;
849
-
850
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
-
852
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
853
-                        if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
-                        }
856
-
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
-                        //$wpdb->query($meta_field_add);
859
-
860
-
861
-                        if (!empty($extra_fields)) {
820
+						array($site_title, $post_type, $htmlvar_name)
821
+					)
822
+				);
823
+
824
+
825
+				if ($cat_sort == '')
826
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+
828
+
829
+				/**
830
+				 * Called after all custom fields are saved for a post.
831
+				 *
832
+				 * @since 1.0.0
833
+				 * @param int $lastid The post ID.
834
+				 */
835
+				do_action('geodir_after_custom_fields_updated', $lastid);
836
+
837
+			} else {
838
+
839
+				switch ($field_type):
840
+
841
+					case 'address':
842
+
843
+						$data_type = '';
844
+
845
+						if ($htmlvar_name != '') {
846
+							$prefix = $htmlvar_name . '_';
847
+						}
848
+						$old_prefix = $old_html_variable;
849
+
850
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
+
852
+						$meta_field_add = "VARCHAR( 254 ) NULL";
853
+						if ($default_value != '') {
854
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+						}
856
+
857
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+						//$wpdb->query($meta_field_add);
859
+
860
+
861
+						if (!empty($extra_fields)) {
862 862
 
863
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
866
-                                if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
-                                }
869
-
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
-                                //$wpdb->query($meta_field_add);
872
-                            }
873
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
876
-                                if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
-                                }
879
-
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
-                                //$wpdb->query($meta_field_add);
882
-                            }
883
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
-
886
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
897
-                                if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
-                                }
900
-
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
-                                //$wpdb->query($meta_field_add);
903
-                            }
904
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
907
-                                if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
-                                }
910
-
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
-                                //$wpdb->query($meta_field_add);
913
-
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
-
916
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
917
-                                if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
-                                }
920
-
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
-
923
-                                //$wpdb->query($meta_field_add);
924
-                            }
925
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
-
928
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
929
-                                if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
-                                }
932
-
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
-
935
-                                //$wpdb->query($meta_field_add);
936
-                            }
937
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
-
940
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
941
-                                if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
-                                }
944
-
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
-
947
-                                //$wpdb->query($meta_field_add);
948
-                            }
949
-                            // show lat lng
950
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
-
953
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
954
-                                $meta_field_add .= " DEFAULT '1'";
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
-                                //$wpdb->query($meta_field_add);
958
-                            }
959
-                        }
960
-
961
-                        break;
962
-
963
-                    case 'checkbox':
964
-                        $data_type = 'TINYINT';
965
-
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
968
-                            $meta_field_add .= " DEFAULT '1'";
969
-                        }
970
-
971
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
-                        if ($add_result === false) {
973
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
-                        }
975
-                        break;
976
-                    case 'multiselect':
977
-                    case 'select':
978
-                        $data_type = 'VARCHAR';
979
-                        $op_size = '500';
980
-
981
-                        // only make the field as big as it needs to be.
982
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
983
-                            $option_values_arr = explode(',', $option_values);
984
-
985
-                            if (is_array($option_values_arr)) {
986
-                                $op_max = 0;
987
-
988
-                                foreach ($option_values_arr as $op_val) {
989
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
990
-                                        $op_max = strlen($op_val);
991
-                                    }
992
-                                }
993
-
994
-                                if ($op_max) {
995
-                                    $op_size = $op_max;
996
-                                }
997
-                            }
998
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
-                            if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1001
-                            }
1002
-
1003
-                            if (isset($request_field['multi_display_type'])) {
1004
-                                $extra_fields = $request_field['multi_display_type'];
1005
-                            }
1006
-                        }
1007
-
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
-                        if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
-                        }
1012
-
1013
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
-                        if ($add_result === false) {
1015
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
-                        }
1017
-                        break;
1018
-                    case 'textarea':
1019
-                    case 'html':
1020
-                    case 'url':
1021
-                    case 'file':
1022
-
1023
-                        $data_type = 'TEXT';
1024
-
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
-
1027
-                        $meta_field_add = $data_type . " NULL ";
1028
-                        /*if($default_value != '')
863
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+								$meta_field_add = "VARCHAR( 30 ) NULL";
866
+								if ($default_value != '') {
867
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+								}
869
+
870
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+								//$wpdb->query($meta_field_add);
872
+							}
873
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+								$meta_field_add = "VARCHAR( 30 ) NULL";
876
+								if ($default_value != '') {
877
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+								}
879
+
880
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+								//$wpdb->query($meta_field_add);
882
+							}
883
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+
886
+								$meta_field_add = "VARCHAR( 30 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+								$meta_field_add = "VARCHAR( 15 ) NULL";
897
+								if ($default_value != '') {
898
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+								}
900
+
901
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+								//$wpdb->query($meta_field_add);
903
+							}
904
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+								$meta_field_add = "VARCHAR( 20 ) NULL";
907
+								if ($default_value != '') {
908
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+								}
910
+
911
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+								//$wpdb->query($meta_field_add);
913
+
914
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+
916
+								$meta_field_add = "VARCHAR( 20 ) NULL";
917
+								if ($default_value != '') {
918
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+								}
920
+
921
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+
923
+								//$wpdb->query($meta_field_add);
924
+							}
925
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+
928
+								$meta_field_add = "VARCHAR( 15 ) NULL";
929
+								if ($default_value != '') {
930
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+								}
932
+
933
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+
935
+								//$wpdb->query($meta_field_add);
936
+							}
937
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+
940
+								$meta_field_add = "VARCHAR( 3 ) NULL";
941
+								if ($default_value != '') {
942
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+								}
944
+
945
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+
947
+								//$wpdb->query($meta_field_add);
948
+							}
949
+							// show lat lng
950
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+
953
+								$meta_field_add = "VARCHAR( 3 ) NULL";
954
+								$meta_field_add .= " DEFAULT '1'";
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+								//$wpdb->query($meta_field_add);
958
+							}
959
+						}
960
+
961
+						break;
962
+
963
+					case 'checkbox':
964
+						$data_type = 'TINYINT';
965
+
966
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
+						if ((int)$default_value === 1) {
968
+							$meta_field_add .= " DEFAULT '1'";
969
+						}
970
+
971
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
+						if ($add_result === false) {
973
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
+						}
975
+						break;
976
+					case 'multiselect':
977
+					case 'select':
978
+						$data_type = 'VARCHAR';
979
+						$op_size = '500';
980
+
981
+						// only make the field as big as it needs to be.
982
+						if (isset($option_values) && $option_values && $field_type == 'select') {
983
+							$option_values_arr = explode(',', $option_values);
984
+
985
+							if (is_array($option_values_arr)) {
986
+								$op_max = 0;
987
+
988
+								foreach ($option_values_arr as $op_val) {
989
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
990
+										$op_max = strlen($op_val);
991
+									}
992
+								}
993
+
994
+								if ($op_max) {
995
+									$op_size = $op_max;
996
+								}
997
+							}
998
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
+							if (strlen($option_values)) {
1000
+								$op_size =  strlen($option_values);
1001
+							}
1002
+
1003
+							if (isset($request_field['multi_display_type'])) {
1004
+								$extra_fields = $request_field['multi_display_type'];
1005
+							}
1006
+						}
1007
+
1008
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+						if ($default_value != '') {
1010
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+						}
1012
+
1013
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
+						if ($add_result === false) {
1015
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
+						}
1017
+						break;
1018
+					case 'textarea':
1019
+					case 'html':
1020
+					case 'url':
1021
+					case 'file':
1022
+
1023
+						$data_type = 'TEXT';
1024
+
1025
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+
1027
+						$meta_field_add = $data_type . " NULL ";
1028
+						/*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
1031
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
-                        if ($add_result === false) {
1033
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
-                        }
1031
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
+						if ($add_result === false) {
1033
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
+						}
1035 1035
 
1036
-                        break;
1036
+						break;
1037 1037
 
1038
-                    case 'datepicker':
1038
+					case 'datepicker':
1039 1039
 
1040
-                        $data_type = 'DATE';
1040
+						$data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+						$meta_field_add = $data_type . " NULL ";
1045 1045
 
1046
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
-                        if ($add_result === false) {
1048
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
-                        }
1046
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
+						if ($add_result === false) {
1048
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
+						}
1050 1050
 
1051
-                        break;
1051
+						break;
1052 1052
 
1053
-                    case 'time':
1053
+					case 'time':
1054 1054
 
1055
-                        $data_type = 'TIME';
1055
+						$data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+						$meta_field_add = $data_type . " NULL ";
1060 1060
 
1061
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
-                        if ($add_result === false) {
1063
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
-                        }
1061
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
+						if ($add_result === false) {
1063
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
+						}
1065 1065
 
1066
-                        break;
1066
+						break;
1067 1067
 
1068
-                    default:
1068
+					default:
1069 1069
 
1070
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1070
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1071
+							$meta_field_add = $data_type . " NULL ";
1072 1072
 
1073
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
-                            }
1073
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+							}
1076 1076
 
1077
-                            if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
-                            }
1081
-                        } else {
1082
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1077
+							if (is_numeric($default_value) && $default_value != '') {
1078
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1079
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
+							}
1081
+						} else {
1082
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084
-                            if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
-                            }
1088
-                        }
1084
+							if ($default_value != '') {
1085
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1086
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
+							}
1088
+						}
1089 1089
 
1090
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
-                        if ($add_result === false) {
1092
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
-                        }
1094
-                        break;
1095
-                endswitch;
1090
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
+						if ($add_result === false) {
1092
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
+						}
1094
+						break;
1095
+				endswitch;
1096 1096
 
1097
-                $extra_field_query = '';
1098
-                if (!empty($extra_fields)) {
1099
-                    $extra_field_query = serialize($extra_fields);
1100
-                }
1097
+				$extra_field_query = '';
1098
+				if (!empty($extra_fields)) {
1099
+					$extra_field_query = serialize($extra_fields);
1100
+				}
1101 1101
 
1102
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103 1103
 
1104
-                $wpdb->query(
1104
+				$wpdb->query(
1105 1105
 
1106
-                    $wpdb->prepare(
1106
+					$wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,26 +1138,26 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1142 1142
 
1143
-                    )
1143
+					)
1144 1144
 
1145
-                );
1145
+				);
1146 1146
 
1147
-                $lastid = $wpdb->insert_id;
1147
+				$lastid = $wpdb->insert_id;
1148 1148
 
1149
-                $lastid = trim($lastid);
1149
+				$lastid = trim($lastid);
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            return (int)$lastid;
1153
+			return (int)$lastid;
1154 1154
 
1155 1155
 
1156
-        } else {
1157
-            return 'HTML Variable Name should be a unique name';
1158
-        }
1156
+		} else {
1157
+			return 'HTML Variable Name should be a unique name';
1158
+		}
1159 1159
 
1160
-    }
1160
+	}
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1172,54 +1172,54 @@  discard block
 block discarded – undo
1172 1172
 function godir_set_field_order($field_ids = array())
1173 1173
 {
1174 1174
 
1175
-    global $wpdb;
1175
+	global $wpdb;
1176 1176
 
1177
-    $count = 0;
1178
-    if (!empty($field_ids)):
1179
-        $post_meta_info = false;
1180
-        foreach ($field_ids as $id) {
1177
+	$count = 0;
1178
+	if (!empty($field_ids)):
1179
+		$post_meta_info = false;
1180
+		foreach ($field_ids as $id) {
1181 1181
 
1182
-            $cf = trim($id, '_');
1182
+			$cf = trim($id, '_');
1183 1183
 
1184
-            $post_meta_info = $wpdb->query(
1185
-                $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+			$post_meta_info = $wpdb->query(
1185
+				$wpdb->prepare(
1186
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189
-                    array($count, $cf)
1190
-                )
1191
-            );
1192
-            $count++;
1193
-        }
1194
-
1195
-        return $post_meta_info;
1196
-    else:
1197
-        return false;
1198
-    endif;
1189
+					array($count, $cf)
1190
+				)
1191
+			);
1192
+			$count++;
1193
+		}
1194
+
1195
+		return $post_meta_info;
1196
+	else:
1197
+		return false;
1198
+	endif;
1199 1199
 }
1200 1200
 
1201 1201
 
1202 1202
 function geodir_get_cf_value($cf){
1203
-    global $gd_session;
1204
-    $value = '';
1205
-    if (is_admin()) {
1206
-        global $post,$gd_session;
1207
-
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1210
-    }
1211
-
1212
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
-        $post = $gd_ses_listing;
1214
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
-    } else {
1218
-        if ($value == '') {
1219
-            $value = $cf['default'];
1220
-        }
1221
-    }
1222
-    return $value;
1203
+	global $gd_session;
1204
+	$value = '';
1205
+	if (is_admin()) {
1206
+		global $post,$gd_session;
1207
+
1208
+		if (isset($_REQUEST['post']))
1209
+			$_REQUEST['pid'] = $_REQUEST['post'];
1210
+	}
1211
+
1212
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
+		$post = $gd_ses_listing;
1214
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
+	} else {
1218
+		if ($value == '') {
1219
+			$value = $cf['default'];
1220
+		}
1221
+	}
1222
+	return $value;
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1238,411 +1238,411 @@  discard block
 block discarded – undo
1238 1238
  * @param string $post_type Optional. The wordpress post type.
1239 1239
  */
1240 1240
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1241
-    global $is_default, $mapzoom, $gd_session;
1241
+	global $is_default, $mapzoom, $gd_session;
1242 1242
 
1243
-    $listing_type = $post_type;
1243
+	$listing_type = $post_type;
1244 1244
 
1245
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246 1246
 
1247
-    foreach ($custom_fields as $key => $val) {
1248
-        $val = stripslashes_deep($val); // strip slashes from labels
1249
-        $name = $val['name'];
1250
-        $type = $val['type'];
1251
-        $is_default = $val['is_default'];
1247
+	foreach ($custom_fields as $key => $val) {
1248
+		$val = stripslashes_deep($val); // strip slashes from labels
1249
+		$name = $val['name'];
1250
+		$type = $val['type'];
1251
+		$is_default = $val['is_default'];
1252 1252
 
1253
-        /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
-        if ($for_admin_use && !is_super_admin()) {
1256
-            continue;
1257
-        }
1253
+		/* field available to site admin only for edit */
1254
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
+		if ($for_admin_use && !is_super_admin()) {
1256
+			continue;
1257
+		}
1258 1258
 
1259
-        if (is_admin()) {
1260
-            global $post;
1259
+		if (is_admin()) {
1260
+			global $post;
1261 1261
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1264
-        }
1262
+			if (isset($_REQUEST['post']))
1263
+				$_REQUEST['pid'] = $_REQUEST['post'];
1264
+		}
1265 1265
 
1266 1266
         
1267 1267
 
1268
-        /**
1269
-         * Called before the custom fields info is output for submitting a post.
1270
-         *
1271
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
-         *
1273
-         * @since 1.0.0
1274
-         * @param string $listing_type The post post type.
1275
-         * @param int $package_id The price package ID for the post.
1276
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
-         * @see 'geodir_after_custom_form_field_$name'
1278
-         */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
-
1281
-
1282
-        $custom_field = $val;
1283
-        $html ='';
1284
-        /**
1285
-         * Filter the output for custom fields.
1286
-         *
1287
-         * Here we can remove or add new functions depending on the field type.
1288
-         *
1289
-         * @param string $html The html to be filtered (blank).
1290
-         * @param array $custom_field The custom field array values.
1291
-         */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
-
1294
-
1295
-
1296
-        /**
1297
-         * Called after the custom fields info is output for submitting a post.
1298
-         *
1299
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
-         *
1301
-         * @since 1.0.0
1302
-         * @param string $listing_type The post post type.
1303
-         * @param int $package_id The price package ID for the post.
1304
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
-         * @see 'geodir_before_custom_form_field_$name'
1306
-         */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
-
1309
-    }
1268
+		/**
1269
+		 * Called before the custom fields info is output for submitting a post.
1270
+		 *
1271
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
+		 *
1273
+		 * @since 1.0.0
1274
+		 * @param string $listing_type The post post type.
1275
+		 * @param int $package_id The price package ID for the post.
1276
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
+		 * @see 'geodir_after_custom_form_field_$name'
1278
+		 */
1279
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
+
1281
+
1282
+		$custom_field = $val;
1283
+		$html ='';
1284
+		/**
1285
+		 * Filter the output for custom fields.
1286
+		 *
1287
+		 * Here we can remove or add new functions depending on the field type.
1288
+		 *
1289
+		 * @param string $html The html to be filtered (blank).
1290
+		 * @param array $custom_field The custom field array values.
1291
+		 */
1292
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
+
1294
+
1295
+
1296
+		/**
1297
+		 * Called after the custom fields info is output for submitting a post.
1298
+		 *
1299
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
+		 *
1301
+		 * @since 1.0.0
1302
+		 * @param string $listing_type The post post type.
1303
+		 * @param int $package_id The price package ID for the post.
1304
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
+		 * @see 'geodir_before_custom_form_field_$name'
1306
+		 */
1307
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
+
1309
+	}
1310 1310
 
1311 1311
 }
1312 1312
 
1313 1313
 
1314 1314
 if (!function_exists('geodir_get_field_infoby')) {
1315
-    /**
1316
-     * Get custom field using key and value.
1317
-     *
1318
-     * @since 1.0.0
1319
-     * @package GeoDirectory
1320
-     * @global object $wpdb WordPress Database object.
1321
-     * @param string $key The key you want to look for.
1322
-     * @param string $value The value of the key you want to look for.
1323
-     * @param string $geodir_post_type The post type.
1324
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1325
-     */
1326
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
-    {
1328
-
1329
-        global $wpdb;
1330
-
1331
-        $filter = $wpdb->get_row(
1332
-            $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
-                array($geodir_post_type)
1335
-            )
1336
-        );
1337
-
1338
-        if ($filter) {
1339
-            return $filter;
1340
-        } else {
1341
-            return false;
1342
-        }
1343
-
1344
-    }
1315
+	/**
1316
+	 * Get custom field using key and value.
1317
+	 *
1318
+	 * @since 1.0.0
1319
+	 * @package GeoDirectory
1320
+	 * @global object $wpdb WordPress Database object.
1321
+	 * @param string $key The key you want to look for.
1322
+	 * @param string $value The value of the key you want to look for.
1323
+	 * @param string $geodir_post_type The post type.
1324
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1325
+	 */
1326
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
+	{
1328
+
1329
+		global $wpdb;
1330
+
1331
+		$filter = $wpdb->get_row(
1332
+			$wpdb->prepare(
1333
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
+				array($geodir_post_type)
1335
+			)
1336
+		);
1337
+
1338
+		if ($filter) {
1339
+			return $filter;
1340
+		} else {
1341
+			return false;
1342
+		}
1343
+
1344
+	}
1345 1345
 }
1346 1346
 
1347 1347
 
1348 1348
 function geodir_field_icon_proccess($cf){
1349 1349
 
1350 1350
 
1351
-    if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1356
-        $field_icon = $cf['field_icon'];
1357
-    }
1351
+	if (strpos($cf['field_icon'], 'http') !== false) {
1352
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
+	}else{
1356
+		$field_icon = $cf['field_icon'];
1357
+	}
1358 1358
 
1359
-    return $field_icon;
1359
+	return $field_icon;
1360 1360
 }
1361 1361
 
1362 1362
 if (!function_exists('geodir_show_listing_info')) {
1363
-    /**
1364
-     * Show listing info depending on field location.
1365
-     *
1366
-     * @since 1.0.0
1367
-     * @since 1.5.7 Custom fields option values added to db translation.
1368
-     *              Changes to display url fields title.
1369
-     * @package GeoDirectory
1370
-     * @global object $wpdb WordPress Database object.
1371
-     * @global object $post The current post object.
1372
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
-     *
1374
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
-     * @return string Returns listing info html.
1376
-     */
1377
-    function geodir_show_listing_info($fields_location = '') {
1378
-        global $post, $preview, $wpdb, $send_to_friend;
1379
-
1380
-        $package_info = array();
1381
-
1382
-        $package_info = geodir_post_package_info($package_info, $post);
1383
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
-        $send_to_friend = false;
1386
-
1387
-        ob_start();
1388
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
-
1390
-        if (!empty($fields_info)) {
1391
-            $post = stripslashes_deep($post); // strip slashes
1363
+	/**
1364
+	 * Show listing info depending on field location.
1365
+	 *
1366
+	 * @since 1.0.0
1367
+	 * @since 1.5.7 Custom fields option values added to db translation.
1368
+	 *              Changes to display url fields title.
1369
+	 * @package GeoDirectory
1370
+	 * @global object $wpdb WordPress Database object.
1371
+	 * @global object $post The current post object.
1372
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
+	 *
1374
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
+	 * @return string Returns listing info html.
1376
+	 */
1377
+	function geodir_show_listing_info($fields_location = '') {
1378
+		global $post, $preview, $wpdb, $send_to_friend;
1379
+
1380
+		$package_info = array();
1381
+
1382
+		$package_info = geodir_post_package_info($package_info, $post);
1383
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
+		$send_to_friend = false;
1386
+
1387
+		ob_start();
1388
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
+
1390
+		if (!empty($fields_info)) {
1391
+			$post = stripslashes_deep($post); // strip slashes
1392 1392
             
1393
-            //echo '<div class="geodir-company_info field-group">';
1394
-            global $field_set_start;
1395
-            $field_set_start = 0;
1393
+			//echo '<div class="geodir-company_info field-group">';
1394
+			global $field_set_start;
1395
+			$field_set_start = 0;
1396 1396
 
1397 1397
 
1398 1398
 
1399
-            foreach ($fields_info as $type) {
1400
-                $type = stripslashes_deep($type); // strip slashes
1401
-                $html = '';
1402
-                $field_icon = geodir_field_icon_proccess($type);
1403
-                $filed_type = $type['type'];
1404
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1399
+			foreach ($fields_info as $type) {
1400
+				$type = stripslashes_deep($type); // strip slashes
1401
+				$html = '';
1402
+				$field_icon = geodir_field_icon_proccess($type);
1403
+				$filed_type = $type['type'];
1404
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
+				if($html_var=='post'){$html_var='post_address';}
1406 1406
 
1407
-                /**
1408
-                 * Filter the output for custom fields.
1409
-                 *
1410
-                 * Here we can remove or add new functions depending on the field type.
1411
-                 *
1412
-                 * @param string $html The html to be filtered (blank).
1413
-                 * @param string $fields_location The location the field is to be show.
1414
-                 * @param array $type The array of field values.
1415
-                 */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1407
+				/**
1408
+				 * Filter the output for custom fields.
1409
+				 *
1410
+				 * Here we can remove or add new functions depending on the field type.
1411
+				 *
1412
+				 * @param string $html The html to be filtered (blank).
1413
+				 * @param string $fields_location The location the field is to be show.
1414
+				 * @param array $type The array of field values.
1415
+				 */
1416
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417 1417
 
1418
-                $variables_array = array();
1418
+				$variables_array = array();
1419 1419
 
1420 1420
 //                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
1421 1421
 //                    continue;
1422 1422
 //                }
1423 1423
 
1424
-                if ($type['type'] != 'fieldset'):
1425
-                    $variables_array['post_id'] = $post->ID;
1426
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
-                    $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1430
-                endif;
1424
+				if ($type['type'] != 'fieldset'):
1425
+					$variables_array['post_id'] = $post->ID;
1426
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
+					$variables_array['value'] = '';
1428
+					if (isset($post->{$type['htmlvar_name']}))
1429
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1430
+				endif;
1431 1431
 
1432 1432
 
1433
-                if ($html):
1433
+				if ($html):
1434 1434
 
1435
-                    /**
1436
-                     * Called before a custom fields is output on the frontend.
1437
-                     *
1438
-                     * @since 1.0.0
1439
-                     * @param string $html_var The HTML variable name for the field.
1440
-                     */
1441
-                    do_action("geodir_before_show_{$html_var}");
1442
-                    /**
1443
-                     * Filter custom field output.
1444
-                     *
1445
-                     * @since 1.0.0
1446
-                     *
1447
-                     * @param string $html_var The HTML variable name for the field.
1448
-                     * @param string $html Custom field unfiltered HTML.
1449
-                     * @param array $variables_array Custom field variables array.
1450
-                     */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1435
+					/**
1436
+					 * Called before a custom fields is output on the frontend.
1437
+					 *
1438
+					 * @since 1.0.0
1439
+					 * @param string $html_var The HTML variable name for the field.
1440
+					 */
1441
+					do_action("geodir_before_show_{$html_var}");
1442
+					/**
1443
+					 * Filter custom field output.
1444
+					 *
1445
+					 * @since 1.0.0
1446
+					 *
1447
+					 * @param string $html_var The HTML variable name for the field.
1448
+					 * @param string $html Custom field unfiltered HTML.
1449
+					 * @param array $variables_array Custom field variables array.
1450
+					 */
1451
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452 1452
 
1453
-                    /**
1454
-                     * Called after a custom fields is output on the frontend.
1455
-                     *
1456
-                     * @since 1.0.0
1457
-                     * @param string $html_var The HTML variable name for the field.
1458
-                     */
1459
-                    do_action("geodir_after_show_{$html_var}");
1453
+					/**
1454
+					 * Called after a custom fields is output on the frontend.
1455
+					 *
1456
+					 * @since 1.0.0
1457
+					 * @param string $html_var The HTML variable name for the field.
1458
+					 */
1459
+					do_action("geodir_after_show_{$html_var}");
1460 1460
 
1461
-                endif;
1461
+				endif;
1462 1462
 
1463
-            }
1463
+			}
1464 1464
 
1465
-            //echo '</div>';
1465
+			//echo '</div>';
1466 1466
 
1467
-        }
1467
+		}
1468 1468
 
1469 1469
 
1470
-        return $html = ob_get_clean();
1470
+		return $html = ob_get_clean();
1471 1471
 
1472
-    }
1472
+	}
1473 1473
 }
1474 1474
 
1475 1475
 if (!function_exists('geodir_default_date_format')) {
1476
-    /**
1477
-     * Returns default date format.
1478
-     *
1479
-     * @since 1.0.0
1480
-     * @package GeoDirectory
1481
-     * @return mixed|string|void Returns default date format.
1482
-     */
1483
-    function geodir_default_date_format()
1484
-    {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1489
-    }
1476
+	/**
1477
+	 * Returns default date format.
1478
+	 *
1479
+	 * @since 1.0.0
1480
+	 * @package GeoDirectory
1481
+	 * @return mixed|string|void Returns default date format.
1482
+	 */
1483
+	function geodir_default_date_format()
1484
+	{
1485
+		if ($format = get_option('date_format'))
1486
+			return $format;
1487
+		else
1488
+			return 'dd-mm-yy';
1489
+	}
1490 1490
 }
1491 1491
 
1492 1492
 if (!function_exists('geodir_get_formated_date')) {
1493
-    /**
1494
-     * Returns formatted date.
1495
-     *
1496
-     * @since 1.0.0
1497
-     * @package GeoDirectory
1498
-     * @param string $date Date string to convert.
1499
-     * @return bool|int|string Returns formatted date.
1500
-     */
1501
-    function geodir_get_formated_date($date)
1502
-    {
1503
-        return mysql2date(get_option('date_format'), $date);
1504
-    }
1493
+	/**
1494
+	 * Returns formatted date.
1495
+	 *
1496
+	 * @since 1.0.0
1497
+	 * @package GeoDirectory
1498
+	 * @param string $date Date string to convert.
1499
+	 * @return bool|int|string Returns formatted date.
1500
+	 */
1501
+	function geodir_get_formated_date($date)
1502
+	{
1503
+		return mysql2date(get_option('date_format'), $date);
1504
+	}
1505 1505
 }
1506 1506
 
1507 1507
 if (!function_exists('geodir_get_formated_time')) {
1508
-    /**
1509
-     * Returns formatted time.
1510
-     *
1511
-     * @since 1.0.0
1512
-     * @package GeoDirectory
1513
-     * @param string $time Time string to convert.
1514
-     * @return bool|int|string Returns formatted time.
1515
-     */
1516
-    function geodir_get_formated_time($time)
1517
-    {
1518
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1519
-    }
1508
+	/**
1509
+	 * Returns formatted time.
1510
+	 *
1511
+	 * @since 1.0.0
1512
+	 * @package GeoDirectory
1513
+	 * @param string $time Time string to convert.
1514
+	 * @return bool|int|string Returns formatted time.
1515
+	 */
1516
+	function geodir_get_formated_time($time)
1517
+	{
1518
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1519
+	}
1520 1520
 }
1521 1521
 
1522 1522
 
1523 1523
 if (!function_exists('geodir_save_post_file_fields')) {
1524
-    /**
1525
-     * Save post file fields
1526
-     *
1527
-     * @since 1.0.0
1528
-     * @since 1.4.7 Added `$extra_fields` parameter.
1529
-     * @package GeoDirectory
1530
-     * @global object $wpdb WordPress Database object.
1531
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
-     * @global object $current_user Current user object.
1533
-     * @param int $post_id
1534
-     * @param string $field_id
1535
-     * @param array $post_image
1536
-     * @param array $extra_fields Array of extra fields.
1537
-     */
1538
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
-    {
1524
+	/**
1525
+	 * Save post file fields
1526
+	 *
1527
+	 * @since 1.0.0
1528
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1529
+	 * @package GeoDirectory
1530
+	 * @global object $wpdb WordPress Database object.
1531
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
+	 * @global object $current_user Current user object.
1533
+	 * @param int $post_id
1534
+	 * @param string $field_id
1535
+	 * @param array $post_image
1536
+	 * @param array $extra_fields Array of extra fields.
1537
+	 */
1538
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
+	{
1540 1540
 
1541
-        global $wpdb, $plugin_prefix, $current_user;
1541
+		global $wpdb, $plugin_prefix, $current_user;
1542 1542
 
1543
-        $post_type = get_post_type($post_id);
1544
-        //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1543
+		$post_type = get_post_type($post_id);
1544
+		//echo $field_id; exit;
1545
+		$table = $plugin_prefix . $post_type . '_detail';
1546 1546
 
1547
-        $postcurr_images = array();
1548
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
-        $file_urls = '';
1547
+		$postcurr_images = array();
1548
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
+		$file_urls = '';
1550 1550
 
1551
-        if (!empty($post_image)) {
1551
+		if (!empty($post_image)) {
1552 1552
 
1553
-            $invalid_files = array();
1553
+			$invalid_files = array();
1554 1554
 
1555
-            //Get and remove all old images of post from database to set by new order
1556
-            $geodir_uploaddir = '';
1557
-            $uploads = wp_upload_dir();
1558
-            $uploads_dir = $uploads['path'];
1555
+			//Get and remove all old images of post from database to set by new order
1556
+			$geodir_uploaddir = '';
1557
+			$uploads = wp_upload_dir();
1558
+			$uploads_dir = $uploads['path'];
1559 1559
 
1560
-            $geodir_uploadpath = $uploads['path'];
1561
-            $geodir_uploadurl = $uploads['url'];
1562
-            $sub_dir = $uploads['subdir'];
1560
+			$geodir_uploadpath = $uploads['path'];
1561
+			$geodir_uploadurl = $uploads['url'];
1562
+			$sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566
-            for ($m = 0; $m < count($post_image); $m++) {
1566
+			for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568
-                /* --------- start ------- */
1568
+				/* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573
-                    $curr_img_url = $post_image[$m];
1574
-                    $image_name_arr = explode('/', $curr_img_url);
1575
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
-                    $filename = end($image_name_arr);
1577
-                    $img_name_arr = explode('.', $filename);
1573
+					$curr_img_url = $post_image[$m];
1574
+					$image_name_arr = explode('/', $curr_img_url);
1575
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
+					$filename = end($image_name_arr);
1577
+					$img_name_arr = explode('.', $filename);
1578 1578
 
1579
-                    $arr_file_type = wp_check_filetype($filename);
1579
+					$arr_file_type = wp_check_filetype($filename);
1580 1580
 
1581
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
-                        continue;
1583
-                    }
1581
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
+						continue;
1583
+					}
1584 1584
 
1585
-                    $uploaded_file_type = $arr_file_type['type'];
1586
-                    $uploaded_file_ext = $arr_file_type['ext'];
1585
+					$uploaded_file_type = $arr_file_type['type'];
1586
+					$uploaded_file_ext = $arr_file_type['ext'];
1587 1587
 
1588
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
-                        continue; // Invalid file type.
1590
-                    }
1588
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
+						continue; // Invalid file type.
1590
+					}
1591 1591
 
1592
-                    // Set an array containing a list of acceptable formats
1593
-                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1592
+					// Set an array containing a list of acceptable formats
1593
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1594
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1595
+					if (!function_exists('wp_handle_upload'))
1596
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1597 1597
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1598
+					if (!is_dir($geodir_uploadpath))
1599
+						mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
-                    $explode_sub_dir = explode("/", $sub_dir);
1603
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1606
-                    } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
-                    }
1601
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
+					$explode_sub_dir = explode("/", $sub_dir);
1603
+					if ($curr_img_dir == end($explode_sub_dir)) {
1604
+						$img_path = $geodir_uploadpath . '/' . $filename;
1605
+						$img_url = $geodir_uploadurl . '/' . $filename;
1606
+					} else {
1607
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
+					}
1610 1610
 
1611
-                    $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1611
+					$uploaded_file = '';
1612
+					if (file_exists($img_path))
1613
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1614 1614
 
1615
-                    if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1618
-                    }
1615
+					if ($curr_img_dir != $geodir_uploaddir) {
1616
+						if (file_exists($img_path))
1617
+							unlink($img_path);
1618
+					}
1619 1619
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1620
+					if (!empty($uploaded_file))
1621
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1622 1622
 
1623
-                } else {
1624
-                    $file_urls = $post_image[$m];
1625
-                }
1626
-            }
1623
+				} else {
1624
+					$file_urls = $post_image[$m];
1625
+				}
1626
+			}
1627 1627
 
1628 1628
 
1629
-        }
1629
+		}
1630 1630
 
1631
-        //Remove all old attachments and temp images
1632
-        if (!empty($postcurr_images)) {
1631
+		//Remove all old attachments and temp images
1632
+		if (!empty($postcurr_images)) {
1633 1633
 
1634
-            if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1637
-            }
1638
-        }
1634
+			if ($file_urls != $postcurr_images) {
1635
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1636
+				$invalid_files = (object)$invalid_files;
1637
+			}
1638
+		}
1639 1639
 
1640
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1640
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1641
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1642
+		if (!empty($invalid_files))
1643
+			geodir_remove_attachments($invalid_files);
1644 1644
 
1645
-    }
1645
+	}
1646 1646
 }
1647 1647
 
1648 1648
 
@@ -1657,76 +1657,76 @@  discard block
 block discarded – undo
1657 1657
  */
1658 1658
 function geodir_custom_upload_mimes($existing_mimes = array())
1659 1659
 {
1660
-    $existing_mimes['wif'] = 'text/plain';
1661
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
-    $existing_mimes['gif'] = 'image/gif';
1663
-    $existing_mimes['png'] = 'image/png';
1664
-    $existing_mimes['pdf'] = 'application/pdf';
1665
-    $existing_mimes['txt'] = 'text/text';
1666
-    $existing_mimes['csv'] = 'application/octet-stream';
1667
-    $existing_mimes['doc'] = 'application/msword';
1668
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
-    return $existing_mimes;
1660
+	$existing_mimes['wif'] = 'text/plain';
1661
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
+	$existing_mimes['gif'] = 'image/gif';
1663
+	$existing_mimes['png'] = 'image/png';
1664
+	$existing_mimes['pdf'] = 'application/pdf';
1665
+	$existing_mimes['txt'] = 'text/text';
1666
+	$existing_mimes['csv'] = 'application/octet-stream';
1667
+	$existing_mimes['doc'] = 'application/msword';
1668
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
+	return $existing_mimes;
1672 1672
 }
1673 1673
 
1674 1674
 if (!function_exists('geodir_plupload_action')) {
1675 1675
 
1676
-    /**
1677
-     * Get upload directory path details
1678
-     *
1679
-     * @since 1.0.0
1680
-     * @package GeoDirectory
1681
-     * @global object $current_user Current user object.
1682
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
-     * @return mixed Returns upload directory details as an array.
1684
-     */
1685
-    function geodir_upload_dir($upload)
1686
-    {
1687
-        global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
-        return $upload;
1692
-    }
1693
-
1694
-    /**
1695
-     * Handles place file and image upload.
1696
-     *
1697
-     * @since 1.0.0
1698
-     * @package GeoDirectory
1699
-     */
1700
-    function geodir_plupload_action()
1701
-    {
1702
-        // check ajax noonce
1703
-        $imgid = $_POST["imgid"];
1704
-
1705
-        check_ajax_referer($imgid . 'pluploadan');
1706
-
1707
-        // handle custom file uploaddir
1708
-        add_filter('upload_dir', 'geodir_upload_dir');
1709
-
1710
-        // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
-
1713
-        // handle file upload
1714
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
-        // remove handle custom file uploaddir
1716
-        remove_filter('upload_dir', 'geodir_upload_dir');
1717
-
1718
-        if(!isset($status['url']) && isset($status['error'])){
1719
-            print_r($status);
1720
-        }
1721
-
1722
-        // send the uploaded file url in response
1723
-        if (isset($status['url'])) {
1724
-            echo $status['url'];
1725
-        } else {
1726
-            echo 'x';
1727
-        }
1728
-        exit;
1729
-    }
1676
+	/**
1677
+	 * Get upload directory path details
1678
+	 *
1679
+	 * @since 1.0.0
1680
+	 * @package GeoDirectory
1681
+	 * @global object $current_user Current user object.
1682
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
+	 * @return mixed Returns upload directory details as an array.
1684
+	 */
1685
+	function geodir_upload_dir($upload)
1686
+	{
1687
+		global $current_user;
1688
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
+		return $upload;
1692
+	}
1693
+
1694
+	/**
1695
+	 * Handles place file and image upload.
1696
+	 *
1697
+	 * @since 1.0.0
1698
+	 * @package GeoDirectory
1699
+	 */
1700
+	function geodir_plupload_action()
1701
+	{
1702
+		// check ajax noonce
1703
+		$imgid = $_POST["imgid"];
1704
+
1705
+		check_ajax_referer($imgid . 'pluploadan');
1706
+
1707
+		// handle custom file uploaddir
1708
+		add_filter('upload_dir', 'geodir_upload_dir');
1709
+
1710
+		// change file orinetation if needed
1711
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
+
1713
+		// handle file upload
1714
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
+		// remove handle custom file uploaddir
1716
+		remove_filter('upload_dir', 'geodir_upload_dir');
1717
+
1718
+		if(!isset($status['url']) && isset($status['error'])){
1719
+			print_r($status);
1720
+		}
1721
+
1722
+		// send the uploaded file url in response
1723
+		if (isset($status['url'])) {
1724
+			echo $status['url'];
1725
+		} else {
1726
+			echo 'x';
1727
+		}
1728
+		exit;
1729
+	}
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1741,17 +1741,17 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_get_video($post_id)
1743 1743
 {
1744
-    global $wpdb, $plugin_prefix;
1744
+	global $wpdb, $plugin_prefix;
1745 1745
 
1746
-    $post_type = get_post_type($post_id);
1746
+	$post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+	$table = $plugin_prefix . $post_type . '_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1751 1751
 
1752
-    if ($results) {
1753
-        return $results[0]->geodir_video;
1754
-    }
1752
+	if ($results) {
1753
+		return $results[0]->geodir_video;
1754
+	}
1755 1755
 
1756 1756
 }
1757 1757
 
@@ -1767,40 +1767,40 @@  discard block
 block discarded – undo
1767 1767
  */
1768 1768
 function geodir_get_special_offers($post_id)
1769 1769
 {
1770
-    global $wpdb, $plugin_prefix;
1770
+	global $wpdb, $plugin_prefix;
1771 1771
 
1772
-    $post_type = get_post_type($post_id);
1772
+	$post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+	$table = $plugin_prefix . $post_type . '_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1777 1777
 
1778
-    if ($results) {
1779
-        return $results[0]->geodir_special_offers;
1780
-    }
1778
+	if ($results) {
1779
+		return $results[0]->geodir_special_offers;
1780
+	}
1781 1781
 
1782 1782
 }
1783 1783
 
1784 1784
 if (!function_exists('geodir_max_upload_size')) {
1785
-    /**
1786
-     * Get max upload file size
1787
-     *
1788
-     * @since 1.0.0
1789
-     * @package GeoDirectory
1790
-     * @return mixed|void Returns max upload file size.
1791
-     */
1792
-    function geodir_max_upload_size()
1793
-    {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
-
1796
-        if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
-        } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
-        }
1801
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1802
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
-    }
1785
+	/**
1786
+	 * Get max upload file size
1787
+	 *
1788
+	 * @since 1.0.0
1789
+	 * @package GeoDirectory
1790
+	 * @return mixed|void Returns max upload file size.
1791
+	 */
1792
+	function geodir_max_upload_size()
1793
+	{
1794
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
+
1796
+		if ($max_filesize > 0 && $max_filesize < 1) {
1797
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
+		} else {
1799
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
+		}
1801
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1802
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
+	}
1804 1804
 }
1805 1805
 
1806 1806
 
@@ -1818,33 +1818,33 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function geodir_add_custom_sort_options($fields, $post_type)
1820 1820
 {
1821
-    global $wpdb;
1821
+	global $wpdb;
1822 1822
 
1823
-    if ($post_type != '') {
1823
+	if ($post_type != '') {
1824 1824
 
1825
-        $all_postypes = geodir_get_posttypes();
1825
+		$all_postypes = geodir_get_posttypes();
1826 1826
 
1827
-        if (in_array($post_type, $all_postypes)) {
1827
+		if (in_array($post_type, $all_postypes)) {
1828 1828
 
1829
-            $custom_fields = $wpdb->get_results(
1830
-                $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
-                    array($post_type)
1833
-                ), 'ARRAY_A'
1834
-            );
1829
+			$custom_fields = $wpdb->get_results(
1830
+				$wpdb->prepare(
1831
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
+					array($post_type)
1833
+				), 'ARRAY_A'
1834
+			);
1835 1835
 
1836
-            if (!empty($custom_fields)) {
1836
+			if (!empty($custom_fields)) {
1837 1837
 
1838
-                foreach ($custom_fields as $val) {
1839
-                    $fields[] = $val;
1840
-                }
1841
-            }
1838
+				foreach ($custom_fields as $val) {
1839
+					$fields[] = $val;
1840
+				}
1841
+			}
1842 1842
 
1843
-        }
1843
+		}
1844 1844
 
1845
-    }
1845
+	}
1846 1846
 
1847
-    return $fields;
1847
+	return $fields;
1848 1848
 }
1849 1849
 
1850 1850
 
@@ -1860,76 +1860,76 @@  discard block
 block discarded – undo
1860 1860
 function geodir_get_custom_sort_options($post_type = '')
1861 1861
 {
1862 1862
 
1863
-    global $wpdb;
1864
-
1865
-    if ($post_type != '') {
1866
-
1867
-        $all_postypes = geodir_get_posttypes();
1868
-
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1871
-
1872
-        $fields = array();
1873
-
1874
-        $fields[] = array(
1875
-            'post_type' => $post_type,
1876
-            'data_type' => '',
1877
-            'field_type' => 'random',
1878
-            'site_title' => 'Random',
1879
-            'htmlvar_name' => 'post_title',
1880
-            'field_icon' =>  'fa fa-random',
1881
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
-        );
1883
-
1884
-        $fields[] = array(
1885
-            'post_type' => $post_type,
1886
-            'data_type' => '',
1887
-            'field_type' => 'datetime',
1888
-            'site_title' => __('Add date', 'geodirectory'),
1889
-            'htmlvar_name' => 'post_date',
1890
-            'field_icon' =>  'fa fa-calendar',
1891
-            'description' =>  __('Sort by date added', 'geodirectory')
1892
-        );
1893
-        $fields[] = array(
1894
-            'post_type' => $post_type,
1895
-            'data_type' => '',
1896
-            'field_type' => 'bigint',
1897
-            'site_title' => __('Review', 'geodirectory'),
1898
-            'htmlvar_name' => 'comment_count',
1899
-            'field_icon' =>  'fa fa-commenting-o',
1900
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
-        );
1902
-        $fields[] = array(
1903
-            'post_type' => $post_type,
1904
-            'data_type' => '',
1905
-            'field_type' => 'float',
1906
-            'site_title' => __('Rating', 'geodirectory'),
1907
-            'htmlvar_name' => 'overall_rating',
1908
-            'field_icon' =>  'fa fa-star-o',
1909
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
-        );
1911
-        $fields[] = array(
1912
-            'post_type' => $post_type,
1913
-            'data_type' => '',
1914
-            'field_type' => 'text',
1915
-            'site_title' => __('Title', 'geodirectory'),
1916
-            'htmlvar_name' => 'post_title',
1917
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1918
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
-        );
1920
-
1921
-        /**
1922
-         * Hook to add custom sort options.
1923
-         *
1924
-         * @since 1.0.0
1925
-         * @param array $fields Unmodified sort options array.
1926
-         * @param string $post_type Post type.
1927
-         */
1928
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
-
1930
-    }
1931
-
1932
-    return false;
1863
+	global $wpdb;
1864
+
1865
+	if ($post_type != '') {
1866
+
1867
+		$all_postypes = geodir_get_posttypes();
1868
+
1869
+		if (!in_array($post_type, $all_postypes))
1870
+			return false;
1871
+
1872
+		$fields = array();
1873
+
1874
+		$fields[] = array(
1875
+			'post_type' => $post_type,
1876
+			'data_type' => '',
1877
+			'field_type' => 'random',
1878
+			'site_title' => 'Random',
1879
+			'htmlvar_name' => 'post_title',
1880
+			'field_icon' =>  'fa fa-random',
1881
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1882
+		);
1883
+
1884
+		$fields[] = array(
1885
+			'post_type' => $post_type,
1886
+			'data_type' => '',
1887
+			'field_type' => 'datetime',
1888
+			'site_title' => __('Add date', 'geodirectory'),
1889
+			'htmlvar_name' => 'post_date',
1890
+			'field_icon' =>  'fa fa-calendar',
1891
+			'description' =>  __('Sort by date added', 'geodirectory')
1892
+		);
1893
+		$fields[] = array(
1894
+			'post_type' => $post_type,
1895
+			'data_type' => '',
1896
+			'field_type' => 'bigint',
1897
+			'site_title' => __('Review', 'geodirectory'),
1898
+			'htmlvar_name' => 'comment_count',
1899
+			'field_icon' =>  'fa fa-commenting-o',
1900
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1901
+		);
1902
+		$fields[] = array(
1903
+			'post_type' => $post_type,
1904
+			'data_type' => '',
1905
+			'field_type' => 'float',
1906
+			'site_title' => __('Rating', 'geodirectory'),
1907
+			'htmlvar_name' => 'overall_rating',
1908
+			'field_icon' =>  'fa fa-star-o',
1909
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1910
+		);
1911
+		$fields[] = array(
1912
+			'post_type' => $post_type,
1913
+			'data_type' => '',
1914
+			'field_type' => 'text',
1915
+			'site_title' => __('Title', 'geodirectory'),
1916
+			'htmlvar_name' => 'post_title',
1917
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1918
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1919
+		);
1920
+
1921
+		/**
1922
+		 * Hook to add custom sort options.
1923
+		 *
1924
+		 * @since 1.0.0
1925
+		 * @param array $fields Unmodified sort options array.
1926
+		 * @param string $post_type Post type.
1927
+		 */
1928
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1929
+
1930
+	}
1931
+
1932
+	return false;
1933 1933
 }
1934 1934
 
1935 1935
 
@@ -1945,117 +1945,117 @@  discard block
 block discarded – undo
1945 1945
 function godir_set_sort_field_order($field_ids = array())
1946 1946
 {
1947 1947
 
1948
-    global $wpdb;
1948
+	global $wpdb;
1949 1949
 
1950
-    $count = 0;
1951
-    if (!empty($field_ids)):
1952
-        foreach ($field_ids as $id) {
1950
+	$count = 0;
1951
+	if (!empty($field_ids)):
1952
+		foreach ($field_ids as $id) {
1953 1953
 
1954
-            $cf = trim($id, '_');
1954
+			$cf = trim($id, '_');
1955 1955
 
1956
-            $post_meta_info = $wpdb->query(
1957
-                $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1956
+			$post_meta_info = $wpdb->query(
1957
+				$wpdb->prepare(
1958
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961
-                    array($count, $cf)
1962
-                )
1963
-            );
1964
-            $count++;
1965
-        }
1966
-
1967
-        return $field_ids;
1968
-    else:
1969
-        return false;
1970
-    endif;
1961
+					array($count, $cf)
1962
+				)
1963
+			);
1964
+			$count++;
1965
+		}
1966
+
1967
+		return $field_ids;
1968
+	else:
1969
+		return false;
1970
+	endif;
1971 1971
 }
1972 1972
 
1973 1973
 
1974 1974
 if (!function_exists('geodir_custom_sort_field_save')) {
1975
-    /**
1976
-     * Save or Update custom sort fields into the database.
1977
-     *
1978
-     * @since 1.0.0
1979
-     * @package GeoDirectory
1980
-     * @global object $wpdb WordPress Database object.
1981
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
-     * @param array $request_field {
1983
-     *    Attributes of the Request field.
1984
-     *
1985
-     *    @type string $action Ajax action name.
1986
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
-     *    @type string $create_field Do you want to create this field?.
1988
-     *    @type string $field_ins_upd Field created or updated?.
1989
-     *    @type string $_wpnonce Nonce value.
1990
-     *    @type string $listing_type The Post type.
1991
-     *    @type string $field_type Field Type.
1992
-     *    @type string $field_id Field ID.
1993
-     *    @type string $data_type Data Type.
1994
-     *    @type string $htmlvar_name HTML variable name.
1995
-     *    @type string $site_title Section title which you wish to display in frontend.
1996
-     *    @type string $is_default Is this default sorting?.
1997
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
-     *    @type string $sort_order Sort Order.
1999
-     *
2000
-     * }
2001
-     * @param bool $default Not yet implemented.
2002
-     * @return int Returns the last affected db table row id.
2003
-     */
2004
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
-    {
2006
-
2007
-        global $wpdb, $plugin_prefix;
2008
-
2009
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
-
2011
-        $cf = trim($result_str, '_');
2012
-
2013
-        /*-------- check dublicate validation --------*/
2014
-
2015
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
-
2018
-        $post_type = $request_field['listing_type'];
2019
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
-
2031
-        $default_order = '';
2032
-        if ($is_default != '') {
2033
-            $default_order = $is_default;
2034
-            $is_default = '1';
2035
-        }
2036
-
2037
-
2038
-        $check_html_variable = $wpdb->get_var(
2039
-            $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
-                array($cehhtmlvar_name, $post_type, $field_type)
2042
-            )
2043
-        );
2044
-
2045
-        if ($is_default == 1) {
2046
-
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
-
2049
-        }
2050
-
2051
-
2052
-        if (!$check_html_variable) {
2053
-
2054
-            $wpdb->query(
2055
-
2056
-                $wpdb->prepare(
2057
-
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1975
+	/**
1976
+	 * Save or Update custom sort fields into the database.
1977
+	 *
1978
+	 * @since 1.0.0
1979
+	 * @package GeoDirectory
1980
+	 * @global object $wpdb WordPress Database object.
1981
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1982
+	 * @param array $request_field {
1983
+	 *    Attributes of the Request field.
1984
+	 *
1985
+	 *    @type string $action Ajax action name.
1986
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1987
+	 *    @type string $create_field Do you want to create this field?.
1988
+	 *    @type string $field_ins_upd Field created or updated?.
1989
+	 *    @type string $_wpnonce Nonce value.
1990
+	 *    @type string $listing_type The Post type.
1991
+	 *    @type string $field_type Field Type.
1992
+	 *    @type string $field_id Field ID.
1993
+	 *    @type string $data_type Data Type.
1994
+	 *    @type string $htmlvar_name HTML variable name.
1995
+	 *    @type string $site_title Section title which you wish to display in frontend.
1996
+	 *    @type string $is_default Is this default sorting?.
1997
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
1998
+	 *    @type string $sort_order Sort Order.
1999
+	 *
2000
+	 * }
2001
+	 * @param bool $default Not yet implemented.
2002
+	 * @return int Returns the last affected db table row id.
2003
+	 */
2004
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2005
+	{
2006
+
2007
+		global $wpdb, $plugin_prefix;
2008
+
2009
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2010
+
2011
+		$cf = trim($result_str, '_');
2012
+
2013
+		/*-------- check dublicate validation --------*/
2014
+
2015
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2016
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2017
+
2018
+		$post_type = $request_field['listing_type'];
2019
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2020
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2021
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2022
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2023
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2024
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2025
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2026
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2027
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2028
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2029
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2030
+
2031
+		$default_order = '';
2032
+		if ($is_default != '') {
2033
+			$default_order = $is_default;
2034
+			$is_default = '1';
2035
+		}
2036
+
2037
+
2038
+		$check_html_variable = $wpdb->get_var(
2039
+			$wpdb->prepare(
2040
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041
+				array($cehhtmlvar_name, $post_type, $field_type)
2042
+			)
2043
+		);
2044
+
2045
+		if ($is_default == 1) {
2046
+
2047
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048
+
2049
+		}
2050
+
2051
+
2052
+		if (!$check_html_variable) {
2053
+
2054
+			$wpdb->query(
2055
+
2056
+				$wpdb->prepare(
2057
+
2058
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2070,23 +2070,23 @@  discard block
 block discarded – undo
2070 2070
 				asc_title = %s,
2071 2071
 				desc_title = %s",
2072 2072
 
2073
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
-                )
2073
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
2074
+				)
2075 2075
 
2076
-            );
2076
+			);
2077 2077
 
2078 2078
 
2079
-            $lastid = $wpdb->insert_id;
2079
+			$lastid = $wpdb->insert_id;
2080 2080
 
2081
-            $lastid = trim($lastid);
2081
+			$lastid = trim($lastid);
2082 2082
 
2083
-        } else {
2083
+		} else {
2084 2084
 
2085
-            $wpdb->query(
2085
+			$wpdb->query(
2086 2086
 
2087
-                $wpdb->prepare(
2087
+				$wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2102,123 +2102,123 @@  discard block
 block discarded – undo
2102 2102
 				desc_title = %s
2103 2103
 				where id = %d",
2104 2104
 
2105
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
-                )
2105
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
2106
+				)
2107 2107
 
2108
-            );
2108
+			);
2109 2109
 
2110
-            $lastid = trim($cf);
2110
+			$lastid = trim($cf);
2111 2111
 
2112
-        }
2112
+		}
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+		return (int)$lastid;
2116 2116
 
2117
-    }
2117
+	}
2118 2118
 }
2119 2119
 
2120 2120
 
2121 2121
 if (!function_exists('geodir_custom_sort_field_delete')) {
2122
-    /**
2123
-     * Delete a custom sort field using field id.
2124
-     * @since 1.0.0
2125
-     * @package GeoDirectory
2126
-     * @global object $wpdb WordPress Database object.
2127
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
-     * @param string $field_id The field ID.
2129
-     * @return int|string Returns field id when successful deletion, else returns 0.
2130
-     */
2131
-    function geodir_custom_sort_field_delete($field_id = '')
2132
-    {
2133
-
2134
-        global $wpdb, $plugin_prefix;
2135
-        if ($field_id != '') {
2136
-            $cf = trim($field_id, '_');
2137
-
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
-
2140
-            return $field_id;
2141
-
2142
-        } else
2143
-            return 0;
2144
-
2145
-    }
2122
+	/**
2123
+	 * Delete a custom sort field using field id.
2124
+	 * @since 1.0.0
2125
+	 * @package GeoDirectory
2126
+	 * @global object $wpdb WordPress Database object.
2127
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2128
+	 * @param string $field_id The field ID.
2129
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2130
+	 */
2131
+	function geodir_custom_sort_field_delete($field_id = '')
2132
+	{
2133
+
2134
+		global $wpdb, $plugin_prefix;
2135
+		if ($field_id != '') {
2136
+			$cf = trim($field_id, '_');
2137
+
2138
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2139
+
2140
+			return $field_id;
2141
+
2142
+		} else
2143
+			return 0;
2144
+
2145
+	}
2146 2146
 }
2147 2147
 
2148 2148
 
2149 2149
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2150
-    /**
2151
-     * Custom sort field admin html.
2152
-     *
2153
-     * @since 1.0.0
2154
-     * @package GeoDirectory
2155
-     * @global object $wpdb WordPress Database object.
2156
-     * @param string $field_type The form field type.
2157
-     * @param object|int $result_str The custom field results object or row id.
2158
-     * @param string $field_ins_upd When set to "submit" displays form.
2159
-     * @param bool $default when set to true field will be for admin use only.
2160
-     */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
-    {
2163
-        global $wpdb;
2164
-        $cf = $result_str;
2165
-        if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
-        } else {
2168
-            $field_info = $cf;
2169
-            $result_str = $cf->id;
2170
-        }
2171
-
2172
-        $field_info = stripslashes_deep($field_info); // strip slashes
2173
-
2174
-        if (!isset($field_info->post_type)) {
2175
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
-        } else {
2177
-            $post_type = $field_info->post_type;
2178
-        }
2179
-
2180
-
2181
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
-
2183
-        $site_title = '';
2184
-        if ($site_title == '')
2185
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
-
2187
-        if ($site_title == '') {
2188
-            $fields = geodir_get_custom_sort_options($post_type);
2189
-
2190
-            foreach ($fields as $val) {
2191
-                $val = stripslashes_deep($val); // strip slashes
2192
-
2193
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
-                }
2196
-            }
2197
-        }
2198
-
2199
-        if ($htmlvar_name == '')
2200
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
-
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
-
2204
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2206
-
2207
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2210
-
2211
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
-                }
2216
-
2217
-            }
2218
-        }
2219
-
2220
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
-        ?>
2150
+	/**
2151
+	 * Custom sort field admin html.
2152
+	 *
2153
+	 * @since 1.0.0
2154
+	 * @package GeoDirectory
2155
+	 * @global object $wpdb WordPress Database object.
2156
+	 * @param string $field_type The form field type.
2157
+	 * @param object|int $result_str The custom field results object or row id.
2158
+	 * @param string $field_ins_upd When set to "submit" displays form.
2159
+	 * @param bool $default when set to true field will be for admin use only.
2160
+	 */
2161
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2162
+	{
2163
+		global $wpdb;
2164
+		$cf = $result_str;
2165
+		if (!is_object($cf)) {
2166
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2167
+		} else {
2168
+			$field_info = $cf;
2169
+			$result_str = $cf->id;
2170
+		}
2171
+
2172
+		$field_info = stripslashes_deep($field_info); // strip slashes
2173
+
2174
+		if (!isset($field_info->post_type)) {
2175
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2176
+		} else {
2177
+			$post_type = $field_info->post_type;
2178
+		}
2179
+
2180
+
2181
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182
+
2183
+		$site_title = '';
2184
+		if ($site_title == '')
2185
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2186
+
2187
+		if ($site_title == '') {
2188
+			$fields = geodir_get_custom_sort_options($post_type);
2189
+
2190
+			foreach ($fields as $val) {
2191
+				$val = stripslashes_deep($val); // strip slashes
2192
+
2193
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2194
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2195
+				}
2196
+			}
2197
+		}
2198
+
2199
+		if ($htmlvar_name == '')
2200
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201
+
2202
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
+
2204
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2206
+
2207
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
+		foreach($cso_arr as $cso){
2209
+			if($cur_field_type==$cso['field_type']){
2210
+
2211
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215
+				}
2216
+
2217
+			}
2218
+		}
2219
+
2220
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221
+		?>
2222 2222
 
2223 2223
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2228 2228
                 <?php
2229 2229
 
2230
-                ?>
2230
+				?>
2231 2231
 
2232 2232
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233 2233
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2242,17 +2242,17 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245
-                     echo 'block;';
2246
-                 } else {
2247
-                     echo 'none;';
2248
-                 } ?>">
2245
+					 echo 'block;';
2246
+				 } else {
2247
+					 echo 'none;';
2248
+				 } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250 2250
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251 2251
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252 2252
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254
-                    echo $field_info->data_type;
2255
-                }?>"/>
2254
+					echo $field_info->data_type;
2255
+				}?>"/>
2256 2256
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2257 2257
 
2258 2258
 
@@ -2275,14 +2275,14 @@  discard block
 block discarded – undo
2275 2275
 
2276 2276
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278
-                                        echo 'checked';
2279
-                                    } ?>/>
2278
+										echo 'checked';
2279
+									} ?>/>
2280 2280
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282 2282
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284
-                                        echo 'checked';
2285
-                                    } ?>/>
2284
+										echo 'checked';
2285
+									} ?>/>
2286 2286
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
@@ -2319,8 +2319,8 @@  discard block
 block discarded – undo
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321 2321
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2322
-                                    echo 'checked="checked"';
2323
-                                } ?>/>
2322
+									echo 'checked="checked"';
2323
+								} ?>/>
2324 2324
                             </div>
2325 2325
 
2326 2326
                         </li>
@@ -2340,14 +2340,14 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343
-                                        echo 'checked';
2344
-                                    } ?>/>
2343
+										echo 'checked';
2344
+									} ?>/>
2345 2345
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347 2347
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349
-                                        echo 'checked';
2350
-                                    } ?>/>
2349
+										echo 'checked';
2350
+									} ?>/>
2351 2351
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
@@ -2383,8 +2383,8 @@  discard block
 block discarded – undo
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385 2385
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2386
-                                    echo 'checked="checked"';
2387
-                                } ?>/>
2386
+									echo 'checked="checked"';
2387
+								} ?>/>
2388 2388
                             </div>
2389 2389
 
2390 2390
                         </li>
@@ -2426,8 +2426,8 @@  discard block
 block discarded – undo
2426 2426
 
2427 2427
                                 <input type="checkbox" name="is_default"
2428 2428
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2429
-                                    echo 'checked="checked"';
2430
-                                } ?>/>
2429
+									echo 'checked="checked"';
2430
+								} ?>/>
2431 2431
                             </div>
2432 2432
 
2433 2433
 
@@ -2450,14 +2450,14 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453
-                                    echo 'checked';
2454
-                                } ?>/>
2453
+									echo 'checked';
2454
+								} ?>/>
2455 2455
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457 2457
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459
-                                    echo 'checked';
2460
-                                } ?>/>
2459
+									echo 'checked';
2460
+								} ?>/>
2461 2461
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 
2468 2468
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2469 2469
                                                 value="<?php if (isset($field_info->sort_order)) {
2470
-                                                    echo esc_attr($field_info->sort_order);
2471
-                                                }?>" size="50"/>
2470
+													echo esc_attr($field_info->sort_order);
2471
+												}?>" size="50"/>
2472 2472
 
2473 2473
 
2474 2474
 
@@ -2492,38 +2492,38 @@  discard block
 block discarded – undo
2492 2492
             </form>
2493 2493
         </li> <?php
2494 2494
 
2495
-    }
2495
+	}
2496 2496
 }
2497 2497
 
2498 2498
 if (!function_exists('check_field_visibility')) {
2499
-    /**
2500
-     * Check field visibility as per price package.
2501
-     *
2502
-     * @since 1.0.0
2503
-     * @package GeoDirectory
2504
-     * @global object $wpdb WordPress Database object.
2505
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
-     * @param int|string $package_id The package ID.
2507
-     * @param string $field_name The field name.
2508
-     * @param string $post_type Optional. The wordpress post type.
2509
-     * @return bool Returns true when field visible, otherwise false.
2510
-     */
2511
-    function check_field_visibility($package_id, $field_name, $post_type)
2512
-    {
2513
-        global $wpdb, $geodir_addon_list;
2514
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
-            return true;
2516
-        }
2517
-        if (!$package_id || !$field_name || !$post_type) {
2518
-            return true;
2519
-        }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
-
2522
-        if ($wpdb->get_var($sql)) {
2523
-            return true;
2524
-        }
2525
-        return false;
2526
-    }
2499
+	/**
2500
+	 * Check field visibility as per price package.
2501
+	 *
2502
+	 * @since 1.0.0
2503
+	 * @package GeoDirectory
2504
+	 * @global object $wpdb WordPress Database object.
2505
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2506
+	 * @param int|string $package_id The package ID.
2507
+	 * @param string $field_name The field name.
2508
+	 * @param string $post_type Optional. The wordpress post type.
2509
+	 * @return bool Returns true when field visible, otherwise false.
2510
+	 */
2511
+	function check_field_visibility($package_id, $field_name, $post_type)
2512
+	{
2513
+		global $wpdb, $geodir_addon_list;
2514
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2515
+			return true;
2516
+		}
2517
+		if (!$package_id || !$field_name || !$post_type) {
2518
+			return true;
2519
+		}
2520
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2521
+
2522
+		if ($wpdb->get_var($sql)) {
2523
+			return true;
2524
+		}
2525
+		return false;
2526
+	}
2527 2527
 }
2528 2528
 
2529 2529
 /**
@@ -2538,43 +2538,43 @@  discard block
 block discarded – undo
2538 2538
  */
2539 2539
 function geodir_string_to_options($input = '', $translated = false)
2540 2540
 {
2541
-    $return = array();
2542
-    if ($input != '') {
2543
-        $input = trim($input);
2544
-        $input = rtrim($input, ",");
2545
-        $input = ltrim($input, ",");
2546
-        $input = trim($input);
2547
-    }
2548
-
2549
-    $input_arr = explode(',', $input);
2550
-
2551
-    if (!empty($input_arr)) {
2552
-        foreach ($input_arr as $input_str) {
2553
-            $input_str = trim($input_str);
2554
-
2555
-            if (strpos($input_str, "/") !== false) {
2556
-                $input_str = explode("/", $input_str, 2);
2557
-                $label = trim($input_str[0]);
2558
-                if ($translated && $label != '') {
2559
-                    $label = __($label, 'geodirectory');
2560
-                }
2561
-                $label = ucfirst($label);
2562
-                $value = trim($input_str[1]);
2563
-            } else {
2564
-                if ($translated && $input_str != '') {
2565
-                    $input_str = __($input_str, 'geodirectory');
2566
-                }
2567
-                $label = ucfirst($input_str);
2568
-                $value = $input_str;
2569
-            }
2570
-
2571
-            if ($label != '') {
2572
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
-            }
2574
-        }
2575
-    }
2576
-
2577
-    return $return;
2541
+	$return = array();
2542
+	if ($input != '') {
2543
+		$input = trim($input);
2544
+		$input = rtrim($input, ",");
2545
+		$input = ltrim($input, ",");
2546
+		$input = trim($input);
2547
+	}
2548
+
2549
+	$input_arr = explode(',', $input);
2550
+
2551
+	if (!empty($input_arr)) {
2552
+		foreach ($input_arr as $input_str) {
2553
+			$input_str = trim($input_str);
2554
+
2555
+			if (strpos($input_str, "/") !== false) {
2556
+				$input_str = explode("/", $input_str, 2);
2557
+				$label = trim($input_str[0]);
2558
+				if ($translated && $label != '') {
2559
+					$label = __($label, 'geodirectory');
2560
+				}
2561
+				$label = ucfirst($label);
2562
+				$value = trim($input_str[1]);
2563
+			} else {
2564
+				if ($translated && $input_str != '') {
2565
+					$input_str = __($input_str, 'geodirectory');
2566
+				}
2567
+				$label = ucfirst($input_str);
2568
+				$value = $input_str;
2569
+			}
2570
+
2571
+			if ($label != '') {
2572
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2573
+			}
2574
+		}
2575
+	}
2576
+
2577
+	return $return;
2578 2578
 }
2579 2579
 
2580 2580
 /**
@@ -2589,59 +2589,59 @@  discard block
 block discarded – undo
2589 2589
  */
2590 2590
 function geodir_string_values_to_options($option_values = '', $translated = false)
2591 2591
 {
2592
-    $options = array();
2593
-    if ($option_values == '') {
2594
-        return NULL;
2595
-    }
2596
-
2597
-    if (strpos($option_values, "{/optgroup}") !== false) {
2598
-        $option_values_arr = explode("{/optgroup}", $option_values);
2599
-
2600
-        foreach ($option_values_arr as $optgroup) {
2601
-            if (strpos($optgroup, "{optgroup}") !== false) {
2602
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2603
-
2604
-                $count = 0;
2605
-                foreach ($optgroup_arr as $optgroup_str) {
2606
-                    $count++;
2607
-                    $optgroup_str = trim($optgroup_str);
2608
-
2609
-                    $optgroup_label = '';
2610
-                    if (strpos($optgroup_str, "|") !== false) {
2611
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2613
-                        if ($translated && $optgroup_label != '') {
2614
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2615
-                        }
2616
-                        $optgroup_label = ucfirst($optgroup_label);
2617
-                        $optgroup_str = $optgroup_str_arr[1];
2618
-                    }
2619
-
2620
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
-
2622
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
-                    }
2627
-                    $options = array_merge($options, $optgroup3);
2628
-                }
2629
-            } else {
2630
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
-                $options = array_merge($options, $optgroup1);
2632
-            }
2633
-        }
2634
-    } else {
2635
-        $options = geodir_string_to_options($option_values, $translated);
2636
-    }
2637
-
2638
-    return $options;
2592
+	$options = array();
2593
+	if ($option_values == '') {
2594
+		return NULL;
2595
+	}
2596
+
2597
+	if (strpos($option_values, "{/optgroup}") !== false) {
2598
+		$option_values_arr = explode("{/optgroup}", $option_values);
2599
+
2600
+		foreach ($option_values_arr as $optgroup) {
2601
+			if (strpos($optgroup, "{optgroup}") !== false) {
2602
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2603
+
2604
+				$count = 0;
2605
+				foreach ($optgroup_arr as $optgroup_str) {
2606
+					$count++;
2607
+					$optgroup_str = trim($optgroup_str);
2608
+
2609
+					$optgroup_label = '';
2610
+					if (strpos($optgroup_str, "|") !== false) {
2611
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2612
+						$optgroup_label = trim($optgroup_str_arr[0]);
2613
+						if ($translated && $optgroup_label != '') {
2614
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2615
+						}
2616
+						$optgroup_label = ucfirst($optgroup_label);
2617
+						$optgroup_str = $optgroup_str_arr[1];
2618
+					}
2619
+
2620
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2621
+
2622
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2623
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2624
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2625
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2626
+					}
2627
+					$options = array_merge($options, $optgroup3);
2628
+				}
2629
+			} else {
2630
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2631
+				$options = array_merge($options, $optgroup1);
2632
+			}
2633
+		}
2634
+	} else {
2635
+		$options = geodir_string_to_options($option_values, $translated);
2636
+	}
2637
+
2638
+	return $options;
2639 2639
 }
2640 2640
 
2641 2641
 
2642 2642
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2643
-    ob_start();
2644
-    ?>
2643
+	ob_start();
2644
+	?>
2645 2645
     <li>
2646 2646
         <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2647 2647
         <div class="gd-cf-input-wrap">
@@ -2650,16 +2650,16 @@  discard block
 block discarded – undo
2650 2650
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2651 2651
                 <option
2652 2652
                     value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
2653
-                    echo 'selected="selected"';
2654
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2653
+					echo 'selected="selected"';
2654
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2655 2655
                 <option
2656 2656
                     value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
2657
-                    echo 'selected="selected"';
2658
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2657
+					echo 'selected="selected"';
2658
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2659 2659
                 <option
2660 2660
                     value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
2661
-                    echo 'selected="selected"';
2662
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2661
+					echo 'selected="selected"';
2662
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2663 2663
             </select>
2664 2664
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2665 2665
 
@@ -2672,8 +2672,8 @@  discard block
 block discarded – undo
2672 2672
             <select name="decimal_point" id="decimal_point">
2673 2673
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2674 2674
                 <?php for ($i = 1; $i <= 10; $i++) {
2675
-                    $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
-                    $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2675
+					$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2676
+					$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2677 2677
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2678 2678
                 <?php } ?>
2679 2679
             </select>
@@ -2682,8 +2682,8 @@  discard block
 block discarded – undo
2682 2682
     </li>
2683 2683
 <?php
2684 2684
 
2685
-    $output = ob_get_clean();
2686
-    return $output;
2685
+	$output = ob_get_clean();
2686
+	return $output;
2687 2687
 }
2688 2688
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2689 2689
 
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
 
2722 2722
 
2723 2723
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
-    ob_start();
2726
-    ?>
2724
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2725
+	ob_start();
2726
+	?>
2727 2727
     <li>
2728 2728
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2729 2729
             <div class="gdcf-tooltip">
@@ -2734,13 +2734,13 @@  discard block
 block discarded – undo
2734 2734
         <div class="gd-cf-input-wrap">
2735 2735
 
2736 2736
             <?php
2737
-            $selected = '';
2738
-            if (isset($field_info->extra_fields))
2739
-                $advanced_editor = unserialize($field_info->extra_fields);
2737
+			$selected = '';
2738
+			if (isset($field_info->extra_fields))
2739
+				$advanced_editor = unserialize($field_info->extra_fields);
2740 2740
 
2741
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
-                $selected = 'checked="checked"';
2743
-            ?>
2741
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
+				$selected = 'checked="checked"';
2743
+			?>
2744 2744
 
2745 2745
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2746 2746
                    value="1" <?php echo $selected; ?>/>
@@ -2749,22 +2749,22 @@  discard block
 block discarded – undo
2749 2749
     </li>
2750 2750
     <?php
2751 2751
 
2752
-    $output = ob_get_clean();
2753
-    return $output;
2752
+	$output = ob_get_clean();
2753
+	return $output;
2754 2754
 }
2755 2755
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2756 2756
 
2757 2757
 
2758 2758
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2759
-    ob_start();
2760
-
2761
-    $value = '';
2762
-    if (isset($field_info->validation_pattern)) {
2763
-        $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2766
-    }
2767
-    ?>
2759
+	ob_start();
2760
+
2761
+	$value = '';
2762
+	if (isset($field_info->validation_pattern)) {
2763
+		$value = esc_attr($field_info->validation_pattern);
2764
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2766
+	}
2767
+	?>
2768 2768
     <li>
2769 2769
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2770 2770
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
         </div>
2779 2779
     </li>
2780 2780
     <?php
2781
-    $value = '';
2782
-    if (isset($field_info->validation_msg)) {
2783
-        $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
-        $value = esc_attr($cf['defaults']['validation_msg']);
2786
-    }
2787
-    ?>
2781
+	$value = '';
2782
+	if (isset($field_info->validation_msg)) {
2783
+		$value = esc_attr($field_info->validation_msg);
2784
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785
+		$value = esc_attr($cf['defaults']['validation_msg']);
2786
+	}
2787
+	?>
2788 2788
     <li>
2789 2789
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2790 2790
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2799,21 +2799,21 @@  discard block
 block discarded – undo
2799 2799
     </li>
2800 2800
     <?php
2801 2801
 
2802
-    $output = ob_get_clean();
2803
-    return $output;
2802
+	$output = ob_get_clean();
2803
+	return $output;
2804 2804
 }
2805 2805
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2806 2806
 
2807 2807
 
2808 2808
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2809
-    ob_start();
2810
-    global $post_type;
2811
-
2812
-    if (!isset($field_info->post_type)) {
2813
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
-    } else
2815
-        $post_type = $field_info->post_type;
2816
-    ?>
2809
+	ob_start();
2810
+	global $post_type;
2811
+
2812
+	if (!isset($field_info->post_type)) {
2813
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
+	} else
2815
+		$post_type = $field_info->post_type;
2816
+	?>
2817 2817
     <li style="display: none;">
2818 2818
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2819 2819
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2824,15 +2824,15 @@  discard block
 block discarded – undo
2824 2824
         <div class="gd-cf-input-wrap">
2825 2825
             <select name="htmlvar_name" id="htmlvar_name">
2826 2826
                 <?php
2827
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2827
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2828 2828
 
2829
-                foreach ($gd_taxonomy as $gd_tax) {
2830
-                    ?>
2829
+				foreach ($gd_taxonomy as $gd_tax) {
2830
+					?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832
-                        echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
-                }
2835
-                ?>
2832
+						echo 'selected="selected"';
2833
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2834
+				}
2835
+				?>
2836 2836
             </select>
2837 2837
         </div>
2838 2838
     </li>
@@ -2848,49 +2848,49 @@  discard block
 block discarded – undo
2848 2848
 
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851
-                    echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2851
+					echo 'selected="selected"';
2852
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854
-                    echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2854
+					echo 'selected="selected"';
2855
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857
-                    echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2857
+					echo 'selected="selected"';
2858
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860
-                    echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2860
+					echo 'selected="selected"';
2861
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863
-                    echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2863
+					echo 'selected="selected"';
2864
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
2868 2868
     <?php
2869 2869
 
2870
-    $output = ob_get_clean();
2871
-    return $output;
2870
+	$output = ob_get_clean();
2871
+	return $output;
2872 2872
 }
2873 2873
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2874 2874
 
2875 2875
 
2876 2876
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2877 2877
 
2878
-    ob_start();
2879
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
-        $address = unserialize($field_info->extra_fields);
2881
-    }
2878
+	ob_start();
2879
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2880
+		$address = unserialize($field_info->extra_fields);
2881
+	}
2882 2882
 
2883
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
-    ?>
2883
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2884
+	?>
2885 2885
     <?php
2886
-    /**
2887
-     * Called on the add custom fields settings page before the address field is output.
2888
-     *
2889
-     * @since 1.0.0
2890
-     * @param array $address The address settings array.
2891
-     * @param object $field_info Extra fields info.
2892
-     */
2893
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2886
+	/**
2887
+	 * Called on the add custom fields settings page before the address field is output.
2888
+	 *
2889
+	 * @since 1.0.0
2890
+	 * @param array $address The address settings array.
2891
+	 * @param object $field_info Extra fields info.
2892
+	 */
2893
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2894 2894
 
2895 2895
     <li>
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2903,14 +2903,14 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906
-                    echo 'checked';
2907
-                } ?>/>
2906
+					echo 'checked';
2907
+				} ?>/>
2908 2908
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910 2910
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912
-                    echo 'checked';
2913
-                } ?>/>
2912
+					echo 'checked';
2913
+				} ?>/>
2914 2914
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
@@ -2927,8 +2927,8 @@  discard block
 block discarded – undo
2927 2927
         <div class="gd-cf-input-wrap">
2928 2928
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2929 2929
                    value="<?php if (isset($address['zip_lable'])) {
2930
-                       echo esc_attr($address['zip_lable']);
2931
-                   }?>"/>
2930
+					   echo esc_attr($address['zip_lable']);
2931
+				   }?>"/>
2932 2932
         </div>
2933 2933
     </li>
2934 2934
 
@@ -2945,8 +2945,8 @@  discard block
 block discarded – undo
2945 2945
         <div class="gd-cf-input-wrap">
2946 2946
             <input type="text" name="extra[map_lable]" id="map_lable"
2947 2947
                    value="<?php if (isset($address['map_lable'])) {
2948
-                       echo esc_attr($address['map_lable']);
2949
-                   }?>"/>
2948
+					   echo esc_attr($address['map_lable']);
2949
+				   }?>"/>
2950 2950
         </div>
2951 2951
     </li>
2952 2952
 
@@ -2961,14 +2961,14 @@  discard block
 block discarded – undo
2961 2961
 
2962 2962
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964
-                    echo 'checked';
2965
-                } ?>/>
2964
+					echo 'checked';
2965
+				} ?>/>
2966 2966
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968 2968
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970
-                    echo 'checked';
2971
-                } ?>/>
2970
+					echo 'checked';
2971
+				} ?>/>
2972 2972
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
@@ -2985,14 +2985,14 @@  discard block
 block discarded – undo
2985 2985
 
2986 2986
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988
-                    echo 'checked';
2989
-                } ?>/>
2988
+					echo 'checked';
2989
+				} ?>/>
2990 2990
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992 2992
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994
-                    echo 'checked';
2995
-                } ?>/>
2994
+					echo 'checked';
2995
+				} ?>/>
2996 2996
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
@@ -3009,8 +3009,8 @@  discard block
 block discarded – undo
3009 3009
         <div class="gd-cf-input-wrap">
3010 3010
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3011 3011
                    value="<?php if (isset($address['mapview_lable'])) {
3012
-                       echo esc_attr($address['mapview_lable']);
3013
-                   }?>"/>
3012
+					   echo esc_attr($address['mapview_lable']);
3013
+				   }?>"/>
3014 3014
         </div>
3015 3015
     </li>
3016 3016
     <li>
@@ -3024,29 +3024,29 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027
-                    echo 'checked';
3028
-                } ?>/>
3027
+					echo 'checked';
3028
+				} ?>/>
3029 3029
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031 3031
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033
-                    echo 'checked';
3034
-                } ?>/>
3033
+					echo 'checked';
3034
+				} ?>/>
3035 3035
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
3039 3039
     <?php
3040 3040
 
3041
-    $html = ob_get_clean();
3042
-    return $output.$html;
3041
+	$html = ob_get_clean();
3042
+	return $output.$html;
3043 3043
 }
3044 3044
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3045 3045
 
3046 3046
 
3047 3047
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3048
-    ob_start();
3049
-    ?>
3048
+	ob_start();
3049
+	?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3058,14 +3058,14 @@  discard block
 block discarded – undo
3058 3058
 
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061
-                    echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3061
+					echo 'selected="selected"';
3062
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064
-                    echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3064
+					echo 'selected="selected"';
3065
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067
-                    echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3067
+					echo 'selected="selected"';
3068
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3073,25 +3073,25 @@  discard block
 block discarded – undo
3073 3073
     </li>
3074 3074
     <?php
3075 3075
 
3076
-    $html = ob_get_clean();
3077
-    return $output.$html;
3076
+	$html = ob_get_clean();
3077
+	return $output.$html;
3078 3078
 }
3079 3079
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3080 3080
 
3081 3081
 
3082 3082
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3083 3083
 
3084
-    ob_start();
3084
+	ob_start();
3085 3085
 
3086
-    $value = '';
3087
-    if (isset($field_info->option_values)) {
3088
-        $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090
-        $value = esc_attr($cf['defaults']['option_values']);
3091
-    }
3086
+	$value = '';
3087
+	if (isset($field_info->option_values)) {
3088
+		$value = esc_attr($field_info->option_values);
3089
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090
+		$value = esc_attr($cf['defaults']['option_values']);
3091
+	}
3092 3092
 
3093
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3094
-    ?>
3093
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3094
+	?>
3095 3095
     <li>
3096 3096
         <label for="option_values" class="gd-cf-tooltip-wrap">
3097 3097
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3118,8 +3118,8 @@  discard block
 block discarded – undo
3118 3118
     </li>
3119 3119
     <?php
3120 3120
 
3121
-    $html = ob_get_clean();
3122
-    return $output.$html;
3121
+	$html = ob_get_clean();
3122
+	return $output.$html;
3123 3123
 }
3124 3124
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3125 3125
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3127,12 +3127,12 @@  discard block
 block discarded – undo
3127 3127
 
3128 3128
 
3129 3129
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3130
-    ob_start();
3131
-    $extra = array();
3132
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3133
-        $extra = unserialize($field_info->extra_fields);
3134
-    }
3135
-    ?>
3130
+	ob_start();
3131
+	$extra = array();
3132
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3133
+		$extra = unserialize($field_info->extra_fields);
3134
+	}
3135
+	?>
3136 3136
     <li>
3137 3137
         <label for="date_format" class="gd-cf-tooltip-wrap">
3138 3138
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3142,52 +3142,52 @@  discard block
 block discarded – undo
3142 3142
         </label>
3143 3143
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3144 3144
             <?php
3145
-            $date_formats = array(
3146
-                'm/d/Y',
3147
-                'd/m/Y',
3148
-                'Y/m/d',
3149
-                'm-d-Y',
3150
-                'd-m-Y',
3151
-                'Y-m-d',
3152
-                'F j, Y',
3153
-            );
3154
-            /**
3155
-             * Filter the custom field date format options.
3156
-             *
3157
-             * @since 1.6.5
3158
-             * @param array $date_formats The PHP date format array.
3159
-             */
3160
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3161
-            ?>
3145
+			$date_formats = array(
3146
+				'm/d/Y',
3147
+				'd/m/Y',
3148
+				'Y/m/d',
3149
+				'm-d-Y',
3150
+				'd-m-Y',
3151
+				'Y-m-d',
3152
+				'F j, Y',
3153
+			);
3154
+			/**
3155
+			 * Filter the custom field date format options.
3156
+			 *
3157
+			 * @since 1.6.5
3158
+			 * @param array $date_formats The PHP date format array.
3159
+			 */
3160
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3161
+			?>
3162 3162
             <select name="extra[date_format]" id="date_format">
3163 3163
                 <?php
3164
-                foreach($date_formats as $format){
3165
-                    $selected = '';
3166
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3167
-                        $selected = "selected='selected'";
3168
-                    }
3169
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3170
-                }
3171
-                ?>
3164
+				foreach($date_formats as $format){
3165
+					$selected = '';
3166
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3167
+						$selected = "selected='selected'";
3168
+					}
3169
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3170
+				}
3171
+				?>
3172 3172
             </select>
3173 3173
 
3174 3174
         </div>
3175 3175
     </li>
3176 3176
     <?php
3177 3177
 
3178
-    $html = ob_get_clean();
3179
-    return $output.$html;
3178
+	$html = ob_get_clean();
3179
+	return $output.$html;
3180 3180
 }
3181 3181
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3182 3182
 
3183 3183
 
3184 3184
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3185
-    ob_start();
3186
-    $allowed_file_types = geodir_allowed_mime_types();
3185
+	ob_start();
3186
+	$allowed_file_types = geodir_allowed_mime_types();
3187 3187
 
3188
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3189
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3190
-    ?>
3188
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3189
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3190
+	?>
3191 3191
     <li>
3192 3192
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3193 3193
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3210,182 +3210,182 @@  discard block
 block discarded – undo
3210 3210
     </li>
3211 3211
     <?php
3212 3212
 
3213
-    $html = ob_get_clean();
3214
-    return $output.$html;
3213
+	$html = ob_get_clean();
3214
+	return $output.$html;
3215 3215
 }
3216 3216
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3217 3217
 
3218 3218
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3219
-    $fields = array();
3220
-    $package = ($package_id=='') ? '' : array($package_id);
3221
-
3222
-    $fields[] = array('listing_type' => $post_type,
3223
-                      'data_type' => 'VARCHAR',
3224
-                      'field_type' => 'taxonomy',
3225
-                      'admin_title' => __('Category', 'geodirectory'),
3226
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3227
-                      'site_title' => __('Category', 'geodirectory'),
3228
-                      'htmlvar_name' => $post_type.'category',
3229
-                      'default_value' => '',
3230
-                      'is_default' => '1',
3231
-                      'is_admin' => '1',
3232
-                      'is_required' => '1',
3233
-                      'show_in'   =>  '[detail]',
3234
-                      'show_on_pkg' => $package,
3235
-                      'clabels' => __('Category', 'geodirectory'));
3236
-
3237
-    $fields[] = array('listing_type' => $post_type,
3238
-                      'data_type' => 'VARCHAR',
3239
-                      'field_type' => 'address',
3240
-                      'admin_title' => __('Address', 'geodirectory'),
3241
-                      'admin_desc' => ADDRESS_MSG,
3242
-                      'site_title' => __('Address', 'geodirectory'),
3243
-                      'htmlvar_name' => 'post',
3244
-                      'default_value' => '',
3245
-                      'option_values' => '',
3246
-                      'is_default' => '1',
3247
-                      'is_admin' => '1',
3248
-                      'is_required' => '1',
3249
-                      'show_in'   =>  '[detail],[mapbubble]',
3250
-                      'show_on_pkg' => $package,
3251
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3252
-                      'clabels' => __('Address', 'geodirectory'),
3253
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3254
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3255
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3256
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3257
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3258
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3259
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3260
-                                       'show_latlng' => 1));
3261
-
3262
-    $fields[] = array('listing_type' => $post_type,
3263
-                      'data_type' => 'VARCHAR',
3264
-                      'field_type' => 'text',
3265
-                      'admin_title' => __('Time', 'geodirectory'),
3266
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3267
-                      'site_title' => __('Time', 'geodirectory'),
3268
-                      'htmlvar_name' => 'timing',
3269
-                      'default_value' => '',
3270
-                      'option_values' => '',
3271
-                      'is_default' => '1',
3272
-                      'is_admin' => '1',
3273
-                      'show_in' =>  '[detail],[mapbubble]',
3274
-                      'show_on_pkg' => $package,
3275
-                      'clabels' => __('Time', 'geodirectory'));
3276
-
3277
-    $fields[] = array('listing_type' => $post_type,
3278
-                      'data_type' => 'VARCHAR',
3279
-                      'field_type' => 'phone',
3280
-                      'admin_title' => __('Phone', 'geodirectory'),
3281
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3282
-                      'site_title' => __('Phone', 'geodirectory'),
3283
-                      'htmlvar_name' => 'contact',
3284
-                      'default_value' => '',
3285
-                      'option_values' => '',
3286
-                      'is_default' => '1',
3287
-                      'is_admin' => '1',
3288
-                      'show_in' =>  '[detail],[mapbubble]',
3289
-                      'show_on_pkg' => $package,
3290
-                      'clabels' => __('Phone', 'geodirectory'));
3291
-
3292
-    $fields[] = array('listing_type' => $post_type,
3293
-                      'data_type' => 'VARCHAR',
3294
-                      'field_type' => 'email',
3295
-                      'admin_title' => __('Email', 'geodirectory'),
3296
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3297
-                      'site_title' => __('Email', 'geodirectory'),
3298
-                      'htmlvar_name' => 'email',
3299
-                      'default_value' => '',
3300
-                      'option_values' => '',
3301
-                      'is_default' => '1',
3302
-                      'is_admin' => '1',
3303
-                      'show_in' => '[detail]',
3304
-                      'show_on_pkg' => $package,
3305
-                      'clabels' => __('Email', 'geodirectory'));
3306
-
3307
-    $fields[] = array('listing_type' => $post_type,
3308
-                      'data_type' => 'VARCHAR',
3309
-                      'field_type' => 'url',
3310
-                      'admin_title' => __('Website', 'geodirectory'),
3311
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3312
-                      'site_title' => __('Website', 'geodirectory'),
3313
-                      'htmlvar_name' => 'website',
3314
-                      'default_value' => '',
3315
-                      'option_values' => '',
3316
-                      'is_default' => '1',
3317
-                      'is_admin' => '1',
3318
-                      'show_in' => '[detail]',
3319
-                      'show_on_pkg' => $package,
3320
-                      'clabels' => __('Website', 'geodirectory'));
3321
-
3322
-    $fields[] = array('listing_type' => $post_type,
3323
-                      'data_type' => 'VARCHAR',
3324
-                      'field_type' => 'url',
3325
-                      'admin_title' => __('Twitter', 'geodirectory'),
3326
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3327
-                      'site_title' => __('Twitter', 'geodirectory'),
3328
-                      'htmlvar_name' => 'twitter',
3329
-                      'default_value' => '',
3330
-                      'option_values' => '',
3331
-                      'is_default' => '1',
3332
-                      'is_admin' => '1',
3333
-                      'show_in' => '[detail]',
3334
-                      'show_on_pkg' => $package,
3335
-                      'clabels' => __('Twitter', 'geodirectory'));
3336
-
3337
-    $fields[] = array('listing_type' => $post_type,
3338
-                      'data_type' => 'VARCHAR',
3339
-                      'field_type' => 'url',
3340
-                      'admin_title' => __('Facebook', 'geodirectory'),
3341
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3342
-                      'site_title' => __('Facebook', 'geodirectory'),
3343
-                      'htmlvar_name' => 'facebook',
3344
-                      'default_value' => '',
3345
-                      'option_values' => '',
3346
-                      'is_default' => '1',
3347
-                      'is_admin' => '1',
3348
-                      'show_in' => '[detail]',
3349
-                      'show_on_pkg' => $package,
3350
-                      'clabels' => __('Facebook', 'geodirectory'));
3351
-
3352
-    $fields[] = array('listing_type' => $post_type,
3353
-                      'data_type' => 'TEXT',
3354
-                      'field_type' => 'textarea',
3355
-                      'admin_title' => __('Video', 'geodirectory'),
3356
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3357
-                      'site_title' => __('Video', 'geodirectory'),
3358
-                      'htmlvar_name' => 'video',
3359
-                      'default_value' => '',
3360
-                      'option_values' => '',
3361
-                      'is_default' => '0',
3362
-                      'is_admin' => '1',
3363
-                      'show_in' => '[owntab]',
3364
-                      'show_on_pkg' => $package,
3365
-                      'clabels' => __('Video', 'geodirectory'));
3366
-
3367
-    $fields[] = array('listing_type' => $post_type,
3368
-                      'data_type' => 'TEXT',
3369
-                      'field_type' => 'textarea',
3370
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3371
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3372
-                      'site_title' => __('Special Offers', 'geodirectory'),
3373
-                      'htmlvar_name' => 'special_offers',
3374
-                      'default_value' => '',
3375
-                      'option_values' => '',
3376
-                      'is_default' => '0',
3377
-                      'is_admin' => '1',
3378
-                      'show_in' => '[owntab]',
3379
-                      'show_on_pkg' => $package,
3380
-                      'clabels' => __('Special Offers', 'geodirectory'));
3381
-
3382
-    /**
3383
-     * Filter the array of default custom fields DB table data.
3384
-     *
3385
-     * @since 1.6.6
3386
-     * @param string $fields The default custom fields as an array.
3387
-     */
3388
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3389
-
3390
-    return  $fields;
3219
+	$fields = array();
3220
+	$package = ($package_id=='') ? '' : array($package_id);
3221
+
3222
+	$fields[] = array('listing_type' => $post_type,
3223
+					  'data_type' => 'VARCHAR',
3224
+					  'field_type' => 'taxonomy',
3225
+					  'admin_title' => __('Category', 'geodirectory'),
3226
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3227
+					  'site_title' => __('Category', 'geodirectory'),
3228
+					  'htmlvar_name' => $post_type.'category',
3229
+					  'default_value' => '',
3230
+					  'is_default' => '1',
3231
+					  'is_admin' => '1',
3232
+					  'is_required' => '1',
3233
+					  'show_in'   =>  '[detail]',
3234
+					  'show_on_pkg' => $package,
3235
+					  'clabels' => __('Category', 'geodirectory'));
3236
+
3237
+	$fields[] = array('listing_type' => $post_type,
3238
+					  'data_type' => 'VARCHAR',
3239
+					  'field_type' => 'address',
3240
+					  'admin_title' => __('Address', 'geodirectory'),
3241
+					  'admin_desc' => ADDRESS_MSG,
3242
+					  'site_title' => __('Address', 'geodirectory'),
3243
+					  'htmlvar_name' => 'post',
3244
+					  'default_value' => '',
3245
+					  'option_values' => '',
3246
+					  'is_default' => '1',
3247
+					  'is_admin' => '1',
3248
+					  'is_required' => '1',
3249
+					  'show_in'   =>  '[detail],[mapbubble]',
3250
+					  'show_on_pkg' => $package,
3251
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3252
+					  'clabels' => __('Address', 'geodirectory'),
3253
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3254
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3255
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3256
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3257
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3258
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3259
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3260
+									   'show_latlng' => 1));
3261
+
3262
+	$fields[] = array('listing_type' => $post_type,
3263
+					  'data_type' => 'VARCHAR',
3264
+					  'field_type' => 'text',
3265
+					  'admin_title' => __('Time', 'geodirectory'),
3266
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3267
+					  'site_title' => __('Time', 'geodirectory'),
3268
+					  'htmlvar_name' => 'timing',
3269
+					  'default_value' => '',
3270
+					  'option_values' => '',
3271
+					  'is_default' => '1',
3272
+					  'is_admin' => '1',
3273
+					  'show_in' =>  '[detail],[mapbubble]',
3274
+					  'show_on_pkg' => $package,
3275
+					  'clabels' => __('Time', 'geodirectory'));
3276
+
3277
+	$fields[] = array('listing_type' => $post_type,
3278
+					  'data_type' => 'VARCHAR',
3279
+					  'field_type' => 'phone',
3280
+					  'admin_title' => __('Phone', 'geodirectory'),
3281
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3282
+					  'site_title' => __('Phone', 'geodirectory'),
3283
+					  'htmlvar_name' => 'contact',
3284
+					  'default_value' => '',
3285
+					  'option_values' => '',
3286
+					  'is_default' => '1',
3287
+					  'is_admin' => '1',
3288
+					  'show_in' =>  '[detail],[mapbubble]',
3289
+					  'show_on_pkg' => $package,
3290
+					  'clabels' => __('Phone', 'geodirectory'));
3291
+
3292
+	$fields[] = array('listing_type' => $post_type,
3293
+					  'data_type' => 'VARCHAR',
3294
+					  'field_type' => 'email',
3295
+					  'admin_title' => __('Email', 'geodirectory'),
3296
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3297
+					  'site_title' => __('Email', 'geodirectory'),
3298
+					  'htmlvar_name' => 'email',
3299
+					  'default_value' => '',
3300
+					  'option_values' => '',
3301
+					  'is_default' => '1',
3302
+					  'is_admin' => '1',
3303
+					  'show_in' => '[detail]',
3304
+					  'show_on_pkg' => $package,
3305
+					  'clabels' => __('Email', 'geodirectory'));
3306
+
3307
+	$fields[] = array('listing_type' => $post_type,
3308
+					  'data_type' => 'VARCHAR',
3309
+					  'field_type' => 'url',
3310
+					  'admin_title' => __('Website', 'geodirectory'),
3311
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3312
+					  'site_title' => __('Website', 'geodirectory'),
3313
+					  'htmlvar_name' => 'website',
3314
+					  'default_value' => '',
3315
+					  'option_values' => '',
3316
+					  'is_default' => '1',
3317
+					  'is_admin' => '1',
3318
+					  'show_in' => '[detail]',
3319
+					  'show_on_pkg' => $package,
3320
+					  'clabels' => __('Website', 'geodirectory'));
3321
+
3322
+	$fields[] = array('listing_type' => $post_type,
3323
+					  'data_type' => 'VARCHAR',
3324
+					  'field_type' => 'url',
3325
+					  'admin_title' => __('Twitter', 'geodirectory'),
3326
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3327
+					  'site_title' => __('Twitter', 'geodirectory'),
3328
+					  'htmlvar_name' => 'twitter',
3329
+					  'default_value' => '',
3330
+					  'option_values' => '',
3331
+					  'is_default' => '1',
3332
+					  'is_admin' => '1',
3333
+					  'show_in' => '[detail]',
3334
+					  'show_on_pkg' => $package,
3335
+					  'clabels' => __('Twitter', 'geodirectory'));
3336
+
3337
+	$fields[] = array('listing_type' => $post_type,
3338
+					  'data_type' => 'VARCHAR',
3339
+					  'field_type' => 'url',
3340
+					  'admin_title' => __('Facebook', 'geodirectory'),
3341
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3342
+					  'site_title' => __('Facebook', 'geodirectory'),
3343
+					  'htmlvar_name' => 'facebook',
3344
+					  'default_value' => '',
3345
+					  'option_values' => '',
3346
+					  'is_default' => '1',
3347
+					  'is_admin' => '1',
3348
+					  'show_in' => '[detail]',
3349
+					  'show_on_pkg' => $package,
3350
+					  'clabels' => __('Facebook', 'geodirectory'));
3351
+
3352
+	$fields[] = array('listing_type' => $post_type,
3353
+					  'data_type' => 'TEXT',
3354
+					  'field_type' => 'textarea',
3355
+					  'admin_title' => __('Video', 'geodirectory'),
3356
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3357
+					  'site_title' => __('Video', 'geodirectory'),
3358
+					  'htmlvar_name' => 'video',
3359
+					  'default_value' => '',
3360
+					  'option_values' => '',
3361
+					  'is_default' => '0',
3362
+					  'is_admin' => '1',
3363
+					  'show_in' => '[owntab]',
3364
+					  'show_on_pkg' => $package,
3365
+					  'clabels' => __('Video', 'geodirectory'));
3366
+
3367
+	$fields[] = array('listing_type' => $post_type,
3368
+					  'data_type' => 'TEXT',
3369
+					  'field_type' => 'textarea',
3370
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3371
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3372
+					  'site_title' => __('Special Offers', 'geodirectory'),
3373
+					  'htmlvar_name' => 'special_offers',
3374
+					  'default_value' => '',
3375
+					  'option_values' => '',
3376
+					  'is_default' => '0',
3377
+					  'is_admin' => '1',
3378
+					  'show_in' => '[owntab]',
3379
+					  'show_on_pkg' => $package,
3380
+					  'clabels' => __('Special Offers', 'geodirectory'));
3381
+
3382
+	/**
3383
+	 * Filter the array of default custom fields DB table data.
3384
+	 *
3385
+	 * @since 1.6.6
3386
+	 * @param string $fields The default custom fields as an array.
3387
+	 */
3388
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3389
+
3390
+	return  $fields;
3391 3391
 }
3392 3392
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 {
75 75
     global $wpdb, $geodir_post_custom_fields_cache;
76 76
 
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
77
+    $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location;
78 78
 
79 79
     if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80 80
         return $geodir_post_custom_fields_cache[$cache_stored];
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $default_query .= " and is_admin = '0' ";
89 89
 
90 90
     if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
91
+    } else {
92
+        $fields_location = esc_sql($fields_location);
93 93
         $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94 94
     }
95 95
 
96 96
     $post_meta_info = $wpdb->get_results(
97 97
         $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
98
+            "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99 99
             array($post_type)
100 100
         )
101 101
     );
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      * @param string $field_ins_upd When set to "submit" displays form.
163 163
      * @param string $field_type_key The key of the custom field.
164 164
      */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
165
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
166 166
     {
167 167
         global $wpdb;
168 168
         $cf = $result_str;
169 169
         if (!is_object($cf)) {
170 170
 
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
171
+            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
172 172
 
173 173
         } else {
174 174
             $field_info = $cf;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
         if ($field_id != '') {
203 203
             $cf = trim($field_id, '_');
204 204
 
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
205
+            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
206
+                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
207 207
 
208 208
                 $post_type = $field->post_type;
209 209
                 $htmlvar_name = $field->htmlvar_name;
210 210
 
211 211
                 if ($post_type != '' && $htmlvar_name != '') {
212
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
212
+                    $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
213 213
                 }
214 214
 
215 215
                 /**
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
                 do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224 224
 
225 225
                 if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
226
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
227
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
228
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
229
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
230
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
231
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
232
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
233
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
234
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
235 235
                 } else {
236 236
                     if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
237
+                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
238 238
                     }
239 239
                 }
240 240
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305 305
 
306 306
         // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
307
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
308 308
             $request_field['data_type'] = 'VARCHAR';
309 309
         }
310 310
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
         $post_type = $request_field['listing_type'];
318 318
 
319 319
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
320
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
321 321
         }
322 322
 
323 323
         $check_html_variable = $wpdb->get_var(
324 324
             $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
325
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
326 326
                 array($cf, $cehhtmlvar_name, $post_type)
327 327
             )
328 328
         );
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
                 $post_meta_info = $wpdb->get_row(
336 336
                     $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
337
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
338 338
                         array($cf)
339 339
                     )
340 340
                 );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
             if ($post_type == '') $post_type = 'gd_place';
353 353
 
354 354
 
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
355
+            $detail_table = $plugin_prefix.$post_type.'_detail';
356 356
 
357 357
             $admin_title = $request_field['admin_title'];
358 358
             $site_title = $request_field['site_title'];
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
             $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
383
+            if (is_array($show_in)) {
384 384
                 $show_in = implode(",", $request_field['show_in']);
385 385
             }
386 386
             
387 387
             if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
388
+                $htmlvar_name = 'geodir_'.$htmlvar_name;
389 389
             }
390 390
 
391 391
             $option_values = '';
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 
427 427
             if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
431
+                $sort_order = (int) $last_order + 1;
432 432
             }
433 433
 
434 434
             $default_value_add = '';
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
                     case 'address':
441 441
 
442 442
                         if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
443
+                            $prefix = $htmlvar_name.'_';
444 444
                         }
445
-                        $old_prefix = $old_html_variable . '_';
445
+                        $old_prefix = $old_html_variable.'_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";
449 449
 
450 450
                         if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
451
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
452 452
                         }
453 453
 
454 454
                         $wpdb->query($meta_field_add);
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 
458 458
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
460
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
461 461
                                 if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
462
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";
463 463
 
464 464
                                     if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
465
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
466 466
                                     }
467 467
 
468 468
                                     $wpdb->query($meta_field_add);
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 
471 471
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
472 472
                                     if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
473
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
474 474
                                     }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
475
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
476 476
 
477 477
                                 }
478 478
 
@@ -482,36 +482,36 @@  discard block
 block discarded – undo
482 482
 
483 483
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
486 486
 
487 487
                                 if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";
489 489
 
490 490
                                     if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
491
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
492 492
                                     }
493 493
 
494 494
                                     $wpdb->query($meta_field_add);
495 495
                                 } else {
496 496
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
497 497
                                     if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
498
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
499 499
                                     }
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
501
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
502 502
                                 }
503 503
 
504 504
                             }
505 505
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
508 508
 
509 509
                                 if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";
512 512
 
513 513
                                     if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
514
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
515 515
                                     }
516 516
 
517 517
                                     $wpdb->query($meta_field_add);
@@ -519,24 +519,24 @@  discard block
 block discarded – undo
519 519
 
520 520
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
521 521
                                     if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
522
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
523 523
                                     }
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
526 526
 
527 527
                                 }
528 528
 
529 529
                             }
530 530
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
533 533
 
534 534
                                 if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";
537 537
 
538 538
                                     if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
539
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
540 540
                                     }
541 541
 
542 542
                                     $wpdb->query($meta_field_add);
@@ -544,128 +544,128 @@  discard block
 block discarded – undo
544 544
 
545 545
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
546 546
                                     if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
547
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
548 548
                                     }
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
551 551
 
552 552
                                 }
553 553
 
554 554
                             }
555 555
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
557
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
558 558
                                 if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";
561 561
 
562 562
                                     if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
563
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
564 564
                                     }
565 565
 
566 566
                                     $wpdb->query($meta_field_add);
567 567
                                 } else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
569
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
570 570
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
571 571
                                     if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
572
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
573 573
                                     }
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
576 576
 
577 577
                                 }
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
581 581
 
582 582
                                 if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";
584 584
 
585 585
                                     if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
586
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
587 587
                                     }
588 588
 
589 589
                                     $wpdb->query($meta_field_add);
590 590
                                 } else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
592
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
593 593
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
594 594
                                     if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
595
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
596 596
                                     }
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
598
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
599 599
                                 }
600 600
 
601 601
                             }
602 602
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
605 605
 
606 606
                                 if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";
608 608
 
609 609
                                     if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
610
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
611 611
                                     }
612 612
 
613 613
                                     $wpdb->query($meta_field_add);
614 614
                                 } else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
617 617
 
618 618
                                     $meta_field_add = "VARCHAR( 15 ) NULL";
619 619
                                     if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
620
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
621 621
                                     }
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
623
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
624 624
                                 }
625 625
 
626 626
 
627 627
                             }
628 628
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
630
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
631 631
                                 if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
632
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634 634
                                     if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
635
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
636 636
                                     }
637 637
 
638 638
                                     $wpdb->query($meta_field_add);
639 639
 
640 640
                                 } else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644 644
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
645 645
                                     if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
646
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
647 647
                                     }
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
649
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
650 650
                                 }
651 651
 
652 652
                             }
653 653
                             // show lat lng
654 654
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
655
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
656 656
 
657 657
                                 if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
658
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";
659 659
                                     $meta_field_add .= " DEFAULT '1'";
660 660
 
661 661
                                     $wpdb->query($meta_field_add);
662 662
                                 } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
663
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
664 664
 
665 665
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
666 666
                                     $meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
668
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
669 669
                                 }
670 670
 
671 671
                             }
@@ -681,30 +681,30 @@  discard block
 block discarded – undo
681 681
                         $op_size = '500';
682 682
 
683 683
                         // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
684
+                        if (isset($option_values) && $option_values && $field_type == 'select') {
685
+                            $option_values_arr = explode(',', $option_values);
686
+                            if (is_array($option_values_arr)) {
687 687
                                 $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
688
+                                foreach ($option_values_arr as $op_val) {
689
+                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
690 690
                                 }
691
-                                if($op_max){$op_size =$op_max; }
691
+                                if ($op_max) {$op_size = $op_max; }
692 692
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
693
+                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
694
+                            if (strlen($option_values)) {
695
+                                $op_size = strlen($option_values);
696 696
                             }
697 697
                         }
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";
700 700
 
701 701
                         if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
702
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
703 703
                         }
704 704
 
705 705
                         $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
706
+                        if ($alter_result === false) {
707
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
708 708
                         }
709 709
 
710 710
                         if (isset($request_field['cat_display_type']))
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
                     case 'url':
722 722
                     case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
724
+                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
725
+                        if ($alter_result === false) {
726
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
727 727
                         }
728 728
                         if (isset($request_field['advanced_editor']))
729 729
                             $extra_fields = $request_field['advanced_editor'];
@@ -737,24 +737,24 @@  discard block
 block discarded – undo
737 737
                     default:
738 738
                         if ($data_type != 'VARCHAR' && $data_type != '') {
739 739
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
740
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";
741 741
                             } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
742
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";
743 743
                             }
744 744
 
745 745
                             if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
746
+                                $default_value_add .= " DEFAULT '".$default_value."'";
747 747
                             }
748 748
                         } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
749
+                            $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";
750 750
                             if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
751
+                                $default_value_add .= " DEFAULT '".$default_value."'";
752 752
                             }
753 753
                         }
754 754
 
755 755
                         $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
756
+                        if ($alter_result === false) {
757
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
758 758
                         }
759 759
                         break;
760 760
                 endswitch;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
                     $wpdb->prepare(
772 772
 
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
773
+                        "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
807
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)
808 808
                     )
809 809
 
810 810
                 );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
                 $wpdb->query(
816 816
                     $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
817
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820 820
                         array($site_title, $post_type, $htmlvar_name)
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 
825 825
                 if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
826
+                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827 827
 
828 828
 
829 829
                 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
                         $data_type = '';
844 844
 
845 845
                         if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
846
+                            $prefix = $htmlvar_name.'_';
847 847
                         }
848 848
                         $old_prefix = $old_html_variable;
849 849
 
@@ -851,109 +851,109 @@  discard block
 block discarded – undo
851 851
 
852 852
                         $meta_field_add = "VARCHAR( 254 ) NULL";
853 853
                         if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
854
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
855 855
                         }
856 856
 
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
858 858
                         //$wpdb->query($meta_field_add);
859 859
 
860 860
 
861 861
                         if (!empty($extra_fields)) {
862 862
 
863 863
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
865 865
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
866 866
                                 if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
867
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
868 868
                                 }
869 869
 
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
871 871
                                 //$wpdb->query($meta_field_add);
872 872
                             }
873 873
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
875 875
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
876 876
                                 if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
877
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
878 878
                                 }
879 879
 
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
881 881
                                 //$wpdb->query($meta_field_add);
882 882
                             }
883 883
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
885 885
 
886 886
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
887 887
                                 if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
888
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
889 889
                                 }
890 890
 
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
892 892
                                 //$wpdb->query($meta_field_add);
893 893
                             }
894 894
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
896 896
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
897 897
                                 if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
898
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
899 899
                                 }
900 900
 
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
902 902
                                 //$wpdb->query($meta_field_add);
903 903
                             }
904 904
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
906 906
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
907 907
                                 if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
908
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
909 909
                                 }
910 910
 
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
912 912
                                 //$wpdb->query($meta_field_add);
913 913
 
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
915 915
 
916 916
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
917 917
                                 if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
918
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
919 919
                                 }
920 920
 
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
922 922
 
923 923
                                 //$wpdb->query($meta_field_add);
924 924
                             }
925 925
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
927 927
 
928 928
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
929 929
                                 if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
931 931
                                 }
932 932
 
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
934 934
 
935 935
                                 //$wpdb->query($meta_field_add);
936 936
                             }
937 937
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
939 939
 
940 940
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
941 941
                                 if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
943 943
                                 }
944 944
 
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
946 946
 
947 947
                                 //$wpdb->query($meta_field_add);
948 948
                             }
949 949
                             // show lat lng
950 950
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
952 952
 
953 953
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
954 954
                                 $meta_field_add .= " DEFAULT '1'";
955 955
 
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
957 957
                                 //$wpdb->query($meta_field_add);
958 958
                             }
959 959
                         }
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
                     case 'checkbox':
964 964
                         $data_type = 'TINYINT';
965 965
 
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
966
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
967
+                        if ((int) $default_value === 1) {
968 968
                             $meta_field_add .= " DEFAULT '1'";
969 969
                         }
970 970
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                             }
998 998
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999 999
                             if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1000
+                                $op_size = strlen($option_values);
1001 1001
                             }
1002 1002
 
1003 1003
                             if (isset($request_field['multi_display_type'])) {
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
                             }
1006 1006
                         }
1007 1007
 
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1008
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1009 1009
                         if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1011 1011
                         }
1012 1012
 
1013 1013
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
                         $data_type = 'TEXT';
1024 1024
 
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1026 1026
 
1027
-                        $meta_field_add = $data_type . " NULL ";
1027
+                        $meta_field_add = $data_type." NULL ";
1028 1028
                         /*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
@@ -1039,9 +1039,9 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
                         $data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+                        $meta_field_add = $data_type." NULL ";
1045 1045
 
1046 1046
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047 1047
                         if ($add_result === false) {
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                         $data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+                        $meta_field_add = $data_type." NULL ";
1060 1060
 
1061 1061
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062 1062
                         if ($add_result === false) {
@@ -1068,22 +1068,22 @@  discard block
 block discarded – undo
1068 1068
                     default:
1069 1069
 
1070 1070
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1071
+                            $meta_field_add = $data_type." NULL ";
1072 1072
 
1073 1073
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1075 1075
                             }
1076 1076
 
1077 1077
                             if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1078
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1079
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1080 1080
                             }
1081 1081
                         } else {
1082 1082
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084 1084
                             if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1085
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1086
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1087 1087
                             }
1088 1088
                         }
1089 1089
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
                     $wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1141
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)
1142 1142
 
1143 1143
                     )
1144 1144
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
             }
1152 1152
 
1153
-            return (int)$lastid;
1153
+            return (int) $lastid;
1154 1154
 
1155 1155
 
1156 1156
         } else {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
             $post_meta_info = $wpdb->query(
1185 1185
                 $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1186
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189 1189
                     array($count, $cf)
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 }
1200 1200
 
1201 1201
 
1202
-function geodir_get_cf_value($cf){
1202
+function geodir_get_cf_value($cf) {
1203 1203
     global $gd_session;
1204 1204
     $value = '';
1205 1205
     if (is_admin()) {
1206
-        global $post,$gd_session;
1206
+        global $post, $gd_session;
1207 1207
 
1208 1208
         if (isset($_REQUEST['post']))
1209 1209
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
         $is_default = $val['is_default'];
1252 1252
 
1253 1253
         /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1255 1255
         if ($for_admin_use && !is_super_admin()) {
1256 1256
             continue;
1257 1257
         }
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277 1277
          * @see 'geodir_after_custom_form_field_$name'
1278 1278
          */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1280 1280
 
1281 1281
 
1282 1282
         $custom_field = $val;
1283
-        $html ='';
1283
+        $html = '';
1284 1284
         /**
1285 1285
          * Filter the output for custom fields.
1286 1286
          *
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
          * @param string $html The html to be filtered (blank).
1290 1290
          * @param array $custom_field The custom field array values.
1291 1291
          */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1293 1293
 
1294 1294
 
1295 1295
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305 1305
          * @see 'geodir_before_custom_form_field_$name'
1306 1306
          */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1308 1308
 
1309 1309
     }
1310 1310
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
         $filter = $wpdb->get_row(
1332 1332
             $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1334 1334
                 array($geodir_post_type)
1335 1335
             )
1336 1336
         );
@@ -1345,14 +1345,14 @@  discard block
 block discarded – undo
1345 1345
 }
1346 1346
 
1347 1347
 
1348
-function geodir_field_icon_proccess($cf){
1348
+function geodir_field_icon_proccess($cf) {
1349 1349
 
1350 1350
 
1351 1351
     if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1353
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1354
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1355
+    } else {
1356 1356
         $field_icon = $cf['field_icon'];
1357 1357
     }
1358 1358
 
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
                 $field_icon = geodir_field_icon_proccess($type);
1403 1403
                 $filed_type = $type['type'];
1404 1404
                 $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1405
+                if ($html_var == 'post') {$html_var = 'post_address'; }
1406 1406
 
1407 1407
                 /**
1408 1408
                  * Filter the output for custom fields.
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
                  * @param string $fields_location The location the field is to be show.
1414 1414
                  * @param array $type The array of field values.
1415 1415
                  */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1417 1417
 
1418 1418
                 $variables_array = array();
1419 1419
 
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 
1543 1543
         $post_type = get_post_type($post_id);
1544 1544
         //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1545
+        $table = $plugin_prefix.$post_type.'_detail';
1546 1546
 
1547 1547
         $postcurr_images = array();
1548 1548
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1561,13 +1561,13 @@  discard block
 block discarded – undo
1561 1561
             $geodir_uploadurl = $uploads['url'];
1562 1562
             $sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1564
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1565 1565
 
1566 1566
             for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568 1568
                 /* --------- start ------- */
1569 1569
 
1570
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1570
+                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
1571 1571
 
1572 1572
 
1573 1573
                     $curr_img_url = $post_image[$m];
@@ -1593,24 +1593,24 @@  discard block
 block discarded – undo
1593 1593
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1594
 
1595 1595
                     if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1596
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1597 1597
 
1598 1598
                     if (!is_dir($geodir_uploadpath))
1599 1599
                         mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1601
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1602 1602
                     $explode_sub_dir = explode("/", $sub_dir);
1603 1603
                     if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1604
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1605
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1606 1606
                     } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1607
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1608
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1609 1609
                     }
1610 1610
 
1611 1611
                     $uploaded_file = '';
1612 1612
                     if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1613
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1614 1614
 
1615 1615
                     if ($curr_img_dir != $geodir_uploaddir) {
1616 1616
                         if (file_exists($img_path))
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     }
1619 1619
 
1620 1620
                     if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1621
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1622 1622
 
1623 1623
                 } else {
1624 1624
                     $file_urls = $post_image[$m];
@@ -1632,8 +1632,8 @@  discard block
 block discarded – undo
1632 1632
         if (!empty($postcurr_images)) {
1633 1633
 
1634 1634
             if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1635
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1636
+                $invalid_files = (object) $invalid_files;
1637 1637
             }
1638 1638
         }
1639 1639
 
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
     function geodir_upload_dir($upload)
1686 1686
     {
1687 1687
         global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1688
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1689
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1690
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1691 1691
         return $upload;
1692 1692
     }
1693 1693
 
@@ -1702,20 +1702,20 @@  discard block
 block discarded – undo
1702 1702
         // check ajax noonce
1703 1703
         $imgid = $_POST["imgid"];
1704 1704
 
1705
-        check_ajax_referer($imgid . 'pluploadan');
1705
+        check_ajax_referer($imgid.'pluploadan');
1706 1706
 
1707 1707
         // handle custom file uploaddir
1708 1708
         add_filter('upload_dir', 'geodir_upload_dir');
1709 1709
 
1710 1710
         // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1711
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1712 1712
 
1713 1713
         // handle file upload
1714 1714
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715 1715
         // remove handle custom file uploaddir
1716 1716
         remove_filter('upload_dir', 'geodir_upload_dir');
1717 1717
 
1718
-        if(!isset($status['url']) && isset($status['error'])){
1718
+        if (!isset($status['url']) && isset($status['error'])) {
1719 1719
             print_r($status);
1720 1720
         }
1721 1721
 
@@ -1745,9 +1745,9 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
     $post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+    $table = $plugin_prefix.$post_type.'_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1751 1751
 
1752 1752
     if ($results) {
1753 1753
         return $results[0]->geodir_video;
@@ -1771,9 +1771,9 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
     $post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+    $table = $plugin_prefix.$post_type.'_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1777 1777
 
1778 1778
     if ($results) {
1779 1779
         return $results[0]->geodir_special_offers;
@@ -1791,12 +1791,12 @@  discard block
 block discarded – undo
1791 1791
      */
1792 1792
     function geodir_max_upload_size()
1793 1793
     {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1794
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1795 1795
 
1796 1796
         if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1797
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1798 1798
         } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1799
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1800 1800
         }
1801 1801
         /** Filter documented in geodirectory-functions/general_functions.php **/
1802 1802
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 
1829 1829
             $custom_fields = $wpdb->get_results(
1830 1830
                 $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1831
+                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832 1832
                     array($post_type)
1833 1833
                 ), 'ARRAY_A'
1834 1834
             );
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
             $post_meta_info = $wpdb->query(
1957 1957
                 $wpdb->prepare(
1958
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1958
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1959 1959
 															sort_order=%d 
1960 1960
 															where id= %d",
1961 1961
                     array($count, $cf)
@@ -2037,14 +2037,14 @@  discard block
 block discarded – undo
2037 2037
 
2038 2038
         $check_html_variable = $wpdb->get_var(
2039 2039
             $wpdb->prepare(
2040
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2040
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2041 2041
                 array($cehhtmlvar_name, $post_type, $field_type)
2042 2042
             )
2043 2043
         );
2044 2044
 
2045 2045
         if ($is_default == 1) {
2046 2046
 
2047
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2047
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2048 2048
 
2049 2049
         }
2050 2050
 
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
                 $wpdb->prepare(
2057 2057
 
2058
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2058
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2059 2059
 				post_type = %s,
2060 2060
 				data_type = %s,
2061 2061
 				field_type = %s,
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 
2087 2087
                 $wpdb->prepare(
2088 2088
 
2089
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2089
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2090 2090
 				post_type = %s,
2091 2091
 				data_type = %s,
2092 2092
 				field_type = %s,
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         }
2113 2113
 
2114 2114
 
2115
-        return (int)$lastid;
2115
+        return (int) $lastid;
2116 2116
 
2117 2117
     }
2118 2118
 }
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
         if ($field_id != '') {
2136 2136
             $cf = trim($field_id, '_');
2137 2137
 
2138
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2138
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2139 2139
 
2140 2140
             return $field_id;
2141 2141
 
@@ -2158,12 +2158,12 @@  discard block
 block discarded – undo
2158 2158
      * @param string $field_ins_upd When set to "submit" displays form.
2159 2159
      * @param bool $default when set to true field will be for admin use only.
2160 2160
      */
2161
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2161
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
2162 2162
     {
2163 2163
         global $wpdb;
2164 2164
         $cf = $result_str;
2165 2165
         if (!is_object($cf)) {
2166
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2166
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2167 2167
         } else {
2168 2168
             $field_info = $cf;
2169 2169
             $result_str = $cf->id;
@@ -2199,18 +2199,18 @@  discard block
 block discarded – undo
2199 2199
         if ($htmlvar_name == '')
2200 2200
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2201 2201
 
2202
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2202
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2203 2203
 
2204 2204
         $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2205 2205
         $cso_arr = geodir_get_custom_sort_options($post_type);
2206 2206
 
2207 2207
         $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2208
-        foreach($cso_arr as $cso){
2209
-            if($cur_field_type==$cso['field_type']){
2208
+        foreach ($cso_arr as $cso) {
2209
+            if ($cur_field_type == $cso['field_type']) {
2210 2210
 
2211 2211
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212 2212
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2213
+                }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
2214 2214
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215 2215
                 }
2216 2216
 
@@ -2220,40 +2220,40 @@  discard block
 block discarded – undo
2220 2220
         $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2221 2221
         ?>
2222 2222
 
2223
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2223
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2224 2224
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
2225
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2226
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2227
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2225
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2226
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2227
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2228 2228
                 <?php
2229 2229
 
2230 2230
                 ?>
2231 2231
 
2232
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2233
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2232
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2233
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2234 2234
                      class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
2235 2235
 
2236 2236
 
2237
-                <?php echo $field_icon;?>
2237
+                <?php echo $field_icon; ?>
2238 2238
                 <b style="cursor:pointer;"
2239
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2239
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2240 2240
 
2241 2241
             </div>
2242 2242
 
2243
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2243
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2244 2244
                  style="display:<?php if ($field_ins_upd == 'submit') {
2245 2245
                      echo 'block;';
2246 2246
                  } else {
2247 2247
                      echo 'none;';
2248 2248
                  } ?>">
2249 2249
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2250
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2251
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2252
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2250
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2251
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2252
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2253 2253
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2254 2254
                     echo $field_info->data_type;
2255 2255
                 }?>"/>
2256
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2256
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2257 2257
 
2258 2258
 
2259 2259
                 <ul class="widefat post fixed" border="0" style="width:100%;">
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
                         <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/>
2264 2264
 
2265 2265
                         <li>
2266
-                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?>
2266
+                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?>
2267 2267
 
2268 2268
                             <label for="asc" class="gd-cf-tooltip-wrap">
2269 2269
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
@@ -2273,24 +2273,24 @@  discard block
 block discarded – undo
2273 2273
                             </label>
2274 2274
                             <div class="gd-cf-input-wrap gd-switch">
2275 2275
 
2276
-                                <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2276
+                                <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled"  value="1"
2277 2277
                                     <?php if ($value == '1') {
2278 2278
                                         echo 'checked';
2279 2279
                                     } ?>/>
2280
-                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2280
+                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2281 2281
 
2282
-                                <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2282
+                                <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0"
2283 2283
                                     <?php if ($value == '0' || !$value) {
2284 2284
                                         echo 'checked';
2285 2285
                                     } ?>/>
2286
-                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2286
+                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2287 2287
 
2288 2288
                             </div>
2289 2289
 
2290 2290
                         </li>
2291 2291
 
2292
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2293
-                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?>
2292
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2293
+                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?>
2294 2294
 
2295 2295
                             <label for="asc_title" class="gd-cf-tooltip-wrap">
2296 2296
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
@@ -2300,14 +2300,14 @@  discard block
 block discarded – undo
2300 2300
                             </label>
2301 2301
                             <div class="gd-cf-input-wrap">
2302 2302
 
2303
-                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" />
2303
+                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" />
2304 2304
                             </div>
2305 2305
 
2306 2306
 
2307 2307
                         </li>
2308 2308
 
2309 2309
 
2310
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2310
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2311 2311
 
2312 2312
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2313 2313
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
                             <div class="gd-cf-input-wrap">
2319 2319
 
2320 2320
                                 <input type="radio" name="is_default"
2321
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2321
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2322 2322
                                     echo 'checked="checked"';
2323 2323
                                 } ?>/>
2324 2324
                             </div>
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
 
2329 2329
 
2330 2330
                         <li>
2331
-                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?>
2331
+                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?>
2332 2332
 
2333 2333
                             <label for="desc" class="gd-cf-tooltip-wrap">
2334 2334
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
@@ -2338,24 +2338,24 @@  discard block
 block discarded – undo
2338 2338
                             </label>
2339 2339
                             <div class="gd-cf-input-wrap gd-switch">
2340 2340
 
2341
-                                <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2341
+                                <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled"  value="1"
2342 2342
                                     <?php if ($value == '1') {
2343 2343
                                         echo 'checked';
2344 2344
                                     } ?>/>
2345
-                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2345
+                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2346 2346
 
2347
-                                <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2347
+                                <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0"
2348 2348
                                     <?php if ($value == '0' || !$value) {
2349 2349
                                         echo 'checked';
2350 2350
                                     } ?>/>
2351
-                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2351
+                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2352 2352
 
2353 2353
                             </div>
2354 2354
 
2355 2355
                         </li>
2356 2356
 
2357
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2358
-                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?>
2357
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2358
+                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?>
2359 2359
 
2360 2360
                             <label for="desc_title" class="gd-cf-tooltip-wrap">
2361 2361
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
@@ -2365,13 +2365,13 @@  discard block
 block discarded – undo
2365 2365
                             </label>
2366 2366
                             <div class="gd-cf-input-wrap">
2367 2367
 
2368
-                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" />
2368
+                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" />
2369 2369
                             </div>
2370 2370
 
2371 2371
 
2372 2372
                         </li>
2373 2373
 
2374
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2374
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2375 2375
 
2376 2376
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2377 2377
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
                             <div class="gd-cf-input-wrap">
2383 2383
 
2384 2384
                                 <input type="radio" name="is_default"
2385
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2385
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2386 2386
                                     echo 'checked="checked"';
2387 2387
                                 } ?>/>
2388 2388
                             </div>
@@ -2407,14 +2407,14 @@  discard block
 block discarded – undo
2407 2407
                             </label>
2408 2408
                             <div class="gd-cf-input-wrap">
2409 2409
 
2410
-                                <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" />
2410
+                                <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" />
2411 2411
                             </div>
2412 2412
 
2413 2413
 
2414 2414
                         </li>
2415 2415
 
2416 2416
                         <li>
2417
-                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?>
2417
+                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?>
2418 2418
 
2419 2419
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2420 2420
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 
2439 2439
 
2440 2440
                     <li>
2441
-                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?>
2441
+                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?>
2442 2442
 
2443 2443
                         <label for="is_active" class="gd-cf-tooltip-wrap">
2444 2444
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
@@ -2448,17 +2448,17 @@  discard block
 block discarded – undo
2448 2448
                         </label>
2449 2449
                         <div class="gd-cf-input-wrap gd-switch">
2450 2450
 
2451
-                            <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2451
+                            <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
2452 2452
                                 <?php if ($value == '1') {
2453 2453
                                     echo 'checked';
2454 2454
                                 } ?>/>
2455
-                            <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2455
+                            <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2456 2456
 
2457
-                            <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2457
+                            <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
2458 2458
                                 <?php if ($value == '0' || !$value) {
2459 2459
                                     echo 'checked';
2460 2460
                                 } ?>/>
2461
-                            <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2461
+                            <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2462 2462
 
2463 2463
                         </div>
2464 2464
 
@@ -2479,10 +2479,10 @@  discard block
 block discarded – undo
2479 2479
                             <h3></h3>
2480 2480
                         </label>
2481 2481
                         <div class="gd-cf-input-wrap">
2482
-                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
2482
+                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
2483 2483
                                    onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
2484
-                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
2485
-                                                                    onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2484
+                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
2485
+                                                                    onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2486 2486
                                                                     class="button"/></a>
2487 2487
                         </div>
2488 2488
                     </li>
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
         if (!$package_id || !$field_name || !$post_type) {
2518 2518
             return true;
2519 2519
         }
2520
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
2520
+        $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
2521 2521
 
2522 2522
         if ($wpdb->get_var($sql)) {
2523 2523
             return true;
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 }
2640 2640
 
2641 2641
 
2642
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2642
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2643 2643
     ob_start();
2644 2644
     ?>
2645 2645
     <li>
@@ -2685,43 +2685,43 @@  discard block
 block discarded – undo
2685 2685
     $output = ob_get_clean();
2686 2686
     return $output;
2687 2687
 }
2688
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2688
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2689 2689
 
2690 2690
 // htmlvar not needed for fieldset and taxonomy
2691
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2692
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2691
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2692
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2693 2693
 
2694 2694
 
2695 2695
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2696
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2697
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2698
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2699
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2700
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2701
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2696
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2697
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2698
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2699
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2700
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2701
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2702 2702
 
2703 2703
 // is_required not needed for fieldset
2704
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2705
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2704
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2705
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2706 2706
 
2707 2707
 // field_icon not needed for fieldset
2708
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2709
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2708
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2709
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2710 2710
 
2711 2711
 // cat_sort not needed for some fields
2712
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2713
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2714
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2715
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2716
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2717
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2718
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2719
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2712
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2713
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2714
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2715
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2716
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2717
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2718
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2719
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2720 2720
 
2721 2721
 
2722 2722
 
2723
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2724
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2723
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2724
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2725 2725
     ob_start();
2726 2726
     ?>
2727 2727
     <li>
@@ -2752,16 +2752,16 @@  discard block
 block discarded – undo
2752 2752
     $output = ob_get_clean();
2753 2753
     return $output;
2754 2754
 }
2755
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2755
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2756 2756
 
2757 2757
 
2758
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2758
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2759 2759
     ob_start();
2760 2760
 
2761 2761
     $value = '';
2762 2762
     if (isset($field_info->validation_pattern)) {
2763 2763
         $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2764
+    }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
2765 2765
         $value = esc_attr($cf['defaults']['validation_pattern']);
2766 2766
     }
2767 2767
     ?>
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
     $value = '';
2782 2782
     if (isset($field_info->validation_msg)) {
2783 2783
         $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2784
+    }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
2785 2785
         $value = esc_attr($cf['defaults']['validation_msg']);
2786 2786
     }
2787 2787
     ?>
@@ -2802,10 +2802,10 @@  discard block
 block discarded – undo
2802 2802
     $output = ob_get_clean();
2803 2803
     return $output;
2804 2804
 }
2805
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2805
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2806 2806
 
2807 2807
 
2808
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2808
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2809 2809
     ob_start();
2810 2810
     global $post_type;
2811 2811
 
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
                     ?>
2831 2831
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2832 2832
                         echo 'selected="selected"';
2833
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2833
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2834 2834
                 }
2835 2835
                 ?>
2836 2836
             </select>
@@ -2841,7 +2841,7 @@  discard block
 block discarded – undo
2841 2841
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2842 2842
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2843 2843
             <div class="gdcf-tooltip">
2844
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2844
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2845 2845
             </div>
2846 2846
         </label>
2847 2847
         <div class="gd-cf-input-wrap">
@@ -2849,19 +2849,19 @@  discard block
 block discarded – undo
2849 2849
             <select name="cat_display_type" id="cat_display_type">
2850 2850
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2851 2851
                     echo 'selected="selected"';
2852
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2852
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2853 2853
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2854 2854
                     echo 'selected="selected"';
2855
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2855
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2856 2856
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2857 2857
                     echo 'selected="selected"';
2858
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2858
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2859 2859
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2860 2860
                     echo 'selected="selected"';
2861
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2861
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2862 2862
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2863 2863
                     echo 'selected="selected"';
2864
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2864
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2865 2865
             </select>
2866 2866
         </div>
2867 2867
     </li>
@@ -2870,10 +2870,10 @@  discard block
 block discarded – undo
2870 2870
     $output = ob_get_clean();
2871 2871
     return $output;
2872 2872
 }
2873
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2873
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2874 2874
 
2875 2875
 
2876
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2876
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2877 2877
 
2878 2878
     ob_start();
2879 2879
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2896,32 +2896,32 @@  discard block
 block discarded – undo
2896 2896
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2897 2897
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2898 2898
             <div class="gdcf-tooltip">
2899
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2899
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2900 2900
             </div>
2901 2901
         </label>
2902 2902
         <div class="gd-cf-input-wrap gd-switch">
2903 2903
 
2904
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2904
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2905 2905
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2906 2906
                     echo 'checked';
2907 2907
                 } ?>/>
2908
-            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2908
+            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2909 2909
 
2910
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2910
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2911 2911
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2912 2912
                     echo 'checked';
2913 2913
                 } ?>/>
2914
-            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2914
+            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2915 2915
 
2916 2916
 
2917 2917
         </div>
2918 2918
     </li>
2919 2919
 
2920
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2920
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2921 2921
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2922 2922
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2923 2923
             <div class="gdcf-tooltip">
2924
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2924
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2925 2925
             </div>
2926 2926
         </label>
2927 2927
         <div class="gd-cf-input-wrap">
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2940 2940
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2941 2941
             <div class="gdcf-tooltip">
2942
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2942
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2943 2943
             </div>
2944 2944
         </label>
2945 2945
         <div class="gd-cf-input-wrap">
@@ -2954,22 +2954,22 @@  discard block
 block discarded – undo
2954 2954
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2955 2955
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2956 2956
             <div class="gdcf-tooltip">
2957
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2957
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2958 2958
             </div>
2959 2959
         </label>
2960 2960
         <div class="gd-cf-input-wrap gd-switch">
2961 2961
 
2962
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2962
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2963 2963
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2964 2964
                     echo 'checked';
2965 2965
                 } ?>/>
2966
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2966
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2967 2967
 
2968
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2968
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2969 2969
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2970 2970
                     echo 'checked';
2971 2971
                 } ?>/>
2972
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2972
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2973 2973
 
2974 2974
         </div>
2975 2975
     </li>
@@ -2978,22 +2978,22 @@  discard block
 block discarded – undo
2978 2978
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
2979 2979
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
2980 2980
             <div class="gdcf-tooltip">
2981
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
2981
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
2982 2982
             </div>
2983 2983
         </label>
2984 2984
         <div class="gd-cf-input-wrap gd-switch">
2985 2985
 
2986
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2986
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2987 2987
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2988 2988
                     echo 'checked';
2989 2989
                 } ?>/>
2990
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2990
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991 2991
 
2992
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2992
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2993 2993
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2994 2994
                     echo 'checked';
2995 2995
                 } ?>/>
2996
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2996
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997 2997
 
2998 2998
         </div>
2999 2999
     </li>
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
3004 3004
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
3005 3005
             <div class="gdcf-tooltip">
3006
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
3006
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
3007 3007
             </div>
3008 3008
         </label>
3009 3009
         <div class="gd-cf-input-wrap">
@@ -3017,22 +3017,22 @@  discard block
 block discarded – undo
3017 3017
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
3018 3018
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
3019 3019
             <div class="gdcf-tooltip">
3020
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
3020
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
3021 3021
             </div>
3022 3022
         </label>
3023 3023
         <div class="gd-cf-input-wrap gd-switch">
3024 3024
 
3025
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3025
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3026 3026
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3027 3027
                     echo 'checked';
3028 3028
                 } ?>/>
3029
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3029
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3030 3030
 
3031
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3031
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3032 3032
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3033 3033
                     echo 'checked';
3034 3034
                 } ?>/>
3035
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3035
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3036 3036
 
3037 3037
         </div>
3038 3038
     </li>
@@ -3041,17 +3041,17 @@  discard block
 block discarded – undo
3041 3041
     $html = ob_get_clean();
3042 3042
     return $output.$html;
3043 3043
 }
3044
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3044
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
3045 3045
 
3046 3046
 
3047
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3047
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
3048 3048
     ob_start();
3049 3049
     ?>
3050 3050
     <li>
3051 3051
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3052 3052
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
3053 3053
             <div class="gdcf-tooltip">
3054
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
3054
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
3055 3055
             </div>
3056 3056
         </label>
3057 3057
         <div class="gd-cf-input-wrap">
@@ -3059,13 +3059,13 @@  discard block
 block discarded – undo
3059 3059
             <select name="multi_display_type" id="multi_display_type">
3060 3060
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3061 3061
                     echo 'selected="selected"';
3062
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3062
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
3063 3063
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3064 3064
                     echo 'selected="selected"';
3065
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3065
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
3066 3066
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3067 3067
                     echo 'selected="selected"';
3068
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3068
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
3069 3069
             </select>
3070 3070
 
3071 3071
             <br/>
@@ -3076,17 +3076,17 @@  discard block
 block discarded – undo
3076 3076
     $html = ob_get_clean();
3077 3077
     return $output.$html;
3078 3078
 }
3079
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3079
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
3080 3080
 
3081 3081
 
3082
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3082
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
3083 3083
 
3084 3084
     ob_start();
3085 3085
 
3086 3086
     $value = '';
3087 3087
     if (isset($field_info->option_values)) {
3088 3088
         $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3089
+    }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
3090 3090
         $value = esc_attr($cf['defaults']['option_values']);
3091 3091
     }
3092 3092
 
@@ -3096,11 +3096,11 @@  discard block
 block discarded – undo
3096 3096
         <label for="option_values" class="gd-cf-tooltip-wrap">
3097 3097
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
3098 3098
             <div class="gdcf-tooltip">
3099
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
3099
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
3100 3100
                 <br/>
3101
-                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
3101
+                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
3102 3102
                     <br/>
3103
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
3103
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
3104 3104
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
3105 3105
                         <br/>
3106 3106
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
         </label>
3112 3112
         <div class="gd-cf-input-wrap">
3113 3113
             <input type="text" name="option_values" id="option_values"
3114
-                   value="<?php echo $value;?>"/>
3114
+                   value="<?php echo $value; ?>"/>
3115 3115
             <br/>
3116 3116
 
3117 3117
         </div>
@@ -3121,12 +3121,12 @@  discard block
 block discarded – undo
3121 3121
     $html = ob_get_clean();
3122 3122
     return $output.$html;
3123 3123
 }
3124
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3125
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
3126
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
3124
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
3125
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
3126
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
3127 3127
 
3128 3128
 
3129
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3129
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
3130 3130
     ob_start();
3131 3131
     $extra = array();
3132 3132
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
         <label for="date_format" class="gd-cf-tooltip-wrap">
3138 3138
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
3139 3139
             <div class="gdcf-tooltip">
3140
-                <?php _e('Select the date format.', 'geodirectory');?>
3140
+                <?php _e('Select the date format.', 'geodirectory'); ?>
3141 3141
             </div>
3142 3142
         </label>
3143 3143
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -3157,16 +3157,16 @@  discard block
 block discarded – undo
3157 3157
              * @since 1.6.5
3158 3158
              * @param array $date_formats The PHP date format array.
3159 3159
              */
3160
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3160
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
3161 3161
             ?>
3162 3162
             <select name="extra[date_format]" id="date_format">
3163 3163
                 <?php
3164
-                foreach($date_formats as $format){
3164
+                foreach ($date_formats as $format) {
3165 3165
                     $selected = '';
3166
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3166
+                    if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
3167 3167
                         $selected = "selected='selected'";
3168 3168
                     }
3169
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3169
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3170 3170
                 }
3171 3171
                 ?>
3172 3172
             </select>
@@ -3178,10 +3178,10 @@  discard block
 block discarded – undo
3178 3178
     $html = ob_get_clean();
3179 3179
     return $output.$html;
3180 3180
 }
3181
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3181
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3182 3182
 
3183 3183
 
3184
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3184
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3185 3185
     ob_start();
3186 3186
     $allowed_file_types = geodir_allowed_mime_types();
3187 3187
 
@@ -3192,16 +3192,16 @@  discard block
 block discarded – undo
3192 3192
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3193 3193
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3194 3194
             <div class="gdcf-tooltip">
3195
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3195
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3196 3196
             </div>
3197 3197
         </label>
3198 3198
         <div class="gd-cf-input-wrap">
3199 3199
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3200
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3201
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3202
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3203
-                        <?php foreach ( $types as $ext => $type ) { ?>
3204
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3200
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3201
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3202
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3203
+                        <?php foreach ($types as $ext => $type) { ?>
3204
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3205 3205
                         <?php } ?>
3206 3206
                     </optgroup>
3207 3207
                 <?php } ?>
@@ -3213,11 +3213,11 @@  discard block
 block discarded – undo
3213 3213
     $html = ob_get_clean();
3214 3214
     return $output.$html;
3215 3215
 }
3216
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3216
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3217 3217
 
3218
-function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3218
+function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
3219 3219
     $fields = array();
3220
-    $package = ($package_id=='') ? '' : array($package_id);
3220
+    $package = ($package_id == '') ? '' : array($package_id);
3221 3221
 
3222 3222
     $fields[] = array('listing_type' => $post_type,
3223 3223
                       'data_type' => 'VARCHAR',
Please login to merge, or discard this patch.
Braces   +124 added lines, -83 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query .= " and is_admin IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query .= " and is_admin = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'none') {
91 93
     } else{
@@ -239,10 +241,12 @@  discard block
 block discarded – undo
239 241
                 }
240 242
 
241 243
                 return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
244
+            } else {
245
+                            return 0;
246
+            }
247
+        } else {
248
+                    return 0;
249
+        }
246 250
     }
247 251
 }
248 252
 
@@ -349,7 +353,9 @@  discard block
 block discarded – undo
349 353
 
350 354
 
351 355
 
352
-            if ($post_type == '') $post_type = 'gd_place';
356
+            if ($post_type == '') {
357
+            	$post_type = 'gd_place';
358
+            }
353 359
 
354 360
 
355 361
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -389,16 +395,17 @@  discard block
 block discarded – undo
389 395
             }
390 396
 
391 397
             $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
398
+            if (isset($request_field['option_values'])) {
399
+                            $option_values = $request_field['option_values'];
400
+            }
394 401
 
395 402
             $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 403
 
397 404
             $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 405
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
406
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
407
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
408
+            } else {
402 409
                 $package_info = array();
403 410
 
404 411
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -406,22 +413,29 @@  discard block
 block discarded – undo
406 413
             }
407 414
 
408 415
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
416
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
417
+                            $extra_fields = $request_field['extra'];
418
+            }
411 419
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
420
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
421
+                            $is_default = $request_field['is_default'];
422
+            } else {
423
+                            $is_default = '0';
424
+            }
416 425
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
426
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
427
+                            $is_admin = $request_field['is_admin'];
428
+            } else {
429
+                            $is_admin = '0';
430
+            }
421 431
 
422 432
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
433
+            if ($is_active == '') {
434
+            	$is_active = 1;
435
+            }
436
+            if ($is_required == '') {
437
+            	$is_required = 0;
438
+            }
425 439
 
426 440
 
427 441
             if ($sort_order == '') {
@@ -690,7 +704,7 @@  discard block
 block discarded – undo
690 704
                                 }
691 705
                                 if($op_max){$op_size =$op_max; }
692 706
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694 708
                             if(strlen($option_values)){
695 709
                                 $op_size =  strlen($option_values);
696 710
                             }
@@ -707,11 +721,13 @@  discard block
 block discarded – undo
707 721
                             return __('Column change failed, you may have too many columns.','geodirectory');
708 722
                         }
709 723
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
712 727
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
715 731
 
716 732
 
717 733
                         break;
@@ -725,8 +741,9 @@  discard block
 block discarded – undo
725 741
                         if($alter_result===false){
726 742
                             return __('Column change failed, you may have too many columns.','geodirectory');
727 743
                         }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
744
+                        if (isset($request_field['advanced_editor'])) {
745
+                                                    $extra_fields = $request_field['advanced_editor'];
746
+                        }
730 747
 
731 748
                         break;
732 749
 
@@ -822,8 +839,9 @@  discard block
 block discarded – undo
822 839
                 );
823 840
 
824 841
 
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
842
+                if ($cat_sort == '') {
843
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
844
+                }
827 845
 
828 846
 
829 847
                 /**
@@ -1193,8 +1211,10 @@  discard block
 block discarded – undo
1193 1211
         }
1194 1212
 
1195 1213
         return $post_meta_info;
1196
-    else:
1197
-        return false;
1214
+    else {
1215
+    	:
1216
+        return false;
1217
+    }
1198 1218
     endif;
1199 1219
 }
1200 1220
 
@@ -1205,8 +1225,9 @@  discard block
 block discarded – undo
1205 1225
     if (is_admin()) {
1206 1226
         global $post,$gd_session;
1207 1227
 
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1228
+        if (isset($_REQUEST['post'])) {
1229
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1230
+        }
1210 1231
     }
1211 1232
 
1212 1233
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1259,8 +1280,9 @@  discard block
 block discarded – undo
1259 1280
         if (is_admin()) {
1260 1281
             global $post;
1261 1282
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1283
+            if (isset($_REQUEST['post'])) {
1284
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1285
+            }
1264 1286
         }
1265 1287
 
1266 1288
         
@@ -1352,7 +1374,7 @@  discard block
 block discarded – undo
1352 1374
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1375
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354 1376
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1377
+    } else{
1356 1378
         $field_icon = $cf['field_icon'];
1357 1379
     }
1358 1380
 
@@ -1425,8 +1447,9 @@  discard block
 block discarded – undo
1425 1447
                     $variables_array['post_id'] = $post->ID;
1426 1448
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427 1449
                     $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1450
+                    if (isset($post->{$type['htmlvar_name']})) {
1451
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1452
+                    }
1430 1453
                 endif;
1431 1454
 
1432 1455
 
@@ -1448,7 +1471,9 @@  discard block
 block discarded – undo
1448 1471
                      * @param string $html Custom field unfiltered HTML.
1449 1472
                      * @param array $variables_array Custom field variables array.
1450 1473
                      */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1474
+                    if ($html) {
1475
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1476
+                    }
1452 1477
 
1453 1478
                     /**
1454 1479
                      * Called after a custom fields is output on the frontend.
@@ -1482,10 +1507,11 @@  discard block
 block discarded – undo
1482 1507
      */
1483 1508
     function geodir_default_date_format()
1484 1509
     {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1510
+        if ($format = get_option('date_format')) {
1511
+                    return $format;
1512
+        } else {
1513
+                    return 'dd-mm-yy';
1514
+        }
1489 1515
     }
1490 1516
 }
1491 1517
 
@@ -1592,11 +1618,13 @@  discard block
 block discarded – undo
1592 1618
                     // Set an array containing a list of acceptable formats
1593 1619
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1594 1620
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1621
+                    if (!function_exists('wp_handle_upload')) {
1622
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1623
+                    }
1597 1624
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1625
+                    if (!is_dir($geodir_uploadpath)) {
1626
+                                            mkdir($geodir_uploadpath);
1627
+                    }
1600 1628
 
1601 1629
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602 1630
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1609,16 +1637,19 @@  discard block
 block discarded – undo
1609 1637
                     }
1610 1638
 
1611 1639
                     $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1640
+                    if (file_exists($img_path)) {
1641
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1642
+                    }
1614 1643
 
1615 1644
                     if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1645
+                        if (file_exists($img_path)) {
1646
+                                                    unlink($img_path);
1647
+                        }
1618 1648
                     }
1619 1649
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1650
+                    if (!empty($uploaded_file)) {
1651
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1652
+                    }
1622 1653
 
1623 1654
                 } else {
1624 1655
                     $file_urls = $post_image[$m];
@@ -1639,8 +1670,9 @@  discard block
 block discarded – undo
1639 1670
 
1640 1671
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1672
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1673
+        if (!empty($invalid_files)) {
1674
+                    geodir_remove_attachments($invalid_files);
1675
+        }
1644 1676
 
1645 1677
     }
1646 1678
 }
@@ -1866,8 +1898,9 @@  discard block
 block discarded – undo
1866 1898
 
1867 1899
         $all_postypes = geodir_get_posttypes();
1868 1900
 
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1901
+        if (!in_array($post_type, $all_postypes)) {
1902
+                    return false;
1903
+        }
1871 1904
 
1872 1905
         $fields = array();
1873 1906
 
@@ -1965,8 +1998,10 @@  discard block
 block discarded – undo
1965 1998
         }
1966 1999
 
1967 2000
         return $field_ids;
1968
-    else:
1969
-        return false;
2001
+    else {
2002
+    	:
2003
+        return false;
2004
+    }
1970 2005
     endif;
1971 2006
 }
1972 2007
 
@@ -2139,8 +2174,9 @@  discard block
 block discarded – undo
2139 2174
 
2140 2175
             return $field_id;
2141 2176
 
2142
-        } else
2143
-            return 0;
2177
+        } else {
2178
+                    return 0;
2179
+        }
2144 2180
 
2145 2181
     }
2146 2182
 }
@@ -2181,8 +2217,9 @@  discard block
 block discarded – undo
2181 2217
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2182 2218
 
2183 2219
         $site_title = '';
2184
-        if ($site_title == '')
2185
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2220
+        if ($site_title == '') {
2221
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2222
+        }
2186 2223
 
2187 2224
         if ($site_title == '') {
2188 2225
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2196,8 +2233,9 @@  discard block
 block discarded – undo
2196 2233
             }
2197 2234
         }
2198 2235
 
2199
-        if ($htmlvar_name == '')
2200
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2236
+        if ($htmlvar_name == '') {
2237
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2238
+        }
2201 2239
 
2202 2240
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203 2241
 
@@ -2210,7 +2248,7 @@  discard block
 block discarded – undo
2210 2248
 
2211 2249
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2212 2250
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2213
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2251
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2214 2252
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2215 2253
                 }
2216 2254
 
@@ -2735,11 +2773,13 @@  discard block
 block discarded – undo
2735 2773
 
2736 2774
             <?php
2737 2775
             $selected = '';
2738
-            if (isset($field_info->extra_fields))
2739
-                $advanced_editor = unserialize($field_info->extra_fields);
2776
+            if (isset($field_info->extra_fields)) {
2777
+                            $advanced_editor = unserialize($field_info->extra_fields);
2778
+            }
2740 2779
 
2741
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2742
-                $selected = 'checked="checked"';
2780
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2781
+                            $selected = 'checked="checked"';
2782
+            }
2743 2783
             ?>
2744 2784
 
2745 2785
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2761,7 +2801,7 @@  discard block
 block discarded – undo
2761 2801
     $value = '';
2762 2802
     if (isset($field_info->validation_pattern)) {
2763 2803
         $value = esc_attr($field_info->validation_pattern);
2764
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2804
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2765 2805
         $value = esc_attr($cf['defaults']['validation_pattern']);
2766 2806
     }
2767 2807
     ?>
@@ -2781,7 +2821,7 @@  discard block
 block discarded – undo
2781 2821
     $value = '';
2782 2822
     if (isset($field_info->validation_msg)) {
2783 2823
         $value = esc_attr($field_info->validation_msg);
2784
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2824
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2785 2825
         $value = esc_attr($cf['defaults']['validation_msg']);
2786 2826
     }
2787 2827
     ?>
@@ -2811,8 +2851,9 @@  discard block
 block discarded – undo
2811 2851
 
2812 2852
     if (!isset($field_info->post_type)) {
2813 2853
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2814
-    } else
2815
-        $post_type = $field_info->post_type;
2854
+    } else {
2855
+            $post_type = $field_info->post_type;
2856
+    }
2816 2857
     ?>
2817 2858
     <li style="display: none;">
2818 2859
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3086,7 +3127,7 @@  discard block
 block discarded – undo
3086 3127
     $value = '';
3087 3128
     if (isset($field_info->option_values)) {
3088 3129
         $value = esc_attr($field_info->option_values);
3089
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3130
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3090 3131
         $value = esc_attr($cf['defaults']['option_values']);
3091 3132
     }
3092 3133
 
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 2 patches
Indentation   +1200 added lines, -1200 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name)) . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -401,32 +401,32 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_get_current_posttype()
403 403
 {
404
-    global $wp_query, $geodir_post_type;
404
+	global $wp_query, $geodir_post_type;
405 405
 
406
-    $geodir_post_type = get_query_var('post_type');
406
+	$geodir_post_type = get_query_var('post_type');
407 407
 
408
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
-    }
408
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+		elseif (isset($_REQUEST['listing_type']))
412
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
+	}
414 414
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417 417
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
418
+	if (is_tax())
419
+		$geodir_post_type = geodir_get_taxonomy_posttype();
420 420
 
421 421
 
422
-    $all_postypes = geodir_get_posttypes();
423
-    $all_postypes = stripslashes_deep($all_postypes);
422
+	$all_postypes = geodir_get_posttypes();
423
+	$all_postypes = stripslashes_deep($all_postypes);
424 424
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
425
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
+		$geodir_post_type = '';
427 427
 
428 428
 
429
-    return $geodir_post_type;
429
+	return $geodir_post_type;
430 430
 }
431 431
 
432 432
 /**
@@ -440,21 +440,21 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function geodir_get_default_posttype()
442 442
 {
443
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
443
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
444 444
 
445
-    foreach ( $post_types as $post_type => $info ) {
446
-        global $wpdb;
447
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
448
-        if ( $has_posts ) {
449
-            $stype = $post_type; break;
450
-        }
451
-    }
445
+	foreach ( $post_types as $post_type => $info ) {
446
+		global $wpdb;
447
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
448
+		if ( $has_posts ) {
449
+			$stype = $post_type; break;
450
+		}
451
+	}
452 452
 
453
-    if(!$stype){
454
-        $stype = 'gd_place';
455
-    }
453
+	if(!$stype){
454
+		$stype = 'gd_place';
455
+	}
456 456
 
457
-    return $stype;
457
+	return $stype;
458 458
 }
459 459
 
460 460
 /**
@@ -468,21 +468,21 @@  discard block
 block discarded – undo
468 468
  */
469 469
 function geodir_get_posttypes($output = 'names')
470 470
 {
471
-    $post_types = array();
472
-    $post_types = get_option('geodir_post_types');
473
-    $post_types = stripslashes_deep($post_types);
474
-    if (!empty($post_types)) {
475
-        switch ($output):
476
-            case 'object':
477
-            case 'Object':
478
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
479
-                break;
480
-            case 'array':
481
-            case 'Array':
482
-                $post_types = (array)$post_types;
483
-                break;
471
+	$post_types = array();
472
+	$post_types = get_option('geodir_post_types');
473
+	$post_types = stripslashes_deep($post_types);
474
+	if (!empty($post_types)) {
475
+		switch ($output):
476
+			case 'object':
477
+			case 'Object':
478
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
479
+				break;
480
+			case 'array':
481
+			case 'Array':
482
+				$post_types = (array)$post_types;
483
+				break;
484 484
 			case 'options':
485
-                $post_types = (array)$post_types;
485
+				$post_types = (array)$post_types;
486 486
 				
487 487
 				$options = array();
488 488
 				if (!empty($post_types)) {
@@ -491,17 +491,17 @@  discard block
 block discarded – undo
491 491
 					}
492 492
 				}
493 493
 				$post_types = $options;
494
-                break;
495
-            default:
496
-                $post_types = array_keys($post_types);
497
-                break;
498
-        endswitch;
499
-    }
500
-
501
-    if (!empty($post_types))
502
-        return $post_types;
503
-    else
504
-        return array();
494
+				break;
495
+			default:
496
+				$post_types = array_keys($post_types);
497
+				break;
498
+		endswitch;
499
+	}
500
+
501
+	if (!empty($post_types))
502
+		return $post_types;
503
+	else
504
+		return array();
505 505
 }
506 506
 
507 507
 /**
@@ -514,108 +514,108 @@  discard block
 block discarded – undo
514 514
  */
515 515
 function geodir_get_posttype_info($post_type = '')
516 516
 {
517
-    $post_types = array();
518
-    $post_types = get_option('geodir_post_types');
519
-    $post_types = stripslashes_deep($post_types);
520
-    if (!empty($post_types) && $post_type != '') {
521
-        return $post_types[$post_type];
522
-    } else
523
-        return false;
517
+	$post_types = array();
518
+	$post_types = get_option('geodir_post_types');
519
+	$post_types = stripslashes_deep($post_types);
520
+	if (!empty($post_types) && $post_type != '') {
521
+		return $post_types[$post_type];
522
+	} else
523
+		return false;
524 524
 }
525 525
 
526 526
 if (!function_exists('geodir_get_taxonomies')) {
527
-    /**
528
-     * Get all custom taxonomies.
529
-     *
530
-     * @since 1.0.0
531
-     * @package GeoDirectory
532
-     * @param string $post_type The post type.
533
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
534
-     * @return array|bool Taxonomies on success. false on failure.
535
-     */
536
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
537
-    {
527
+	/**
528
+	 * Get all custom taxonomies.
529
+	 *
530
+	 * @since 1.0.0
531
+	 * @package GeoDirectory
532
+	 * @param string $post_type The post type.
533
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
534
+	 * @return array|bool Taxonomies on success. false on failure.
535
+	 */
536
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
537
+	{
538 538
 
539
-        $taxonomies = array();
540
-        $gd_taxonomies = array();
539
+		$taxonomies = array();
540
+		$gd_taxonomies = array();
541 541
 
542
-        if ($taxonomies = get_option('geodir_taxonomies')) {
542
+		if ($taxonomies = get_option('geodir_taxonomies')) {
543 543
 
544 544
 
545
-            $gd_taxonomies = array_keys($taxonomies);
545
+			$gd_taxonomies = array_keys($taxonomies);
546 546
 
547 547
 
548
-            if ($post_type != '')
549
-                $gd_taxonomies = array();
548
+			if ($post_type != '')
549
+				$gd_taxonomies = array();
550 550
 
551
-            $i = 0;
552
-            foreach ($taxonomies as $taxonomy => $args) {
551
+			$i = 0;
552
+			foreach ($taxonomies as $taxonomy => $args) {
553 553
 
554
-                if ($post_type != '' && $args['object_type'] == $post_type)
555
-                    $gd_taxonomies[] = $taxonomy;
554
+				if ($post_type != '' && $args['object_type'] == $post_type)
555
+					$gd_taxonomies[] = $taxonomy;
556 556
 
557
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
558
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
559
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
560
-                }
557
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
558
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
559
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
560
+				}
561 561
 
562
-            }
562
+			}
563 563
 
564
-            $gd_taxonomies = array_values($gd_taxonomies);
565
-        }
566
-
567
-        /**
568
-         * Filter the taxonomies.
569
-         *
570
-         * @since 1.0.0
571
-         * @param array $gd_taxonomies The taxonomy array.
572
-         */
573
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
574
-
575
-        if (!empty($taxonomies)) {
576
-            return $taxonomies;
577
-        } else {
578
-            return false;
579
-        }
580
-    }
564
+			$gd_taxonomies = array_values($gd_taxonomies);
565
+		}
566
+
567
+		/**
568
+		 * Filter the taxonomies.
569
+		 *
570
+		 * @since 1.0.0
571
+		 * @param array $gd_taxonomies The taxonomy array.
572
+		 */
573
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
574
+
575
+		if (!empty($taxonomies)) {
576
+			return $taxonomies;
577
+		} else {
578
+			return false;
579
+		}
580
+	}
581 581
 }
582 582
 
583 583
 if (!function_exists(' geodir_get_categories_dl')) {
584
-    /**
585
-     * Get categories dropdown HTML.
586
-     *
587
-     * @since 1.0.0
588
-     * @package GeoDirectory
589
-     * @param string $post_type The post type.
590
-     * @param string $selected The selected value.
591
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
592
-     * @param bool $echo Prints the HTML when set to true. Default: true.
593
-     * @return void|string Dropdown HTML.
594
-     */
595
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
596
-    {
597
-
598
-        $html = '';
599
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
600
-
601
-        $categories = get_terms($taxonomies);
602
-
603
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
604
-
605
-        foreach ($categories as $category_obj) {
606
-            $select_opt = '';
607
-            if ($selected == $category_obj->term_id) {
608
-                $select_opt = 'selected="selected"';
609
-            }
610
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
611
-                . ucfirst($category_obj->name) . '</option>';
612
-        }
613
-
614
-        if ($echo)
615
-            echo $html;
616
-        else
617
-            return $html;
618
-    }
584
+	/**
585
+	 * Get categories dropdown HTML.
586
+	 *
587
+	 * @since 1.0.0
588
+	 * @package GeoDirectory
589
+	 * @param string $post_type The post type.
590
+	 * @param string $selected The selected value.
591
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
592
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
593
+	 * @return void|string Dropdown HTML.
594
+	 */
595
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
596
+	{
597
+
598
+		$html = '';
599
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
600
+
601
+		$categories = get_terms($taxonomies);
602
+
603
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
604
+
605
+		foreach ($categories as $category_obj) {
606
+			$select_opt = '';
607
+			if ($selected == $category_obj->term_id) {
608
+				$select_opt = 'selected="selected"';
609
+			}
610
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
611
+				. ucfirst($category_obj->name) . '</option>';
612
+		}
613
+
614
+		if ($echo)
615
+			echo $html;
616
+		else
617
+			return $html;
618
+	}
619 619
 }
620 620
 
621 621
 
@@ -630,28 +630,28 @@  discard block
 block discarded – undo
630 630
 function geodir_get_listing_slug($object_type = '')
631 631
 {
632 632
 
633
-    $listing_slug = '';
633
+	$listing_slug = '';
634 634
 
635
-    $post_types = get_option('geodir_post_types');
636
-    $taxonomies = get_option('geodir_taxonomies');
635
+	$post_types = get_option('geodir_post_types');
636
+	$taxonomies = get_option('geodir_taxonomies');
637 637
 
638 638
 
639
-    if ($object_type != '') {
640
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
639
+	if ($object_type != '') {
640
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
641 641
 
642
-            $object_info = $post_types[$object_type];
643
-            $listing_slug = $object_info['listing_slug'];
644
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
645
-            $object_info = $taxonomies[$object_type];
646
-            $listing_slug = $object_info['listing_slug'];
647
-        }
642
+			$object_info = $post_types[$object_type];
643
+			$listing_slug = $object_info['listing_slug'];
644
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
645
+			$object_info = $taxonomies[$object_type];
646
+			$listing_slug = $object_info['listing_slug'];
647
+		}
648 648
 
649
-    }
649
+	}
650 650
 
651
-    if (!empty($listing_slug))
652
-        return $listing_slug;
653
-    else
654
-        return false;
651
+	if (!empty($listing_slug))
652
+		return $listing_slug;
653
+	else
654
+		return false;
655 655
 }
656 656
 
657 657
 
@@ -666,212 +666,212 @@  discard block
 block discarded – undo
666 666
  */
667 667
 function geodir_get_taxonomy_posttype($taxonomy = '')
668 668
 {
669
-    global $wp_query;
670
-
671
-    $post_type = array();
672
-    $taxonomies = array();
673
-
674
-    if (!empty($taxonomy)) {
675
-        $taxonomies[] = $taxonomy;
676
-    } elseif (isset($wp_query->tax_query->queries)) {
677
-        $tax_arr = $wp_query->tax_query->queries;
678
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
679
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
680
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
681
-    }
682
-
683
-    if (!empty($taxonomies)) {
684
-        foreach (geodir_get_posttypes() as $pt) {
685
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
686
-            if (array_intersect($taxonomies, $object_taxonomies))
687
-                $post_type[] = $pt;
688
-        }
689
-    }
690
-
691
-    if (!empty($post_type))
692
-        return $post_type[0];
693
-    else
694
-        return false;
669
+	global $wp_query;
670
+
671
+	$post_type = array();
672
+	$taxonomies = array();
673
+
674
+	if (!empty($taxonomy)) {
675
+		$taxonomies[] = $taxonomy;
676
+	} elseif (isset($wp_query->tax_query->queries)) {
677
+		$tax_arr = $wp_query->tax_query->queries;
678
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
679
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
680
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
681
+	}
682
+
683
+	if (!empty($taxonomies)) {
684
+		foreach (geodir_get_posttypes() as $pt) {
685
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
686
+			if (array_intersect($taxonomies, $object_taxonomies))
687
+				$post_type[] = $pt;
688
+		}
689
+	}
690
+
691
+	if (!empty($post_type))
692
+		return $post_type[0];
693
+	else
694
+		return false;
695 695
 }
696 696
 
697 697
 if (!function_exists('geodir_custom_taxonomy_walker')) {
698
-    /**
699
-     * Custom taxonomy walker function.
700
-     *
701
-     * @since 1.0.0
702
-     * @package GeoDirectory
703
-     * @param string $cat_taxonomy The taxonomy name.
704
-     * @param int $cat_parent The parent term ID.
705
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
706
-     * @param int $pading CSS padding in pixels.
707
-     * @return string|void taxonomy HTML.
708
-     */
709
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
710
-    {
711
-        global $cat_display, $post_cat, $exclude_cats;
712
-
713
-        $search_terms = trim($post_cat, ",");
714
-
715
-        $search_terms = explode(",", $search_terms);
716
-
717
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
718
-
719
-        $display = '';
720
-        $onchange = '';
721
-        $term_check = '';
722
-        $main_list_class = '';
723
-        $out = '';
724
-        //If there are terms, start displaying
725
-        if (count($cat_terms) > 0) {
726
-            //Displaying as a list
727
-            $p = $pading * 20;
728
-            $pading++;
729
-
730
-
731
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
732
-                if ($cat_parent == 0) {
733
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
734
-                    $main_list_class = 'class="main_list_selecter"';
735
-                } else {
736
-                    //$display = 'display:none';
737
-                    $list_class = 'sub_list gd-sub-cats-list';
738
-                }
739
-            }
698
+	/**
699
+	 * Custom taxonomy walker function.
700
+	 *
701
+	 * @since 1.0.0
702
+	 * @package GeoDirectory
703
+	 * @param string $cat_taxonomy The taxonomy name.
704
+	 * @param int $cat_parent The parent term ID.
705
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
706
+	 * @param int $pading CSS padding in pixels.
707
+	 * @return string|void taxonomy HTML.
708
+	 */
709
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
710
+	{
711
+		global $cat_display, $post_cat, $exclude_cats;
712
+
713
+		$search_terms = trim($post_cat, ",");
714
+
715
+		$search_terms = explode(",", $search_terms);
716
+
717
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
718
+
719
+		$display = '';
720
+		$onchange = '';
721
+		$term_check = '';
722
+		$main_list_class = '';
723
+		$out = '';
724
+		//If there are terms, start displaying
725
+		if (count($cat_terms) > 0) {
726
+			//Displaying as a list
727
+			$p = $pading * 20;
728
+			$pading++;
729
+
730
+
731
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
732
+				if ($cat_parent == 0) {
733
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
734
+					$main_list_class = 'class="main_list_selecter"';
735
+				} else {
736
+					//$display = 'display:none';
737
+					$list_class = 'sub_list gd-sub-cats-list';
738
+				}
739
+			}
740 740
 
741
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
742
-                $p = 0;
743
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
744
-            }
741
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
742
+				$p = 0;
743
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
744
+			}
745 745
 
746
-            foreach ($cat_terms as $cat_term) {
746
+			foreach ($cat_terms as $cat_term) {
747 747
 
748
-                $checked = '';
748
+				$checked = '';
749 749
 
750
-                if (in_array($cat_term->term_id, $search_terms)) {
751
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
752
-                        $checked = 'selected="selected"';
753
-                    else
754
-                        $checked = 'checked="checked"';
755
-                }
750
+				if (in_array($cat_term->term_id, $search_terms)) {
751
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
752
+						$checked = 'selected="selected"';
753
+					else
754
+						$checked = 'checked="checked"';
755
+				}
756 756
 
757
-                if ($cat_display == 'radio')
758
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
759
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
760
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
757
+				if ($cat_display == 'radio')
758
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
759
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
760
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
761 761
 
762
-                else {
763
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
764
-                }
762
+				else {
763
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
764
+				}
765 765
 
766
-                // Call recurson to print sub cats
767
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
766
+				// Call recurson to print sub cats
767
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
768 768
 
769
-            }
769
+			}
770 770
 
771
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
772
-                $out .= '</div>';
771
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
772
+				$out .= '</div>';
773 773
 
774
-            return $out;
775
-        }
776
-        return;
777
-    }
774
+			return $out;
775
+		}
776
+		return;
777
+	}
778 778
 }
779 779
 
780 780
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
781
-    /**
782
-     * Custom taxonomy walker function.
783
-     *
784
-     * @since 1.0.0
785
-     * @package GeoDirectory
786
-     * @global object $post WordPress Post object.
787
-     * @global object $gd_session GeoDirectory Session object.
788
-     * @param string $cat_taxonomy The taxonomy name.
789
-     * @param string $cat_limit Number of categories to display.
790
-     */
791
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
792
-    {
793
-        $post_category = '';
794
-        $post_category_str = '';
795
-        global $exclude_cats, $gd_session;
796
-
797
-        $cat_exclude = '';
798
-        if (is_array($exclude_cats) && !empty($exclude_cats))
799
-            $cat_exclude = serialize($exclude_cats);
800
-
801
-        if (isset($_REQUEST['backandedit'])) {
802
-            $post = (object)$gd_session->get('listing');
803
-
804
-            if (!is_array($post->post_category[$cat_taxonomy]))
805
-                $post_category = $post->post_category[$cat_taxonomy];
806
-
807
-            $post_categories = $post->post_category_str;
808
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
809
-                $post_category_str = $post_categories[$cat_taxonomy];
810
-
811
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
812
-            global $post;
813
-
814
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
815
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
816
-                $post_category = $post->{$cat_taxonomy};
817
-            }
781
+	/**
782
+	 * Custom taxonomy walker function.
783
+	 *
784
+	 * @since 1.0.0
785
+	 * @package GeoDirectory
786
+	 * @global object $post WordPress Post object.
787
+	 * @global object $gd_session GeoDirectory Session object.
788
+	 * @param string $cat_taxonomy The taxonomy name.
789
+	 * @param string $cat_limit Number of categories to display.
790
+	 */
791
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
792
+	{
793
+		$post_category = '';
794
+		$post_category_str = '';
795
+		global $exclude_cats, $gd_session;
796
+
797
+		$cat_exclude = '';
798
+		if (is_array($exclude_cats) && !empty($exclude_cats))
799
+			$cat_exclude = serialize($exclude_cats);
800
+
801
+		if (isset($_REQUEST['backandedit'])) {
802
+			$post = (object)$gd_session->get('listing');
803
+
804
+			if (!is_array($post->post_category[$cat_taxonomy]))
805
+				$post_category = $post->post_category[$cat_taxonomy];
806
+
807
+			$post_categories = $post->post_category_str;
808
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
809
+				$post_category_str = $post_categories[$cat_taxonomy];
810
+
811
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
812
+			global $post;
813
+
814
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
815
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
816
+				$post_category = $post->{$cat_taxonomy};
817
+			}
818 818
 
819
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
819
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
820 820
 
821
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
822
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
823
-                    if (is_numeric($cat_part)) {
824
-                        $cat_part_arr[] = $cat_part;
825
-                    }
826
-                }
827
-                if (is_array($cat_part_arr)) {
828
-                    $post_category = implode(',', $cat_part_arr);
829
-                }
830
-            }
821
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
822
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
823
+					if (is_numeric($cat_part)) {
824
+						$cat_part_arr[] = $cat_part;
825
+					}
826
+				}
827
+				if (is_array($cat_part_arr)) {
828
+					$post_category = implode(',', $cat_part_arr);
829
+				}
830
+			}
831 831
 
832
-            if (!empty($post_category)) {
833
-                $cat1 = array_filter(explode(',', $post_category));
834
-                $post_category = ',' . implode(',', $cat1) . ',';
832
+			if (!empty($post_category)) {
833
+				$cat1 = array_filter(explode(',', $post_category));
834
+				$post_category = ',' . implode(',', $cat1) . ',';
835 835
 
836
-            }
836
+			}
837 837
 
838
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
838
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
839 839
 
840
-                $post_category_upd = explode(',', $post_category);
841
-                $post_category_change = '';
842
-                foreach ($post_category_upd as $cat) {
840
+				$post_category_upd = explode(',', $post_category);
841
+				$post_category_change = '';
842
+				foreach ($post_category_upd as $cat) {
843 843
 
844
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
845
-                        $post_category_change .= ',' . $cat;
846
-                    }
847
-                }
848
-                $post_category = $post_category_change;
849
-            }
844
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
845
+						$post_category_change .= ',' . $cat;
846
+					}
847
+				}
848
+				$post_category = $post_category_change;
849
+			}
850 850
 
851 851
 
852
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
853
-                $post_category_str = $post_categories[$cat_taxonomy];
854
-            }
855
-        }
852
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
853
+				$post_category_str = $post_categories[$cat_taxonomy];
854
+			}
855
+		}
856 856
 
857
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
857
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
858 858
 
859
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
859
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
860 860
 
861
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
861
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
862 862
 
863 863
 
864
-        ?>
864
+		?>
865 865
         <div class="cat_sublist">
866 866
             <?php
867 867
 
868
-            $post_id = isset($post->ID) ? $post->ID : '';
868
+			$post_id = isset($post->ID) ? $post->ID : '';
869 869
 
870
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
870
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
871 871
 
872
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
873
-            }
874
-            ?>
872
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
873
+			}
874
+			?>
875 875
         </div>
876 876
         <script type="text/javascript">
877 877
 
@@ -994,22 +994,22 @@  discard block
 block discarded – undo
994 994
 
995 995
         </script>
996 996
         <?php
997
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
998
-            $post_cat_str = $post_categories[$cat_taxonomy];
999
-            $post_cat_array = explode("#", $post_cat_str);
1000
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1001
-                $style = "display:none;";
1002
-        }
1003
-        ?>
997
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
998
+			$post_cat_str = $post_categories[$cat_taxonomy];
999
+			$post_cat_array = explode("#", $post_cat_str);
1000
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1001
+				$style = "display:none;";
1002
+		}
1003
+		?>
1004 1004
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1005
-            echo $style;
1006
-        }?> ">
1005
+			echo $style;
1006
+		}?> ">
1007 1007
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1008
-            ?>
1008
+			?>
1009 1009
         </div>
1010 1010
     <?php
1011 1011
 
1012
-    }
1012
+	}
1013 1013
 }
1014 1014
 
1015 1015
 /**
@@ -1026,23 +1026,23 @@  discard block
 block discarded – undo
1026 1026
  */
1027 1027
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1028 1028
 {
1029
-    global $exclude_cats;
1029
+	global $exclude_cats;
1030 1030
 
1031
-    if ($exclude != '') {
1032
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1031
+	if ($exclude != '') {
1032
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1033 1033
 
1034
-        if(is_array( $exclude_cats)){
1035
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1036
-        }else{
1037
-            $exclude_cats = intval($exclude_cats);
1038
-        }
1034
+		if(is_array( $exclude_cats)){
1035
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1036
+		}else{
1037
+			$exclude_cats = intval($exclude_cats);
1038
+		}
1039 1039
 
1040
-    }
1040
+	}
1041 1041
 
1042
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1043
-        (!is_array($exclude_cats) || empty($exclude_cats))
1044
-    ) {
1045
-        ?>
1042
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1043
+		(!is_array($exclude_cats) || empty($exclude_cats))
1044
+	) {
1045
+		?>
1046 1046
 
1047 1047
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1048 1048
 
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
             <br/>
1073 1073
             <?php
1074
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1075
-            if (!empty($cat_terms)) { ?>
1074
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1075
+			if (!empty($cat_terms)) { ?>
1076 1076
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1077 1077
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1078 1078
             <?php } ?>
@@ -1094,53 +1094,53 @@  discard block
 block discarded – undo
1094 1094
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1095 1095
 {
1096 1096
 
1097
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1098
-        $post_cat_str = $post_categories[$request_taxonomy];
1099
-        $post_cat_array = explode("#", $post_cat_str);
1100
-        if (is_array($post_cat_array)) {
1101
-            $post_cat_array = array_unique( $post_cat_array );
1097
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1098
+		$post_cat_str = $post_categories[$request_taxonomy];
1099
+		$post_cat_array = explode("#", $post_cat_str);
1100
+		if (is_array($post_cat_array)) {
1101
+			$post_cat_array = array_unique( $post_cat_array );
1102 1102
 
1103 1103
 			foreach ($post_cat_array as $post_cat_html) {
1104 1104
 
1105
-                $post_cat_info = explode(":", $post_cat_html);
1106
-                $post_maincat_str = $post_cat_info[0];
1105
+				$post_cat_info = explode(":", $post_cat_html);
1106
+				$post_maincat_str = $post_cat_info[0];
1107 1107
 
1108
-                if (!empty($post_maincat_str)) {
1109
-                    $post_maincat_info = explode(",", $post_maincat_str);
1110
-                    $post_maincat_id = $post_maincat_info[0];
1111
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1112
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1113
-                }
1114
-                $post_sub_catid = '';
1115
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1116
-                    $post_sub_catid = (int)$post_cat_info[1];
1117
-                }
1108
+				if (!empty($post_maincat_str)) {
1109
+					$post_maincat_info = explode(",", $post_maincat_str);
1110
+					$post_maincat_id = $post_maincat_info[0];
1111
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1112
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1113
+				}
1114
+				$post_sub_catid = '';
1115
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1116
+					$post_sub_catid = (int)$post_cat_info[1];
1117
+				}
1118 1118
 
1119
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1119
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1120 1120
 
1121
-            }
1122
-        } else {
1121
+			}
1122
+		} else {
1123 1123
 
1124
-            $post_cat_info = explode(":", $post_cat_str);
1125
-            $post_maincat_str = $post_cat_info[0];
1124
+			$post_cat_info = explode(":", $post_cat_str);
1125
+			$post_maincat_str = $post_cat_info[0];
1126 1126
 
1127
-            $post_sub_catid = '';
1127
+			$post_sub_catid = '';
1128 1128
 
1129
-            if (!empty($post_maincat_str)) {
1130
-                $post_maincat_info = explode(",", $post_maincat_str);
1131
-                $post_maincat_id = $post_maincat_info[0];
1132
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1133
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1134
-            }
1129
+			if (!empty($post_maincat_str)) {
1130
+				$post_maincat_info = explode(",", $post_maincat_str);
1131
+				$post_maincat_id = $post_maincat_info[0];
1132
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1133
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1134
+			}
1135 1135
 
1136
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1137
-                $post_sub_catid = (int)$post_cat_info[1];
1138
-            }
1136
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1137
+				$post_sub_catid = (int)$post_cat_info[1];
1138
+			}
1139 1139
 
1140
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1140
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1141 1141
 
1142
-        }
1143
-    }
1142
+		}
1143
+	}
1144 1144
 }
1145 1145
 
1146 1146
 /**
@@ -1154,35 +1154,35 @@  discard block
 block discarded – undo
1154 1154
  */
1155 1155
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1156 1156
 {
1157
-    global $exclude_cats;
1157
+	global $exclude_cats;
1158 1158
 
1159
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1159
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1160 1160
 
1161
-    if (!empty($cat_terms)) {
1162
-        $onchange = '';
1163
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1161
+	if (!empty($cat_terms)) {
1162
+		$onchange = '';
1163
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1164 1164
 
1165
-        $option_selected = '';
1166
-        if (!$selected)
1167
-            $option_slected = ' selected="selected" ';
1165
+		$option_selected = '';
1166
+		if (!$selected)
1167
+			$option_slected = ' selected="selected" ';
1168 1168
 
1169
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1169
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1170 1170
 
1171
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1171
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1172 1172
 
1173
-        foreach ($cat_terms as $cat_term) {
1174
-            $option_selected = '';
1175
-            if ($selected == $cat_term->term_id)
1176
-                $option_selected = ' selected="selected" ';
1173
+		foreach ($cat_terms as $cat_term) {
1174
+			$option_selected = '';
1175
+			if ($selected == $cat_term->term_id)
1176
+				$option_selected = ' selected="selected" ';
1177 1177
 
1178
-            // Count child terms
1179
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1180
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1178
+			// Count child terms
1179
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1180
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1181 1181
 
1182
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1183
-        }
1184
-        echo '</select>';
1185
-    }
1182
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1183
+		}
1184
+		echo '</select>';
1185
+	}
1186 1186
 }
1187 1187
 
1188 1188
 /**
@@ -1198,28 +1198,28 @@  discard block
 block discarded – undo
1198 1198
  */
1199 1199
 function geodir_custom_update_messages($messages)
1200 1200
 {
1201
-    global $post, $post_ID;
1202
-
1203
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1204
-
1205
-    foreach ($post_types as $post_type => $post_object) {
1206
-
1207
-        $messages[$post_type] = array(
1208
-            0 => '', // Unused. Messages start at index 1.
1209
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1210
-            2 => __('Custom field updated.', 'geodirectory'),
1211
-            3 => __('Custom field deleted.', 'geodirectory'),
1212
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1213
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1214
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1215
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1216
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1217
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1218
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1219
-        );
1220
-    }
1221
-
1222
-    return $messages;
1201
+	global $post, $post_ID;
1202
+
1203
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1204
+
1205
+	foreach ($post_types as $post_type => $post_object) {
1206
+
1207
+		$messages[$post_type] = array(
1208
+			0 => '', // Unused. Messages start at index 1.
1209
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1210
+			2 => __('Custom field updated.', 'geodirectory'),
1211
+			3 => __('Custom field deleted.', 'geodirectory'),
1212
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1213
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1214
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1215
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1216
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1217
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1218
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1219
+		);
1220
+	}
1221
+
1222
+	return $messages;
1223 1223
 }
1224 1224
 
1225 1225
 
@@ -1234,183 +1234,183 @@  discard block
 block discarded – undo
1234 1234
 function geodir_register_defaults()
1235 1235
 {
1236 1236
 
1237
-    global $wpdb;
1238
-
1239
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1240
-
1241
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1242
-        $listing_slug = 'places';
1243
-
1244
-    /**
1245
-     * Taxonomies
1246
-     **/
1247
-    //if ( ! taxonomy_exists('gd_place_tags') )
1248
-    {
1249
-
1250
-        $gd_placetags = array();
1251
-        $gd_placetags['object_type'] = 'gd_place';
1252
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1253
-        $gd_placetags['args'] = array(
1254
-            'public' => true,
1255
-            'hierarchical' => false,
1256
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1257
-            'query_var' => true,
1258
-
1259
-            'labels' => array(
1260
-                'name' => __('Place Tags', 'geodirectory'),
1261
-                'singular_name' => __('Place Tag', 'geodirectory'),
1262
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1263
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1264
-                'all_items' => __('All Place Tags', 'geodirectory'),
1265
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1266
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1267
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1268
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1269
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1270
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1271
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1272
-            ),
1273
-        );
1274
-
1275
-
1276
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1277
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1278
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1279
-
1280
-
1281
-        // Update post types and delete tmp options
1282
-        flush_rewrite_rules();
1283
-
1284
-    }
1285
-
1286
-    //if ( ! taxonomy_exists('gd_placecategory') )
1287
-    {
1288
-
1289
-        $gd_placecategory = array();
1290
-        $gd_placecategory['object_type'] = 'gd_place';
1291
-        $gd_placecategory['listing_slug'] = $listing_slug;
1292
-        $gd_placecategory['args'] = array(
1293
-            'public' => true,
1294
-            'hierarchical' => true,
1295
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1296
-            'query_var' => true,
1297
-            'labels' => array(
1298
-                'name' => __('Place Categories', 'geodirectory'),
1299
-                'singular_name' => __('Place Category', 'geodirectory'),
1300
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1301
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1302
-                'all_items' => __('All Place Categories', 'geodirectory'),
1303
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1304
-                'update_item' => __('Update Place Category', 'geodirectory'),
1305
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1306
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1307
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1308
-            ),
1309
-        );
1310
-
1311
-
1312
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1313
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1314
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1315
-
1316
-
1317
-        flush_rewrite_rules();
1318
-    }
1319
-
1320
-    /**
1321
-     * Post Types
1322
-     **/
1323
-
1324
-    //if ( ! post_type_exists('gd_place') )
1325
-    {
1326
-
1327
-        $labels = array(
1328
-            'name' => __('Places', 'geodirectory'),
1329
-            'singular_name' => __('Place', 'geodirectory'),
1330
-            'add_new' => __('Add New', 'geodirectory'),
1331
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1332
-            'edit_item' => __('Edit Place', 'geodirectory'),
1333
-            'new_item' => __('New Place', 'geodirectory'),
1334
-            'view_item' => __('View Place', 'geodirectory'),
1335
-            'search_items' => __('Search Places', 'geodirectory'),
1336
-            'not_found' => __('No Place Found', 'geodirectory'),
1337
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1338
-
1339
-        $place_default = array(
1340
-            'labels' => $labels,
1341
-            'can_export' => true,
1342
-            'capability_type' => 'post',
1343
-            'description' => 'Place post type.',
1344
-            'has_archive' => $listing_slug,
1345
-            'hierarchical' => false,
1346
-            'map_meta_cap' => true,
1347
-            'menu_icon' => $menu_icon,
1348
-            'public' => true,
1349
-            'query_var' => true,
1350
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1351
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1352
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1353
-
1354
-        //Update custom post types
1355
-        $geodir_post_types = get_option('geodir_post_types');
1356
-        $geodir_post_types['gd_place'] = $place_default;
1357
-        update_option('geodir_post_types', $geodir_post_types);
1358
-
1359
-        // Update post types and delete tmp options
1360
-        flush_rewrite_rules();
1361
-    }
1362
-
1363
-
1364
-    geodir_register_taxonomies();
1365
-    geodir_register_post_types();
1366
-
1367
-    //die;
1237
+	global $wpdb;
1238
+
1239
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1240
+
1241
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1242
+		$listing_slug = 'places';
1243
+
1244
+	/**
1245
+	 * Taxonomies
1246
+	 **/
1247
+	//if ( ! taxonomy_exists('gd_place_tags') )
1248
+	{
1249
+
1250
+		$gd_placetags = array();
1251
+		$gd_placetags['object_type'] = 'gd_place';
1252
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1253
+		$gd_placetags['args'] = array(
1254
+			'public' => true,
1255
+			'hierarchical' => false,
1256
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1257
+			'query_var' => true,
1258
+
1259
+			'labels' => array(
1260
+				'name' => __('Place Tags', 'geodirectory'),
1261
+				'singular_name' => __('Place Tag', 'geodirectory'),
1262
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1263
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1264
+				'all_items' => __('All Place Tags', 'geodirectory'),
1265
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1266
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1267
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1268
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1269
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1270
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1271
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1272
+			),
1273
+		);
1274
+
1275
+
1276
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1277
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1278
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1279
+
1280
+
1281
+		// Update post types and delete tmp options
1282
+		flush_rewrite_rules();
1283
+
1284
+	}
1285
+
1286
+	//if ( ! taxonomy_exists('gd_placecategory') )
1287
+	{
1288
+
1289
+		$gd_placecategory = array();
1290
+		$gd_placecategory['object_type'] = 'gd_place';
1291
+		$gd_placecategory['listing_slug'] = $listing_slug;
1292
+		$gd_placecategory['args'] = array(
1293
+			'public' => true,
1294
+			'hierarchical' => true,
1295
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1296
+			'query_var' => true,
1297
+			'labels' => array(
1298
+				'name' => __('Place Categories', 'geodirectory'),
1299
+				'singular_name' => __('Place Category', 'geodirectory'),
1300
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1301
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1302
+				'all_items' => __('All Place Categories', 'geodirectory'),
1303
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1304
+				'update_item' => __('Update Place Category', 'geodirectory'),
1305
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1306
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1307
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1308
+			),
1309
+		);
1310
+
1311
+
1312
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1313
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1314
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1315
+
1316
+
1317
+		flush_rewrite_rules();
1318
+	}
1319
+
1320
+	/**
1321
+	 * Post Types
1322
+	 **/
1323
+
1324
+	//if ( ! post_type_exists('gd_place') )
1325
+	{
1326
+
1327
+		$labels = array(
1328
+			'name' => __('Places', 'geodirectory'),
1329
+			'singular_name' => __('Place', 'geodirectory'),
1330
+			'add_new' => __('Add New', 'geodirectory'),
1331
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1332
+			'edit_item' => __('Edit Place', 'geodirectory'),
1333
+			'new_item' => __('New Place', 'geodirectory'),
1334
+			'view_item' => __('View Place', 'geodirectory'),
1335
+			'search_items' => __('Search Places', 'geodirectory'),
1336
+			'not_found' => __('No Place Found', 'geodirectory'),
1337
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1338
+
1339
+		$place_default = array(
1340
+			'labels' => $labels,
1341
+			'can_export' => true,
1342
+			'capability_type' => 'post',
1343
+			'description' => 'Place post type.',
1344
+			'has_archive' => $listing_slug,
1345
+			'hierarchical' => false,
1346
+			'map_meta_cap' => true,
1347
+			'menu_icon' => $menu_icon,
1348
+			'public' => true,
1349
+			'query_var' => true,
1350
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1351
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1352
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1353
+
1354
+		//Update custom post types
1355
+		$geodir_post_types = get_option('geodir_post_types');
1356
+		$geodir_post_types['gd_place'] = $place_default;
1357
+		update_option('geodir_post_types', $geodir_post_types);
1358
+
1359
+		// Update post types and delete tmp options
1360
+		flush_rewrite_rules();
1361
+	}
1362
+
1363
+
1364
+	geodir_register_taxonomies();
1365
+	geodir_register_post_types();
1366
+
1367
+	//die;
1368 1368
 
1369 1369
 }
1370 1370
 
1371 1371
 $gd_wpml_get_languages = "";
1372 1372
 function gd_wpml_get_lang_from_url($url){
1373 1373
 
1374
-    global $gd_wpml_get_languages;
1375
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1374
+	global $gd_wpml_get_languages;
1375
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1376 1376
 
1377 1377
 
1378
-    //
1379
-    $url = str_replace(array("http://","https://"),"",$url);
1378
+	//
1379
+	$url = str_replace(array("http://","https://"),"",$url);
1380 1380
 
1381
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1382
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1381
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1382
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1383 1383
 
1384
-    $url = str_replace($site_url,"",$url);
1384
+	$url = str_replace($site_url,"",$url);
1385 1385
 
1386 1386
 
1387
-    $segments = explode('/', trim($url, '/'));
1387
+	$segments = explode('/', trim($url, '/'));
1388 1388
 
1389
-    //print_r( $segments);
1390
-    if($gd_wpml_get_languages){
1391
-        $langs = $gd_wpml_get_languages;
1392
-    }else{
1393
-        global $sitepress;
1394
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1395
-    }
1389
+	//print_r( $segments);
1390
+	if($gd_wpml_get_languages){
1391
+		$langs = $gd_wpml_get_languages;
1392
+	}else{
1393
+		global $sitepress;
1394
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1395
+	}
1396 1396
 
1397
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1398
-        return $segments[0];
1399
-    }
1397
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1398
+		return $segments[0];
1399
+	}
1400 1400
 
1401
-    return false;
1401
+	return false;
1402 1402
 
1403 1403
 
1404 1404
 }
1405 1405
 
1406 1406
 function gd_wpml_slug_translation_turned_on($post_type) {
1407 1407
 
1408
-    global $sitepress;
1409
-    $settings = $sitepress->get_settings();
1410
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1411
-    && $settings['posts_slug_translation']['types'][$post_type]
1412
-    && isset($settings['posts_slug_translation']['on'])
1413
-    && $settings['posts_slug_translation']['on'];
1408
+	global $sitepress;
1409
+	$settings = $sitepress->get_settings();
1410
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1411
+	&& $settings['posts_slug_translation']['types'][$post_type]
1412
+	&& isset($settings['posts_slug_translation']['on'])
1413
+	&& $settings['posts_slug_translation']['on'];
1414 1414
 }
1415 1415
 
1416 1416
 
@@ -1435,150 +1435,150 @@  discard block
 block discarded – undo
1435 1435
  */
1436 1436
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1437 1437
 {
1438
-    //echo $post_link."<br />".$sample ;
1438
+	//echo $post_link."<br />".$sample ;
1439 1439
 
1440 1440
 
1441
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1442
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1443
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1444
-        return $post_link;
1445
-    } else {
1446
-        $orig_post = $post;
1447
-        $post = $post_obj;
1448
-    }
1441
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1442
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1443
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1444
+		return $post_link;
1445
+	} else {
1446
+		$orig_post = $post;
1447
+		$post = $post_obj;
1448
+	}
1449 1449
 
1450
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1450
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1451 1451
 
1452 1452
 
1453
-        $post_types = get_option('geodir_post_types');
1454
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1453
+		$post_types = get_option('geodir_post_types');
1454
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1455 1455
 
1456
-        // Alter the CPT slug if WPML is set to do so
1457
-        if(function_exists('icl_object_id')){
1458
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1456
+		// Alter the CPT slug if WPML is set to do so
1457
+		if(function_exists('icl_object_id')){
1458
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1459 1459
 
1460
-                $org_slug = $slug;
1461
-                $slug = apply_filters( 'wpml_translate_single_string',
1462
-                    $slug,
1463
-                    'WordPress',
1464
-                    'URL slug: ' . $slug,
1465
-                    $language_code);
1460
+				$org_slug = $slug;
1461
+				$slug = apply_filters( 'wpml_translate_single_string',
1462
+					$slug,
1463
+					'WordPress',
1464
+					'URL slug: ' . $slug,
1465
+					$language_code);
1466 1466
 
1467
-                if(!$slug){$slug = $org_slug;}
1467
+				if(!$slug){$slug = $org_slug;}
1468 1468
 
1469
-            }
1470
-        }
1469
+			}
1470
+		}
1471 1471
 
1472
-        if (function_exists('geodir_location_geo_home_link')) {
1473
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1474
-        }
1472
+		if (function_exists('geodir_location_geo_home_link')) {
1473
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1474
+		}
1475 1475
         
1476
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1477
-        $site_url = trailingslashit(get_bloginfo('url'));
1476
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1477
+		$site_url = trailingslashit(get_bloginfo('url'));
1478 1478
         
1479
-        if (function_exists('geodir_location_geo_home_link')) {
1480
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1481
-        }
1482
-
1483
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1484
-        if ($fix_url) {
1485
-            $post_link = str_replace($site_url, '', $post_link);
1486
-        }
1487
-
1488
-        $post_link = trailingslashit(
1489
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1490
-        );
1491
-
1492
-        if ($fix_url) {
1493
-            $post_link = $site_url . $post_link;
1494
-        }
1495
-
1496
-        if (isset($comment_post_cache[$post->ID])) {
1497
-            $post = $comment_post_cache[$post->ID];
1498
-        }
1499
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1500
-            $post_id = $post->ID;
1501
-            if (isset($orig_post)) {
1502
-                $post = $orig_post;
1503
-            }
1504
-            return $gd_permalink_cache[$post_id];
1505
-        }
1479
+		if (function_exists('geodir_location_geo_home_link')) {
1480
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1481
+		}
1506 1482
 
1507
-        if (!isset($post->post_locations)) {
1508
-            $post_type = $post->post_type;
1509
-            $ID = $post->ID;
1510
-            $post2 = $wpdb->get_row(
1511
-                $wpdb->prepare(
1512
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1513
-                    array($post->ID)
1514
-                )
1515
-            );
1483
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1484
+		if ($fix_url) {
1485
+			$post_link = str_replace($site_url, '', $post_link);
1486
+		}
1487
+
1488
+		$post_link = trailingslashit(
1489
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1490
+		);
1491
+
1492
+		if ($fix_url) {
1493
+			$post_link = $site_url . $post_link;
1494
+		}
1516 1495
 
1517
-            $post = (object)array_merge((array)$post, (array)$post2);
1496
+		if (isset($comment_post_cache[$post->ID])) {
1497
+			$post = $comment_post_cache[$post->ID];
1498
+		}
1499
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1500
+			$post_id = $post->ID;
1501
+			if (isset($orig_post)) {
1502
+				$post = $orig_post;
1503
+			}
1504
+			return $gd_permalink_cache[$post_id];
1505
+		}
1518 1506
 
1519
-            $comment_post_cache[$post->ID] = $post;
1520
-        }
1507
+		if (!isset($post->post_locations)) {
1508
+			$post_type = $post->post_type;
1509
+			$ID = $post->ID;
1510
+			$post2 = $wpdb->get_row(
1511
+				$wpdb->prepare(
1512
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1513
+					array($post->ID)
1514
+				)
1515
+			);
1521 1516
 
1517
+			$post = (object)array_merge((array)$post, (array)$post2);
1522 1518
 
1519
+			$comment_post_cache[$post->ID] = $post;
1520
+		}
1523 1521
 
1524
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1525 1522
 
1526
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1527
-                $location_request = '';
1528 1523
 
1524
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1529 1525
 
1530
-                if (!empty($post->post_locations)) {
1531
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1532
-                    if (count($geodir_arr_locations) == 3) {
1533
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1534
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1535
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1536
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1537
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1538
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1526
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1527
+				$location_request = '';
1539 1528
 
1540
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1541
-                            'region_slug' => $post->region_slug,
1542
-                            'city_slug' => $post->city_slug
1543
-                        );
1544 1529
 
1545
-                    } else
1546
-                        $post_location = geodir_get_location();
1530
+				if (!empty($post->post_locations)) {
1531
+					$geodir_arr_locations = explode(',', $post->post_locations);
1532
+					if (count($geodir_arr_locations) == 3) {
1533
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1534
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1535
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1536
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1537
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1538
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1547 1539
 
1540
+						$post_location = (object)array('country_slug' => $post->country_slug,
1541
+							'region_slug' => $post->region_slug,
1542
+							'city_slug' => $post->city_slug
1543
+						);
1548 1544
 
1549
-                } else {
1545
+					} else
1546
+						$post_location = geodir_get_location();
1550 1547
 
1551
-                    $post_location_sql = $wpdb->get_results(
1552
-                        $wpdb->prepare(
1553
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1554
-                            array($post->ID)
1555
-                        )
1556
-                    );
1557
-
1558
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1559
-
1560
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1561
-                        if (count($geodir_arr_locations) == 3) {
1562
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1563
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1564
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1565
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1566
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1567
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1568
-
1569
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1570
-                                'region_slug' => $post->region_slug,
1571
-                                'city_slug' => $post->city_slug
1572
-                            );
1573 1548
 
1574
-                        }
1575
-                    } else
1576
-                        $post_location = geodir_get_location();
1577
-                }
1549
+				} else {
1550
+
1551
+					$post_location_sql = $wpdb->get_results(
1552
+						$wpdb->prepare(
1553
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1554
+							array($post->ID)
1555
+						)
1556
+					);
1557
+
1558
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1559
+
1560
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1561
+						if (count($geodir_arr_locations) == 3) {
1562
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1563
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1564
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1565
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1566
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1567
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1568
+
1569
+							$post_location = (object)array('country_slug' => $post->country_slug,
1570
+								'region_slug' => $post->region_slug,
1571
+								'city_slug' => $post->city_slug
1572
+							);
1573
+
1574
+						}
1575
+					} else
1576
+						$post_location = geodir_get_location();
1577
+				}
1578 1578
 
1579 1579
 
1580
-                if (!empty($post_location)) {
1581
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1580
+				if (!empty($post_location)) {
1581
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1582 1582
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1583 1583
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1584 1584
 					
@@ -1596,78 +1596,78 @@  discard block
 block discarded – undo
1596 1596
 					$location_slug[] = $city_slug;
1597 1597
 					
1598 1598
 					$location_request .= implode('/', $location_slug) . '/';
1599
-                }
1600
-            }
1599
+				}
1600
+			}
1601 1601
 
1602
-            if (get_option('geodir_add_categories_url')) {
1602
+			if (get_option('geodir_add_categories_url')) {
1603 1603
 
1604
-                $term_request = '';
1605
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1604
+				$term_request = '';
1605
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1606 1606
 
1607
-                $taxonomies = end($taxonomies);
1607
+				$taxonomies = end($taxonomies);
1608 1608
 
1609
-                if (!empty($post->default_category)) {
1610
-                    $post_terms = $post->default_category;
1611
-                } else {
1612
-                    $post_terms = '';
1609
+				if (!empty($post->default_category)) {
1610
+					$post_terms = $post->default_category;
1611
+				} else {
1612
+					$post_terms = '';
1613 1613
 
1614
-                    if (isset($post->{$taxonomies})) {
1615
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1616
-                        $post_terms = $post_terms[0];
1617
-                    }
1614
+					if (isset($post->{$taxonomies})) {
1615
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1616
+						$post_terms = $post_terms[0];
1617
+					}
1618 1618
 
1619
-                    if (!$post_terms)
1620
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1619
+					if (!$post_terms)
1620
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1621 1621
 
1622
-                    if (!$post_terms) {
1623
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1622
+					if (!$post_terms) {
1623
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1624 1624
 
1625
-                        if ($post_terms) {
1626
-                            $post_terms = explode(",", trim($post_terms, ","));
1627
-                            $post_terms = $post_terms[0];
1628
-                        }
1629
-                    }
1630
-                }
1625
+						if ($post_terms) {
1626
+							$post_terms = explode(",", trim($post_terms, ","));
1627
+							$post_terms = $post_terms[0];
1628
+						}
1629
+					}
1630
+				}
1631 1631
 
1632
-                $term = get_term_by('id', $post_terms, $taxonomies);
1632
+				$term = get_term_by('id', $post_terms, $taxonomies);
1633 1633
 
1634
-                if (!empty($term))
1635
-                    $term_request = $term->slug;
1636
-                //$term_request = $term->slug.'/';
1637
-            }
1634
+				if (!empty($term))
1635
+					$term_request = $term->slug;
1636
+				//$term_request = $term->slug.'/';
1637
+			}
1638 1638
 
1639
-            $request_term = '';
1640
-            $listingurl_separator = '';
1641
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1642
-            $detailurl_separator = '';
1643
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1644
-                $request_term = $location_request;
1645
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1646
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1647
-                $request_term .= $term_request;
1639
+			$request_term = '';
1640
+			$listingurl_separator = '';
1641
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1642
+			$detailurl_separator = '';
1643
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1644
+				$request_term = $location_request;
1645
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1646
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1647
+				$request_term .= $term_request;
1648 1648
 
1649
-            } else {
1650
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1649
+			} else {
1650
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1651 1651
 
1652
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1653
-            }
1654
-            $request_term = trim($request_term, '/');
1655
-            if (!empty($request_term))
1656
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1657
-            else
1658
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1659
-            //echo $post_link ;
1660
-        }
1661
-        // temp cache the permalink
1662
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1663
-            $gd_permalink_cache[$post->ID] = $post_link;
1664
-        }
1665
-    }
1666
-    if (isset($orig_post)) {
1667
-        $post = $orig_post;
1668
-    }
1669
-    //echo $post_link ;
1670
-    return $post_link;
1652
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1653
+			}
1654
+			$request_term = trim($request_term, '/');
1655
+			if (!empty($request_term))
1656
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1657
+			else
1658
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1659
+			//echo $post_link ;
1660
+		}
1661
+		// temp cache the permalink
1662
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1663
+			$gd_permalink_cache[$post->ID] = $post_link;
1664
+		}
1665
+	}
1666
+	if (isset($orig_post)) {
1667
+		$post = $orig_post;
1668
+	}
1669
+	//echo $post_link ;
1670
+	return $post_link;
1671 1671
 
1672 1672
 }
1673 1673
 
@@ -1684,103 +1684,103 @@  discard block
 block discarded – undo
1684 1684
  * @return string The term link.
1685 1685
  */
1686 1686
 function geodir_term_link($termlink, $term, $taxonomy) {
1687
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1687
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1688 1688
 
1689
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1690
-        global $geodir_add_location_url, $gd_session;
1691
-        $include_location = false;
1692
-        $request_term = array();
1689
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1690
+		global $geodir_add_location_url, $gd_session;
1691
+		$include_location = false;
1692
+		$request_term = array();
1693 1693
 
1694
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1694
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1695 1695
 
1696
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1697
-            if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1698
-                $include_location = true;
1699
-            }
1700
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1701
-            $include_location = true;
1696
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1697
+			if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1698
+				$include_location = true;
1699
+			}
1700
+		} elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1701
+			$include_location = true;
1702 1702
 
1703
-        if ($include_location) {
1704
-            global $post;
1703
+		if ($include_location) {
1704
+			global $post;
1705 1705
 			
1706 1706
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1707 1707
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1708 1708
             
1709 1709
 			if(geodir_is_page('detail') && isset($post->country_slug)){
1710
-                $location_terms = array(
1711
-                    'gd_country' => $post->country_slug,
1712
-                    'gd_region' => $post->region_slug,
1713
-                    'gd_city' => $post->city_slug
1714
-                );
1710
+				$location_terms = array(
1711
+					'gd_country' => $post->country_slug,
1712
+					'gd_region' => $post->region_slug,
1713
+					'gd_city' => $post->city_slug
1714
+				);
1715 1715
 				
1716 1716
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1717 1717
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1718 1718
 				}
1719
-            } else {
1720
-                $location_terms = geodir_get_current_location_terms('query_vars');
1721
-            }
1719
+			} else {
1720
+				$location_terms = geodir_get_current_location_terms('query_vars');
1721
+			}
1722 1722
 
1723
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1724
-            $location_terms = geodir_remove_location_terms($location_terms);
1723
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1724
+			$location_terms = geodir_remove_location_terms($location_terms);
1725 1725
 
1726
-            if (!empty($location_terms)) {
1726
+			if (!empty($location_terms)) {
1727 1727
 
1728
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1728
+				$url_separator = '';//get_option('geodir_listingurl_separator');
1729 1729
 
1730
-                if (get_option('permalink_structure') != '') {
1731
-                    $old_listing_slug = '/' . $listing_slug . '/';
1732
-                    $request_term = implode("/", $location_terms);
1733
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1730
+				if (get_option('permalink_structure') != '') {
1731
+					$old_listing_slug = '/' . $listing_slug . '/';
1732
+					$request_term = implode("/", $location_terms);
1733
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1734 1734
 
1735
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1736
-                } else {
1737
-                    $termlink = geodir_getlink($termlink, $request_term);
1738
-                }
1739
-            }
1740
-        }
1735
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1736
+				} else {
1737
+					$termlink = geodir_getlink($termlink, $request_term);
1738
+				}
1739
+			}
1740
+		}
1741 1741
 
1742
-        // Alter the CPT slug is WPML is set to do so
1743
-        /* we can replace this with the below function
1742
+		// Alter the CPT slug is WPML is set to do so
1743
+		/* we can replace this with the below function
1744 1744
         if(function_exists('icl_object_id')){
1745 1745
             global $sitepress;
1746 1746
             $post_type = str_replace("category","",$taxonomy);
1747 1747
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1748 1748
         }*/
1749 1749
 
1750
-        // Alter the CPT slug if WPML is set to do so
1751
-        if(function_exists('icl_object_id')){
1752
-            $post_types = get_option('geodir_post_types');
1753
-            $post_type = str_replace("category","",$taxonomy);
1750
+		// Alter the CPT slug if WPML is set to do so
1751
+		if(function_exists('icl_object_id')){
1752
+			$post_types = get_option('geodir_post_types');
1753
+			$post_type = str_replace("category","",$taxonomy);
1754 1754
 			$post_type = str_replace("_tags","",$post_type);
1755
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1756
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1755
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1756
+			if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1757 1757
 
1758
-                global $sitepress;
1759
-                $default_lang = $sitepress->get_default_language();
1760
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1761
-                if(!$language_code ){$language_code  = $default_lang;}
1758
+				global $sitepress;
1759
+				$default_lang = $sitepress->get_default_language();
1760
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1761
+				if(!$language_code ){$language_code  = $default_lang;}
1762 1762
 
1763
-                $org_slug = $slug;
1764
-                $slug = apply_filters( 'wpml_translate_single_string',
1765
-                    $slug,
1766
-                    'WordPress',
1767
-                    'URL slug: ' . $slug,
1768
-                    $language_code);
1763
+				$org_slug = $slug;
1764
+				$slug = apply_filters( 'wpml_translate_single_string',
1765
+					$slug,
1766
+					'WordPress',
1767
+					'URL slug: ' . $slug,
1768
+					$language_code);
1769 1769
 
1770 1770
 
1771
-                if(!$slug){$slug = $org_slug;}
1771
+				if(!$slug){$slug = $org_slug;}
1772 1772
 
1773
-                $termlink = trailingslashit(
1773
+				$termlink = trailingslashit(
1774 1774
 
1775
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1776
-                );
1775
+					preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1776
+				);
1777 1777
 
1778
-            }
1779
-        }
1778
+			}
1779
+		}
1780 1780
 
1781
-    }
1781
+	}
1782 1782
 	
1783
-    return $termlink;
1783
+	return $termlink;
1784 1784
 }
1785 1785
 
1786 1786
 /**
@@ -1806,14 +1806,14 @@  discard block
 block discarded – undo
1806 1806
 	if (in_array($post_type, geodir_get_posttypes())) {
1807 1807
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1808 1808
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1809
-                $location_terms = array(
1810
-                    'gd_country' => $post->country_slug,
1811
-                    'gd_region' => $post->region_slug,
1812
-                    'gd_city' => $post->city_slug
1813
-                );
1814
-            } else {
1815
-                $location_terms = geodir_get_current_location_terms('query_vars');
1816
-            }
1809
+				$location_terms = array(
1810
+					'gd_country' => $post->country_slug,
1811
+					'gd_region' => $post->region_slug,
1812
+					'gd_city' => $post->city_slug
1813
+				);
1814
+			} else {
1815
+				$location_terms = geodir_get_current_location_terms('query_vars');
1816
+			}
1817 1817
 			
1818 1818
 			$location_terms = geodir_remove_location_terms($location_terms);
1819 1819
 			
@@ -1844,14 +1844,14 @@  discard block
 block discarded – undo
1844 1844
  */
1845 1845
 function get_post_type_singular_label($post_type, $echo = false)
1846 1846
 {
1847
-    $obj_post_type = get_post_type_object($post_type);
1848
-    if (!is_object($obj_post_type)) {
1849
-        return;
1850
-    }
1851
-    if ($echo)
1852
-        echo $obj_post_type->labels->singular_name;
1853
-    else
1854
-        return $obj_post_type->labels->singular_name;
1847
+	$obj_post_type = get_post_type_object($post_type);
1848
+	if (!is_object($obj_post_type)) {
1849
+		return;
1850
+	}
1851
+	if ($echo)
1852
+		echo $obj_post_type->labels->singular_name;
1853
+	else
1854
+		return $obj_post_type->labels->singular_name;
1855 1855
 
1856 1856
 }
1857 1857
 
@@ -1866,16 +1866,16 @@  discard block
 block discarded – undo
1866 1866
  */
1867 1867
 function get_post_type_plural_label($post_type, $echo = false)
1868 1868
 {
1869
-    $all_postypes = geodir_get_posttypes();
1869
+	$all_postypes = geodir_get_posttypes();
1870 1870
 
1871
-    if (!in_array($post_type, $all_postypes))
1872
-        return false;
1871
+	if (!in_array($post_type, $all_postypes))
1872
+		return false;
1873 1873
 
1874
-    $obj_post_type = get_post_type_object($post_type);
1875
-    if ($echo)
1876
-        echo $obj_post_type->labels->name;
1877
-    else
1878
-        return $obj_post_type->labels->name;
1874
+	$obj_post_type = get_post_type_object($post_type);
1875
+	if ($echo)
1876
+		echo $obj_post_type->labels->name;
1877
+	else
1878
+		return $obj_post_type->labels->name;
1879 1879
 
1880 1880
 }
1881 1881
 
@@ -1894,51 +1894,51 @@  discard block
 block discarded – undo
1894 1894
  */
1895 1895
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1896 1896
 {
1897
-    global $wpdb;
1898
-
1899
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1900
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1901
-
1902
-    if (is_int($term)) {
1903
-        if (0 == $term)
1904
-            return 0;
1905
-        $where = 't.term_id = %d';
1906
-        if (!empty($taxonomy))
1907
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1908
-        else
1909
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1910
-    }
1897
+	global $wpdb;
1898
+
1899
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1900
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1901
+
1902
+	if (is_int($term)) {
1903
+		if (0 == $term)
1904
+			return 0;
1905
+		$where = 't.term_id = %d';
1906
+		if (!empty($taxonomy))
1907
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1908
+		else
1909
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1910
+	}
1911 1911
 
1912
-    $term = trim(wp_unslash($term));
1912
+	$term = trim(wp_unslash($term));
1913 1913
 
1914
-    if ('' === $slug = sanitize_title($term))
1915
-        return 0;
1914
+	if ('' === $slug = sanitize_title($term))
1915
+		return 0;
1916 1916
 
1917
-    $where = 't.slug = %s';
1917
+	$where = 't.slug = %s';
1918 1918
 
1919
-    $where_fields = array($slug);
1920
-    if (!empty($taxonomy)) {
1921
-        $parent = (int)$parent;
1922
-        if ($parent > 0) {
1923
-            $where_fields[] = $parent;
1924
-            $else_where_fields[] = $parent;
1925
-            $where .= ' AND tt.parent = %d';
1919
+	$where_fields = array($slug);
1920
+	if (!empty($taxonomy)) {
1921
+		$parent = (int)$parent;
1922
+		if ($parent > 0) {
1923
+			$where_fields[] = $parent;
1924
+			$else_where_fields[] = $parent;
1925
+			$where .= ' AND tt.parent = %d';
1926 1926
 
1927
-        }
1927
+		}
1928 1928
 
1929
-        $where_fields[] = $taxonomy;
1929
+		$where_fields[] = $taxonomy;
1930 1930
 
1931 1931
 
1932
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1933
-            return $result;
1932
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1933
+			return $result;
1934 1934
 
1935
-        return false;
1936
-    }
1935
+		return false;
1936
+	}
1937 1937
 
1938
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1939
-        return $result;
1938
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1939
+		return $result;
1940 1940
 
1941
-    return false;
1941
+	return false;
1942 1942
 }
1943 1943
 
1944 1944
 /**
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
 function geodir_get_term_icon_rebuild()
1951 1951
 {
1952 1952
 
1953
-    update_option('gd_term_icons', '');
1953
+	update_option('gd_term_icons', '');
1954 1954
 
1955 1955
 }
1956 1956
 
@@ -1968,60 +1968,60 @@  discard block
 block discarded – undo
1968 1968
  */
1969 1969
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1970 1970
 {
1971
-    global $wpdb;
1972
-    if (!$rebuild) {
1973
-        $terms_icons = get_option('gd_term_icons');
1974
-    } else {
1975
-        $terms_icons = '';
1976
-    }
1977
-
1978
-    if (empty($terms_icons)) {
1979
-        $default_icon_url = get_option('geodir_default_marker_icon');
1980
-        $taxonomy = geodir_get_taxonomies();
1981
-        $post_types = geodir_get_posttypes();
1982
-        $tax_arr = array();
1983
-        foreach ($post_types as $post_type) {
1984
-            $tax_arr[] = "'" . $post_type . "category'";
1985
-        }
1986
-        $tax_c = implode(',', $tax_arr);
1987
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1988
-        //$terms = get_terms( $taxonomy );
1989
-
1990
-        if($terms) {
1991
-            foreach ($terms as $term) {
1992
-                $post_type = str_replace("category", "", $term->taxonomy);
1993
-                $a_terms[$post_type][] = $term;
1971
+	global $wpdb;
1972
+	if (!$rebuild) {
1973
+		$terms_icons = get_option('gd_term_icons');
1974
+	} else {
1975
+		$terms_icons = '';
1976
+	}
1994 1977
 
1995
-            }
1996
-        }
1978
+	if (empty($terms_icons)) {
1979
+		$default_icon_url = get_option('geodir_default_marker_icon');
1980
+		$taxonomy = geodir_get_taxonomies();
1981
+		$post_types = geodir_get_posttypes();
1982
+		$tax_arr = array();
1983
+		foreach ($post_types as $post_type) {
1984
+			$tax_arr[] = "'" . $post_type . "category'";
1985
+		}
1986
+		$tax_c = implode(',', $tax_arr);
1987
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1988
+		//$terms = get_terms( $taxonomy );
1997 1989
 
1998
-        if($a_terms) {
1999
-            foreach ($a_terms as $pt => $t2) {
1990
+		if($terms) {
1991
+			foreach ($terms as $term) {
1992
+				$post_type = str_replace("category", "", $term->taxonomy);
1993
+				$a_terms[$post_type][] = $term;
2000 1994
 
2001
-                foreach ($t2 as $term) {
2002
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2003
-                    if ($term_icon) {
2004
-                        $term_icon_url = $term_icon["src"];
2005
-                    } else {
2006
-                        $term_icon_url = $default_icon_url;
2007
-                    }
2008
-                    $terms_icons[$term->term_id] = $term_icon_url;
2009
-                }
2010
-            }
2011
-        }
1995
+			}
1996
+		}
1997
+
1998
+		if($a_terms) {
1999
+			foreach ($a_terms as $pt => $t2) {
2000
+
2001
+				foreach ($t2 as $term) {
2002
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2003
+					if ($term_icon) {
2004
+						$term_icon_url = $term_icon["src"];
2005
+					} else {
2006
+						$term_icon_url = $default_icon_url;
2007
+					}
2008
+					$terms_icons[$term->term_id] = $term_icon_url;
2009
+				}
2010
+			}
2011
+		}
2012 2012
 
2013
-        update_option('gd_term_icons', $terms_icons);
2014
-    }
2013
+		update_option('gd_term_icons', $terms_icons);
2014
+	}
2015 2015
 
2016
-    if ($term_id && isset($terms_icons[$term_id])) {
2017
-        return $terms_icons[$term_id];
2018
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2019
-        return get_option('geodir_default_marker_icon');
2020
-    }
2016
+	if ($term_id && isset($terms_icons[$term_id])) {
2017
+		return $terms_icons[$term_id];
2018
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2019
+		return get_option('geodir_default_marker_icon');
2020
+	}
2021 2021
 
2022
-    if (is_ssl()) {
2023
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2024
-    }
2022
+	if (is_ssl()) {
2023
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2024
+	}
2025 2025
 
2026
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2026
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2027 2027
 }
2028 2028
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
                              * @since 1.0.0
61 61
                              * @param string $menu_class The menu HTML class.
62 62
                              */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
63
+                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
64 64
                             /**
65 65
                              * Filter the menu a class.
66 66
                              *
67 67
                              * @since 1.0.0
68 68
                              */
69 69
                             $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
71
-									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72
-										' . __(ucfirst($args->labels->name)) . '
70
+                            $items .= '<li class="'.$li_class.'">
71
+									<a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'">
72
+										' . __(ucfirst($args->labels->name)).'
73 73
 									</a>
74 74
 								</li>';
75 75
                         }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
              * @since 1.0.0
89 89
              * @param string $menu_class The menu HTML class.
90 90
              */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
91
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
92 92
             /**
93 93
              * Filter the sub menu li class.
94 94
              *
95 95
              * @since 1.0.0
96 96
              * @param string $menu_class The menu HTML class.
97 97
              */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
98
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
99 99
             /**
100 100
              * Filter the sub menu ul class.
101 101
              *
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
              * @since 1.0.0
115 115
              */
116 116
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
118
-					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119
-					<ul class="' . $sub_ul_class . '">';
117
+            $items .= '<li class="'.$li_class.'">
118
+					<a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
119
+					<ul class="' . $sub_ul_class.'">';
120 120
             $post_types = geodir_get_posttypes('object');
121 121
 
122 122
             $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                                 if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134 134
                                     $menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
137
-														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(ucfirst($args->labels->name),'geodirectory') . '
136
+                                $items .= '<li class="'.$sub_li_class.'">
137
+														<a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'">
138
+															' . __(ucfirst($args->labels->name), 'geodirectory').'
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
              *
152 152
              * @since 1.5.9
153 153
              */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
154
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
155 155
             $items .= '</li>';
156 156
         }
157 157
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                      * @since 1.0.0
185 185
                                      * @param string $menu_class The menu HTML class.
186 186
                                      */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
187
+                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
188 188
                                     /**
189 189
                                      * Filter the menu a class.
190 190
                                      *
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
                                      */
193 193
                                     $a_class = apply_filters('geodir_menu_a_class', '');
194 194
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
196
-											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
195
+                                    $items .= '<li class="'.$li_class.'">
196
+											<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'">
197
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
198 198
 											</a>
199 199
 										</li>';
200 200
                                 }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
              * @since 1.0.0
219 219
              * @param string $menu_class The menu HTML class.
220 220
              */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
221
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
222 222
             /**
223 223
              * Filter the sub menu li class.
224 224
              *
225 225
              * @since 1.0.0
226 226
              * @param string $menu_class The menu HTML class.
227 227
              */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
228
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
229 229
             /**
230 230
              * Filter the sub menu ul class.
231 231
              *
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
              * @since 1.0.0
245 245
              */
246 246
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
248
-					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249
-					<ul class="' . $sub_ul_class . '">';
247
+            $items .= '<li  class="'.$li_class.'">
248
+					<a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
249
+					<ul class="' . $sub_ul_class.'">';
250 250
 
251 251
             $post_types = geodir_get_posttypes('object');
252 252
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
                                          * @since 1.0.0
270 270
                                          * @param string $menu_class The menu HTML class.
271 271
                                          */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
272
+                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
273 273
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
275
-														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
274
+                                        $items .= '<li class="'.$li_class.'">
275
+														<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'">
276
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
277 277
 														</a>
278 278
 													</li>';
279 279
                                     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
 
287 287
             $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
288
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
289 289
             $items .= '</li>';
290 290
 
291 291
         }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
     $geodir_theme_location = get_option('geodir_theme_location_nav');
314 314
     $geodir_theme_location_nav = array();
315 315
     if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
317 317
         $geodir_theme_location_nav[] = $args['theme_location'];
318 318
         update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319 319
     }
320 320
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322 322
     else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
323
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
324 324
 
325 325
     return $menu;
326 326
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
351
+        $items = $items.geodir_add_nav_menu_items();
352 352
         return $items;
353 353
 
354 354
     } else {
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 
374 374
     $taxonomies = geodir_get_taxonomies();
375 375
     $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
376
+    $taxonomies = "'".$taxonomies."'";
377 377
 
378 378
     $pn_categories = $wpdb->get_results(
379 379
         $wpdb->prepare(
380 380
             "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
381
+            array($wpdb->terms.term_id)
382 382
         )
383 383
     );
384 384
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409 409
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
411 411
         elseif (isset($_REQUEST['listing_type']))
412 412
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413 413
     }
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function geodir_get_default_posttype()
442 442
 {
443
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
443
+    $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
444 444
 
445
-    foreach ( $post_types as $post_type => $info ) {
445
+    foreach ($post_types as $post_type => $info) {
446 446
         global $wpdb;
447
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
448
-        if ( $has_posts ) {
447
+        $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
448
+        if ($has_posts) {
449 449
             $stype = $post_type; break;
450 450
         }
451 451
     }
452 452
 
453
-    if(!$stype){
453
+    if (!$stype) {
454 454
         $stype = 'gd_place';
455 455
     }
456 456
 
@@ -475,14 +475,14 @@  discard block
 block discarded – undo
475 475
         switch ($output):
476 476
             case 'object':
477 477
             case 'Object':
478
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
478
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
479 479
                 break;
480 480
             case 'array':
481 481
             case 'Array':
482
-                $post_types = (array)$post_types;
482
+                $post_types = (array) $post_types;
483 483
                 break;
484 484
 			case 'options':
485
-                $post_types = (array)$post_types;
485
+                $post_types = (array) $post_types;
486 486
 				
487 487
 				$options = array();
488 488
 				if (!empty($post_types)) {
@@ -600,15 +600,15 @@  discard block
 block discarded – undo
600 600
 
601 601
         $categories = get_terms($taxonomies);
602 602
 
603
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
603
+        $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
604 604
 
605 605
         foreach ($categories as $category_obj) {
606 606
             $select_opt = '';
607 607
             if ($selected == $category_obj->term_id) {
608 608
                 $select_opt = 'selected="selected"';
609 609
             }
610
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
611
-                . ucfirst($category_obj->name) . '</option>';
610
+            $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">'
611
+                . ucfirst($category_obj->name).'</option>';
612 612
         }
613 613
 
614 614
         if ($echo)
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
     } elseif (isset($wp_query->tax_query->queries)) {
677 677
         $tax_arr = $wp_query->tax_query->queries;
678 678
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
679
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
679
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
680 680
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
681 681
     }
682 682
 
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
             if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
732 732
                 if ($cat_parent == 0) {
733
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
733
+                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display;
734 734
                     $main_list_class = 'class="main_list_selecter"';
735 735
                 } else {
736 736
                     //$display = 'display:none';
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
             if ($cat_display == 'checkbox' || $cat_display == 'radio') {
742 742
                 $p = 0;
743
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
743
+                $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">';
744 744
             }
745 745
 
746 746
             foreach ($cat_terms as $cat_term) {
@@ -755,12 +755,12 @@  discard block
 block discarded – undo
755 755
                 }
756 756
 
757 757
                 if ($cat_display == 'radio')
758
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
758
+                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
759 759
                 elseif ($cat_display == 'select' || $cat_display == 'multiselect')
760
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
760
+                    $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>';
761 761
 
762 762
                 else {
763
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
763
+                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
764 764
                 }
765 765
 
766 766
                 // Call recurson to print sub cats
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
             $cat_exclude = serialize($exclude_cats);
800 800
 
801 801
         if (isset($_REQUEST['backandedit'])) {
802
-            $post = (object)$gd_session->get('listing');
802
+            $post = (object) $gd_session->get('listing');
803 803
 
804 804
             if (!is_array($post->post_category[$cat_taxonomy]))
805 805
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 
832 832
             if (!empty($post_category)) {
833 833
                 $cat1 = array_filter(explode(',', $post_category));
834
-                $post_category = ',' . implode(',', $cat1) . ',';
834
+                $post_category = ','.implode(',', $cat1).',';
835 835
 
836 836
             }
837 837
 
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                 foreach ($post_category_upd as $cat) {
843 843
 
844 844
                     if (!in_array($cat, $exclude_cats) && $cat != '') {
845
-                        $post_category_change .= ',' . $cat;
845
+                        $post_category_change .= ','.$cat;
846 846
                     }
847 847
                 }
848 848
                 $post_category = $post_category_change;
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
             }
855 855
         }
856 856
 
857
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
857
+        echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']"  />';
858 858
 
859
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
859
+        echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']"  />';
860 860
 
861
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
861
+        echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']"  />';
862 862
 
863 863
 
864 864
         ?>
@@ -877,14 +877,14 @@  discard block
 block discarded – undo
877 877
 
878 878
             function show_subcatlist(main_cat, catObj) {
879 879
                 if (main_cat != '') {
880
-					var url = '<?php echo geodir_get_ajax_url();?>';
881
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
882
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
880
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
881
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
882
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
883 883
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
884
-					<?php if ((int)$cat_limit > 0) { ?>
884
+					<?php if ((int) $cat_limit > 0) { ?>
885 885
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
886 886
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
887
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
887
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
888 888
 						return false;
889 889
 					}
890 890
 					<?php } ?>
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
             }
924 924
 
925 925
             function update_listing_cat(el) {
926
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
926
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
927 927
                 var cat_ids = '';
928 928
                 var main_cat = '';
929 929
                 var sub_cat = '';
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1005 1005
             echo $style;
1006 1006
         }?> ">
1007
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1007
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
1008 1008
             ?>
1009 1009
         </div>
1010 1010
     <?php
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
     if ($exclude != '') {
1032 1032
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
1033 1033
 
1034
-        if(is_array( $exclude_cats)){
1035
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1036
-        }else{
1034
+        if (is_array($exclude_cats)) {
1035
+            $exclude_cats = array_map('intval', $exclude_cats);
1036
+        } else {
1037 1037
             $exclude_cats = intval($exclude_cats);
1038 1038
         }
1039 1039
 
@@ -1047,25 +1047,25 @@  discard block
 block discarded – undo
1047 1047
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1048 1048
 
1049 1049
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1050
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1050
+            <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>"
1051 1051
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1052 1052
             <?php /* ?>
1053 1053
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1054 1054
 		<?php */ ?>
1055 1055
 
1056
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1056
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1057 1057
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1058 1058
                    checked="checked" disabled="disabled"/>
1059 1059
        <span> 
1060
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1060
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1061 1061
         </span>
1062 1062
             <br/>
1063 1063
 
1064 1064
             <div class="post_default_category">
1065
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1066
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1065
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1066
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1067 1067
         <span> 
1068
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1068
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1069 1069
         </span>
1070 1070
             </div>
1071 1071
 
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
         $post_cat_str = $post_categories[$request_taxonomy];
1099 1099
         $post_cat_array = explode("#", $post_cat_str);
1100 1100
         if (is_array($post_cat_array)) {
1101
-            $post_cat_array = array_unique( $post_cat_array );
1101
+            $post_cat_array = array_unique($post_cat_array);
1102 1102
 
1103 1103
 			foreach ($post_cat_array as $post_cat_html) {
1104 1104
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
                 }
1114 1114
                 $post_sub_catid = '';
1115 1115
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1116
-                    $post_sub_catid = (int)$post_cat_info[1];
1116
+                    $post_sub_catid = (int) $post_cat_info[1];
1117 1117
                 }
1118 1118
 
1119 1119
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
             }
1135 1135
 
1136 1136
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1137
-                $post_sub_catid = (int)$post_cat_info[1];
1137
+                $post_sub_catid = (int) $post_cat_info[1];
1138 1138
             }
1139 1139
 
1140 1140
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
         if (!$selected)
1167 1167
             $option_slected = ' selected="selected" ';
1168 1168
 
1169
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1169
+        echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >';
1170 1170
 
1171
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1171
+        echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
1172 1172
 
1173 1173
         foreach ($cat_terms as $cat_term) {
1174 1174
             $option_selected = '';
@@ -1176,10 +1176,10 @@  discard block
 block discarded – undo
1176 1176
                 $option_selected = ' selected="selected" ';
1177 1177
 
1178 1178
             // Count child terms
1179
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1180
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1179
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1180
+            $has_child = !empty($child_terms) ? 't' : 'f';
1181 1181
 
1182
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1182
+            echo '<option  '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>';
1183 1183
         }
1184 1184
         echo '</select>';
1185 1185
     }
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
             2 => __('Custom field updated.', 'geodirectory'),
1211 1211
             3 => __('Custom field deleted.', 'geodirectory'),
1212 1212
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1213
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1213
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1214 1214
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1215 1215
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1216 1216
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
     global $wpdb;
1238 1238
 
1239
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1239
+    $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico';
1240 1240
 
1241 1241
     if (!$listing_slug = get_option('geodir_listing_prefix'))
1242 1242
         $listing_slug = 'places';
@@ -1249,11 +1249,11 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
         $gd_placetags = array();
1251 1251
         $gd_placetags['object_type'] = 'gd_place';
1252
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1252
+        $gd_placetags['listing_slug'] = $listing_slug.'/tags';
1253 1253
         $gd_placetags['args'] = array(
1254 1254
             'public' => true,
1255 1255
             'hierarchical' => false,
1256
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1256
+            'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
1257 1257
             'query_var' => true,
1258 1258
 
1259 1259
             'labels' => array(
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
             'menu_icon' => $menu_icon,
1348 1348
             'public' => true,
1349 1349
             'query_var' => true,
1350
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1350
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1351 1351
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1352 1352
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1353 1353
 
@@ -1369,27 +1369,27 @@  discard block
 block discarded – undo
1369 1369
 }
1370 1370
 
1371 1371
 $gd_wpml_get_languages = "";
1372
-function gd_wpml_get_lang_from_url($url){
1372
+function gd_wpml_get_lang_from_url($url) {
1373 1373
 
1374 1374
     global $gd_wpml_get_languages;
1375
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1375
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1376 1376
 
1377 1377
 
1378 1378
     //
1379
-    $url = str_replace(array("http://","https://"),"",$url);
1379
+    $url = str_replace(array("http://", "https://"), "", $url);
1380 1380
 
1381 1381
     // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1382
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1382
+    $site_url = str_replace(array("http://", "https://"), "", site_url());
1383 1383
 
1384
-    $url = str_replace($site_url,"",$url);
1384
+    $url = str_replace($site_url, "", $url);
1385 1385
 
1386 1386
 
1387 1387
     $segments = explode('/', trim($url, '/'));
1388 1388
 
1389 1389
     //print_r( $segments);
1390
-    if($gd_wpml_get_languages){
1390
+    if ($gd_wpml_get_languages) {
1391 1391
         $langs = $gd_wpml_get_languages;
1392
-    }else{
1392
+    } else {
1393 1393
         global $sitepress;
1394 1394
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1395 1395
     }
@@ -1454,17 +1454,17 @@  discard block
 block discarded – undo
1454 1454
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1455 1455
 
1456 1456
         // Alter the CPT slug if WPML is set to do so
1457
-        if(function_exists('icl_object_id')){
1458
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1457
+        if (function_exists('icl_object_id')) {
1458
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1459 1459
 
1460 1460
                 $org_slug = $slug;
1461
-                $slug = apply_filters( 'wpml_translate_single_string',
1461
+                $slug = apply_filters('wpml_translate_single_string',
1462 1462
                     $slug,
1463 1463
                     'WordPress',
1464
-                    'URL slug: ' . $slug,
1464
+                    'URL slug: '.$slug,
1465 1465
                     $language_code);
1466 1466
 
1467
-                if(!$slug){$slug = $org_slug;}
1467
+                if (!$slug) {$slug = $org_slug; }
1468 1468
 
1469 1469
             }
1470 1470
         }
@@ -1486,11 +1486,11 @@  discard block
 block discarded – undo
1486 1486
         }
1487 1487
 
1488 1488
         $post_link = trailingslashit(
1489
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1489
+            preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
1490 1490
         );
1491 1491
 
1492 1492
         if ($fix_url) {
1493
-            $post_link = $site_url . $post_link;
1493
+            $post_link = $site_url.$post_link;
1494 1494
         }
1495 1495
 
1496 1496
         if (isset($comment_post_cache[$post->ID])) {
@@ -1509,12 +1509,12 @@  discard block
 block discarded – undo
1509 1509
             $ID = $post->ID;
1510 1510
             $post2 = $wpdb->get_row(
1511 1511
                 $wpdb->prepare(
1512
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1512
+                    "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1513 1513
                     array($post->ID)
1514 1514
                 )
1515 1515
             );
1516 1516
 
1517
-            $post = (object)array_merge((array)$post, (array)$post2);
1517
+            $post = (object) array_merge((array) $post, (array) $post2);
1518 1518
 
1519 1519
             $comment_post_cache[$post->ID] = $post;
1520 1520
         }
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
 
1524 1524
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1525 1525
 
1526
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1526
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1527 1527
                 $location_request = '';
1528 1528
 
1529 1529
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1538 1538
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1539 1539
 
1540
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1540
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1541 1541
                             'region_slug' => $post->region_slug,
1542 1542
                             'city_slug' => $post->city_slug
1543 1543
                         );
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
                     $post_location_sql = $wpdb->get_results(
1552 1552
                         $wpdb->prepare(
1553
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1553
+                            "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1554 1554
                             array($post->ID)
1555 1555
                         )
1556 1556
                     );
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1567 1567
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1568 1568
 
1569
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1569
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1570 1570
                                 'region_slug' => $post->region_slug,
1571 1571
                                 'city_slug' => $post->city_slug
1572 1572
                             );
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 					}
1596 1596
 					$location_slug[] = $city_slug;
1597 1597
 					
1598
-					$location_request .= implode('/', $location_slug) . '/';
1598
+					$location_request .= implode('/', $location_slug).'/';
1599 1599
                 }
1600 1600
             }
1601 1601
 
@@ -1653,9 +1653,9 @@  discard block
 block discarded – undo
1653 1653
             }
1654 1654
             $request_term = trim($request_term, '/');
1655 1655
             if (!empty($request_term))
1656
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1656
+                $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1657 1657
             else
1658
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1658
+                $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1659 1659
             //echo $post_link ;
1660 1660
         }
1661 1661
         // temp cache the permalink
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1707 1707
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1708 1708
             
1709
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1709
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1710 1710
                 $location_terms = array(
1711 1711
                     'gd_country' => $post->country_slug,
1712 1712
                     'gd_region' => $post->region_slug,
@@ -1725,12 +1725,12 @@  discard block
 block discarded – undo
1725 1725
 
1726 1726
             if (!empty($location_terms)) {
1727 1727
 
1728
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1728
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1729 1729
 
1730 1730
                 if (get_option('permalink_structure') != '') {
1731
-                    $old_listing_slug = '/' . $listing_slug . '/';
1731
+                    $old_listing_slug = '/'.$listing_slug.'/';
1732 1732
                     $request_term = implode("/", $location_terms);
1733
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1733
+                    $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/';
1734 1734
 
1735 1735
                     $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1736 1736
                 } else {
@@ -1748,31 +1748,31 @@  discard block
 block discarded – undo
1748 1748
         }*/
1749 1749
 
1750 1750
         // Alter the CPT slug if WPML is set to do so
1751
-        if(function_exists('icl_object_id')){
1751
+        if (function_exists('icl_object_id')) {
1752 1752
             $post_types = get_option('geodir_post_types');
1753
-            $post_type = str_replace("category","",$taxonomy);
1754
-			$post_type = str_replace("_tags","",$post_type);
1753
+            $post_type = str_replace("category", "", $taxonomy);
1754
+			$post_type = str_replace("_tags", "", $post_type);
1755 1755
             $slug = $post_types[$post_type]['rewrite']['slug'];
1756
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1756
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1757 1757
 
1758 1758
                 global $sitepress;
1759 1759
                 $default_lang = $sitepress->get_default_language();
1760 1760
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1761
-                if(!$language_code ){$language_code  = $default_lang;}
1761
+                if (!$language_code) {$language_code = $default_lang; }
1762 1762
 
1763 1763
                 $org_slug = $slug;
1764
-                $slug = apply_filters( 'wpml_translate_single_string',
1764
+                $slug = apply_filters('wpml_translate_single_string',
1765 1765
                     $slug,
1766 1766
                     'WordPress',
1767
-                    'URL slug: ' . $slug,
1767
+                    'URL slug: '.$slug,
1768 1768
                     $language_code);
1769 1769
 
1770 1770
 
1771
-                if(!$slug){$slug = $org_slug;}
1771
+                if (!$slug) {$slug = $org_slug; }
1772 1772
 
1773 1773
                 $termlink = trailingslashit(
1774 1774
 
1775
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1775
+                    preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)
1776 1776
                 );
1777 1777
 
1778 1778
             }
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 	
1806 1806
 	if (in_array($post_type, geodir_get_posttypes())) {
1807 1807
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1808
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1808
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1809 1809
                 $location_terms = array(
1810 1810
                     'gd_country' => $post->country_slug,
1811 1811
                     'gd_region' => $post->region_slug,
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 					$location_terms = implode("/", $location_terms);
1823 1823
 					$location_terms = rtrim($location_terms, '/');
1824 1824
 					
1825
-					$link .= urldecode($location_terms) . '/';
1825
+					$link .= urldecode($location_terms).'/';
1826 1826
 				} else {
1827 1827
 					$link = geodir_getlink($link, $location_terms);
1828 1828
 				}
@@ -1904,9 +1904,9 @@  discard block
 block discarded – undo
1904 1904
             return 0;
1905 1905
         $where = 't.term_id = %d';
1906 1906
         if (!empty($taxonomy))
1907
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1907
+            return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1908 1908
         else
1909
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1909
+            return $wpdb->get_var($wpdb->prepare($select.$where, $term));
1910 1910
     }
1911 1911
 
1912 1912
     $term = trim(wp_unslash($term));
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 
1919 1919
     $where_fields = array($slug);
1920 1920
     if (!empty($taxonomy)) {
1921
-        $parent = (int)$parent;
1921
+        $parent = (int) $parent;
1922 1922
         if ($parent > 0) {
1923 1923
             $where_fields[] = $parent;
1924 1924
             $else_where_fields[] = $parent;
@@ -1981,13 +1981,13 @@  discard block
 block discarded – undo
1981 1981
         $post_types = geodir_get_posttypes();
1982 1982
         $tax_arr = array();
1983 1983
         foreach ($post_types as $post_type) {
1984
-            $tax_arr[] = "'" . $post_type . "category'";
1984
+            $tax_arr[] = "'".$post_type."category'";
1985 1985
         }
1986 1986
         $tax_c = implode(',', $tax_arr);
1987 1987
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1988 1988
         //$terms = get_terms( $taxonomy );
1989 1989
 
1990
-        if($terms) {
1990
+        if ($terms) {
1991 1991
             foreach ($terms as $term) {
1992 1992
                 $post_type = str_replace("category", "", $term->taxonomy);
1993 1993
                 $a_terms[$post_type][] = $term;
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
             }
1996 1996
         }
1997 1997
 
1998
-        if($a_terms) {
1998
+        if ($a_terms) {
1999 1999
             foreach ($a_terms as $pt => $t2) {
2000 2000
 
2001 2001
                 foreach ($t2 as $term) {
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
     }
2021 2021
 
2022 2022
     if (is_ssl()) {
2023
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2023
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
2024 2024
     }
2025 2025
 
2026 2026
     return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_predefined.php 3 patches
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -16,301 +16,301 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_custom_fields_predefined($post_type=''){
18 18
 
19
-    $custom_fields = array();
20
-
21
-
22
-    // price
23
-    $custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
24
-        'field_type'  =>  'text',
25
-        'class'       =>  'gd-price',
26
-        'icon'        =>  'fa fa-usd',
27
-        'name'        =>  __('Price', 'geodirectory'),
28
-        'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
29
-        'defaults'    => array(
30
-            'data_type'           =>  'FLOAT',
31
-            'admin_title'         =>  'Price',
32
-            'site_title'          =>  'Price',
33
-            'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
34
-            'htmlvar_name'        =>  'price',
35
-            'is_active'           =>  true,
36
-            'for_admin_use'       =>  false,
37
-            'default_value'       =>  '',
38
-            'show_in' 	      =>  '[detail],[listing]',
39
-            'is_required'         =>  false,
40
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
41
-            'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
42
-            'required_msg'        =>  '',
43
-            'field_icon'          =>  'fa fa-usd',
44
-            'css_class'           =>  '',
45
-            'cat_sort'            =>  true,
46
-            'cat_filter'	      =>  true
47
-        )
48
-    );
49
-
50
-    // property status
51
-    $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
52
-        'field_type'  =>  'select',
53
-        'class'       =>  'gd-property-status',
54
-        'icon'        =>  'fa fa-home',
55
-        'name'        =>  __('Property Status', 'geodirectory'),
56
-        'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
57
-        'defaults'    => array(
58
-            'data_type'           =>  'VARCHAR',
59
-            'admin_title'         =>  'Property Status',
60
-            'site_title'          =>  'Property Status',
61
-            'admin_desc'          =>  'Enter the status of the property.',
62
-            'htmlvar_name'        =>  'property_status',
63
-            'is_active'           =>  true,
64
-            'for_admin_use'       =>  false,
65
-            'default_value'       =>  '',
66
-            'show_in' 	          =>  '[detail],[listing]',
67
-            'is_required'         =>  true,
68
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
69
-            'validation_pattern'  =>  '',
70
-            'validation_msg'      =>  '',
71
-            'required_msg'        =>  '',
72
-            'field_icon'          =>  'fa fa-home',
73
-            'css_class'           =>  '',
74
-            'cat_sort'            =>  true,
75
-            'cat_filter'	      =>  true
76
-        )
77
-    );
78
-
79
-    // property furnishing
80
-    $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
81
-        'field_type'  =>  'select',
82
-        'class'       =>  'gd-property-furnishing',
83
-        'icon'        =>  'fa fa-home',
84
-        'name'        =>  __('Property Furnishing', 'geodirectory'),
85
-        'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
86
-        'defaults'    => array(
87
-            'data_type'           =>  'VARCHAR',
88
-            'admin_title'         =>  'Furnishing',
89
-            'site_title'          =>  'Furnishing',
90
-            'admin_desc'          =>  'Enter the furnishing status of the property.',
91
-            'htmlvar_name'        =>  'property_furnishing',
92
-            'is_active'           =>  true,
93
-            'for_admin_use'       =>  false,
94
-            'default_value'       =>  '',
95
-            'show_in' 	          =>  '[detail],[listing]',
96
-            'is_required'         =>  true,
97
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
98
-            'validation_pattern'  =>  '',
99
-            'validation_msg'      =>  '',
100
-            'required_msg'        =>  '',
101
-            'field_icon'          =>  'fa fa-th-larg',
102
-            'css_class'           =>  '',
103
-            'cat_sort'            =>  true,
104
-            'cat_filter'	      =>  true
105
-        )
106
-    );
107
-
108
-    // property type
109
-    $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
110
-        'field_type'  =>  'select',
111
-        'class'       =>  'gd-property-type',
112
-        'icon'        =>  'fa fa-home',
113
-        'name'        =>  __('Property Type', 'geodirectory'),
114
-        'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
115
-        'defaults'    => array(
116
-            'data_type'           =>  'VARCHAR',
117
-            'admin_title'         =>  'Property Type',
118
-            'site_title'          =>  'Property Type',
119
-            'admin_desc'          =>  'Select the property type.',
120
-            'htmlvar_name'        =>  'property_type',
121
-            'is_active'           =>  true,
122
-            'for_admin_use'       =>  false,
123
-            'default_value'       =>  '',
124
-            'show_in' 	          =>  '[detail],[listing]',
125
-            'is_required'         =>  true,
126
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
127
-            'validation_pattern'  =>  '',
128
-            'validation_msg'      =>  '',
129
-            'required_msg'        =>  '',
130
-            'field_icon'          =>  'fa fa-home',
131
-            'css_class'           =>  '',
132
-            'cat_sort'            =>  true,
133
-            'cat_filter'	      =>  true
134
-        )
135
-    );
136
-
137
-    // property bedrooms
138
-    $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
139
-        'field_type'  =>  'select',
140
-        'class'       =>  'gd-property-bedrooms',
141
-        'icon'        =>  'fa fa-home',
142
-        'name'        =>  __('Property Bedrooms', 'geodirectory'),
143
-        'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
144
-        'defaults'    => array(
145
-            'data_type'           =>  'VARCHAR',
146
-            'admin_title'         =>  'Property Bedrooms',
147
-            'site_title'          =>  'Bedrooms',
148
-            'admin_desc'          =>  'Select the number of bedrooms',
149
-            'htmlvar_name'        =>  'property_bedrooms',
150
-            'is_active'           =>  true,
151
-            'for_admin_use'       =>  false,
152
-            'default_value'       =>  '',
153
-            'show_in' 	          =>  '[detail],[listing]',
154
-            'is_required'         =>  true,
155
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
156
-            'validation_pattern'  =>  '',
157
-            'validation_msg'      =>  '',
158
-            'required_msg'        =>  '',
159
-            'field_icon'          =>  'fa fa-bed',
160
-            'css_class'           =>  '',
161
-            'cat_sort'            =>  true,
162
-            'cat_filter'	      =>  true
163
-        )
164
-    );
165
-
166
-    // property bathrooms
167
-    $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
168
-        'field_type'  =>  'select',
169
-        'class'       =>  'gd-property-bathrooms',
170
-        'icon'        =>  'fa fa-home',
171
-        'name'        =>  __('Property Bathrooms', 'geodirectory'),
172
-        'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
173
-        'defaults'    => array(
174
-            'data_type'           =>  'VARCHAR',
175
-            'admin_title'         =>  'Property Bathrooms',
176
-            'site_title'          =>  'Bathrooms',
177
-            'admin_desc'          =>  'Select the number of bathrooms',
178
-            'htmlvar_name'        =>  'property_bathrooms',
179
-            'is_active'           =>  true,
180
-            'for_admin_use'       =>  false,
181
-            'default_value'       =>  '',
182
-            'show_in' 	          =>  '[detail],[listing]',
183
-            'is_required'         =>  true,
184
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
185
-            'validation_pattern'  =>  '',
186
-            'validation_msg'      =>  '',
187
-            'required_msg'        =>  '',
188
-            'field_icon'          =>  'fa fa-bold',
189
-            'css_class'           =>  '',
190
-            'cat_sort'            =>  true,
191
-            'cat_filter'	      =>  true
192
-        )
193
-    );
194
-
195
-    // property area
196
-    $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
197
-        'field_type'  =>  'text',
198
-        'class'       =>  'gd-area',
199
-        'icon'        =>  'fa fa-home',
200
-        'name'        =>  __('Property Area', 'geodirectory'),
201
-        'description' =>  __('Adds a input for the property area.', 'geodirectory'),
202
-        'defaults'    => array(
203
-            'data_type'           =>  'FLOAT',
204
-            'admin_title'         =>  'Property Area',
205
-            'site_title'          =>  'Area (Sq Ft)',
206
-            'admin_desc'          =>  'Enter the Sq Ft value for the property',
207
-            'htmlvar_name'        =>  'property_area',
208
-            'is_active'           =>  true,
209
-            'for_admin_use'       =>  false,
210
-            'default_value'       =>  '',
211
-            'show_in' 	      =>  '[detail],[listing]',
212
-            'is_required'         =>  false,
213
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
214
-            'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
215
-            'required_msg'        =>  '',
216
-            'field_icon'          =>  'fa fa-area-chart',
217
-            'css_class'           =>  '',
218
-            'cat_sort'            =>  true,
219
-            'cat_filter'	      =>  true
220
-        )
221
-    );
222
-
223
-    // property type
224
-    $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
225
-        'field_type'  =>  'multiselect',
226
-        'class'       =>  'gd-property-features',
227
-        'icon'        =>  'fa fa-home',
228
-        'name'        =>  __('Property Features', 'geodirectory'),
229
-        'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
230
-        'defaults'    => array(
231
-            'data_type'           =>  'VARCHAR',
232
-            'admin_title'         =>  'Property Features',
233
-            'site_title'          =>  'Features',
234
-            'admin_desc'          =>  'Select the property features.',
235
-            'htmlvar_name'        =>  'property_features',
236
-            'is_active'           =>  true,
237
-            'for_admin_use'       =>  false,
238
-            'default_value'       =>  '',
239
-            'show_in' 	          =>  '[detail],[listing]',
240
-            'is_required'         =>  true,
241
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
242
-            'validation_pattern'  =>  '',
243
-            'validation_msg'      =>  '',
244
-            'required_msg'        =>  '',
245
-            'field_icon'          =>  'fa fa-plus-square',
246
-            'css_class'           =>  '',
247
-            'cat_sort'            =>  true,
248
-            'cat_filter'	      =>  true
249
-        )
250
-    );
251
-
252
-    // Twitter feed
253
-    $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
254
-        'field_type'  =>  'text',
255
-        'class'       =>  'gd-twitter',
256
-        'icon'        =>  'fa fa-twitter',
257
-        'name'        =>  __('Twitter feed', 'geodirectory'),
258
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
259
-        'defaults'    => array(
260
-            'data_type'           =>  'VARCHAR',
261
-            'admin_title'         =>  'Twitter',
262
-            'site_title'          =>  'Twitter',
263
-            'admin_desc'          =>  'Enter your Twitter username',
264
-            'htmlvar_name'        =>  'twitterusername',
265
-            'is_active'           =>  true,
266
-            'for_admin_use'       =>  false,
267
-            'default_value'       =>  '',
268
-            'show_in' 	      =>  '[detail],[owntab]',
269
-            'is_required'         =>  false,
270
-            'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
271
-            'validation_msg'      =>  'Please enter a valid twitter username.',
272
-            'required_msg'        =>  '',
273
-            'field_icon'          =>  'fa fa-twitter',
274
-            'css_class'           =>  '',
275
-            'cat_sort'            =>  false,
276
-            'cat_filter'	      =>  false
277
-        )
278
-    );
279
-
280
-    // Get directions link
281
-    $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
282
-        'field_type'  =>  'text',
283
-        'class'       =>  'gd-get-directions',
284
-        'icon'        =>  'fa fa-location-arrow',
285
-        'name'        =>  __('Get Directions Link', 'geodirectory'),
286
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
287
-        'defaults'    => array(
288
-            'data_type'           =>  'VARCHAR',
289
-            'admin_title'         =>  'Get Directions',
290
-            'site_title'          =>  'Get Directions',
291
-            'admin_desc'          =>  '',
292
-            'htmlvar_name'        =>  'get_directions',
293
-            'is_active'           =>  true,
294
-            'for_admin_use'       =>  true,
295
-            'default_value'       =>  'Get Directions',
296
-            'show_in' 	      =>  '[detail],[listing]',
297
-            'is_required'         =>  false,
298
-            'validation_pattern'  =>  '',
299
-            'validation_msg'      =>  '',
300
-            'required_msg'        =>  '',
301
-            'field_icon'          =>  'fa fa-location-arrow',
302
-            'css_class'           =>  '',
303
-            'cat_sort'            =>  false,
304
-            'cat_filter'	      =>  false
305
-        )
306
-    );
307
-
308
-
309
-
310
-    /**
311
-     * @see `geodir_custom_fields`
312
-     */
313
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
19
+	$custom_fields = array();
20
+
21
+
22
+	// price
23
+	$custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
24
+		'field_type'  =>  'text',
25
+		'class'       =>  'gd-price',
26
+		'icon'        =>  'fa fa-usd',
27
+		'name'        =>  __('Price', 'geodirectory'),
28
+		'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
29
+		'defaults'    => array(
30
+			'data_type'           =>  'FLOAT',
31
+			'admin_title'         =>  'Price',
32
+			'site_title'          =>  'Price',
33
+			'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
34
+			'htmlvar_name'        =>  'price',
35
+			'is_active'           =>  true,
36
+			'for_admin_use'       =>  false,
37
+			'default_value'       =>  '',
38
+			'show_in' 	      =>  '[detail],[listing]',
39
+			'is_required'         =>  false,
40
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
41
+			'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
42
+			'required_msg'        =>  '',
43
+			'field_icon'          =>  'fa fa-usd',
44
+			'css_class'           =>  '',
45
+			'cat_sort'            =>  true,
46
+			'cat_filter'	      =>  true
47
+		)
48
+	);
49
+
50
+	// property status
51
+	$custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
52
+		'field_type'  =>  'select',
53
+		'class'       =>  'gd-property-status',
54
+		'icon'        =>  'fa fa-home',
55
+		'name'        =>  __('Property Status', 'geodirectory'),
56
+		'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
57
+		'defaults'    => array(
58
+			'data_type'           =>  'VARCHAR',
59
+			'admin_title'         =>  'Property Status',
60
+			'site_title'          =>  'Property Status',
61
+			'admin_desc'          =>  'Enter the status of the property.',
62
+			'htmlvar_name'        =>  'property_status',
63
+			'is_active'           =>  true,
64
+			'for_admin_use'       =>  false,
65
+			'default_value'       =>  '',
66
+			'show_in' 	          =>  '[detail],[listing]',
67
+			'is_required'         =>  true,
68
+			'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
69
+			'validation_pattern'  =>  '',
70
+			'validation_msg'      =>  '',
71
+			'required_msg'        =>  '',
72
+			'field_icon'          =>  'fa fa-home',
73
+			'css_class'           =>  '',
74
+			'cat_sort'            =>  true,
75
+			'cat_filter'	      =>  true
76
+		)
77
+	);
78
+
79
+	// property furnishing
80
+	$custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
81
+		'field_type'  =>  'select',
82
+		'class'       =>  'gd-property-furnishing',
83
+		'icon'        =>  'fa fa-home',
84
+		'name'        =>  __('Property Furnishing', 'geodirectory'),
85
+		'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
86
+		'defaults'    => array(
87
+			'data_type'           =>  'VARCHAR',
88
+			'admin_title'         =>  'Furnishing',
89
+			'site_title'          =>  'Furnishing',
90
+			'admin_desc'          =>  'Enter the furnishing status of the property.',
91
+			'htmlvar_name'        =>  'property_furnishing',
92
+			'is_active'           =>  true,
93
+			'for_admin_use'       =>  false,
94
+			'default_value'       =>  '',
95
+			'show_in' 	          =>  '[detail],[listing]',
96
+			'is_required'         =>  true,
97
+			'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
98
+			'validation_pattern'  =>  '',
99
+			'validation_msg'      =>  '',
100
+			'required_msg'        =>  '',
101
+			'field_icon'          =>  'fa fa-th-larg',
102
+			'css_class'           =>  '',
103
+			'cat_sort'            =>  true,
104
+			'cat_filter'	      =>  true
105
+		)
106
+	);
107
+
108
+	// property type
109
+	$custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
110
+		'field_type'  =>  'select',
111
+		'class'       =>  'gd-property-type',
112
+		'icon'        =>  'fa fa-home',
113
+		'name'        =>  __('Property Type', 'geodirectory'),
114
+		'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
115
+		'defaults'    => array(
116
+			'data_type'           =>  'VARCHAR',
117
+			'admin_title'         =>  'Property Type',
118
+			'site_title'          =>  'Property Type',
119
+			'admin_desc'          =>  'Select the property type.',
120
+			'htmlvar_name'        =>  'property_type',
121
+			'is_active'           =>  true,
122
+			'for_admin_use'       =>  false,
123
+			'default_value'       =>  '',
124
+			'show_in' 	          =>  '[detail],[listing]',
125
+			'is_required'         =>  true,
126
+			'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
127
+			'validation_pattern'  =>  '',
128
+			'validation_msg'      =>  '',
129
+			'required_msg'        =>  '',
130
+			'field_icon'          =>  'fa fa-home',
131
+			'css_class'           =>  '',
132
+			'cat_sort'            =>  true,
133
+			'cat_filter'	      =>  true
134
+		)
135
+	);
136
+
137
+	// property bedrooms
138
+	$custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
139
+		'field_type'  =>  'select',
140
+		'class'       =>  'gd-property-bedrooms',
141
+		'icon'        =>  'fa fa-home',
142
+		'name'        =>  __('Property Bedrooms', 'geodirectory'),
143
+		'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
144
+		'defaults'    => array(
145
+			'data_type'           =>  'VARCHAR',
146
+			'admin_title'         =>  'Property Bedrooms',
147
+			'site_title'          =>  'Bedrooms',
148
+			'admin_desc'          =>  'Select the number of bedrooms',
149
+			'htmlvar_name'        =>  'property_bedrooms',
150
+			'is_active'           =>  true,
151
+			'for_admin_use'       =>  false,
152
+			'default_value'       =>  '',
153
+			'show_in' 	          =>  '[detail],[listing]',
154
+			'is_required'         =>  true,
155
+			'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
156
+			'validation_pattern'  =>  '',
157
+			'validation_msg'      =>  '',
158
+			'required_msg'        =>  '',
159
+			'field_icon'          =>  'fa fa-bed',
160
+			'css_class'           =>  '',
161
+			'cat_sort'            =>  true,
162
+			'cat_filter'	      =>  true
163
+		)
164
+	);
165
+
166
+	// property bathrooms
167
+	$custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
168
+		'field_type'  =>  'select',
169
+		'class'       =>  'gd-property-bathrooms',
170
+		'icon'        =>  'fa fa-home',
171
+		'name'        =>  __('Property Bathrooms', 'geodirectory'),
172
+		'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
173
+		'defaults'    => array(
174
+			'data_type'           =>  'VARCHAR',
175
+			'admin_title'         =>  'Property Bathrooms',
176
+			'site_title'          =>  'Bathrooms',
177
+			'admin_desc'          =>  'Select the number of bathrooms',
178
+			'htmlvar_name'        =>  'property_bathrooms',
179
+			'is_active'           =>  true,
180
+			'for_admin_use'       =>  false,
181
+			'default_value'       =>  '',
182
+			'show_in' 	          =>  '[detail],[listing]',
183
+			'is_required'         =>  true,
184
+			'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
185
+			'validation_pattern'  =>  '',
186
+			'validation_msg'      =>  '',
187
+			'required_msg'        =>  '',
188
+			'field_icon'          =>  'fa fa-bold',
189
+			'css_class'           =>  '',
190
+			'cat_sort'            =>  true,
191
+			'cat_filter'	      =>  true
192
+		)
193
+	);
194
+
195
+	// property area
196
+	$custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
197
+		'field_type'  =>  'text',
198
+		'class'       =>  'gd-area',
199
+		'icon'        =>  'fa fa-home',
200
+		'name'        =>  __('Property Area', 'geodirectory'),
201
+		'description' =>  __('Adds a input for the property area.', 'geodirectory'),
202
+		'defaults'    => array(
203
+			'data_type'           =>  'FLOAT',
204
+			'admin_title'         =>  'Property Area',
205
+			'site_title'          =>  'Area (Sq Ft)',
206
+			'admin_desc'          =>  'Enter the Sq Ft value for the property',
207
+			'htmlvar_name'        =>  'property_area',
208
+			'is_active'           =>  true,
209
+			'for_admin_use'       =>  false,
210
+			'default_value'       =>  '',
211
+			'show_in' 	      =>  '[detail],[listing]',
212
+			'is_required'         =>  false,
213
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
214
+			'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
215
+			'required_msg'        =>  '',
216
+			'field_icon'          =>  'fa fa-area-chart',
217
+			'css_class'           =>  '',
218
+			'cat_sort'            =>  true,
219
+			'cat_filter'	      =>  true
220
+		)
221
+	);
222
+
223
+	// property type
224
+	$custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
225
+		'field_type'  =>  'multiselect',
226
+		'class'       =>  'gd-property-features',
227
+		'icon'        =>  'fa fa-home',
228
+		'name'        =>  __('Property Features', 'geodirectory'),
229
+		'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
230
+		'defaults'    => array(
231
+			'data_type'           =>  'VARCHAR',
232
+			'admin_title'         =>  'Property Features',
233
+			'site_title'          =>  'Features',
234
+			'admin_desc'          =>  'Select the property features.',
235
+			'htmlvar_name'        =>  'property_features',
236
+			'is_active'           =>  true,
237
+			'for_admin_use'       =>  false,
238
+			'default_value'       =>  '',
239
+			'show_in' 	          =>  '[detail],[listing]',
240
+			'is_required'         =>  true,
241
+			'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
242
+			'validation_pattern'  =>  '',
243
+			'validation_msg'      =>  '',
244
+			'required_msg'        =>  '',
245
+			'field_icon'          =>  'fa fa-plus-square',
246
+			'css_class'           =>  '',
247
+			'cat_sort'            =>  true,
248
+			'cat_filter'	      =>  true
249
+		)
250
+	);
251
+
252
+	// Twitter feed
253
+	$custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
254
+		'field_type'  =>  'text',
255
+		'class'       =>  'gd-twitter',
256
+		'icon'        =>  'fa fa-twitter',
257
+		'name'        =>  __('Twitter feed', 'geodirectory'),
258
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
259
+		'defaults'    => array(
260
+			'data_type'           =>  'VARCHAR',
261
+			'admin_title'         =>  'Twitter',
262
+			'site_title'          =>  'Twitter',
263
+			'admin_desc'          =>  'Enter your Twitter username',
264
+			'htmlvar_name'        =>  'twitterusername',
265
+			'is_active'           =>  true,
266
+			'for_admin_use'       =>  false,
267
+			'default_value'       =>  '',
268
+			'show_in' 	      =>  '[detail],[owntab]',
269
+			'is_required'         =>  false,
270
+			'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
271
+			'validation_msg'      =>  'Please enter a valid twitter username.',
272
+			'required_msg'        =>  '',
273
+			'field_icon'          =>  'fa fa-twitter',
274
+			'css_class'           =>  '',
275
+			'cat_sort'            =>  false,
276
+			'cat_filter'	      =>  false
277
+		)
278
+	);
279
+
280
+	// Get directions link
281
+	$custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
282
+		'field_type'  =>  'text',
283
+		'class'       =>  'gd-get-directions',
284
+		'icon'        =>  'fa fa-location-arrow',
285
+		'name'        =>  __('Get Directions Link', 'geodirectory'),
286
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
287
+		'defaults'    => array(
288
+			'data_type'           =>  'VARCHAR',
289
+			'admin_title'         =>  'Get Directions',
290
+			'site_title'          =>  'Get Directions',
291
+			'admin_desc'          =>  '',
292
+			'htmlvar_name'        =>  'get_directions',
293
+			'is_active'           =>  true,
294
+			'for_admin_use'       =>  true,
295
+			'default_value'       =>  'Get Directions',
296
+			'show_in' 	      =>  '[detail],[listing]',
297
+			'is_required'         =>  false,
298
+			'validation_pattern'  =>  '',
299
+			'validation_msg'      =>  '',
300
+			'required_msg'        =>  '',
301
+			'field_icon'          =>  'fa fa-location-arrow',
302
+			'css_class'           =>  '',
303
+			'cat_sort'            =>  false,
304
+			'cat_filter'	      =>  false
305
+		)
306
+	);
307
+
308
+
309
+
310
+	/**
311
+	 * @see `geodir_custom_fields`
312
+	 */
313
+	return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
314 314
 }
315 315
 
316 316
 
@@ -325,32 +325,32 @@  discard block
 block discarded – undo
325 325
  * @return string The html to output.
326 326
  */
327 327
 function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
328
-    global $post;
328
+	global $post;
329 329
 
330 330
 
331
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
331
+	if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
332 332
 
333
-        $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
333
+		$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
334 334
 
335
-        $field_icon = geodir_field_icon_proccess($cf);
336
-        if (strpos($field_icon, 'http') !== false) {
337
-            $field_icon_af = '';
338
-        } elseif ($field_icon == '') {
339
-            $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
340
-        } else {
341
-            $field_icon_af = $field_icon;
342
-            $field_icon = '';
343
-        }
335
+		$field_icon = geodir_field_icon_proccess($cf);
336
+		if (strpos($field_icon, 'http') !== false) {
337
+			$field_icon_af = '';
338
+		} elseif ($field_icon == '') {
339
+			$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
340
+		} else {
341
+			$field_icon_af = $field_icon;
342
+			$field_icon = '';
343
+		}
344 344
 
345 345
 
346
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
346
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
347 347
 
348
-        $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349
-        $html .= '</div>';
348
+		$html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349
+		$html .= '</div>';
350 350
 
351
-    endif;
351
+	endif;
352 352
 
353
-    return $html;
353
+	return $html;
354 354
 }
355 355
 add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
356 356
 
@@ -365,36 +365,36 @@  discard block
 block discarded – undo
365 365
  * @return string The html to output.
366 366
  */
367 367
 function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
368
-    global $post;
368
+	global $post;
369 369
 
370 370
 
371
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
371
+	if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
372 372
 
373
-        $field_icon = geodir_field_icon_proccess( $cf );
374
-        if ( strpos( $field_icon, 'http' ) !== false ) {
375
-            $field_icon_af = '';
376
-        } elseif ( $field_icon == '' ) {
377
-            $field_icon_af = '<i class="fa fa-location-arrow"></i>';
378
-        } else {
379
-            $field_icon_af = $field_icon;
380
-            $field_icon    = '';
381
-        }
373
+		$field_icon = geodir_field_icon_proccess( $cf );
374
+		if ( strpos( $field_icon, 'http' ) !== false ) {
375
+			$field_icon_af = '';
376
+		} elseif ( $field_icon == '' ) {
377
+			$field_icon_af = '<i class="fa fa-location-arrow"></i>';
378
+		} else {
379
+			$field_icon_af = $field_icon;
380
+			$field_icon    = '';
381
+		}
382 382
 
383
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
383
+		$link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
384 384
 
385
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
385
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
386 386
 
387
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
388
-            $html .= $field_icon_af;
389
-        }
387
+		if(isset( $cf['field_icon'] ) && $cf['field_icon']){
388
+			$html .= $field_icon_af;
389
+		}
390 390
 
391
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
392
-        $html .= '</div>';
391
+		$html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
392
+		$html .= '</div>';
393 393
 
394
-    }else{
395
-        $html ='';
396
-    }
394
+	}else{
395
+		$html ='';
396
+	}
397 397
 
398
-    return $html;
398
+	return $html;
399 399
 }
400 400
 add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 1.6.9
15 15
  * @package GeoDirectory
16 16
  */
17
-function geodir_custom_fields_predefined($post_type=''){
17
+function geodir_custom_fields_predefined($post_type = '') {
18 18
 
19 19
     $custom_fields = array();
20 20
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             'default_value'       =>  '',
66 66
             'show_in' 	          =>  '[detail],[listing]',
67 67
             'is_required'         =>  true,
68
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
68
+            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'),
69 69
             'validation_pattern'  =>  '',
70 70
             'validation_msg'      =>  '',
71 71
             'required_msg'        =>  '',
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             'default_value'       =>  '',
95 95
             'show_in' 	          =>  '[detail],[listing]',
96 96
             'is_required'         =>  true,
97
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
97
+            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
98 98
             'validation_pattern'  =>  '',
99 99
             'validation_msg'      =>  '',
100 100
             'required_msg'        =>  '',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             'default_value'       =>  '',
124 124
             'show_in' 	          =>  '[detail],[listing]',
125 125
             'is_required'         =>  true,
126
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
126
+            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'),
127 127
             'validation_pattern'  =>  '',
128 128
             'validation_msg'      =>  '',
129 129
             'required_msg'        =>  '',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'default_value'       =>  '',
153 153
             'show_in' 	          =>  '[detail],[listing]',
154 154
             'is_required'         =>  true,
155
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
155
+            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
156 156
             'validation_pattern'  =>  '',
157 157
             'validation_msg'      =>  '',
158 158
             'required_msg'        =>  '',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             'default_value'       =>  '',
182 182
             'show_in' 	          =>  '[detail],[listing]',
183 183
             'is_required'         =>  true,
184
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
184
+            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
185 185
             'validation_pattern'  =>  '',
186 186
             'validation_msg'      =>  '',
187 187
             'required_msg'        =>  '',
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             'default_value'       =>  '',
239 239
             'show_in' 	          =>  '[detail],[listing]',
240 240
             'is_required'         =>  true,
241
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
241
+            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
242 242
             'validation_pattern'  =>  '',
243 243
             'validation_msg'      =>  '',
244 244
             'required_msg'        =>  '',
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     /**
311 311
      * @see `geodir_custom_fields`
312 312
      */
313
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
313
+    return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type);
314 314
 }
315 315
 
316 316
 
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
  * @since 1.6.9
325 325
  * @return string The html to output.
326 326
  */
327
-function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
327
+function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) {
328 328
     global $post;
329 329
 
330 330
 
331
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
331
+    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
332 332
 
333 333
         $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
334 334
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         }
344 344
 
345 345
 
346
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
346
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
347 347
 
348 348
         $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
349 349
         $html .= '</div>';
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
     return $html;
354 354
 }
355
-add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
355
+add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3);
356 356
 
357 357
 /**
358 358
  * Filter the get_directions custom field output to show a link.
@@ -364,37 +364,37 @@  discard block
 block discarded – undo
364 364
  * @since 1.6.9
365 365
  * @return string The html to output.
366 366
  */
367
-function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
367
+function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) {
368 368
     global $post;
369 369
 
370 370
 
371
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
371
+    if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) {
372 372
 
373
-        $field_icon = geodir_field_icon_proccess( $cf );
374
-        if ( strpos( $field_icon, 'http' ) !== false ) {
373
+        $field_icon = geodir_field_icon_proccess($cf);
374
+        if (strpos($field_icon, 'http') !== false) {
375 375
             $field_icon_af = '';
376
-        } elseif ( $field_icon == '' ) {
376
+        } elseif ($field_icon == '') {
377 377
             $field_icon_af = '<i class="fa fa-location-arrow"></i>';
378 378
         } else {
379 379
             $field_icon_af = $field_icon;
380 380
             $field_icon    = '';
381 381
         }
382 382
 
383
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
383
+        $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory');
384 384
 
385
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
385
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
386 386
 
387
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
387
+        if (isset($cf['field_icon']) && $cf['field_icon']) {
388 388
             $html .= $field_icon_af;
389 389
         }
390 390
 
391
-        $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>';
391
+        $html .= '<a href="https://www.google.com/maps/dir//\''.$post->post_latitude.','.$post->post_longitude.'\'/" target="_blank" >'.$link_text.'</a>';
392 392
         $html .= '</div>';
393 393
 
394
-    }else{
395
-        $html ='';
394
+    } else {
395
+        $html = '';
396 396
     }
397 397
 
398 398
     return $html;
399 399
 }
400
-add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
400
+add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
353 353
 
354 354
     if(!$cpt_left){
355 355
         $cpt_left = "gd-cpt-flat";
356
-    }else{
356
+    } else{
357 357
         $cpt_left = '';
358 358
     }
359 359
 
Please login to merge, or discard this patch.