Test Failed
Push — master ( a1f5b3...f6c162 )
by Stiofan
04:37
created
geodirectory-admin/admin_hooks_actions.php 3 patches
Indentation   +1619 added lines, -1619 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
 
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function geodir_conditional_admin_script_load()
88 88
 {
89
-    global $pagenow;
89
+	global $pagenow;
90 90
 	
91 91
 	// Get the current post type
92 92
 	$post_type = geodir_admin_current_post_type();
93 93
 	$geodir_post_types = geodir_get_posttypes();
94 94
     
95 95
 	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')) {
96
-        add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
97
-        add_action('admin_enqueue_scripts', 'geodir_admin_styles');
98
-        add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
96
+		add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
97
+		add_action('admin_enqueue_scripts', 'geodir_admin_styles');
98
+		add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
99 99
         
100
-        // Disable VC editor for GD post types.
101
-        if (class_exists('Vc_Role_Access_Controller')) {
102
-            add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 );
103
-        }
104
-    }
100
+		// Disable VC editor for GD post types.
101
+		if (class_exists('Vc_Role_Access_Controller')) {
102
+			add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 );
103
+		}
104
+	}
105 105
 
106
-    add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
106
+	add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
107 107
 
108 108
 }
109 109
 
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
  */
139 139
 function create_default_admin_main_nav()
140 140
 {
141
-    add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
142
-    add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
143
-    add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
144
-    add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
145
-    add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
146
-    //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
141
+	add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
142
+	add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
143
+	add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
144
+	add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
145
+	add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
146
+	//add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
147 147
 
148 148
 }
149 149
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function geodir_admin_list_columns()
158 158
 {
159
-    if ($post_types = geodir_get_posttypes()) {
159
+	if ($post_types = geodir_get_posttypes()) {
160 160
 
161
-        foreach ($post_types as $post_type):
162
-            add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
163
-            //Filter-Payment-Manager to show Package
164
-            add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
161
+		foreach ($post_types as $post_type):
162
+			add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
163
+			//Filter-Payment-Manager to show Package
164
+			add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
165 165
 
166
-            add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
167
-        endforeach;
168
-    }
166
+			add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
167
+		endforeach;
168
+	}
169 169
 }
170 170
 
171 171
 /**
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
  */
179 179
 function geodir_default_admin_main_tabs($tabs)
180 180
 {
181
-    return $tabs = array(
182
-        'general_settings' => array('label' => __('General', 'geodirectory')),
183
-        'design_settings' => array('label' => __('Design', 'geodirectory')),
184
-        'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
185
-        'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
186
-        'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
187
-        'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
188
-
189
-    );
181
+	return $tabs = array(
182
+		'general_settings' => array('label' => __('General', 'geodirectory')),
183
+		'design_settings' => array('label' => __('Design', 'geodirectory')),
184
+		'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
185
+		'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
186
+		'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
187
+		'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
188
+
189
+	);
190 190
 }
191 191
 
192 192
 add_action('do_meta_boxes', 'geodir_remove_image_box');
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
  */
200 200
 function geodir_remove_image_box()
201 201
 {
202
-    global $post;
202
+	global $post;
203 203
 
204
-    $geodir_posttypes = geodir_get_posttypes();
204
+	$geodir_posttypes = geodir_get_posttypes();
205 205
 
206
-    if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
206
+	if (isset($post) && in_array($post->post_type, $geodir_posttypes)):
207 207
 
208
-        remove_meta_box('postimagediv', $post->post_type, 'side');
209
-        remove_meta_box('revisionsdiv', $post->post_type, 'normal');
208
+		remove_meta_box('postimagediv', $post->post_type, 'side');
209
+		remove_meta_box('revisionsdiv', $post->post_type, 'normal');
210 210
 
211
-    endif;
211
+	endif;
212 212
 
213 213
 }
214 214
 
@@ -223,27 +223,27 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_meta_box_add()
225 225
 {
226
-    global $post;
226
+	global $post;
227 227
 
228
-    $geodir_post_types = geodir_get_posttypes('array');
229
-    $geodir_posttypes = array_keys($geodir_post_types);
228
+	$geodir_post_types = geodir_get_posttypes('array');
229
+	$geodir_posttypes = array_keys($geodir_post_types);
230 230
 
231
-    if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
231
+	if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)):
232 232
 
233
-        $geodir_posttype = $post->post_type;
234
-        $post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory');
235
-        $post_typename = geodir_ucwords($post_typename);
233
+		$geodir_posttype = $post->post_type;
234
+		$post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory');
235
+		$post_typename = geodir_ucwords($post_typename);
236 236
 
237
-        // Filter-Payment-Manager
237
+		// Filter-Payment-Manager
238 238
 
239
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
239
+		add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
240 240
 
241
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
241
+		add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
242 242
 
243
-        // no need of this box as all fields moved to main information box
244
-        //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
243
+		// no need of this box as all fields moved to main information box
244
+		//add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
245 245
 
246
-    endif;
246
+	endif;
247 247
 
248 248
 }
249 249
 
@@ -267,23 +267,23 @@  discard block
 block discarded – undo
267 267
 function geodir_hide_post_taxonomy_meta_boxes()
268 268
 {
269 269
 
270
-    $geodir_post_types = get_option('geodir_post_types');
270
+	$geodir_post_types = get_option('geodir_post_types');
271 271
 
272
-    if (!empty($geodir_post_types)) {
273
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
272
+	if (!empty($geodir_post_types)) {
273
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
274 274
 
275
-            $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
275
+			$gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
276 276
 
277
-            if(!empty($gd_taxonomy)) {
278
-                foreach ($gd_taxonomy as $tax) {
277
+			if(!empty($gd_taxonomy)) {
278
+				foreach ($gd_taxonomy as $tax) {
279 279
 
280
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
280
+					remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
281 281
 
282
-                }
283
-            }
282
+				}
283
+			}
284 284
 
285
-        }
286
-    }
285
+		}
286
+	}
287 287
 }
288 288
 
289 289
 add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
  */
298 298
 function geodir_add_listing_map_restrict($map_restirct)
299 299
 {
300
-    if (is_admin()) {
301
-        if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
302
-            $map_restirct = false;
303
-        }
304
-    }
305
-    return $map_restirct;
300
+	if (is_admin()) {
301
+		if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
302
+			$map_restirct = false;
303
+		}
304
+	}
305
+	return $map_restirct;
306 306
 }
307 307
 
308 308
 
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 function geodir_enable_editor_on_notifications($notification)
322 322
 {
323 323
 
324
-    if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
324
+	if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
325 325
 
326
-        foreach ($notification as $key => $value) {
327
-            if ($value['type'] == 'textarea')
328
-                $notification[$key]['type'] = 'editor';
329
-        }
326
+		foreach ($notification as $key => $value) {
327
+			if ($value['type'] == 'textarea')
328
+				$notification[$key]['type'] = 'editor';
329
+		}
330 330
 
331
-    }
331
+	}
332 332
 
333
-    return $notification;
333
+	return $notification;
334 334
 }
335 335
 
336 336
 
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 function geodir_enable_editor_on_design_settings($design_setting)
348 348
 {
349 349
 
350
-    if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
350
+	if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
351 351
 
352
-        foreach ($design_setting as $key => $value) {
353
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
354
-                $design_setting[$key]['type'] = 'editor';
355
-        }
352
+		foreach ($design_setting as $key => $value) {
353
+			if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
354
+				$design_setting[$key]['type'] = 'editor';
355
+		}
356 356
 
357
-    }
357
+	}
358 358
 
359
-    return $design_setting;
359
+	return $design_setting;
360 360
 }
361 361
 
362 362
 /* ----------- START MANAGE CUSTOM FIELDS ---------------- */
@@ -364,15 +364,15 @@  discard block
 block discarded – undo
364 364
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
365 365
 
366 366
 function geodir_manage_available_fields_predefined($sub_tab){
367
-    if($sub_tab=='custom_fields'){
368
-        geodir_custom_available_fields('predefined');
369
-    }
367
+	if($sub_tab=='custom_fields'){
368
+		geodir_custom_available_fields('predefined');
369
+	}
370 370
 }
371 371
 
372 372
 function geodir_manage_available_fields_custom($sub_tab){
373
-    if($sub_tab=='custom_fields'){
374
-        geodir_custom_available_fields('custom');
375
-    }
373
+	if($sub_tab=='custom_fields'){
374
+		geodir_custom_available_fields('custom');
375
+	}
376 376
 }
377 377
 
378 378
 
@@ -391,16 +391,16 @@  discard block
 block discarded – undo
391 391
 function geodir_manage_available_fields($sub_tab)
392 392
 {
393 393
 
394
-    switch ($sub_tab) {
395
-        case 'custom_fields':
396
-            geodir_custom_available_fields();
397
-            break;
394
+	switch ($sub_tab) {
395
+		case 'custom_fields':
396
+			geodir_custom_available_fields();
397
+			break;
398 398
 
399
-        case 'sorting_options':
400
-            geodir_sorting_options_available_fields();
401
-            break;
399
+		case 'sorting_options':
400
+			geodir_sorting_options_available_fields();
401
+			break;
402 402
 
403
-    }
403
+	}
404 404
 }
405 405
 
406 406
 
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
 function geodir_manage_selected_fields($sub_tab)
417 417
 {
418 418
 
419
-    switch ($sub_tab) {
420
-        case 'custom_fields':
421
-            geodir_custom_selected_fields();
422
-            break;
419
+	switch ($sub_tab) {
420
+		case 'custom_fields':
421
+			geodir_custom_selected_fields();
422
+			break;
423 423
 
424
-        case 'sorting_options':
425
-            geodir_sorting_options_selected_fields();
426
-            break;
424
+		case 'sorting_options':
425
+			geodir_sorting_options_selected_fields();
426
+			break;
427 427
 
428
-    }
428
+	}
429 429
 }
430 430
 
431 431
 /**
@@ -437,52 +437,52 @@  discard block
 block discarded – undo
437 437
  */
438 438
 function geodir_sorting_options_available_fields()
439 439
 {
440
-    global $wpdb;
441
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
442
-    ?>
440
+	global $wpdb;
441
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
442
+	?>
443 443
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
444 444
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
445 445
     <ul>
446 446
     <?php
447
-        $sort_options = geodir_get_custom_sort_options($listing_type);
447
+		$sort_options = geodir_get_custom_sort_options($listing_type);
448 448
         
449
-        foreach ($sort_options as $key => $val) {
450
-            $val = stripslashes_deep($val); // strip slashes
451
-
452
-            $check_html_variable = $wpdb->get_var(
453
-                $wpdb->prepare(
454
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
455
-                    array($val['htmlvar_name'], $listing_type, $val['field_type'])
456
-                )
457
-            );
449
+		foreach ($sort_options as $key => $val) {
450
+			$val = stripslashes_deep($val); // strip slashes
451
+
452
+			$check_html_variable = $wpdb->get_var(
453
+				$wpdb->prepare(
454
+					"SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
455
+					array($val['htmlvar_name'], $listing_type, $val['field_type'])
456
+				)
457
+			);
458 458
             
459
-            $display = $check_html_variable ? ' style="display:none;"' : '';
460
-           ?>
459
+			$display = $check_html_variable ? ' style="display:none;"' : '';
460
+		   ?>
461 461
 
462 462
             <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
463 463
                 <?php
464
-                if(isset($val['description']) && $val['description']){
465
-                    echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
466
-                }?>
464
+				if(isset($val['description']) && $val['description']){
465
+					echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
466
+				}?>
467 467
 
468 468
                 <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'];?>"
469 469
                    title="<?php echo $val['site_title'];?>"
470 470
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
471 471
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
472
-                        echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
473
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
474
-                        echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
475
-                    }else{
476
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
477
-                    }?>
472
+						echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
473
+					}elseif(isset($val['field_icon']) && $val['field_icon'] ){
474
+						echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
475
+					}else{
476
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
477
+					}?>
478 478
                     <?php echo $val['site_title'];?>
479 479
                 </a>
480 480
             </li>
481 481
 
482 482
 
483 483
             <?php
484
-        }
485
-    ?>
484
+		}
485
+	?>
486 486
     </ul>
487 487
     <?php
488 488
 }
@@ -496,28 +496,28 @@  discard block
 block discarded – undo
496 496
  */
497 497
 function geodir_sorting_options_selected_fields()
498 498
 {
499
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
500
-    ?>
499
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
500
+	?>
501 501
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
502 502
     <ul class="core">
503 503
     <?php 
504
-        global $wpdb;
504
+		global $wpdb;
505 505
         
506
-        $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)));
506
+		$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)));
507 507
 
508
-        if (!empty($fields)) {
509
-            foreach ($fields as $field) {
510
-                //$result_str = $field->id;
511
-                $result_str = $field;
512
-                $field_type = $field->field_type;
513
-                $field_ins_upd = 'display';
508
+		if (!empty($fields)) {
509
+			foreach ($fields as $field) {
510
+				//$result_str = $field->id;
511
+				$result_str = $field;
512
+				$field_type = $field->field_type;
513
+				$field_ins_upd = 'display';
514 514
 
515
-                $default = false;
515
+				$default = false;
516 516
 
517
-                geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
518
-            }
519
-        }
520
-    ?>
517
+				geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default);
518
+			}
519
+		}
520
+	?>
521 521
     </ul>
522 522
     <?php
523 523
 }
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
  */
531 531
 function geodir_custom_fields_custom($post_type=''){
532 532
 
533
-    $custom_fields = array();
533
+	$custom_fields = array();
534 534
 
535
-    /**
536
-     * @see `geodir_custom_fields`
537
-     */
538
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
535
+	/**
536
+	 * @see `geodir_custom_fields`
537
+	 */
538
+	return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
539 539
 }
540 540
 
541 541
 
@@ -548,140 +548,140 @@  discard block
 block discarded – undo
548 548
  */
549 549
 function geodir_custom_fields($post_type=''){
550 550
     
551
-    $custom_fields = array(
552
-        'text' => array(
553
-            'field_type'  =>  'text',
554
-            'class' =>  'gd-text',
555
-            'icon'  =>  'fa fa-minus',
556
-            'name'  =>  __('Text', 'geodirectory'),
557
-            'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
558
-        ),
559
-        'datepicker' => array(
560
-            'field_type'  =>  'datepicker',
561
-            'class' =>  'gd-datepicker',
562
-            'icon'  =>  'fa fa-calendar',
563
-            'name'  =>  __('Date', 'geodirectory'),
564
-            'description' =>  __('Adds a date picker.', 'geodirectory')
565
-        ),
566
-        'textarea' => array(
567
-            'field_type'  =>  'textarea',
568
-            'class' =>  'gd-textarea',
569
-            'icon'  =>  'fa fa-bars',
570
-            'name'  =>  __('Textarea', 'geodirectory'),
571
-            'description' =>  __('Adds a textarea', 'geodirectory')
572
-        ),
573
-        'time' => array(
574
-            'field_type'  =>  'time',
575
-            'class' =>  'gd-time',
576
-            'icon' =>  'fa fa-clock-o',
577
-            'name'  =>  __('Time', 'geodirectory'),
578
-            'description' =>  __('Adds a time picker', 'geodirectory')
579
-        ),
580
-        'checkbox' => array(
581
-            'field_type'  =>  'checkbox',
582
-            'class' =>  'gd-checkbox',
583
-            'icon' =>  'fa fa-check-square-o',
584
-            'name'  =>  __('Checkbox', 'geodirectory'),
585
-            'description' =>  __('Adds a checkbox', 'geodirectory')
586
-        ),
587
-        'phone' => array(
588
-            'field_type'  =>  'phone',
589
-            'class' =>  'gd-phone',
590
-            'icon' =>  'fa fa-phone',
591
-            'name'  =>  __('Phone', 'geodirectory'),
592
-            'description' =>  __('Adds a phone input', 'geodirectory')
593
-        ),
594
-        'radio' => array(
595
-            'field_type'  =>  'radio',
596
-            'class' =>  'gd-radio',
597
-            'icon' =>  'fa fa-dot-circle-o',
598
-            'name'  =>  __('Radio', 'geodirectory'),
599
-            'description' =>  __('Adds a radio input', 'geodirectory')
600
-        ),
601
-        'email' => array(
602
-            'field_type'  =>  'email',
603
-            'class' =>  'gd-email',
604
-            'icon' =>  'fa fa-envelope-o',
605
-            'name'  =>  __('Email', 'geodirectory'),
606
-            'description' =>  __('Adds a email input', 'geodirectory')
607
-        ),
608
-        'select' => array(
609
-            'field_type'  =>  'select',
610
-            'class' =>  'gd-select',
611
-            'icon' =>  'fa fa-caret-square-o-down',
612
-            'name'  =>  __('Select', 'geodirectory'),
613
-            'description' =>  __('Adds a select input', 'geodirectory')
614
-        ),
615
-        'multiselect' => array(
616
-            'field_type'  =>  'multiselect',
617
-            'class' =>  'gd-multiselect',
618
-            'icon' =>  'fa fa-caret-square-o-down',
619
-            'name'  =>  __('Multi Select', 'geodirectory'),
620
-            'description' =>  __('Adds a multiselect input', 'geodirectory')
621
-        ),
622
-        'url' => array(
623
-            'field_type'  =>  'url',
624
-            'class' =>  'gd-url',
625
-            'icon' =>  'fa fa-link',
626
-            'name'  =>  __('URL', 'geodirectory'),
627
-            'description' =>  __('Adds a url input', 'geodirectory')
628
-        ),
629
-        'html' => array(
630
-            'field_type'  =>  'html',
631
-            'class' =>  'gd-html',
632
-            'icon' =>  'fa fa-code',
633
-            'name'  =>  __('HTML', 'geodirectory'),
634
-            'description' =>  __('Adds a html input textarea', 'geodirectory')
635
-        ),
636
-        'file' => array(
637
-            'field_type'  =>  'file',
638
-            'class' =>  'gd-file',
639
-            'icon' =>  'fa fa-file',
640
-            'name'  =>  __('File Upload', 'geodirectory'),
641
-            'description' =>  __('Adds a file input', 'geodirectory')
642
-        )
643
-    );
644
-
645
-    /**
646
-     * Filter the custom fields array to be able to add or remove items.
647
-     * 
648
-     * @since 1.6.6
649
-     *
650
-     * @param array $custom_fields {
651
-     *     The custom fields array to be filtered.
652
-     *
653
-     *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
654
-     *     @type string $class The class for the field in backend.
655
-     *     @type string $icon Can be font-awesome class name or icon image url.
656
-     *     @type string $name The name of the field.
657
-     *     @type string $description A short description about the field.
658
-     *     @type array $defaults {
659
-     *                    Optional. Used to set the default value of the field.
660
-     *
661
-     *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
662
-     *                    @type int decimal_point limit if using FLOAT data_type
663
-     *                    @type string admin_title The admin title for the field.
664
-     *                    @type string site_title This will be the title for the field on the frontend.
665
-     *                    @type string admin_desc This will be shown below the field on the add listing form.
666
-     *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
667
-     *                    @type bool is_active If false the field will not be displayed anywhere.
668
-     *                    @type bool for_admin_use If true then only site admin can see and edit this field.
669
-     *                    @type string default_value The default value for the input on the add listing page.
670
-     *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
671
-     *                    @type bool is_required If true the field will be required on the add listing page.
672
-     *                    @type string option_values The option values for select and multiselect only
673
-     *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
674
-     *                    @type string validation_msg HTML5 validation message (text input only by default).
675
-     *                    @type string required_msg Required warning message.
676
-     *                    @type string field_icon Icon url or font awesome class.
677
-     *                    @type string css_class Field custom css class for field custom style.
678
-     *                    @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.
679
-     *                    @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)
680
-     *     }
681
-     * }
682
-     * @param string $post_type The post type requested.
683
-     */
684
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
551
+	$custom_fields = array(
552
+		'text' => array(
553
+			'field_type'  =>  'text',
554
+			'class' =>  'gd-text',
555
+			'icon'  =>  'fa fa-minus',
556
+			'name'  =>  __('Text', 'geodirectory'),
557
+			'description' =>  __('Add any sort of text field, text or numbers', 'geodirectory')
558
+		),
559
+		'datepicker' => array(
560
+			'field_type'  =>  'datepicker',
561
+			'class' =>  'gd-datepicker',
562
+			'icon'  =>  'fa fa-calendar',
563
+			'name'  =>  __('Date', 'geodirectory'),
564
+			'description' =>  __('Adds a date picker.', 'geodirectory')
565
+		),
566
+		'textarea' => array(
567
+			'field_type'  =>  'textarea',
568
+			'class' =>  'gd-textarea',
569
+			'icon'  =>  'fa fa-bars',
570
+			'name'  =>  __('Textarea', 'geodirectory'),
571
+			'description' =>  __('Adds a textarea', 'geodirectory')
572
+		),
573
+		'time' => array(
574
+			'field_type'  =>  'time',
575
+			'class' =>  'gd-time',
576
+			'icon' =>  'fa fa-clock-o',
577
+			'name'  =>  __('Time', 'geodirectory'),
578
+			'description' =>  __('Adds a time picker', 'geodirectory')
579
+		),
580
+		'checkbox' => array(
581
+			'field_type'  =>  'checkbox',
582
+			'class' =>  'gd-checkbox',
583
+			'icon' =>  'fa fa-check-square-o',
584
+			'name'  =>  __('Checkbox', 'geodirectory'),
585
+			'description' =>  __('Adds a checkbox', 'geodirectory')
586
+		),
587
+		'phone' => array(
588
+			'field_type'  =>  'phone',
589
+			'class' =>  'gd-phone',
590
+			'icon' =>  'fa fa-phone',
591
+			'name'  =>  __('Phone', 'geodirectory'),
592
+			'description' =>  __('Adds a phone input', 'geodirectory')
593
+		),
594
+		'radio' => array(
595
+			'field_type'  =>  'radio',
596
+			'class' =>  'gd-radio',
597
+			'icon' =>  'fa fa-dot-circle-o',
598
+			'name'  =>  __('Radio', 'geodirectory'),
599
+			'description' =>  __('Adds a radio input', 'geodirectory')
600
+		),
601
+		'email' => array(
602
+			'field_type'  =>  'email',
603
+			'class' =>  'gd-email',
604
+			'icon' =>  'fa fa-envelope-o',
605
+			'name'  =>  __('Email', 'geodirectory'),
606
+			'description' =>  __('Adds a email input', 'geodirectory')
607
+		),
608
+		'select' => array(
609
+			'field_type'  =>  'select',
610
+			'class' =>  'gd-select',
611
+			'icon' =>  'fa fa-caret-square-o-down',
612
+			'name'  =>  __('Select', 'geodirectory'),
613
+			'description' =>  __('Adds a select input', 'geodirectory')
614
+		),
615
+		'multiselect' => array(
616
+			'field_type'  =>  'multiselect',
617
+			'class' =>  'gd-multiselect',
618
+			'icon' =>  'fa fa-caret-square-o-down',
619
+			'name'  =>  __('Multi Select', 'geodirectory'),
620
+			'description' =>  __('Adds a multiselect input', 'geodirectory')
621
+		),
622
+		'url' => array(
623
+			'field_type'  =>  'url',
624
+			'class' =>  'gd-url',
625
+			'icon' =>  'fa fa-link',
626
+			'name'  =>  __('URL', 'geodirectory'),
627
+			'description' =>  __('Adds a url input', 'geodirectory')
628
+		),
629
+		'html' => array(
630
+			'field_type'  =>  'html',
631
+			'class' =>  'gd-html',
632
+			'icon' =>  'fa fa-code',
633
+			'name'  =>  __('HTML', 'geodirectory'),
634
+			'description' =>  __('Adds a html input textarea', 'geodirectory')
635
+		),
636
+		'file' => array(
637
+			'field_type'  =>  'file',
638
+			'class' =>  'gd-file',
639
+			'icon' =>  'fa fa-file',
640
+			'name'  =>  __('File Upload', 'geodirectory'),
641
+			'description' =>  __('Adds a file input', 'geodirectory')
642
+		)
643
+	);
644
+
645
+	/**
646
+	 * Filter the custom fields array to be able to add or remove items.
647
+	 * 
648
+	 * @since 1.6.6
649
+	 *
650
+	 * @param array $custom_fields {
651
+	 *     The custom fields array to be filtered.
652
+	 *
653
+	 *     @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
654
+	 *     @type string $class The class for the field in backend.
655
+	 *     @type string $icon Can be font-awesome class name or icon image url.
656
+	 *     @type string $name The name of the field.
657
+	 *     @type string $description A short description about the field.
658
+	 *     @type array $defaults {
659
+	 *                    Optional. Used to set the default value of the field.
660
+	 *
661
+	 *                    @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
662
+	 *                    @type int decimal_point limit if using FLOAT data_type
663
+	 *                    @type string admin_title The admin title for the field.
664
+	 *                    @type string site_title This will be the title for the field on the frontend.
665
+	 *                    @type string admin_desc This will be shown below the field on the add listing form.
666
+	 *                    @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
667
+	 *                    @type bool is_active If false the field will not be displayed anywhere.
668
+	 *                    @type bool for_admin_use If true then only site admin can see and edit this field.
669
+	 *                    @type string default_value The default value for the input on the add listing page.
670
+	 *                    @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
671
+	 *                    @type bool is_required If true the field will be required on the add listing page.
672
+	 *                    @type string option_values The option values for select and multiselect only
673
+	 *                    @type string validation_pattern HTML5 validation pattern (text input only by default).
674
+	 *                    @type string validation_msg HTML5 validation message (text input only by default).
675
+	 *                    @type string required_msg Required warning message.
676
+	 *                    @type string field_icon Icon url or font awesome class.
677
+	 *                    @type string css_class Field custom css class for field custom style.
678
+	 *                    @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.
679
+	 *                    @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)
680
+	 *     }
681
+	 * }
682
+	 * @param string $post_type The post type requested.
683
+	 */
684
+	return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
685 685
 }
686 686
 
687 687
 /**
@@ -694,19 +694,19 @@  discard block
 block discarded – undo
694 694
  */
695 695
 function geodir_custom_available_fields($type='')
696 696
 {
697
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
698
-    ?>
697
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
698
+	?>
699 699
     <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
700 700
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
701 701
 
702 702
         <?php
703
-        if($type=='predefined'){
704
-            $cfs = geodir_custom_fields_predefined($listing_type);
705
-        }elseif($type=='custom'){
706
-            $cfs = geodir_custom_fields_custom($listing_type);
707
-        }else{
708
-            $cfs = geodir_custom_fields($listing_type);
709
-            ?>
703
+		if($type=='predefined'){
704
+			$cfs = geodir_custom_fields_predefined($listing_type);
705
+		}elseif($type=='custom'){
706
+			$cfs = geodir_custom_fields_custom($listing_type);
707
+		}else{
708
+			$cfs = geodir_custom_fields($listing_type);
709
+			?>
710 710
             <ul class="full gd-cf-tooltip-wrap">
711 711
                 <li>
712 712
                     <div class="gdcf-tooltip">
@@ -727,18 +727,18 @@  discard block
 block discarded – undo
727 727
             </ul>
728 728
 
729 729
             <?php
730
-        }
730
+		}
731 731
 
732
-    if(!empty($cfs)) {
733
-        echo '<ul>';
734
-        foreach ( $cfs as $id => $cf ) {
735
-            ?>
732
+	if(!empty($cfs)) {
733
+		echo '<ul>';
734
+		foreach ( $cfs as $id => $cf ) {
735
+			?>
736 736
 
737 737
             <li class="gd-cf-tooltip-wrap">
738 738
                 <?php
739
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
740
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
741
-                } ?>
739
+				if ( isset( $cf['description'] ) && $cf['description'] ) {
740
+					echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
741
+				} ?>
742 742
 
743 743
                 <a id="gd-<?php echo $id; ?>"
744 744
                    data-field-custom-type="<?php echo $type; ?>"
@@ -748,21 +748,21 @@  discard block
 block discarded – undo
748 748
                    href="javascript:void(0);">
749 749
 
750 750
                     <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
751
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
752
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
753
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
754
-                    } else {
755
-                        echo '<i class="fa fa-cog" aria-hidden="true"></i>';
756
-                    } ?>
751
+						echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
752
+					} elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
753
+						echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
754
+					} else {
755
+						echo '<i class="fa fa-cog" aria-hidden="true"></i>';
756
+					} ?>
757 757
                     <?php echo $cf['name']; ?>
758 758
                 </a>
759 759
             </li>
760 760
             <?php
761
-        }
762
-    }else{
763
-        _e('There are no custom fields here yet.', 'geodirectory');
764
-    }
765
-        ?>
761
+		}
762
+	}else{
763
+		_e('There are no custom fields here yet.', 'geodirectory');
764
+	}
765
+		?>
766 766
 
767 767
 
768 768
     </ul>
@@ -781,26 +781,26 @@  discard block
 block discarded – undo
781 781
  */
782 782
 function geodir_custom_selected_fields()
783 783
 {
784
-    $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
785
-    ?>
784
+	$listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
785
+	?>
786 786
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
787 787
     <ul class="core">
788 788
     <?php 
789
-        global $wpdb;
790
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
791
-
792
-        if (!empty($fields)) {
793
-            foreach ($fields as $field) {
794
-                //$result_str = $field->id;
795
-                $result_str = $field;
796
-                $field_type = $field->field_type;
797
-                $field_type_key = $field->field_type_key;
798
-                $field_ins_upd = 'display';
799
-
800
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
801
-            }
802
-        }
803
-        ?></ul>
789
+		global $wpdb;
790
+		$fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
791
+
792
+		if (!empty($fields)) {
793
+			foreach ($fields as $field) {
794
+				//$result_str = $field->id;
795
+				$result_str = $field;
796
+				$field_type = $field->field_type;
797
+				$field_type_key = $field->field_type_key;
798
+				$field_ins_upd = 'display';
799
+
800
+				geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
801
+			}
802
+		}
803
+		?></ul>
804 804
 <?php
805 805
 
806 806
 }
@@ -819,16 +819,16 @@  discard block
 block discarded – undo
819 819
 function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type)
820 820
 {
821 821
 
822
-    switch ($sub_tab) {
823
-        case 'custom_fields':
824
-            $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
825
-            break;
822
+	switch ($sub_tab) {
823
+		case 'custom_fields':
824
+			$heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
825
+			break;
826 826
 
827
-        case 'sorting_options':
828
-            $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
829
-            break;
830
-    }
831
-    return $heading;
827
+		case 'sorting_options':
828
+			$heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
829
+			break;
830
+	}
831
+	return $heading;
832 832
 }
833 833
 
834 834
 
@@ -846,16 +846,16 @@  discard block
 block discarded – undo
846 846
 function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type)
847 847
 {
848 848
 
849
-    switch ($sub_tab) {
850
-        case 'custom_fields':
851
-            $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
852
-            break;
849
+	switch ($sub_tab) {
850
+		case 'custom_fields':
851
+			$heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
852
+			break;
853 853
 
854
-        case 'sorting_options':
855
-            $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
856
-            break;
857
-    }
858
-    return $heading;
854
+		case 'sorting_options':
855
+			$heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
856
+			break;
857
+	}
858
+	return $heading;
859 859
 }
860 860
 
861 861
 
@@ -873,16 +873,16 @@  discard block
 block discarded – undo
873 873
 function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type)
874 874
 {
875 875
 
876
-    switch ($sub_tab) {
877
-        case 'custom_fields':
878
-            $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
879
-            break;
876
+	switch ($sub_tab) {
877
+		case 'custom_fields':
878
+			$note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
879
+			break;
880 880
 
881
-        case 'sorting_options':
882
-            $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
883
-            break;
884
-    }
885
-    return $note;
881
+		case 'sorting_options':
882
+			$note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
883
+			break;
884
+	}
885
+	return $note;
886 886
 }
887 887
 
888 888
 
@@ -900,16 +900,16 @@  discard block
 block discarded – undo
900 900
 function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type)
901 901
 {
902 902
 
903
-    switch ($sub_tab) {
904
-        case 'custom_fields':
905
-            $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
906
-            break;
903
+	switch ($sub_tab) {
904
+		case 'custom_fields':
905
+			$heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
906
+			break;
907 907
 
908
-        case 'sorting_options':
909
-            $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
910
-            break;
911
-    }
912
-    return $heading;
908
+		case 'sorting_options':
909
+			$heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
910
+			break;
911
+	}
912
+	return $heading;
913 913
 }
914 914
 
915 915
 
@@ -927,16 +927,16 @@  discard block
 block discarded – undo
927 927
 function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type)
928 928
 {
929 929
 
930
-    switch ($sub_tab) {
931
-        case 'custom_fields':
932
-            $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, false, true));
933
-            break;
930
+	switch ($sub_tab) {
931
+		case 'custom_fields':
932
+			$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, false, true));
933
+			break;
934 934
 
935
-        case 'sorting_options':
936
-            $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, false, true));
937
-            break;
938
-    }
939
-    return $note;
935
+		case 'sorting_options':
936
+			$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, false, true));
937
+			break;
938
+	}
939
+	return $note;
940 940
 }
941 941
 
942 942
 
@@ -952,16 +952,16 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_remove_unnecessary_fields()
954 954
 {
955
-    global $wpdb, $plugin_prefix;
955
+	global $wpdb, $plugin_prefix;
956 956
 
957
-    if (!get_option('geodir_remove_unnecessary_fields')) {
957
+	if (!get_option('geodir_remove_unnecessary_fields')) {
958 958
 
959
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
960
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
959
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
960
+			$wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
961 961
 
962
-        update_option('geodir_remove_unnecessary_fields', '1');
962
+		update_option('geodir_remove_unnecessary_fields', '1');
963 963
 
964
-    }
964
+	}
965 965
 
966 966
 }
967 967
 
@@ -979,28 +979,28 @@  discard block
 block discarded – undo
979 979
  */
980 980
 function geodir_admin_ajax_handler()
981 981
 {
982
-    if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
983
-        $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
984
-        $diagnose_this = "";
985
-        switch ($geodir_admin_ajax_action) {
986
-            case 'diagnosis' :
987
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
988
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
989
-                    call_user_func('geodir_diagnose_' . $diagnose_this);
990
-
991
-                }
992
-                exit();
993
-                break;
994
-
995
-            case 'diagnosis-fix' :
996
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
997
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
998
-                call_user_func('geodir_diagnose_' . $diagnose_this);
999
-                exit();
1000
-                break;
1001
-        }
1002
-    }
1003
-    exit();
982
+	if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
983
+		$geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
984
+		$diagnose_this = "";
985
+		switch ($geodir_admin_ajax_action) {
986
+			case 'diagnosis' :
987
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
988
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
989
+					call_user_func('geodir_diagnose_' . $diagnose_this);
990
+
991
+				}
992
+				exit();
993
+				break;
994
+
995
+			case 'diagnosis-fix' :
996
+				if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
997
+					$diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
998
+				call_user_func('geodir_diagnose_' . $diagnose_this);
999
+				exit();
1000
+				break;
1001
+		}
1002
+	}
1003
+	exit();
1004 1004
 }
1005 1005
 
1006 1006
 
@@ -1018,127 +1018,127 @@  discard block
 block discarded – undo
1018 1018
  */
1019 1019
 function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix)
1020 1020
 {
1021
-    global $wpdb;
1022
-    //$filter_arr['output_str'] .='###'.$table.'###';
1023
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1024
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1025
-        $filter_arr['is_error_during_diagnose'] = true;
1026
-
1027
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1028
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1029
-        $filter_arr['is_error_during_diagnose'] = true;
1030
-        $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>";
1031
-        $filter_arr['is_error_during_diagnose'] = true;
1032
-
1033
-        if ($fix) {
1034
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1035
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1036
-
1037
-            if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1038
-                //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1039
-
1040
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1041
-
1042
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1043
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1044
-                } else {
1045
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1046
-                }
1047
-
1048
-            } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1049
-
1050
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1051
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1052
-
1053
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1054
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1055
-                } else {
1056
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1057
-                }
1058
-
1059
-            } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1060
-
1061
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1062
-
1063
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1064
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1065
-                } else {
1066
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1067
-                }
1068
-
1069
-            }
1070
-
1071
-        }
1072
-
1073
-
1074
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1075
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1076
-        $filter_arr['is_error_during_diagnose'] = true;
1077
-
1078
-        if ($fix) {
1079
-            if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1080
-                if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1081
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1082
-                } else {
1083
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1084
-                }
1085
-
1086
-            } 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
1087
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1088
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1089
-                } else {
1090
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1091
-                }
1092
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1093
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1094
-                } else {
1095
-                    $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>";
1096
-                }
1097
-            } else {// else rename the original table to _ms_bak
1098
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1099
-                    $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>";
1100
-                } else {
1101
-                    $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>";
1102
-                }
1103
-            }
1104
-        }
1105
-
1106
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1107
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1108
-        $filter_arr['is_error_during_diagnose'] = true;
1109
-
1110
-        if ($fix) {
1111
-            // if original table exists but new does not, rename
1112
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1113
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1114
-            } else {
1115
-                $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>";
1116
-            }
1117
-
1118
-        }
1119
-
1120
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1121
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1122
-        $filter_arr['is_error_during_diagnose'] = true;
1123
-
1124
-        if ($fix) {
1125
-            // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1126
-            delete_option('geodirlocation_db_version');
1127
-            delete_option('geodirevents_db_version');
1128
-            delete_option('geodir_reviewrating_db_version');
1129
-            delete_option('gdevents_db_version');
1130
-            delete_option('geodirectory_db_version');
1131
-            delete_option('geodirclaim_db_version');
1132
-            delete_option('geodir_custom_posts_db_version');
1133
-            delete_option('geodir_reviewratings_db_version');
1134
-            delete_option('geodiradvancesearch_db_version');
1135
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1136
-        }
1137
-
1138
-    } else {
1139
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1140
-    }
1141
-    return $filter_arr;
1021
+	global $wpdb;
1022
+	//$filter_arr['output_str'] .='###'.$table.'###';
1023
+	if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1024
+		$filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1025
+		$filter_arr['is_error_during_diagnose'] = true;
1026
+
1027
+	} elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1028
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1029
+		$filter_arr['is_error_during_diagnose'] = true;
1030
+		$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>";
1031
+		$filter_arr['is_error_during_diagnose'] = true;
1032
+
1033
+		if ($fix) {
1034
+			$ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1035
+			$new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1036
+
1037
+			if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1038
+				//$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1039
+
1040
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1041
+
1042
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1043
+					$filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1044
+				} else {
1045
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1046
+				}
1047
+
1048
+			} elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1049
+
1050
+				$wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1051
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1052
+
1053
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1054
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1055
+				} else {
1056
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1057
+				}
1058
+
1059
+			} elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1060
+
1061
+				$wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1062
+
1063
+				if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1064
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1065
+				} else {
1066
+					$filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1067
+				}
1068
+
1069
+			}
1070
+
1071
+		}
1072
+
1073
+
1074
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1075
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1076
+		$filter_arr['is_error_during_diagnose'] = true;
1077
+
1078
+		if ($fix) {
1079
+			if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1080
+				if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1081
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1082
+				} else {
1083
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1084
+				}
1085
+
1086
+			} 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
1087
+				if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1088
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1089
+				} else {
1090
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1091
+				}
1092
+				if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1093
+					$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1094
+				} else {
1095
+					$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>";
1096
+				}
1097
+			} else {// else rename the original table to _ms_bak
1098
+				if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1099
+					$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>";
1100
+				} else {
1101
+					$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>";
1102
+				}
1103
+			}
1104
+		}
1105
+
1106
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1107
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1108
+		$filter_arr['is_error_during_diagnose'] = true;
1109
+
1110
+		if ($fix) {
1111
+			// if original table exists but new does not, rename
1112
+			if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1113
+				$filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1114
+			} else {
1115
+				$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>";
1116
+			}
1117
+
1118
+		}
1119
+
1120
+	} elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1121
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1122
+		$filter_arr['is_error_during_diagnose'] = true;
1123
+
1124
+		if ($fix) {
1125
+			// if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run;
1126
+			delete_option('geodirlocation_db_version');
1127
+			delete_option('geodirevents_db_version');
1128
+			delete_option('geodir_reviewrating_db_version');
1129
+			delete_option('gdevents_db_version');
1130
+			delete_option('geodirectory_db_version');
1131
+			delete_option('geodirclaim_db_version');
1132
+			delete_option('geodir_custom_posts_db_version');
1133
+			delete_option('geodir_reviewratings_db_version');
1134
+			delete_option('geodiradvancesearch_db_version');
1135
+			$filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1136
+		}
1137
+
1138
+	} else {
1139
+		$filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1140
+	}
1141
+	return $filter_arr;
1142 1142
 }
1143 1143
 
1144 1144
 
@@ -1152,111 +1152,111 @@  discard block
 block discarded – undo
1152 1152
  */
1153 1153
 function geodir_diagnose_tags_sync()
1154 1154
 {
1155
-    global $wpdb, $plugin_prefix;
1156
-    $fix = isset($_POST['fix']) ? true : false;
1157
-    $step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0;
1158
-    $step_max_items = geodir_get_diagnose_step_max_items();
1159
-    $offset = (int) $step * $step_max_items;
1160
-    $ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false;
1161
-
1162
-    $total_listings = geodir_total_listings_count();
1163
-    $total_ptype_listings = 0;
1164
-    if ($ptype) {
1165
-        $total_ptype_listings = geodir_total_listings_count($ptype);
1166
-    }
1167
-    $max_step = ceil($total_ptype_listings / $step_max_items) - 1;
1155
+	global $wpdb, $plugin_prefix;
1156
+	$fix = isset($_POST['fix']) ? true : false;
1157
+	$step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0;
1158
+	$step_max_items = geodir_get_diagnose_step_max_items();
1159
+	$offset = (int) $step * $step_max_items;
1160
+	$ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false;
1161
+
1162
+	$total_listings = geodir_total_listings_count();
1163
+	$total_ptype_listings = 0;
1164
+	if ($ptype) {
1165
+		$total_ptype_listings = geodir_total_listings_count($ptype);
1166
+	}
1167
+	$max_step = ceil($total_ptype_listings / $step_max_items) - 1;
1168 1168
     
1169
-    //if($fix){echo 'true';}else{echo 'false';}
1170
-    $is_error_during_diagnose = false;
1171
-    $output_str = '';
1169
+	//if($fix){echo 'true';}else{echo 'false';}
1170
+	$is_error_during_diagnose = false;
1171
+	$output_str = '';
1172 1172
     
1173
-    if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
1174
-        $stepped_process = true;
1175
-    } else {
1176
-        $stepped_process = false;
1177
-    }
1178
-
1179
-    if ($stepped_process) {
1180
-        $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset );
1181
-        $posts = $wpdb->get_results( $sql );
1182
-
1183
-        if (!empty($posts)) {
1184
-
1185
-            foreach ($posts as $p) {
1186
-                $p->post_type = $ptype;
1187
-                $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1188
-                if (empty($raw_tags)) {
1189
-                    $post_tags = '';
1190
-                } else {
1191
-                    $post_tags = implode(",", $raw_tags);
1192
-                }
1193
-                $tablename = $plugin_prefix . $p->post_type . '_detail';
1194
-                $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1195
-
1196
-            }
1197
-            if ($step >= $max_step) {
1198
-                $output_str = "done";    
1199
-            } else {
1200
-                $output_str = $step + 1;
1201
-            }
1202
-        }
1203
-
1204
-    } else {
1205
-        $all_postypes = geodir_get_posttypes();
1206
-
1207
-        if (!empty($all_postypes)) {
1208
-            foreach ($all_postypes as $key) {
1209
-                // update each GD CPT
1210
-                $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail");
1211
-
1212
-                if (!empty($posts)) {
1213
-
1214
-                    foreach ($posts as $p) {
1215
-                        $p->post_type = $key;
1216
-                        $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1217
-                        if (empty($raw_tags)) {
1218
-                            $post_tags = '';
1219
-                        } else {
1220
-                            $post_tags = implode(",", $raw_tags);
1221
-                        }
1222
-                        $tablename = $plugin_prefix . $p->post_type . '_detail';
1223
-                        $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1224
-
1225
-                    }
1226
-                    $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1227
-                }
1228
-
1229
-            }
1230
-
1231
-        }
1232
-    }
1233
-
1234
-
1235
-    if ($is_error_during_diagnose) {
1236
-        $info_div_class = "geodir_problem_info";
1237
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1238
-    } else {
1239
-        $info_div_class = "geodir_noproblem_info";
1240
-        $fix_button_txt = '';
1241
-    }
1242
-
1243
-    if ($stepped_process) {
1244
-        $percent = ($step/$max_step) * 100;
1245
-        if ($output_str == 'done') {
1246
-            echo $output_str;
1247
-        } else {
1248
-            $output = array(
1249
-                'step' => $output_str,
1250
-                'percent' => $percent
1251
-            );
1252
-            echo json_encode($output);
1253
-        }
1254
-    } else {
1255
-        echo "<ul class='$info_div_class'>";
1256
-        echo $output_str;
1257
-        echo $fix_button_txt;
1258
-        echo "</ul>";
1259
-    }
1173
+	if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
1174
+		$stepped_process = true;
1175
+	} else {
1176
+		$stepped_process = false;
1177
+	}
1178
+
1179
+	if ($stepped_process) {
1180
+		$sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset );
1181
+		$posts = $wpdb->get_results( $sql );
1182
+
1183
+		if (!empty($posts)) {
1184
+
1185
+			foreach ($posts as $p) {
1186
+				$p->post_type = $ptype;
1187
+				$raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1188
+				if (empty($raw_tags)) {
1189
+					$post_tags = '';
1190
+				} else {
1191
+					$post_tags = implode(",", $raw_tags);
1192
+				}
1193
+				$tablename = $plugin_prefix . $p->post_type . '_detail';
1194
+				$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1195
+
1196
+			}
1197
+			if ($step >= $max_step) {
1198
+				$output_str = "done";    
1199
+			} else {
1200
+				$output_str = $step + 1;
1201
+			}
1202
+		}
1203
+
1204
+	} else {
1205
+		$all_postypes = geodir_get_posttypes();
1206
+
1207
+		if (!empty($all_postypes)) {
1208
+			foreach ($all_postypes as $key) {
1209
+				// update each GD CPT
1210
+				$posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail");
1211
+
1212
+				if (!empty($posts)) {
1213
+
1214
+					foreach ($posts as $p) {
1215
+						$p->post_type = $key;
1216
+						$raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1217
+						if (empty($raw_tags)) {
1218
+							$post_tags = '';
1219
+						} else {
1220
+							$post_tags = implode(",", $raw_tags);
1221
+						}
1222
+						$tablename = $plugin_prefix . $p->post_type . '_detail';
1223
+						$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1224
+
1225
+					}
1226
+					$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1227
+				}
1228
+
1229
+			}
1230
+
1231
+		}
1232
+	}
1233
+
1234
+
1235
+	if ($is_error_during_diagnose) {
1236
+		$info_div_class = "geodir_problem_info";
1237
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1238
+	} else {
1239
+		$info_div_class = "geodir_noproblem_info";
1240
+		$fix_button_txt = '';
1241
+	}
1242
+
1243
+	if ($stepped_process) {
1244
+		$percent = ($step/$max_step) * 100;
1245
+		if ($output_str == 'done') {
1246
+			echo $output_str;
1247
+		} else {
1248
+			$output = array(
1249
+				'step' => $output_str,
1250
+				'percent' => $percent
1251
+			);
1252
+			echo json_encode($output);
1253
+		}
1254
+	} else {
1255
+		echo "<ul class='$info_div_class'>";
1256
+		echo $output_str;
1257
+		echo $fix_button_txt;
1258
+		echo "</ul>";
1259
+	}
1260 1260
 }
1261 1261
 
1262 1262
 /**
@@ -1271,75 +1271,75 @@  discard block
 block discarded – undo
1271 1271
  */
1272 1272
 function geodir_diagnose_cats_sync()
1273 1273
 {
1274
-    global $wpdb, $plugin_prefix;
1275
-    $fix = isset($_POST['fix']) ? true : false;
1274
+	global $wpdb, $plugin_prefix;
1275
+	$fix = isset($_POST['fix']) ? true : false;
1276 1276
 
1277
-    //if($fix){echo 'true';}else{echo 'false';}
1278
-    $is_error_during_diagnose = false;
1279
-    $output_str = '';
1277
+	//if($fix){echo 'true';}else{echo 'false';}
1278
+	$is_error_during_diagnose = false;
1279
+	$output_str = '';
1280 1280
 
1281 1281
 
1282
-    $all_postypes = geodir_get_posttypes();
1282
+	$all_postypes = geodir_get_posttypes();
1283 1283
 
1284
-    if (!empty($all_postypes)) {
1285
-        foreach ($all_postypes as $key) {
1286
-            // update each GD CTP
1287
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1284
+	if (!empty($all_postypes)) {
1285
+		foreach ($all_postypes as $key) {
1286
+			// update each GD CTP
1287
+			$posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1288 1288
 
1289
-            if (!empty($posts)) {
1289
+			if (!empty($posts)) {
1290 1290
 
1291
-                foreach ($posts as $p) {
1292
-                    $p->post_type = $key;
1293
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1291
+				foreach ($posts as $p) {
1292
+					$p->post_type = $key;
1293
+					$raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1294 1294
 
1295
-                    if (empty($raw_cats)) {
1296
-                        $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1295
+					if (empty($raw_cats)) {
1296
+						$post_categories = get_post_meta($p->post_id, 'post_categories', true);
1297 1297
 
1298
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1299
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1300
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1301
-                                if (is_numeric($cat_part)) {
1302
-                                    $raw_cats[] = (int)$cat_part;
1303
-                                }
1304
-                            }
1298
+						if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1299
+							$post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1300
+							foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1301
+								if (is_numeric($cat_part)) {
1302
+									$raw_cats[] = (int)$cat_part;
1303
+								}
1304
+							}
1305 1305
 
1306
-                        }
1306
+						}
1307 1307
 
1308
-                        if (!empty($raw_cats)) {
1309
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1308
+						if (!empty($raw_cats)) {
1309
+							$term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1310 1310
 
1311
-                        }
1311
+						}
1312 1312
 
1313
-                    }
1313
+					}
1314 1314
 
1315 1315
 
1316
-                    if (empty($raw_cats)) {
1317
-                        $post_cats = '';
1318
-                    } else {
1319
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1320
-                    }
1321
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1322
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1323
-                }
1316
+					if (empty($raw_cats)) {
1317
+						$post_cats = '';
1318
+					} else {
1319
+						$post_cats = ',' . implode(",", $raw_cats) . ',';
1320
+					}
1321
+					$tablename = $plugin_prefix . $p->post_type . '_detail';
1322
+					$wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1323
+				}
1324 1324
 
1325
-            }
1326
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1325
+			}
1326
+			$output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1327 1327
 
1328
-        }
1328
+		}
1329 1329
 
1330
-    }
1330
+	}
1331 1331
 
1332
-    if ($is_error_during_diagnose) {
1333
-        $info_div_class = "geodir_problem_info";
1334
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1335
-    } else {
1336
-        $info_div_class = "geodir_noproblem_info";
1337
-        $fix_button_txt = '';
1338
-    }
1339
-    echo "<ul class='$info_div_class'>";
1340
-    echo $output_str;
1341
-    echo $fix_button_txt;
1342
-    echo "</ul>";
1332
+	if ($is_error_during_diagnose) {
1333
+		$info_div_class = "geodir_problem_info";
1334
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1335
+	} else {
1336
+		$info_div_class = "geodir_noproblem_info";
1337
+		$fix_button_txt = '';
1338
+	}
1339
+	echo "<ul class='$info_div_class'>";
1340
+	echo $output_str;
1341
+	echo $fix_button_txt;
1342
+	echo "</ul>";
1343 1343
 
1344 1344
 }
1345 1345
 
@@ -1353,61 +1353,61 @@  discard block
 block discarded – undo
1353 1353
  */
1354 1354
 function geodir_diagnose_version_clear()
1355 1355
 {
1356
-    global $wpdb, $plugin_prefix;
1357
-    $fix = isset($_POST['fix']) ? true : false;
1358
-
1359
-    //if($fix){echo 'true';}else{echo 'false';}
1360
-    $is_error_during_diagnose = false;
1361
-    $output_str = '';
1362
-
1363
-
1364
-    $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1365
-        'Payment Manager' => 'geodir_payments_db_version',
1366
-        'GeoDirectory Framework' => 'gdf_db_version',
1367
-        'Advanced Search' => 'geodiradvancesearch_db_version',
1368
-        'Review Rating Manager' => 'geodir_reviewratings_db_version',
1369
-        'Claim Manager' => 'geodirclaim_db_version',
1370
-        'CPT Manager' => 'geodir_custom_posts_db_version',
1371
-        'Location Manager' => 'geodirlocation_db_version',
1372
-        'Payment Manager' => 'geodir_payments_db_version',
1373
-        'Events Manager' => 'geodirevents_db_version',
1374
-    );
1375
-
1376
-    /**
1377
-     * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1378
-     *
1379
-     * @since 1.0.0
1380
-     * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1381
-     */
1382
-    $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1383
-
1384
-    if (!empty($ver_arr)) {
1385
-        foreach ($ver_arr as $key => $val) {
1386
-            if (delete_option($val)) {
1387
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1388
-            } else {
1389
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1390
-            }
1391
-
1392
-        }
1393
-
1394
-        if ($output_str) {
1395
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1396
-        }
1397
-
1398
-    }
1399
-
1400
-    if ($is_error_during_diagnose) {
1401
-        $info_div_class = "geodir_problem_info";
1402
-        $fix_button_txt = "";
1403
-    } else {
1404
-        $info_div_class = "geodir_noproblem_info";
1405
-        $fix_button_txt = '';
1406
-    }
1407
-    echo "<ul class='$info_div_class'>";
1408
-    echo $output_str;
1409
-    echo $fix_button_txt;
1410
-    echo "</ul>";
1356
+	global $wpdb, $plugin_prefix;
1357
+	$fix = isset($_POST['fix']) ? true : false;
1358
+
1359
+	//if($fix){echo 'true';}else{echo 'false';}
1360
+	$is_error_during_diagnose = false;
1361
+	$output_str = '';
1362
+
1363
+
1364
+	$gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
1365
+		'Payment Manager' => 'geodir_payments_db_version',
1366
+		'GeoDirectory Framework' => 'gdf_db_version',
1367
+		'Advanced Search' => 'geodiradvancesearch_db_version',
1368
+		'Review Rating Manager' => 'geodir_reviewratings_db_version',
1369
+		'Claim Manager' => 'geodirclaim_db_version',
1370
+		'CPT Manager' => 'geodir_custom_posts_db_version',
1371
+		'Location Manager' => 'geodirlocation_db_version',
1372
+		'Payment Manager' => 'geodir_payments_db_version',
1373
+		'Events Manager' => 'geodirevents_db_version',
1374
+	);
1375
+
1376
+	/**
1377
+	 * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers.
1378
+	 *
1379
+	 * @since 1.0.0
1380
+	 * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
1381
+	 */
1382
+	$ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
1383
+
1384
+	if (!empty($ver_arr)) {
1385
+		foreach ($ver_arr as $key => $val) {
1386
+			if (delete_option($val)) {
1387
+				$output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1388
+			} else {
1389
+				$output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1390
+			}
1391
+
1392
+		}
1393
+
1394
+		if ($output_str) {
1395
+			$output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1396
+		}
1397
+
1398
+	}
1399
+
1400
+	if ($is_error_during_diagnose) {
1401
+		$info_div_class = "geodir_problem_info";
1402
+		$fix_button_txt = "";
1403
+	} else {
1404
+		$info_div_class = "geodir_noproblem_info";
1405
+		$fix_button_txt = '';
1406
+	}
1407
+	echo "<ul class='$info_div_class'>";
1408
+	echo $output_str;
1409
+	echo $fix_button_txt;
1410
+	echo "</ul>";
1411 1411
 
1412 1412
 }
1413 1413
 
@@ -1421,59 +1421,59 @@  discard block
 block discarded – undo
1421 1421
  */
1422 1422
 function geodir_diagnose_ratings()
1423 1423
 {
1424
-    global $wpdb;
1425
-    $fix = isset($_POST['fix']) ? true : false;
1426
-
1427
-    //if($fix){echo 'true';}else{echo 'false';}
1428
-    $is_error_during_diagnose = false;
1429
-    $output_str = '';
1430
-
1431
-    // check review locations
1432
-    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")) {
1433
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1434
-        $is_error_during_diagnose = true;
1435
-
1436
-        if ($fix) {
1437
-            if (geodir_fix_review_location()) {
1438
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1439
-            } else {
1440
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1441
-            }
1442
-        }
1443
-
1444
-    } else {
1445
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1446
-    }
1447
-
1448
-    // check review content
1449
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1450
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1451
-        $is_error_during_diagnose = true;
1452
-
1453
-        if ($fix) {
1454
-            if (geodir_fix_review_content()) {
1455
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1456
-            } else {
1457
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1458
-            }
1459
-        }
1460
-
1461
-    } else {
1462
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1463
-    }
1464
-
1465
-
1466
-    if ($is_error_during_diagnose) {
1467
-        $info_div_class = "geodir_problem_info";
1468
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1469
-    } else {
1470
-        $info_div_class = "geodir_noproblem_info";
1471
-        $fix_button_txt = '';
1472
-    }
1473
-    echo "<ul class='$info_div_class'>";
1474
-    echo $output_str;
1475
-    echo $fix_button_txt;
1476
-    echo "</ul>";
1424
+	global $wpdb;
1425
+	$fix = isset($_POST['fix']) ? true : false;
1426
+
1427
+	//if($fix){echo 'true';}else{echo 'false';}
1428
+	$is_error_during_diagnose = false;
1429
+	$output_str = '';
1430
+
1431
+	// check review locations
1432
+	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")) {
1433
+		$output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1434
+		$is_error_during_diagnose = true;
1435
+
1436
+		if ($fix) {
1437
+			if (geodir_fix_review_location()) {
1438
+				$output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1439
+			} else {
1440
+				$output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1441
+			}
1442
+		}
1443
+
1444
+	} else {
1445
+		$output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1446
+	}
1447
+
1448
+	// check review content
1449
+	if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1450
+		$output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1451
+		$is_error_during_diagnose = true;
1452
+
1453
+		if ($fix) {
1454
+			if (geodir_fix_review_content()) {
1455
+				$output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1456
+			} else {
1457
+				$output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1458
+			}
1459
+		}
1460
+
1461
+	} else {
1462
+		$output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1463
+	}
1464
+
1465
+
1466
+	if ($is_error_during_diagnose) {
1467
+		$info_div_class = "geodir_problem_info";
1468
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1469
+	} else {
1470
+		$info_div_class = "geodir_noproblem_info";
1471
+		$fix_button_txt = '';
1472
+	}
1473
+	echo "<ul class='$info_div_class'>";
1474
+	echo $output_str;
1475
+	echo $fix_button_txt;
1476
+	echo "</ul>";
1477 1477
 
1478 1478
 }
1479 1479
 
@@ -1487,57 +1487,57 @@  discard block
 block discarded – undo
1487 1487
  */
1488 1488
 function geodir_diagnose_multisite_conversion()
1489 1489
 {
1490
-    global $wpdb;
1491
-    $fix = isset($_POST['fix']) ? true : false;
1492
-    //if($fix){echo 'true';}else{echo 'false';}
1493
-    $is_error_during_diagnose = false;
1494
-    $output_str = '';
1495
-
1496
-    $filter_arr = array();
1497
-    $filter_arr['output_str'] = $output_str;
1498
-    $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1499
-    $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1500
-        'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1501
-        'geodir_post_icon' => __('Post icon', 'geodirectory'),
1502
-        'geodir_attachments' => __('Attachments', 'geodirectory'),
1503
-        'geodir_post_review' => __('Reviews', 'geodirectory'),
1504
-        'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1505
-        'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1506
-    );
1507
-
1508
-    // allow other addons to hook in and add their checks
1509
-
1510
-    /**
1511
-     * Filter the array of tables.
1512
-     *
1513
-     * 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.
1514
-     *
1515
-     * @since 1.0.0
1516
-     * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1517
-     */
1518
-    $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1519
-
1520
-    foreach ($table_arr as $table => $table_name) {
1521
-        // Diagnose table
1522
-        $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1523
-    }
1524
-
1525
-
1526
-    $output_str = $filter_arr['output_str'];
1527
-    $is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1528
-
1529
-
1530
-    if ($is_error_during_diagnose) {
1531
-        $info_div_class = "geodir_problem_info";
1532
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1533
-    } else {
1534
-        $info_div_class = "geodir_noproblem_info";
1535
-        $fix_button_txt = '';
1536
-    }
1537
-    echo "<ul class='$info_div_class'>";
1538
-    echo $output_str;
1539
-    echo $fix_button_txt;
1540
-    echo "</ul>";
1490
+	global $wpdb;
1491
+	$fix = isset($_POST['fix']) ? true : false;
1492
+	//if($fix){echo 'true';}else{echo 'false';}
1493
+	$is_error_during_diagnose = false;
1494
+	$output_str = '';
1495
+
1496
+	$filter_arr = array();
1497
+	$filter_arr['output_str'] = $output_str;
1498
+	$filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose;
1499
+	$table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
1500
+		'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
1501
+		'geodir_post_icon' => __('Post icon', 'geodirectory'),
1502
+		'geodir_attachments' => __('Attachments', 'geodirectory'),
1503
+		'geodir_post_review' => __('Reviews', 'geodirectory'),
1504
+		'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
1505
+		'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
1506
+	);
1507
+
1508
+	// allow other addons to hook in and add their checks
1509
+
1510
+	/**
1511
+	 * Filter the array of tables.
1512
+	 *
1513
+	 * 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.
1514
+	 *
1515
+	 * @since 1.0.0
1516
+	 * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
1517
+	 */
1518
+	$table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
1519
+
1520
+	foreach ($table_arr as $table => $table_name) {
1521
+		// Diagnose table
1522
+		$filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix);
1523
+	}
1524
+
1525
+
1526
+	$output_str = $filter_arr['output_str'];
1527
+	$is_error_during_diagnose = $filter_arr['is_error_during_diagnose'];
1528
+
1529
+
1530
+	if ($is_error_during_diagnose) {
1531
+		$info_div_class = "geodir_problem_info";
1532
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1533
+	} else {
1534
+		$info_div_class = "geodir_noproblem_info";
1535
+		$fix_button_txt = '';
1536
+	}
1537
+	echo "<ul class='$info_div_class'>";
1538
+	echo $output_str;
1539
+	echo $fix_button_txt;
1540
+	echo "</ul>";
1541 1541
 }
1542 1542
 
1543 1543
 /**
@@ -1555,39 +1555,39 @@  discard block
 block discarded – undo
1555 1555
  */
1556 1556
 function geodir_fix_virtual_page($slug, $page_title, $old_id, $option)
1557 1557
 {
1558
-    global $wpdb, $current_user;
1559
-
1560
-    if (!empty($old_id)) {
1561
-        wp_delete_post($old_id, true);
1562
-    }//delete post if already there
1563
-    else {
1564
-        $page_found = $wpdb->get_var(
1565
-            $wpdb->prepare(
1566
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1567
-                array($slug)
1568
-            )
1569
-        );
1570
-        wp_delete_post($page_found, true);
1571
-
1572
-    }
1573
-
1574
-    $page_data = array(
1575
-        'post_status' => 'publish',
1576
-        'post_type' => 'page',
1577
-        'post_author' => $current_user->ID,
1578
-        'post_name' => $slug,
1579
-        'post_title' => $page_title,
1580
-        'post_content' => '',
1581
-        'post_parent' => 0,
1582
-        'comment_status' => 'closed'
1583
-    );
1584
-    $page_id = wp_insert_post($page_data);
1585
-    update_option($option, $page_id);
1586
-    if ($page_id) {
1587
-        return true;
1588
-    } else {
1589
-        return false;
1590
-    }
1558
+	global $wpdb, $current_user;
1559
+
1560
+	if (!empty($old_id)) {
1561
+		wp_delete_post($old_id, true);
1562
+	}//delete post if already there
1563
+	else {
1564
+		$page_found = $wpdb->get_var(
1565
+			$wpdb->prepare(
1566
+				"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1567
+				array($slug)
1568
+			)
1569
+		);
1570
+		wp_delete_post($page_found, true);
1571
+
1572
+	}
1573
+
1574
+	$page_data = array(
1575
+		'post_status' => 'publish',
1576
+		'post_type' => 'page',
1577
+		'post_author' => $current_user->ID,
1578
+		'post_name' => $slug,
1579
+		'post_title' => $page_title,
1580
+		'post_content' => '',
1581
+		'post_parent' => 0,
1582
+		'comment_status' => 'closed'
1583
+	);
1584
+	$page_id = wp_insert_post($page_data);
1585
+	update_option($option, $page_id);
1586
+	if ($page_id) {
1587
+		return true;
1588
+	} else {
1589
+		return false;
1590
+	}
1591 1591
 }
1592 1592
 
1593 1593
 /**
@@ -1599,212 +1599,212 @@  discard block
 block discarded – undo
1599 1599
  */
1600 1600
 function geodir_diagnose_default_pages()
1601 1601
 {
1602
-    global $wpdb;
1603
-    $is_error_during_diagnose = false;
1604
-    $output_str = '';
1605
-    $fix = isset($_POST['fix']) ? true : false;
1606
-
1607
-    //////////////////////////////////
1608
-    /* Diagnose GD Home Page Starts */
1609
-    //////////////////////////////////
1610
-    $option_value = get_option('geodir_home_page');
1611
-    $page = get_post($option_value);
1612
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1613
-
1614
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1615
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1616
-    else {
1617
-        $is_error_during_diagnose = true;
1618
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1619
-        if ($fix) {
1620
-            if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1621
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1622
-            } else {
1623
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1624
-            }
1625
-        }
1626
-    }
1627
-
1628
-    ////////////////////////////////
1629
-    /* Diagnose GD Home Page Ends */
1630
-    ////////////////////////////////
1631
-
1632
-    //////////////////////////////////
1633
-    /* Diagnose Add Listing Page Starts */
1634
-    //////////////////////////////////
1635
-    $option_value = get_option('geodir_add_listing_page');
1636
-    $page = get_post($option_value);
1637
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1638
-
1639
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1640
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1641
-    else {
1642
-        $is_error_during_diagnose = true;
1643
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1644
-        if ($fix) {
1645
-            if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1646
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1647
-            } else {
1648
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1649
-            }
1650
-        }
1651
-    }
1652
-
1653
-    ////////////////////////////////
1654
-    /* Diagnose Add Listing Page Ends */
1655
-    ////////////////////////////////
1656
-
1657
-
1658
-    //////////////////////////////////
1659
-    /* Diagnose Listing Preview Page Starts */
1660
-    //////////////////////////////////
1661
-    $option_value = get_option('geodir_preview_page');
1662
-    $page = get_post($option_value);
1663
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1664
-
1665
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1666
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1667
-    else {
1668
-        $is_error_during_diagnose = true;
1669
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1670
-        if ($fix) {
1671
-            if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1672
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1673
-            } else {
1674
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1675
-            }
1676
-        }
1677
-    }
1678
-
1679
-    ////////////////////////////////
1680
-    /* Diagnose Listing Preview Page Ends */
1681
-    ////////////////////////////////
1682
-
1683
-    //////////////////////////////////
1684
-    /* Diagnose Listing Success Page Starts */
1685
-    //////////////////////////////////
1686
-    $option_value = get_option('geodir_success_page');
1687
-    $page = get_post($option_value);
1688
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1689
-
1690
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1691
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1692
-    else {
1693
-        $is_error_during_diagnose = true;
1694
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1695
-        if ($fix) {
1696
-            if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1697
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1698
-            } else {
1699
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1700
-            }
1701
-        }
1702
-    }
1703
-
1704
-    ////////////////////////////////
1705
-    /* Diagnose Listing Sucess Page Ends */
1706
-    ////////////////////////////////
1707
-
1708
-    //////////////////////////////////
1709
-    /* Diagnose Info Page Starts */
1710
-    //////////////////////////////////
1711
-    $option_value = get_option('geodir_info_page');
1712
-    $page = get_post($option_value);
1713
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1714
-
1715
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1716
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1717
-    else {
1718
-        $is_error_during_diagnose = true;
1719
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1720
-        if ($fix) {
1721
-            if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1722
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1723
-            } else {
1724
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1725
-            }
1726
-        }
1727
-    }
1728
-
1729
-    ////////////////////////////////
1730
-    /* Diagnose Info Page Ends */
1731
-    ////////////////////////////////
1732
-
1733
-    //////////////////////////////////
1734
-    /* Diagnose Login Page Starts */
1735
-    //////////////////////////////////
1736
-    $option_value = get_option('geodir_login_page');
1737
-    $page = get_post($option_value);
1738
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1739
-
1740
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1741
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1742
-    else {
1743
-        $is_error_during_diagnose = true;
1744
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1745
-        if ($fix) {
1746
-            if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1747
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1748
-            } else {
1749
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1750
-            }
1751
-        }
1752
-    }
1753
-
1754
-    ////////////////////////////////
1755
-    /* Diagnose Info Page Ends */
1756
-    ////////////////////////////////
1757
-
1758
-    //////////////////////////////////
1759
-    /* Diagnose Location Page Starts */
1760
-    //////////////////////////////////
1761
-    $option_value = get_option('geodir_location_page');
1762
-    $page = get_post($option_value);
1763
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1764
-
1765
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1766
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1767
-    else {
1768
-        $is_error_during_diagnose = true;
1769
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1770
-        if ($fix) {
1771
-            if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1772
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1773
-            } else {
1774
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1775
-            }
1776
-        }
1777
-    }
1778
-
1779
-    ////////////////////////////////
1780
-    /* Diagnose Location Page Ends */
1781
-    ////////////////////////////////
1782
-
1783
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1784
-    /**
1785
-     * This action is called at the end of the GD Tools page check function.
1786
-     *
1787
-     * @since 1.5.2
1788
-     */
1789
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1790
-
1791
-    $output_str = $page_chk_arr['output_str'];
1792
-    $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1793
-
1794
-    if ($is_error_during_diagnose) {
1795
-        if ($fix) {
1796
-            flush_rewrite_rules();
1797
-        }
1798
-        $info_div_class = "geodir_problem_info";
1799
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1800
-    } else {
1801
-        $info_div_class = "geodir_noproblem_info";
1802
-        $fix_button_txt = '';
1803
-    }
1804
-    echo "<ul class='$info_div_class'>";
1805
-    echo $output_str;
1806
-    echo $fix_button_txt;
1807
-    echo "</ul>";
1602
+	global $wpdb;
1603
+	$is_error_during_diagnose = false;
1604
+	$output_str = '';
1605
+	$fix = isset($_POST['fix']) ? true : false;
1606
+
1607
+	//////////////////////////////////
1608
+	/* Diagnose GD Home Page Starts */
1609
+	//////////////////////////////////
1610
+	$option_value = get_option('geodir_home_page');
1611
+	$page = get_post($option_value);
1612
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1613
+
1614
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1615
+		$output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1616
+	else {
1617
+		$is_error_during_diagnose = true;
1618
+		$output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1619
+		if ($fix) {
1620
+			if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1621
+				$output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1622
+			} else {
1623
+				$output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1624
+			}
1625
+		}
1626
+	}
1627
+
1628
+	////////////////////////////////
1629
+	/* Diagnose GD Home Page Ends */
1630
+	////////////////////////////////
1631
+
1632
+	//////////////////////////////////
1633
+	/* Diagnose Add Listing Page Starts */
1634
+	//////////////////////////////////
1635
+	$option_value = get_option('geodir_add_listing_page');
1636
+	$page = get_post($option_value);
1637
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1638
+
1639
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1640
+		$output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1641
+	else {
1642
+		$is_error_during_diagnose = true;
1643
+		$output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1644
+		if ($fix) {
1645
+			if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1646
+				$output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1647
+			} else {
1648
+				$output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1649
+			}
1650
+		}
1651
+	}
1652
+
1653
+	////////////////////////////////
1654
+	/* Diagnose Add Listing Page Ends */
1655
+	////////////////////////////////
1656
+
1657
+
1658
+	//////////////////////////////////
1659
+	/* Diagnose Listing Preview Page Starts */
1660
+	//////////////////////////////////
1661
+	$option_value = get_option('geodir_preview_page');
1662
+	$page = get_post($option_value);
1663
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1664
+
1665
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1666
+		$output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1667
+	else {
1668
+		$is_error_during_diagnose = true;
1669
+		$output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1670
+		if ($fix) {
1671
+			if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1672
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1673
+			} else {
1674
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1675
+			}
1676
+		}
1677
+	}
1678
+
1679
+	////////////////////////////////
1680
+	/* Diagnose Listing Preview Page Ends */
1681
+	////////////////////////////////
1682
+
1683
+	//////////////////////////////////
1684
+	/* Diagnose Listing Success Page Starts */
1685
+	//////////////////////////////////
1686
+	$option_value = get_option('geodir_success_page');
1687
+	$page = get_post($option_value);
1688
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1689
+
1690
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1691
+		$output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1692
+	else {
1693
+		$is_error_during_diagnose = true;
1694
+		$output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1695
+		if ($fix) {
1696
+			if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1697
+				$output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1698
+			} else {
1699
+				$output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1700
+			}
1701
+		}
1702
+	}
1703
+
1704
+	////////////////////////////////
1705
+	/* Diagnose Listing Sucess Page Ends */
1706
+	////////////////////////////////
1707
+
1708
+	//////////////////////////////////
1709
+	/* Diagnose Info Page Starts */
1710
+	//////////////////////////////////
1711
+	$option_value = get_option('geodir_info_page');
1712
+	$page = get_post($option_value);
1713
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1714
+
1715
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1716
+		$output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1717
+	else {
1718
+		$is_error_during_diagnose = true;
1719
+		$output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1720
+		if ($fix) {
1721
+			if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1722
+				$output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1723
+			} else {
1724
+				$output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1725
+			}
1726
+		}
1727
+	}
1728
+
1729
+	////////////////////////////////
1730
+	/* Diagnose Info Page Ends */
1731
+	////////////////////////////////
1732
+
1733
+	//////////////////////////////////
1734
+	/* Diagnose Login Page Starts */
1735
+	//////////////////////////////////
1736
+	$option_value = get_option('geodir_login_page');
1737
+	$page = get_post($option_value);
1738
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1739
+
1740
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1741
+		$output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1742
+	else {
1743
+		$is_error_during_diagnose = true;
1744
+		$output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1745
+		if ($fix) {
1746
+			if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1747
+				$output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1748
+			} else {
1749
+				$output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1750
+			}
1751
+		}
1752
+	}
1753
+
1754
+	////////////////////////////////
1755
+	/* Diagnose Info Page Ends */
1756
+	////////////////////////////////
1757
+
1758
+	//////////////////////////////////
1759
+	/* Diagnose Location Page Starts */
1760
+	//////////////////////////////////
1761
+	$option_value = get_option('geodir_location_page');
1762
+	$page = get_post($option_value);
1763
+	if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1764
+
1765
+	if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1766
+		$output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1767
+	else {
1768
+		$is_error_during_diagnose = true;
1769
+		$output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1770
+		if ($fix) {
1771
+			if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1772
+				$output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1773
+			} else {
1774
+				$output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1775
+			}
1776
+		}
1777
+	}
1778
+
1779
+	////////////////////////////////
1780
+	/* Diagnose Location Page Ends */
1781
+	////////////////////////////////
1782
+
1783
+	$page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1784
+	/**
1785
+	 * This action is called at the end of the GD Tools page check function.
1786
+	 *
1787
+	 * @since 1.5.2
1788
+	 */
1789
+	$page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1790
+
1791
+	$output_str = $page_chk_arr['output_str'];
1792
+	$is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
1793
+
1794
+	if ($is_error_during_diagnose) {
1795
+		if ($fix) {
1796
+			flush_rewrite_rules();
1797
+		}
1798
+		$info_div_class = "geodir_problem_info";
1799
+		$fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1800
+	} else {
1801
+		$info_div_class = "geodir_noproblem_info";
1802
+		$fix_button_txt = '';
1803
+	}
1804
+	echo "<ul class='$info_div_class'>";
1805
+	echo $output_str;
1806
+	echo $fix_button_txt;
1807
+	echo "</ul>";
1808 1808
 
1809 1809
 }
1810 1810
 
@@ -1816,26 +1816,26 @@  discard block
 block discarded – undo
1816 1816
  * @global object $wpdb WordPress Database object.
1817 1817
  */
1818 1818
 function geodir_diagnose_load_db_language() {
1819
-    global $wpdb;
1819
+	global $wpdb;
1820 1820
 	
1821 1821
 	$is_error_during_diagnose = geodirectory_load_db_language();
1822 1822
 
1823
-    $output_str = '';
1824
-    $fix_button_txt = '';
1823
+	$output_str = '';
1824
+	$fix_button_txt = '';
1825 1825
 
1826
-    if ($is_error_during_diagnose) {
1827
-        $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>";
1826
+	if ($is_error_during_diagnose) {
1827
+		$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>";
1828 1828
 		$info_div_class = "geodir_problem_info";
1829
-    } else {
1830
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1829
+	} else {
1830
+		$output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1831 1831
 		$info_div_class = "geodir_noproblem_info";
1832
-        $fix_button_txt = '';
1833
-    }
1832
+		$fix_button_txt = '';
1833
+	}
1834 1834
     
1835 1835
 	echo "<ul class='$info_div_class'>";
1836
-    echo $output_str;
1837
-    echo $fix_button_txt;
1838
-    echo "</ul>";
1836
+	echo $output_str;
1837
+	echo $fix_button_txt;
1838
+	echo "</ul>";
1839 1839
 
1840 1840
 }
1841 1841
 
@@ -1866,23 +1866,23 @@  discard block
 block discarded – undo
1866 1866
  */
1867 1867
 function geodir_posts_clauses_request($clauses)
1868 1868
 {
1869
-    global $wpdb, $wp_query, $plugin_prefix;
1869
+	global $wpdb, $wp_query, $plugin_prefix;
1870 1870
 
1871
-    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'])) {
1872
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1871
+	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'])) {
1872
+		$table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1873 1873
 
1874
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1875
-        $clauses['join'] = $join;
1874
+		$join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1875
+		$clauses['join'] = $join;
1876 1876
 
1877
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1878
-        $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';
1879
-        $clauses['fields'] = $fields;
1877
+		$fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1878
+		$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';
1879
+		$clauses['fields'] = $fields;
1880 1880
 
1881
-        $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1882
-        $orderby = 'gd_expire ' . $order;
1883
-        $clauses['orderby'] = $orderby;
1884
-    }
1885
-    return $clauses;
1881
+		$order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1882
+		$orderby = 'gd_expire ' . $order;
1883
+		$clauses['orderby'] = $orderby;
1884
+	}
1885
+	return $clauses;
1886 1886
 }
1887 1887
 
1888 1888
 
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
  */
1904 1904
 function gd_theme_switch_compat_check()
1905 1905
 {
1906
-    gd_set_theme_compat();
1906
+	gd_set_theme_compat();
1907 1907
 }
1908 1908
 
1909 1909
 /**
@@ -1916,27 +1916,27 @@  discard block
 block discarded – undo
1916 1916
  */
1917 1917
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
1918 1918
 {
1919
-    if (function_exists('str_getcsv')) {
1920
-        $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1921
-    } else {
1922
-        global $current_user;
1923
-        $upload_dir = wp_upload_dir();
1924
-
1925
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1926
-        $handle = fopen($file, 'w');
1927
-
1928
-        fwrite($handle, $input);
1929
-        fclose($handle);
1930
-
1931
-        $handle = fopen($file, 'rt');
1932
-        if (PHP_VERSION >= '5.3.0') {
1933
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1934
-        } else {
1935
-            $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1936
-        }
1937
-        fclose($handle);
1938
-    }
1939
-    return $fgetcsv;
1919
+	if (function_exists('str_getcsv')) {
1920
+		$fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape);
1921
+	} else {
1922
+		global $current_user;
1923
+		$upload_dir = wp_upload_dir();
1924
+
1925
+		$file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1926
+		$handle = fopen($file, 'w');
1927
+
1928
+		fwrite($handle, $input);
1929
+		fclose($handle);
1930
+
1931
+		$handle = fopen($file, 'rt');
1932
+		if (PHP_VERSION >= '5.3.0') {
1933
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape);
1934
+		} else {
1935
+			$fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure);
1936
+		}
1937
+		fclose($handle);
1938
+	}
1939
+	return $fgetcsv;
1940 1940
 }
1941 1941
 
1942 1942
 add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
@@ -1951,375 +1951,375 @@  discard block
 block discarded – undo
1951 1951
  */
1952 1952
 function geodir_ajax_import_csv()
1953 1953
 {
1954
-    error_reporting(0); // hide error to get clean json response
1954
+	error_reporting(0); // hide error to get clean json response
1955 1955
 
1956
-    global $wpdb, $plugin_prefix, $current_user;
1957
-    $uploads = wp_upload_dir();
1958
-    ini_set('auto_detect_line_endings', true);
1956
+	global $wpdb, $plugin_prefix, $current_user;
1957
+	$uploads = wp_upload_dir();
1958
+	ini_set('auto_detect_line_endings', true);
1959 1959
 	
1960 1960
 	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1961 1961
 
1962
-    $task = isset($_POST['task']) ? $_POST['task'] : '';
1963
-    $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1964
-    $filename = $uploadedFile;
1965
-
1966
-    $uploads = wp_upload_dir();
1967
-    $uploads_dir = $uploads['path'];
1968
-    $image_name_arr = explode('/', $filename);
1969
-    $filename = end($image_name_arr);
1970
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1971
-    $return = array();
1972
-    $return['file'] = $uploadedFile;
1973
-    $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1974
-
1975
-    if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1976
-        $wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1977
-
1978
-        if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1979
-            $return['error'] = NULL;
1980
-
1981
-            $return['rows'] = 0;
1982
-
1983
-
1984
-
1985
-                if (($handle = fopen($target_path, "r")) !== FALSE) {
1986
-                    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1987
-                        if(is_array($data) && !empty($data)) {
1988
-                            $file[] = '"' . implode('","', $data) . '"';
1989
-                        }
1990
-                    }
1991
-                    fclose($handle);
1992
-                    $file = $file;
1993
-                }
1994
-
1995
-
1996
-
1997
-                $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1998
-
1999
-
2000
-            if (!$return['rows'] > 0) {
2001
-                $return['error'] = __('No data found in csv file.', 'geodirectory');
2002
-            }
2003
-        }
2004
-    }
2005
-    if ($task == 'prepare' || !empty($return['error'])) {
2006
-        echo json_encode($return);
2007
-        exit;
2008
-    }
2009
-
2010
-    $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
2011
-    $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
2012
-    $count = $importlimit;
2013
-    $requested_limit = $importlimit;
2014
-    $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
2015
-
2016
-    if ($count < $totRecords) {
2017
-        $count = $tmpCnt + $count;
2018
-        if ($count > $totRecords) {
2019
-            $count = $totRecords;
2020
-        }
2021
-    } else {
2022
-        $count = $totRecords;
2023
-    }
2024
-
2025
-    $total_records = 0;
2026
-    $rowcount = 0;
2027
-    $address_invalid = 0;
2028
-    $blank_address = 0;
2029
-    $upload_files = 0;
2030
-    $invalid_post_type = 0;
2031
-    $invalid_title = 0;
2032
-    $customKeyarray = array();
2033
-    $gd_post_info = array();
2034
-    $post_location = array();
2035
-    $countpost = 0;
2036
-
2037
-    if (!empty($file)) {
2038
-        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
2039
-        $customKeyarray = $columns;
2040
-
2041
-        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
2042
-            $return['error'] = CSV_INVAILD_FILE;
2043
-            echo json_encode($return);
2044
-            exit;
2045
-        }
2046
-
2047
-        for ($i = 1; $i <= $importlimit; $i++) {
2048
-            $current_index = $tmpCnt + $i;
2049
-            if (isset($file[$current_index])) {
2050
-                $total_records++;
2051
-
2052
-                $buffer = geodir_str_getcsv($file[$current_index]);
2053
-                $post_title = addslashes($buffer[0]);
2054
-                $current_post_author = $buffer[1];
2055
-                $post_desc = addslashes($buffer[2]);
2056
-                $post_cat = array();
2057
-                $catids_arr = array();
2058
-                $post_cat = trim($buffer[3]); // comma seperated category name
2059
-
2060
-                if ($post_cat) {
2061
-                    $post_cat_arr = explode(',', $post_cat);
2062
-
2063
-                    for ($c = 0; $c < count($post_cat_arr); $c++) {
2064
-                        $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
2065
-
2066
-                        if (!empty($buffer[5])) {
2067
-                            if (in_array($buffer[5], geodir_get_posttypes())) {
2068
-
2069
-                                $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2070
-
2071
-                                if (get_term_by('name', $catid, $p_taxonomy[0])) {
2072
-                                    $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2073
-                                    $catids_arr[] = $cat->slug;
2074
-                                } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2075
-                                    $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2076
-                                    $catids_arr[] = $cat->slug;
2077
-                                } else {
2078
-                                    $ret = wp_insert_term($catid, $p_taxonomy[0]);
2079
-                                    if ($ret && !is_wp_error($ret)) {
2080
-                                        if (get_term_by('name', $catid, $p_taxonomy[0])) {
2081
-                                            $cat = get_term_by('name', $catid, $p_taxonomy[0]);
2082
-                                            $catids_arr[] = $cat->slug;
2083
-                                        } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2084
-                                            $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2085
-                                            $catids_arr[] = $cat->slug;
2086
-                                        }
2087
-                                    }
2088
-                                }
2089
-                            }
2090
-                        }
2091
-                    }
2092
-                }
2093
-
2094
-                if (!$catids_arr) {
2095
-                    $catids_arr[] = 1;
2096
-                }
2097
-
2098
-                $post_tags = trim($buffer[4]); // comma seperated tags
2099
-
2100
-                $tag_arr = '';
2101
-                if ($post_tags) {
2102
-                    $tag_arr = explode(',', $post_tags);
2103
-                }
2104
-
2105
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2106
-
2107
-                $error = '';
2108
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2109
-                    $invalid_post_type++;
2110
-                    continue;
2111
-                }
2112
-
2113
-                if ($post_title != '') {
2114
-                    $menu_order = 0;
2115
-                    $image_folder_name = 'uplaod/';
2116
-
2117
-                    $image_names = array();
2118
-
2119
-                    for ($c = 5; $c < count($customKeyarray); $c++) {
2120
-                        $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2121
-
2122
-                        if ($customKeyarray[$c] == 'IMAGE') {
2123
-                            $buffer[$c] = trim($buffer[$c]);
2124
-
2125
-                            if (!empty($buffer[$c])) {
2126
-                                $image_names[] = $buffer[$c];
2127
-                            }
2128
-                        }
2129
-
2130
-                        if ($customKeyarray[$c] == 'alive_days') {
2131
-                            if ($buffer[$c] != '0' && $buffer[$c] != '') {
2132
-                                $submitdata = date('Y-m-d');
2133
-
2134
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2135
-                            } else {
2136
-                                $gd_post_info['expire_date'] = 'Never';
2137
-                            }
2138
-                        }
2139
-
2140
-                        if ($customKeyarray[$c] == 'post_city') {
2141
-                            $post_city = addslashes($buffer[$c]);
2142
-                        }
2143
-
2144
-                        if ($customKeyarray[$c] == 'post_region') {
2145
-                            $post_region = addslashes($buffer[$c]);
2146
-                        }
2147
-
2148
-                        if ($customKeyarray[$c] == 'post_country') {
2149
-                            $post_country = addslashes($buffer[$c]);
2150
-                        }
2151
-
2152
-                        if ($customKeyarray[$c] == 'post_latitude') {
2153
-                            $post_latitude = addslashes($buffer[$c]);
2154
-                        }
2155
-
2156
-                        if ($customKeyarray[$c] == 'post_longitude') {
2157
-                            $post_longitude = addslashes($buffer[$c]);
2158
-                        }
1962
+	$task = isset($_POST['task']) ? $_POST['task'] : '';
1963
+	$uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
1964
+	$filename = $uploadedFile;
1965
+
1966
+	$uploads = wp_upload_dir();
1967
+	$uploads_dir = $uploads['path'];
1968
+	$image_name_arr = explode('/', $filename);
1969
+	$filename = end($image_name_arr);
1970
+	$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1971
+	$return = array();
1972
+	$return['file'] = $uploadedFile;
1973
+	$return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
1974
+
1975
+	if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
1976
+		$wp_filetype = wp_check_filetype_and_ext($target_path, $filename);
1977
+
1978
+		if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
1979
+			$return['error'] = NULL;
1980
+
1981
+			$return['rows'] = 0;
1982
+
1983
+
1984
+
1985
+				if (($handle = fopen($target_path, "r")) !== FALSE) {
1986
+					while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1987
+						if(is_array($data) && !empty($data)) {
1988
+							$file[] = '"' . implode('","', $data) . '"';
1989
+						}
1990
+					}
1991
+					fclose($handle);
1992
+					$file = $file;
1993
+				}
1994
+
1995
+
1996
+
1997
+				$return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
1998
+
1999
+
2000
+			if (!$return['rows'] > 0) {
2001
+				$return['error'] = __('No data found in csv file.', 'geodirectory');
2002
+			}
2003
+		}
2004
+	}
2005
+	if ($task == 'prepare' || !empty($return['error'])) {
2006
+		echo json_encode($return);
2007
+		exit;
2008
+	}
2009
+
2010
+	$totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL;
2011
+	$importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1;
2012
+	$count = $importlimit;
2013
+	$requested_limit = $importlimit;
2014
+	$tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0;
2015
+
2016
+	if ($count < $totRecords) {
2017
+		$count = $tmpCnt + $count;
2018
+		if ($count > $totRecords) {
2019
+			$count = $totRecords;
2020
+		}
2021
+	} else {
2022
+		$count = $totRecords;
2023
+	}
2024
+
2025
+	$total_records = 0;
2026
+	$rowcount = 0;
2027
+	$address_invalid = 0;
2028
+	$blank_address = 0;
2029
+	$upload_files = 0;
2030
+	$invalid_post_type = 0;
2031
+	$invalid_title = 0;
2032
+	$customKeyarray = array();
2033
+	$gd_post_info = array();
2034
+	$post_location = array();
2035
+	$countpost = 0;
2036
+
2037
+	if (!empty($file)) {
2038
+		$columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
2039
+		$customKeyarray = $columns;
2040
+
2041
+		if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
2042
+			$return['error'] = CSV_INVAILD_FILE;
2043
+			echo json_encode($return);
2044
+			exit;
2045
+		}
2046
+
2047
+		for ($i = 1; $i <= $importlimit; $i++) {
2048
+			$current_index = $tmpCnt + $i;
2049
+			if (isset($file[$current_index])) {
2050
+				$total_records++;
2051
+
2052
+				$buffer = geodir_str_getcsv($file[$current_index]);
2053
+				$post_title = addslashes($buffer[0]);
2054
+				$current_post_author = $buffer[1];
2055
+				$post_desc = addslashes($buffer[2]);
2056
+				$post_cat = array();
2057
+				$catids_arr = array();
2058
+				$post_cat = trim($buffer[3]); // comma seperated category name
2059
+
2060
+				if ($post_cat) {
2061
+					$post_cat_arr = explode(',', $post_cat);
2062
+
2063
+					for ($c = 0; $c < count($post_cat_arr); $c++) {
2064
+						$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
2065
+
2066
+						if (!empty($buffer[5])) {
2067
+							if (in_array($buffer[5], geodir_get_posttypes())) {
2068
+
2069
+								$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
2070
+
2071
+								if (get_term_by('name', $catid, $p_taxonomy[0])) {
2072
+									$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2073
+									$catids_arr[] = $cat->slug;
2074
+								} else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
2075
+									$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2076
+									$catids_arr[] = $cat->slug;
2077
+								} else {
2078
+									$ret = wp_insert_term($catid, $p_taxonomy[0]);
2079
+									if ($ret && !is_wp_error($ret)) {
2080
+										if (get_term_by('name', $catid, $p_taxonomy[0])) {
2081
+											$cat = get_term_by('name', $catid, $p_taxonomy[0]);
2082
+											$catids_arr[] = $cat->slug;
2083
+										} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
2084
+											$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
2085
+											$catids_arr[] = $cat->slug;
2086
+										}
2087
+									}
2088
+								}
2089
+							}
2090
+						}
2091
+					}
2092
+				}
2093
+
2094
+				if (!$catids_arr) {
2095
+					$catids_arr[] = 1;
2096
+				}
2097
+
2098
+				$post_tags = trim($buffer[4]); // comma seperated tags
2099
+
2100
+				$tag_arr = '';
2101
+				if ($post_tags) {
2102
+					$tag_arr = explode(',', $post_tags);
2103
+				}
2104
+
2105
+				$table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2106
+
2107
+				$error = '';
2108
+				if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2109
+					$invalid_post_type++;
2110
+					continue;
2111
+				}
2112
+
2113
+				if ($post_title != '') {
2114
+					$menu_order = 0;
2115
+					$image_folder_name = 'uplaod/';
2116
+
2117
+					$image_names = array();
2118
+
2119
+					for ($c = 5; $c < count($customKeyarray); $c++) {
2120
+						$gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]);
2121
+
2122
+						if ($customKeyarray[$c] == 'IMAGE') {
2123
+							$buffer[$c] = trim($buffer[$c]);
2124
+
2125
+							if (!empty($buffer[$c])) {
2126
+								$image_names[] = $buffer[$c];
2127
+							}
2128
+						}
2129
+
2130
+						if ($customKeyarray[$c] == 'alive_days') {
2131
+							if ($buffer[$c] != '0' && $buffer[$c] != '') {
2132
+								$submitdata = date('Y-m-d');
2133
+
2134
+								$gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2135
+							} else {
2136
+								$gd_post_info['expire_date'] = 'Never';
2137
+							}
2138
+						}
2139
+
2140
+						if ($customKeyarray[$c] == 'post_city') {
2141
+							$post_city = addslashes($buffer[$c]);
2142
+						}
2143
+
2144
+						if ($customKeyarray[$c] == 'post_region') {
2145
+							$post_region = addslashes($buffer[$c]);
2146
+						}
2147
+
2148
+						if ($customKeyarray[$c] == 'post_country') {
2149
+							$post_country = addslashes($buffer[$c]);
2150
+						}
2151
+
2152
+						if ($customKeyarray[$c] == 'post_latitude') {
2153
+							$post_latitude = addslashes($buffer[$c]);
2154
+						}
2155
+
2156
+						if ($customKeyarray[$c] == 'post_longitude') {
2157
+							$post_longitude = addslashes($buffer[$c]);
2158
+						}
2159 2159
 						
2160 2160
 						// Post status
2161 2161
 						if ($customKeyarray[$c] == 'post_status') {
2162
-                            $post_status = sanitize_key( $buffer[$c] );
2163
-                        }
2164
-                    }
2165
-
2166
-                    /* ================ before array create ============== */
2167
-                    $location_result = geodir_get_default_location();
2168
-                    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'] == '')) {
2169
-                        $blank_address++;
2170
-                        continue;
2171
-                    } else if ($location_result->location_id == 0) {
2172
-                        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))) {
2173
-                            $address_invalid++;
2174
-                            continue;
2175
-                        }
2176
-                    }
2162
+							$post_status = sanitize_key( $buffer[$c] );
2163
+						}
2164
+					}
2165
+
2166
+					/* ================ before array create ============== */
2167
+					$location_result = geodir_get_default_location();
2168
+					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'] == '')) {
2169
+						$blank_address++;
2170
+						continue;
2171
+					} else if ($location_result->location_id == 0) {
2172
+						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))) {
2173
+							$address_invalid++;
2174
+							continue;
2175
+						}
2176
+					}
2177 2177
 					
2178 2178
 					// Default post status
2179 2179
 					$default_status = 'publish';
2180 2180
 					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2181 2181
 					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2182 2182
 
2183
-                    $my_post['post_title'] = $post_title;
2184
-                    $my_post['post_content'] = $post_desc;
2185
-                    $my_post['post_type'] = addslashes($buffer[5]);
2186
-                    $my_post['post_author'] = $current_post_author;
2187
-                    $my_post['post_status'] = $post_status;
2188
-                    $my_post['post_category'] = $catids_arr;
2189
-                    $my_post['post_tags'] = $tag_arr;
2190
-
2191
-                    $gd_post_info['post_tags'] = $tag_arr;
2192
-                    $gd_post_info['post_title'] = $post_title;
2193
-                    $gd_post_info['post_status'] = $post_status;
2194
-                    $gd_post_info['submit_time'] = time();
2195
-                    $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2196
-
2197
-                    $last_postid = wp_insert_post($my_post);
2198
-                    $countpost++;
2199
-
2200
-                    // Check if we need to save post location as new location
2201
-                    if ($location_result->location_id > 0) {
2202
-                        if (isset($post_city) && isset($post_region)) {
2203
-                            $request_info['post_location'] = array(
2204
-                                'city' => $post_city,
2205
-                                'region' => $post_region,
2206
-                                'country' => $post_country,
2207
-                                'geo_lat' => $post_latitude,
2208
-                                'geo_lng' => $post_longitude
2209
-                            );
2210
-
2211
-                            $post_location_info = $request_info['post_location'];
2212
-                            if ($location_id = geodir_add_new_location($post_location_info))
2213
-                                $post_location_id = $location_id;
2214
-                        } else {
2215
-                            $post_location_id = 0;
2216
-                        }
2217
-                    } else {
2218
-                        $post_location_id = 0;
2219
-                    }
2220
-
2221
-                    /* ------- get default package info ----- */
2222
-                    $payment_info = array();
2223
-                    $package_info = array();
2224
-
2225
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2226
-                    $package_id = '';
2227
-                    if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2228
-                        $package_id = $gd_post_info['package_id'];
2229
-                    }
2230
-
2231
-                    if (!empty($package_info)) {
2232
-                        $payment_info['package_id'] = $package_info['pid'];
2233
-
2234
-                        if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2235
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2236
-                        } else {
2237
-                            $payment_info['expire_date'] = 'Never';
2238
-                        }
2239
-
2240
-                        $gd_post_info = array_merge($gd_post_info, $payment_info);
2241
-                    }
2242
-
2243
-                    $gd_post_info['post_location_id'] = $post_location_id;
2244
-
2245
-                    $post_type = get_post_type($last_postid);
2246
-
2247
-                    $table = $plugin_prefix . $post_type . '_detail';
2248
-
2249
-                    geodir_save_post_info($last_postid, $gd_post_info);
2250
-
2251
-                    if (!empty($image_names)) {
2252
-                        $upload_files++;
2253
-                        $menu_order = 1;
2254
-
2255
-                        foreach ($image_names as $image_name) {
2256
-                            $img_name_arr = explode('.', $image_name);
2257
-
2258
-                            $uploads = wp_upload_dir();
2259
-                            $sub_dir = $uploads['subdir'];
2260
-
2261
-                            $arr_file_type = wp_check_filetype($image_name);
2262
-                            $uploaded_file_type = $arr_file_type['type'];
2263
-
2264
-                            $attachment = array();
2265
-                            $attachment['post_id'] = $last_postid;
2266
-                            $attachment['title'] = $img_name_arr[0];
2267
-                            $attachment['content'] = '';
2268
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2269
-                            $attachment['mime_type'] = $uploaded_file_type;
2270
-                            $attachment['menu_order'] = $menu_order;
2271
-                            $attachment['is_featured'] = 0;
2272
-
2273
-                            $attachment_set = '';
2274
-
2275
-                            foreach ($attachment as $key => $val) {
2276
-                                if ($val != '')
2277
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2278
-                            }
2279
-                            $attachment_set = trim($attachment_set, ", ");
2280
-
2281
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2282
-
2283
-                            if ($menu_order == 1) {
2284
-                                $post_type = get_post_type($last_postid);
2285
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2286
-                            }
2287
-                            $menu_order++;
2288
-                        }
2289
-                    }
2290
-
2291
-                    $gd_post_info['package_id'] = $package_id;
2292
-
2293
-                    /** This action is documented in geodirectory-functions/post-functions.php */
2294
-                    do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2295
-
2296
-                    if (!empty($buffer[5])) {
2297
-                        if (in_array($buffer[5], geodir_get_posttypes())) {
2298
-                            $taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2299
-                            wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2300
-                            wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2301
-
2302
-                            $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2303
-                            $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2304
-                            geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2305
-                        }
2306
-                    }
2307
-                } else {
2308
-                    $invalid_title++;
2309
-                }
2310
-            }
2311
-        }
2312
-    }
2313
-    $return['rowcount'] = $countpost;
2314
-    $return['invalidcount'] = $address_invalid;
2315
-    $return['blank_address'] = $blank_address;
2316
-    $return['upload_files'] = $upload_files;
2317
-    $return['invalid_post_type'] = $invalid_post_type;
2318
-    $return['invalid_title'] = $invalid_title;
2319
-    $return['total_records'] = $total_records;
2320
-
2321
-    echo json_encode($return);
2322
-    exit;
2183
+					$my_post['post_title'] = $post_title;
2184
+					$my_post['post_content'] = $post_desc;
2185
+					$my_post['post_type'] = addslashes($buffer[5]);
2186
+					$my_post['post_author'] = $current_post_author;
2187
+					$my_post['post_status'] = $post_status;
2188
+					$my_post['post_category'] = $catids_arr;
2189
+					$my_post['post_tags'] = $tag_arr;
2190
+
2191
+					$gd_post_info['post_tags'] = $tag_arr;
2192
+					$gd_post_info['post_title'] = $post_title;
2193
+					$gd_post_info['post_status'] = $post_status;
2194
+					$gd_post_info['submit_time'] = time();
2195
+					$gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR'];
2196
+
2197
+					$last_postid = wp_insert_post($my_post);
2198
+					$countpost++;
2199
+
2200
+					// Check if we need to save post location as new location
2201
+					if ($location_result->location_id > 0) {
2202
+						if (isset($post_city) && isset($post_region)) {
2203
+							$request_info['post_location'] = array(
2204
+								'city' => $post_city,
2205
+								'region' => $post_region,
2206
+								'country' => $post_country,
2207
+								'geo_lat' => $post_latitude,
2208
+								'geo_lng' => $post_longitude
2209
+							);
2210
+
2211
+							$post_location_info = $request_info['post_location'];
2212
+							if ($location_id = geodir_add_new_location($post_location_info))
2213
+								$post_location_id = $location_id;
2214
+						} else {
2215
+							$post_location_id = 0;
2216
+						}
2217
+					} else {
2218
+						$post_location_id = 0;
2219
+					}
2220
+
2221
+					/* ------- get default package info ----- */
2222
+					$payment_info = array();
2223
+					$package_info = array();
2224
+
2225
+					$package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2226
+					$package_id = '';
2227
+					if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2228
+						$package_id = $gd_post_info['package_id'];
2229
+					}
2230
+
2231
+					if (!empty($package_info)) {
2232
+						$payment_info['package_id'] = $package_info['pid'];
2233
+
2234
+						if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2235
+							$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2236
+						} else {
2237
+							$payment_info['expire_date'] = 'Never';
2238
+						}
2239
+
2240
+						$gd_post_info = array_merge($gd_post_info, $payment_info);
2241
+					}
2242
+
2243
+					$gd_post_info['post_location_id'] = $post_location_id;
2244
+
2245
+					$post_type = get_post_type($last_postid);
2246
+
2247
+					$table = $plugin_prefix . $post_type . '_detail';
2248
+
2249
+					geodir_save_post_info($last_postid, $gd_post_info);
2250
+
2251
+					if (!empty($image_names)) {
2252
+						$upload_files++;
2253
+						$menu_order = 1;
2254
+
2255
+						foreach ($image_names as $image_name) {
2256
+							$img_name_arr = explode('.', $image_name);
2257
+
2258
+							$uploads = wp_upload_dir();
2259
+							$sub_dir = $uploads['subdir'];
2260
+
2261
+							$arr_file_type = wp_check_filetype($image_name);
2262
+							$uploaded_file_type = $arr_file_type['type'];
2263
+
2264
+							$attachment = array();
2265
+							$attachment['post_id'] = $last_postid;
2266
+							$attachment['title'] = $img_name_arr[0];
2267
+							$attachment['content'] = '';
2268
+							$attachment['file'] = $sub_dir . '/' . $image_name;
2269
+							$attachment['mime_type'] = $uploaded_file_type;
2270
+							$attachment['menu_order'] = $menu_order;
2271
+							$attachment['is_featured'] = 0;
2272
+
2273
+							$attachment_set = '';
2274
+
2275
+							foreach ($attachment as $key => $val) {
2276
+								if ($val != '')
2277
+									$attachment_set .= $key . " = '" . $val . "', ";
2278
+							}
2279
+							$attachment_set = trim($attachment_set, ", ");
2280
+
2281
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2282
+
2283
+							if ($menu_order == 1) {
2284
+								$post_type = get_post_type($last_postid);
2285
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2286
+							}
2287
+							$menu_order++;
2288
+						}
2289
+					}
2290
+
2291
+					$gd_post_info['package_id'] = $package_id;
2292
+
2293
+					/** This action is documented in geodirectory-functions/post-functions.php */
2294
+					do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
2295
+
2296
+					if (!empty($buffer[5])) {
2297
+						if (in_array($buffer[5], geodir_get_posttypes())) {
2298
+							$taxonomies = geodir_get_posttype_info(addslashes($buffer[5]));
2299
+							wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]);
2300
+							wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]);
2301
+
2302
+							$post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : '';
2303
+							$post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : '';
2304
+							geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str);
2305
+						}
2306
+					}
2307
+				} else {
2308
+					$invalid_title++;
2309
+				}
2310
+			}
2311
+		}
2312
+	}
2313
+	$return['rowcount'] = $countpost;
2314
+	$return['invalidcount'] = $address_invalid;
2315
+	$return['blank_address'] = $blank_address;
2316
+	$return['upload_files'] = $upload_files;
2317
+	$return['invalid_post_type'] = $invalid_post_type;
2318
+	$return['invalid_title'] = $invalid_title;
2319
+	$return['total_records'] = $total_records;
2320
+
2321
+	echo json_encode($return);
2322
+	exit;
2323 2323
 }
2324 2324
 
2325 2325
 // Add the tab in left sidebar menu fro import & export page.
@@ -2339,9 +2339,9 @@  discard block
 block discarded – undo
2339 2339
  * @param $post object $post The post object of the post being saved.
2340 2340
  */
2341 2341
 function geodir_update_location_prefix($post_id,$post){
2342
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2343
-        update_option('geodir_location_prefix',$post->post_name);
2344
-    }
2342
+	if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2343
+		update_option('geodir_location_prefix',$post->post_name);
2344
+	}
2345 2345
 
2346 2346
 }
2347 2347
 
@@ -2352,50 +2352,50 @@  discard block
 block discarded – undo
2352 2352
 function geodir_ga_callback(){
2353 2353
 
2354 2354
 if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2355
-    $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2356
-    $code = "code=".$_REQUEST['code'];
2357
-    $grant_type = "&grant_type=authorization_code";
2358
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2359
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2360
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2355
+	$oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2356
+	$code = "code=".$_REQUEST['code'];
2357
+	$grant_type = "&grant_type=authorization_code";
2358
+	$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2359
+	$client_id = "&client_id=".get_option('geodir_ga_client_id');
2360
+	$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2361 2361
 
2362
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2362
+	$auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2363 2363
 
2364
-    $response = wp_remote_post($auth_url, array('timeout' => 15));
2364
+	$response = wp_remote_post($auth_url, array('timeout' => 15));
2365 2365
 
2366
-    //print_r($response);
2366
+	//print_r($response);
2367 2367
 
2368
-    $error_msg =  __('Something went wrong','geodirectory');
2369
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2368
+	$error_msg =  __('Something went wrong','geodirectory');
2369
+	if(!empty($response['response']['code']) && $response['response']['code']==200){
2370 2370
 
2371
-        $parts = json_decode($response['body']);
2372
-        //print_r($parts);
2373
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2374
-        else{
2371
+		$parts = json_decode($response['body']);
2372
+		//print_r($parts);
2373
+		if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2374
+		else{
2375 2375
 
2376
-            update_option('gd_ga_access_token', $parts->access_token);
2377
-            update_option('gd_ga_refresh_token', $parts->refresh_token);
2378
-            ?><script>window.close();</script><?php
2379
-        }
2376
+			update_option('gd_ga_access_token', $parts->access_token);
2377
+			update_option('gd_ga_refresh_token', $parts->refresh_token);
2378
+			?><script>window.close();</script><?php
2379
+		}
2380 2380
 
2381 2381
 
2382
-    }
2383
-    elseif(!empty($response['response']['code'])) {
2384
-        $parts = json_decode($response['body']);
2382
+	}
2383
+	elseif(!empty($response['response']['code'])) {
2384
+		$parts = json_decode($response['body']);
2385 2385
 
2386
-        if(isset($parts->error)){
2387
-            echo $parts->error.": ".$parts->error_description;exit;
2388
-        }else{
2389
-            echo $error_msg." - #2";exit;
2390
-        }
2386
+		if(isset($parts->error)){
2387
+			echo $parts->error.": ".$parts->error_description;exit;
2388
+		}else{
2389
+			echo $error_msg." - #2";exit;
2390
+		}
2391 2391
 
2392
-    }else{
2392
+	}else{
2393 2393
 
2394
-        echo $error_msg." - #3";exit;
2394
+		echo $error_msg." - #3";exit;
2395 2395
 
2396
-    }
2396
+	}
2397 2397
 }
2398
-    exit;
2398
+	exit;
2399 2399
 }
2400 2400
 
2401 2401
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -2411,45 +2411,45 @@  discard block
 block discarded – undo
2411 2411
  * @return array Array of settings.
2412 2412
  */
2413 2413
 function geodir_uninstall_settings($general_settings) {
2414
-    $settings   = array();
2415
-    $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2416
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2414
+	$settings   = array();
2415
+	$settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2416
+	$settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2417 2417
     
2418
-    $plugins    = get_plugins();
2419
-    $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
2418
+	$plugins    = get_plugins();
2419
+	$un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
2420 2420
     
2421
-    if (!empty($plugins) && !empty($un_plugins)) {
2422
-        foreach ($plugins as $plugin => $data) {
2423
-            $plugin_name = plugin_basename(dirname($plugin));
2421
+	if (!empty($plugins) && !empty($un_plugins)) {
2422
+		foreach ($plugins as $plugin => $data) {
2423
+			$plugin_name = plugin_basename(dirname($plugin));
2424 2424
             
2425
-            if (in_array($plugin_name, $un_plugins)) {
2426
-                $settings[] = array(
2427
-                    'type' => 'checkbox',
2428
-                    'id' => 'geodir_un_' . $plugin_name,
2429
-                    'name' => $data['Name'],
2430
-                    'desc' => __('Remove all data when deleted?', 'geodirectory'),
2431
-                    'std' => '0'
2432
-                );
2433
-            }
2434
-        }
2435
-    }
2425
+			if (in_array($plugin_name, $un_plugins)) {
2426
+				$settings[] = array(
2427
+					'type' => 'checkbox',
2428
+					'id' => 'geodir_un_' . $plugin_name,
2429
+					'name' => $data['Name'],
2430
+					'desc' => __('Remove all data when deleted?', 'geodirectory'),
2431
+					'std' => '0'
2432
+				);
2433
+			}
2434
+		}
2435
+	}
2436 2436
         
2437
-    $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
2437
+	$settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
2438 2438
     
2439
-    /**
2440
-     * Filter the uninstall settings array.
2441
-     *
2442
-     * @since 1.6.9
2443
-     *
2444
-     * @param array $settings The settings array.
2445
-     */
2446
-    $settings = apply_filters('geodir_uninstall_settings', $settings);
2439
+	/**
2440
+	 * Filter the uninstall settings array.
2441
+	 *
2442
+	 * @since 1.6.9
2443
+	 *
2444
+	 * @param array $settings The settings array.
2445
+	 */
2446
+	$settings = apply_filters('geodir_uninstall_settings', $settings);
2447 2447
     
2448
-    if (!empty($settings) && count($settings) > 3) {
2449
-        return array_merge($general_settings, $settings);
2450
-    }
2448
+	if (!empty($settings) && count($settings) > 3) {
2449
+		return array_merge($general_settings, $settings);
2450
+	}
2451 2451
     
2452
-    return $general_settings;
2452
+	return $general_settings;
2453 2453
 }
2454 2454
 add_filter('geodir_general_settings', 'geodir_uninstall_settings', 100, 1);
2455 2455
 
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
  * @since 1.6.9
2460 2460
  */
2461 2461
 function geodir_uninstall_settings_desc() {
2462
-    echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2462
+	echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2463 2463
 }
2464 2464
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2465 2465
 
@@ -2475,18 +2475,18 @@  discard block
 block discarded – undo
2475 2475
  * @return array The settings array.
2476 2476
  */
2477 2477
 function geodir_resave_settings($settings = array()) {
2478
-    if (!empty($settings) && is_array($settings)) {
2479
-        $c = 0;
2478
+	if (!empty($settings) && is_array($settings)) {
2479
+		$c = 0;
2480 2480
         
2481
-        foreach ($settings as $setting) {
2482
-            if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
2483
-                $settings[$c]['std'] = $value;
2484
-            }
2485
-            $c++;
2486
-        }
2487
-    }
2488
-
2489
-    return $settings;
2481
+		foreach ($settings as $setting) {
2482
+			if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
2483
+				$settings[$c]['std'] = $value;
2484
+			}
2485
+			$c++;
2486
+		}
2487
+	}
2488
+
2489
+	return $settings;
2490 2490
 }
2491 2491
 
2492 2492
 /**
@@ -2498,9 +2498,9 @@  discard block
 block discarded – undo
2498 2498
  * @return array The modified settings.
2499 2499
  */
2500 2500
 function geodir_core_uninstall_settings($settings) {
2501
-    $settings[] = plugin_basename(dirname(dirname(__FILE__)));
2501
+	$settings[] = plugin_basename(dirname(dirname(__FILE__)));
2502 2502
     
2503
-    return $settings;
2503
+	return $settings;
2504 2504
 }
2505 2505
 add_filter('geodir_plugins_uninstall_settings', 'geodir_core_uninstall_settings', 10, 1);
2506 2506
 
@@ -2514,32 +2514,32 @@  discard block
 block discarded – undo
2514 2514
  */
2515 2515
 function geodir_diagnose_reload_db_countries()
2516 2516
 {
2517
-    global $wpdb, $plugin_prefix;
2518
-
2519
-    $is_error_during_diagnose = false;
2520
-    $output_str = '';
2521
-
2522
-    $delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
2523
-
2524
-
2525
-    if ($delete) {
2526
-            $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
2527
-        ob_start();
2528
-        geodir_diagnose_version_clear();
2529
-        ob_end_clean();
2530
-    }else{
2531
-        $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
2532
-    }
2533
-
2534
-    if ($is_error_during_diagnose) {
2535
-        $info_div_class = "geodir_problem_info";
2536
-        $fix_button_txt = "";
2537
-    } else {
2538
-        $info_div_class = "geodir_noproblem_info";
2539
-        $fix_button_txt = '';
2540
-    }
2541
-    echo "<ul class='$info_div_class'>";
2542
-    echo $output_str;
2543
-    echo $fix_button_txt;
2544
-    echo "</ul>";
2517
+	global $wpdb, $plugin_prefix;
2518
+
2519
+	$is_error_during_diagnose = false;
2520
+	$output_str = '';
2521
+
2522
+	$delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
2523
+
2524
+
2525
+	if ($delete) {
2526
+			$output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
2527
+		ob_start();
2528
+		geodir_diagnose_version_clear();
2529
+		ob_end_clean();
2530
+	}else{
2531
+		$output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
2532
+	}
2533
+
2534
+	if ($is_error_during_diagnose) {
2535
+		$info_div_class = "geodir_problem_info";
2536
+		$fix_button_txt = "";
2537
+	} else {
2538
+		$info_div_class = "geodir_noproblem_info";
2539
+		$fix_button_txt = '';
2540
+	}
2541
+	echo "<ul class='$info_div_class'>";
2542
+	echo $output_str;
2543
+	echo $fix_button_txt;
2544
+	echo "</ul>";
2545 2545
 }
2546 2546
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +231 added lines, -231 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
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         
100 100
         // Disable VC editor for GD post types.
101 101
         if (class_exists('Vc_Role_Access_Controller')) {
102
-            add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 );
102
+            add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
103 103
         }
104 104
     }
105 105
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
127 127
 
128 128
 /* --- insert dummy post action ---*/
129
-add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
130
-add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
129
+add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
130
+add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
131 131
 
132 132
 
133 133
 /**
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 
237 237
         // Filter-Payment-Manager
238 238
 
239
-        add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
239
+        add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
240 240
 
241
-        add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
241
+        add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
242 242
 
243 243
         // no need of this box as all fields moved to main information box
244 244
         //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 }
249 249
 
250
-add_action('save_post', 'geodir_post_information_save',10,2);
250
+add_action('save_post', 'geodir_post_information_save', 10, 2);
251 251
 
252 252
 
253 253
 
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 
275 275
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
276 276
 
277
-            if(!empty($gd_taxonomy)) {
277
+            if (!empty($gd_taxonomy)) {
278 278
                 foreach ($gd_taxonomy as $tax) {
279 279
 
280
-                    remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
280
+                    remove_meta_box($tax.'div', $geodir_post_type, 'normal');
281 281
 
282 282
                 }
283 283
             }
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
 add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
364 364
 add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
365 365
 
366
-function geodir_manage_available_fields_predefined($sub_tab){
367
-    if($sub_tab=='custom_fields'){
366
+function geodir_manage_available_fields_predefined($sub_tab) {
367
+    if ($sub_tab == 'custom_fields') {
368 368
         geodir_custom_available_fields('predefined');
369 369
     }
370 370
 }
371 371
 
372
-function geodir_manage_available_fields_custom($sub_tab){
373
-    if($sub_tab=='custom_fields'){
372
+function geodir_manage_available_fields_custom($sub_tab) {
373
+    if ($sub_tab == 'custom_fields') {
374 374
         geodir_custom_available_fields('custom');
375 375
     }
376 376
 }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     global $wpdb;
441 441
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
442 442
     ?>
443
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
443
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
444 444
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
445 445
     <ul>
446 446
     <?php
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 
452 452
             $check_html_variable = $wpdb->get_var(
453 453
                 $wpdb->prepare(
454
-                    "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
454
+                    "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s",
455 455
                     array($val['htmlvar_name'], $listing_type, $val['field_type'])
456 456
                 )
457 457
             );
@@ -459,23 +459,23 @@  discard block
 block discarded – undo
459 459
             $display = $check_html_variable ? ' style="display:none;"' : '';
460 460
            ?>
461 461
 
462
-            <li   class="gd-cf-tooltip-wrap" <?php echo $display;?>>
462
+            <li   class="gd-cf-tooltip-wrap" <?php echo $display; ?>>
463 463
                 <?php
464
-                if(isset($val['description']) && $val['description']){
464
+                if (isset($val['description']) && $val['description']) {
465 465
                     echo '<div class="gdcf-tooltip">'.$val['description'].'</div>';
466 466
                 }?>
467 467
 
468
-                <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'];?>"
469
-                   title="<?php echo $val['site_title'];?>"
470
-                   class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
468
+                <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']; ?>"
469
+                   title="<?php echo $val['site_title']; ?>"
470
+                   class="gd-draggable-form-items  gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);">
471 471
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
472 472
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
473
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
473
+                    }elseif (isset($val['field_icon']) && $val['field_icon']) {
474 474
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
475
-                    }else{
475
+                    } else {
476 476
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
477 477
                     }?>
478
-                    <?php echo $val['site_title'];?>
478
+                    <?php echo $val['site_title']; ?>
479 479
                 </a>
480 480
             </li>
481 481
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     <?php 
504 504
         global $wpdb;
505 505
         
506
-        $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)));
506
+        $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)));
507 507
 
508 508
         if (!empty($fields)) {
509 509
             foreach ($fields as $field) {
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
  * @since 1.6.9
529 529
  * @package GeoDirectory
530 530
  */
531
-function geodir_custom_fields_custom($post_type=''){
531
+function geodir_custom_fields_custom($post_type = '') {
532 532
 
533 533
     $custom_fields = array();
534 534
 
535 535
     /**
536 536
      * @see `geodir_custom_fields`
537 537
      */
538
-    return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
538
+    return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
539 539
 }
540 540
 
541 541
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
  * @since 1.6.6
547 547
  * @package GeoDirectory
548 548
  */
549
-function geodir_custom_fields($post_type=''){
549
+function geodir_custom_fields($post_type = '') {
550 550
     
551 551
     $custom_fields = array(
552 552
         'text' => array(
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
      * }
682 682
      * @param string $post_type The post type requested.
683 683
      */
684
-    return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
684
+    return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
685 685
 }
686 686
 
687 687
 /**
@@ -692,25 +692,25 @@  discard block
 block discarded – undo
692 692
  * @param string $type The custom field type, predefined, custom or blank for default
693 693
  * @package GeoDirectory
694 694
  */
695
-function geodir_custom_available_fields($type='')
695
+function geodir_custom_available_fields($type = '')
696 696
 {
697 697
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
698 698
     ?>
699
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
699
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
700 700
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" />
701 701
 
702 702
         <?php
703
-        if($type=='predefined'){
703
+        if ($type == 'predefined') {
704 704
             $cfs = geodir_custom_fields_predefined($listing_type);
705
-        }elseif($type=='custom'){
705
+        }elseif ($type == 'custom') {
706 706
             $cfs = geodir_custom_fields_custom($listing_type);
707
-        }else{
707
+        } else {
708 708
             $cfs = geodir_custom_fields($listing_type);
709 709
             ?>
710 710
             <ul class="full gd-cf-tooltip-wrap">
711 711
                 <li>
712 712
                     <div class="gdcf-tooltip">
713
-                        <?php _e('This adds a section separator with a title.', 'geodirectory');?>
713
+                        <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
714 714
                     </div>
715 715
                     <a id="gt-fieldset"
716 716
                        class="gd-draggable-form-items gt-fieldset"
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 
722 722
                         <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
723 723
                         <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
724
-                        <?php _e('Fieldset (section separator)', 'geodirectory');?>
724
+                        <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
725 725
                     </a>
726 726
                 </li>
727 727
             </ul>
@@ -729,15 +729,15 @@  discard block
 block discarded – undo
729 729
             <?php
730 730
         }
731 731
 
732
-    if(!empty($cfs)) {
732
+    if (!empty($cfs)) {
733 733
         echo '<ul>';
734
-        foreach ( $cfs as $id => $cf ) {
734
+        foreach ($cfs as $id => $cf) {
735 735
             ?>
736 736
 
737 737
             <li class="gd-cf-tooltip-wrap">
738 738
                 <?php
739
-                if ( isset( $cf['description'] ) && $cf['description'] ) {
740
-                    echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>';
739
+                if (isset($cf['description']) && $cf['description']) {
740
+                    echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>';
741 741
                 } ?>
742 742
 
743 743
                 <a id="gd-<?php echo $id; ?>"
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
                    class="gd-draggable-form-items <?php echo $cf['class']; ?>"
748 748
                    href="javascript:void(0);">
749 749
 
750
-                    <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
751
-                        echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>';
752
-                    } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
753
-                        echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
750
+                    <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
751
+                        echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
752
+                    } elseif (isset($cf['icon']) && $cf['icon']) {
753
+                        echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
754 754
                     } else {
755 755
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
756 756
                     } ?>
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
             </li>
760 760
             <?php
761 761
         }
762
-    }else{
762
+    } else {
763 763
         _e('There are no custom fields here yet.', 'geodirectory');
764 764
     }
765 765
         ?>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
     <ul class="core">
788 788
     <?php 
789 789
         global $wpdb;
790
-        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
790
+        $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
791 791
 
792 792
         if (!empty($fields)) {
793 793
             foreach ($fields as $field) {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
                 $field_type_key = $field->field_type_key;
798 798
                 $field_ins_upd = 'display';
799 799
 
800
-                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key);
800
+                geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key);
801 801
             }
802 802
         }
803 803
         ?></ul>
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
 
957 957
     if (!get_option('geodir_remove_unnecessary_fields')) {
958 958
 
959
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
960
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
959
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
960
+            $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
961 961
 
962 962
         update_option('geodir_remove_unnecessary_fields', '1');
963 963
 
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
             case 'diagnosis' :
987 987
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
988 988
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
989
-                    call_user_func('geodir_diagnose_' . $diagnose_this);
989
+                    call_user_func('geodir_diagnose_'.$diagnose_this);
990 990
 
991 991
                 }
992 992
                 exit();
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
             case 'diagnosis-fix' :
996 996
                 if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
997 997
                     $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
998
-                call_user_func('geodir_diagnose_' . $diagnose_this);
998
+                call_user_func('geodir_diagnose_'.$diagnose_this);
999 999
                 exit();
1000 1000
                 break;
1001 1001
         }
@@ -1020,50 +1020,50 @@  discard block
 block discarded – undo
1020 1020
 {
1021 1021
     global $wpdb;
1022 1022
     //$filter_arr['output_str'] .='###'.$table.'###';
1023
-    if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
1024
-        $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
1023
+    if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
1024
+        $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
1025 1025
         $filter_arr['is_error_during_diagnose'] = true;
1026 1026
 
1027
-    } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1028
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
1027
+    } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1028
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
1029 1029
         $filter_arr['is_error_during_diagnose'] = true;
1030
-        $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>";
1030
+        $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>";
1031 1031
         $filter_arr['is_error_during_diagnose'] = true;
1032 1032
 
1033 1033
         if ($fix) {
1034
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
1035
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
1034
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
1035
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
1036 1036
 
1037 1037
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
1038 1038
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
1039 1039
 
1040
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
1040
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
1041 1041
 
1042
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1043
-                    $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
1042
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1043
+                    $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
1044 1044
                 } else {
1045
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1045
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1046 1046
                 }
1047 1047
 
1048 1048
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
1049 1049
 
1050
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
1051
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
1050
+                $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
1051
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
1052 1052
 
1053
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1054
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
1053
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1054
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
1055 1055
                 } else {
1056
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1056
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1057 1057
                 }
1058 1058
 
1059 1059
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
1060 1060
 
1061
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
1061
+                $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
1062 1062
 
1063
-                if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
1064
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
1063
+                if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
1064
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
1065 1065
                 } else {
1066
-                    $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
1066
+                    $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
1067 1067
                 }
1068 1068
 
1069 1069
             }
@@ -1071,54 +1071,54 @@  discard block
 block discarded – undo
1071 1071
         }
1072 1072
 
1073 1073
 
1074
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
1075
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
1074
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
1075
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
1076 1076
         $filter_arr['is_error_during_diagnose'] = true;
1077 1077
 
1078 1078
         if ($fix) {
1079 1079
             if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
1080 1080
                 if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
1081
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
1081
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
1082 1082
                 } else {
1083
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
1083
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
1084 1084
                 }
1085 1085
 
1086
-            } 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
1087
-                if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
1088
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1086
+            } 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
1087
+                if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
1088
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1089 1089
                 } else {
1090
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
1090
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
1091 1091
                 }
1092
-                if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1093
-                    $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1092
+                if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1093
+                    $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1094 1094
                 } else {
1095
-                    $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>";
1095
+                    $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>";
1096 1096
                 }
1097 1097
             } else {// else rename the original table to _ms_bak
1098
-                if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1099
-                    $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>";
1098
+                if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1099
+                    $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>";
1100 1100
                 } else {
1101
-                    $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>";
1101
+                    $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>";
1102 1102
                 }
1103 1103
             }
1104 1104
         }
1105 1105
 
1106
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1107
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
1106
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1107
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
1108 1108
         $filter_arr['is_error_during_diagnose'] = true;
1109 1109
 
1110 1110
         if ($fix) {
1111 1111
             // if original table exists but new does not, rename
1112
-            if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1113
-                $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
1112
+            if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
1113
+                $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
1114 1114
             } else {
1115
-                $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>";
1115
+                $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>";
1116 1116
             }
1117 1117
 
1118 1118
         }
1119 1119
 
1120
-    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
1121
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
1120
+    } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
1121
+        $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
1122 1122
         $filter_arr['is_error_during_diagnose'] = true;
1123 1123
 
1124 1124
         if ($fix) {
@@ -1132,11 +1132,11 @@  discard block
 block discarded – undo
1132 1132
             delete_option('geodir_custom_posts_db_version');
1133 1133
             delete_option('geodir_reviewratings_db_version');
1134 1134
             delete_option('geodiradvancesearch_db_version');
1135
-            $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
1135
+            $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
1136 1136
         }
1137 1137
 
1138 1138
     } else {
1139
-        $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
1139
+        $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
1140 1140
     }
1141 1141
     return $filter_arr;
1142 1142
 }
@@ -1177,21 +1177,21 @@  discard block
 block discarded – undo
1177 1177
     }
1178 1178
 
1179 1179
     if ($stepped_process) {
1180
-        $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset );
1181
-        $posts = $wpdb->get_results( $sql );
1180
+        $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
1181
+        $posts = $wpdb->get_results($sql);
1182 1182
 
1183 1183
         if (!empty($posts)) {
1184 1184
 
1185 1185
             foreach ($posts as $p) {
1186 1186
                 $p->post_type = $ptype;
1187
-                $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1187
+                $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1188 1188
                 if (empty($raw_tags)) {
1189 1189
                     $post_tags = '';
1190 1190
                 } else {
1191 1191
                     $post_tags = implode(",", $raw_tags);
1192 1192
                 }
1193
-                $tablename = $plugin_prefix . $p->post_type . '_detail';
1194
-                $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1193
+                $tablename = $plugin_prefix.$p->post_type.'_detail';
1194
+                $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1195 1195
 
1196 1196
             }
1197 1197
             if ($step >= $max_step) {
@@ -1207,23 +1207,23 @@  discard block
 block discarded – undo
1207 1207
         if (!empty($all_postypes)) {
1208 1208
             foreach ($all_postypes as $key) {
1209 1209
                 // update each GD CPT
1210
-                $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail");
1210
+                $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
1211 1211
 
1212 1212
                 if (!empty($posts)) {
1213 1213
 
1214 1214
                     foreach ($posts as $p) {
1215 1215
                         $p->post_type = $key;
1216
-                        $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
1216
+                        $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
1217 1217
                         if (empty($raw_tags)) {
1218 1218
                             $post_tags = '';
1219 1219
                         } else {
1220 1220
                             $post_tags = implode(",", $raw_tags);
1221 1221
                         }
1222
-                        $tablename = $plugin_prefix . $p->post_type . '_detail';
1223
-                        $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1222
+                        $tablename = $plugin_prefix.$p->post_type.'_detail';
1223
+                        $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
1224 1224
 
1225 1225
                     }
1226
-                    $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1226
+                    $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1227 1227
                 }
1228 1228
 
1229 1229
             }
@@ -1234,14 +1234,14 @@  discard block
 block discarded – undo
1234 1234
 
1235 1235
     if ($is_error_during_diagnose) {
1236 1236
         $info_div_class = "geodir_problem_info";
1237
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1237
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1238 1238
     } else {
1239 1239
         $info_div_class = "geodir_noproblem_info";
1240 1240
         $fix_button_txt = '';
1241 1241
     }
1242 1242
 
1243 1243
     if ($stepped_process) {
1244
-        $percent = ($step/$max_step) * 100;
1244
+        $percent = ($step / $max_step) * 100;
1245 1245
         if ($output_str == 'done') {
1246 1246
             echo $output_str;
1247 1247
         } else {
@@ -1284,29 +1284,29 @@  discard block
 block discarded – undo
1284 1284
     if (!empty($all_postypes)) {
1285 1285
         foreach ($all_postypes as $key) {
1286 1286
             // update each GD CTP
1287
-            $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
1287
+            $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
1288 1288
 
1289 1289
             if (!empty($posts)) {
1290 1290
 
1291 1291
                 foreach ($posts as $p) {
1292 1292
                     $p->post_type = $key;
1293
-                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
1293
+                    $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
1294 1294
 
1295 1295
                     if (empty($raw_cats)) {
1296 1296
                         $post_categories = get_post_meta($p->post_id, 'post_categories', true);
1297 1297
 
1298
-                        if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
1299
-                            $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
1300
-                            foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1298
+                        if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
1299
+                            $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
1300
+                            foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
1301 1301
                                 if (is_numeric($cat_part)) {
1302
-                                    $raw_cats[] = (int)$cat_part;
1302
+                                    $raw_cats[] = (int) $cat_part;
1303 1303
                                 }
1304 1304
                             }
1305 1305
 
1306 1306
                         }
1307 1307
 
1308 1308
                         if (!empty($raw_cats)) {
1309
-                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category');
1309
+                            $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category');
1310 1310
 
1311 1311
                         }
1312 1312
 
@@ -1316,14 +1316,14 @@  discard block
 block discarded – undo
1316 1316
                     if (empty($raw_cats)) {
1317 1317
                         $post_cats = '';
1318 1318
                     } else {
1319
-                        $post_cats = ',' . implode(",", $raw_cats) . ',';
1319
+                        $post_cats = ','.implode(",", $raw_cats).',';
1320 1320
                     }
1321
-                    $tablename = $plugin_prefix . $p->post_type . '_detail';
1322
-                    $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1321
+                    $tablename = $plugin_prefix.$p->post_type.'_detail';
1322
+                    $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
1323 1323
                 }
1324 1324
 
1325 1325
             }
1326
-            $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
1326
+            $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
1327 1327
 
1328 1328
         }
1329 1329
 
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
     if ($is_error_during_diagnose) {
1333 1333
         $info_div_class = "geodir_problem_info";
1334
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1334
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1335 1335
     } else {
1336 1336
         $info_div_class = "geodir_noproblem_info";
1337 1337
         $fix_button_txt = '';
@@ -1384,15 +1384,15 @@  discard block
 block discarded – undo
1384 1384
     if (!empty($ver_arr)) {
1385 1385
         foreach ($ver_arr as $key => $val) {
1386 1386
             if (delete_option($val)) {
1387
-                $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
1387
+                $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
1388 1388
             } else {
1389
-                $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
1389
+                $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
1390 1390
             }
1391 1391
 
1392 1392
         }
1393 1393
 
1394 1394
         if ($output_str) {
1395
-            $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
1395
+            $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
1396 1396
         }
1397 1397
 
1398 1398
     }
@@ -1429,43 +1429,43 @@  discard block
 block discarded – undo
1429 1429
     $output_str = '';
1430 1430
 
1431 1431
     // check review locations
1432
-    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")) {
1433
-        $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
1432
+    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")) {
1433
+        $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
1434 1434
         $is_error_during_diagnose = true;
1435 1435
 
1436 1436
         if ($fix) {
1437 1437
             if (geodir_fix_review_location()) {
1438
-                $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
1438
+                $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
1439 1439
             } else {
1440
-                $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
1440
+                $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
1441 1441
             }
1442 1442
         }
1443 1443
 
1444 1444
     } else {
1445
-        $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
1445
+        $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
1446 1446
     }
1447 1447
 
1448 1448
     // check review content
1449
-    if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
1450
-        $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
1449
+    if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
1450
+        $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
1451 1451
         $is_error_during_diagnose = true;
1452 1452
 
1453 1453
         if ($fix) {
1454 1454
             if (geodir_fix_review_content()) {
1455
-                $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
1455
+                $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
1456 1456
             } else {
1457
-                $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
1457
+                $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
1458 1458
             }
1459 1459
         }
1460 1460
 
1461 1461
     } else {
1462
-        $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
1462
+        $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
1463 1463
     }
1464 1464
 
1465 1465
 
1466 1466
     if ($is_error_during_diagnose) {
1467 1467
         $info_div_class = "geodir_problem_info";
1468
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1468
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
1469 1469
     } else {
1470 1470
         $info_div_class = "geodir_noproblem_info";
1471 1471
         $fix_button_txt = '';
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 
1530 1530
     if ($is_error_during_diagnose) {
1531 1531
         $info_div_class = "geodir_problem_info";
1532
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1532
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
1533 1533
     } else {
1534 1534
         $info_div_class = "geodir_noproblem_info";
1535 1535
         $fix_button_txt = '';
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
     else {
1564 1564
         $page_found = $wpdb->get_var(
1565 1565
             $wpdb->prepare(
1566
-                "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
1566
+                "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
1567 1567
                 array($slug)
1568 1568
             )
1569 1569
         );
@@ -1609,18 +1609,18 @@  discard block
 block discarded – undo
1609 1609
     //////////////////////////////////
1610 1610
     $option_value = get_option('geodir_home_page');
1611 1611
     $page = get_post($option_value);
1612
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1612
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1613 1613
 
1614
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1615
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1614
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1615
+        $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
1616 1616
     else {
1617 1617
         $is_error_during_diagnose = true;
1618
-        $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1618
+        $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
1619 1619
         if ($fix) {
1620 1620
             if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
1621
-                $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
1621
+                $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
1622 1622
             } else {
1623
-                $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
1623
+                $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
1624 1624
             }
1625 1625
         }
1626 1626
     }
@@ -1634,18 +1634,18 @@  discard block
 block discarded – undo
1634 1634
     //////////////////////////////////
1635 1635
     $option_value = get_option('geodir_add_listing_page');
1636 1636
     $page = get_post($option_value);
1637
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1637
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1638 1638
 
1639
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1640
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1639
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1640
+        $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
1641 1641
     else {
1642 1642
         $is_error_during_diagnose = true;
1643
-        $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1643
+        $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
1644 1644
         if ($fix) {
1645 1645
             if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
1646
-                $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
1646
+                $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
1647 1647
             } else {
1648
-                $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
1648
+                $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
1649 1649
             }
1650 1650
         }
1651 1651
     }
@@ -1660,18 +1660,18 @@  discard block
 block discarded – undo
1660 1660
     //////////////////////////////////
1661 1661
     $option_value = get_option('geodir_preview_page');
1662 1662
     $page = get_post($option_value);
1663
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1663
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1664 1664
 
1665
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1666
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1665
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1666
+        $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
1667 1667
     else {
1668 1668
         $is_error_during_diagnose = true;
1669
-        $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1669
+        $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
1670 1670
         if ($fix) {
1671 1671
             if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
1672
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
1672
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
1673 1673
             } else {
1674
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
1674
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
1675 1675
             }
1676 1676
         }
1677 1677
     }
@@ -1685,18 +1685,18 @@  discard block
 block discarded – undo
1685 1685
     //////////////////////////////////
1686 1686
     $option_value = get_option('geodir_success_page');
1687 1687
     $page = get_post($option_value);
1688
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1688
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1689 1689
 
1690
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1691
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1690
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1691
+        $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
1692 1692
     else {
1693 1693
         $is_error_during_diagnose = true;
1694
-        $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1694
+        $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
1695 1695
         if ($fix) {
1696 1696
             if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
1697
-                $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
1697
+                $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
1698 1698
             } else {
1699
-                $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
1699
+                $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
1700 1700
             }
1701 1701
         }
1702 1702
     }
@@ -1710,18 +1710,18 @@  discard block
 block discarded – undo
1710 1710
     //////////////////////////////////
1711 1711
     $option_value = get_option('geodir_info_page');
1712 1712
     $page = get_post($option_value);
1713
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1713
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1714 1714
 
1715
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1716
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1715
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1716
+        $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
1717 1717
     else {
1718 1718
         $is_error_during_diagnose = true;
1719
-        $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1719
+        $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
1720 1720
         if ($fix) {
1721 1721
             if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
1722
-                $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
1722
+                $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
1723 1723
             } else {
1724
-                $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
1724
+                $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
1725 1725
             }
1726 1726
         }
1727 1727
     }
@@ -1735,18 +1735,18 @@  discard block
 block discarded – undo
1735 1735
     //////////////////////////////////
1736 1736
     $option_value = get_option('geodir_login_page');
1737 1737
     $page = get_post($option_value);
1738
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1738
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1739 1739
 
1740
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1741
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1740
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1741
+        $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
1742 1742
     else {
1743 1743
         $is_error_during_diagnose = true;
1744
-        $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1744
+        $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
1745 1745
         if ($fix) {
1746 1746
             if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
1747
-                $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
1747
+                $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
1748 1748
             } else {
1749
-                $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
1749
+                $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
1750 1750
             }
1751 1751
         }
1752 1752
     }
@@ -1760,18 +1760,18 @@  discard block
 block discarded – undo
1760 1760
     //////////////////////////////////
1761 1761
     $option_value = get_option('geodir_location_page');
1762 1762
     $page = get_post($option_value);
1763
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1763
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1764 1764
 
1765
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1766
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1765
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1766
+        $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
1767 1767
     else {
1768 1768
         $is_error_during_diagnose = true;
1769
-        $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1769
+        $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
1770 1770
         if ($fix) {
1771 1771
             if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
1772
-                $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
1772
+                $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
1773 1773
             } else {
1774
-                $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
1774
+                $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
1775 1775
             }
1776 1776
         }
1777 1777
     }
@@ -1780,13 +1780,13 @@  discard block
 block discarded – undo
1780 1780
     /* Diagnose Location Page Ends */
1781 1781
     ////////////////////////////////
1782 1782
 
1783
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1783
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1784 1784
     /**
1785 1785
      * This action is called at the end of the GD Tools page check function.
1786 1786
      *
1787 1787
      * @since 1.5.2
1788 1788
      */
1789
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1789
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1790 1790
 
1791 1791
     $output_str = $page_chk_arr['output_str'];
1792 1792
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
             flush_rewrite_rules();
1797 1797
         }
1798 1798
         $info_div_class = "geodir_problem_info";
1799
-        $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1799
+        $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
1800 1800
     } else {
1801 1801
         $info_div_class = "geodir_noproblem_info";
1802 1802
         $fix_button_txt = '';
@@ -1824,10 +1824,10 @@  discard block
 block discarded – undo
1824 1824
     $fix_button_txt = '';
1825 1825
 
1826 1826
     if ($is_error_during_diagnose) {
1827
-        $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>";
1827
+        $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>";
1828 1828
 		$info_div_class = "geodir_problem_info";
1829 1829
     } else {
1830
-        $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1830
+        $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
1831 1831
 		$info_div_class = "geodir_noproblem_info";
1832 1832
         $fix_button_txt = '';
1833 1833
     }
@@ -1869,17 +1869,17 @@  discard block
 block discarded – undo
1869 1869
     global $wpdb, $wp_query, $plugin_prefix;
1870 1870
 
1871 1871
     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'])) {
1872
-        $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail';
1872
+        $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail';
1873 1873
 
1874
-        $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)';
1874
+        $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)';
1875 1875
         $clauses['join'] = $join;
1876 1876
 
1877
-        $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : '';
1877
+        $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : '';
1878 1878
         $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';
1879 1879
         $clauses['fields'] = $fields;
1880 1880
 
1881 1881
         $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC';
1882
-        $orderby = 'gd_expire ' . $order;
1882
+        $orderby = 'gd_expire '.$order;
1883 1883
         $clauses['orderby'] = $orderby;
1884 1884
     }
1885 1885
     return $clauses;
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
         global $current_user;
1923 1923
         $upload_dir = wp_upload_dir();
1924 1924
 
1925
-        $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv';
1925
+        $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv';
1926 1926
         $handle = fopen($file, 'w');
1927 1927
 
1928 1928
         fwrite($handle, $input);
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
     $uploads_dir = $uploads['path'];
1968 1968
     $image_name_arr = explode('/', $filename);
1969 1969
     $filename = end($image_name_arr);
1970
-    $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1970
+    $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1971 1971
     $return = array();
1972 1972
     $return['file'] = $uploadedFile;
1973 1973
     $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
@@ -1984,8 +1984,8 @@  discard block
 block discarded – undo
1984 1984
 
1985 1985
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1986 1986
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1987
-                        if(is_array($data) && !empty($data)) {
1988
-                            $file[] = '"' . implode('","', $data) . '"';
1987
+                        if (is_array($data) && !empty($data)) {
1988
+                            $file[] = '"'.implode('","', $data).'"';
1989 1989
                         }
1990 1990
                     }
1991 1991
                     fclose($handle);
@@ -2102,10 +2102,10 @@  discard block
 block discarded – undo
2102 2102
                     $tag_arr = explode(',', $post_tags);
2103 2103
                 }
2104 2104
 
2105
-                $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database
2105
+                $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database
2106 2106
 
2107 2107
                 $error = '';
2108
-                if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
2108
+                if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
2109 2109
                     $invalid_post_type++;
2110 2110
                     continue;
2111 2111
                 }
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
                             if ($buffer[$c] != '0' && $buffer[$c] != '') {
2132 2132
                                 $submitdata = date('Y-m-d');
2133 2133
 
2134
-                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
2134
+                                $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
2135 2135
                             } else {
2136 2136
                                 $gd_post_info['expire_date'] = 'Never';
2137 2137
                             }
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 						
2160 2160
 						// Post status
2161 2161
 						if ($customKeyarray[$c] == 'post_status') {
2162
-                            $post_status = sanitize_key( $buffer[$c] );
2162
+                            $post_status = sanitize_key($buffer[$c]);
2163 2163
                         }
2164 2164
                     }
2165 2165
 
@@ -2177,8 +2177,8 @@  discard block
 block discarded – undo
2177 2177
 					
2178 2178
 					// Default post status
2179 2179
 					$default_status = 'publish';
2180
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
2181
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
2180
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
2181
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
2182 2182
 
2183 2183
                     $my_post['post_title'] = $post_title;
2184 2184
                     $my_post['post_content'] = $post_desc;
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
                     $payment_info = array();
2223 2223
                     $package_info = array();
2224 2224
 
2225
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2225
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2226 2226
                     $package_id = '';
2227 2227
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2228 2228
                         $package_id = $gd_post_info['package_id'];
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
                         $payment_info['package_id'] = $package_info['pid'];
2233 2233
 
2234 2234
                         if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
2235
-                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
2235
+                            $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
2236 2236
                         } else {
2237 2237
                             $payment_info['expire_date'] = 'Never';
2238 2238
                         }
@@ -2244,7 +2244,7 @@  discard block
 block discarded – undo
2244 2244
 
2245 2245
                     $post_type = get_post_type($last_postid);
2246 2246
 
2247
-                    $table = $plugin_prefix . $post_type . '_detail';
2247
+                    $table = $plugin_prefix.$post_type.'_detail';
2248 2248
 
2249 2249
                     geodir_save_post_info($last_postid, $gd_post_info);
2250 2250
 
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
                             $attachment['post_id'] = $last_postid;
2266 2266
                             $attachment['title'] = $img_name_arr[0];
2267 2267
                             $attachment['content'] = '';
2268
-                            $attachment['file'] = $sub_dir . '/' . $image_name;
2268
+                            $attachment['file'] = $sub_dir.'/'.$image_name;
2269 2269
                             $attachment['mime_type'] = $uploaded_file_type;
2270 2270
                             $attachment['menu_order'] = $menu_order;
2271 2271
                             $attachment['is_featured'] = 0;
@@ -2274,15 +2274,15 @@  discard block
 block discarded – undo
2274 2274
 
2275 2275
                             foreach ($attachment as $key => $val) {
2276 2276
                                 if ($val != '')
2277
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2277
+                                    $attachment_set .= $key." = '".$val."', ";
2278 2278
                             }
2279 2279
                             $attachment_set = trim($attachment_set, ", ");
2280 2280
 
2281
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
2281
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
2282 2282
 
2283 2283
                             if ($menu_order == 1) {
2284 2284
                                 $post_type = get_post_type($last_postid);
2285
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
2285
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
2286 2286
                             }
2287 2287
                             $menu_order++;
2288 2288
                         }
@@ -2323,11 +2323,11 @@  discard block
 block discarded – undo
2323 2323
 }
2324 2324
 
2325 2325
 // Add the tab in left sidebar menu fro import & export page.
2326
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2326
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2327 2327
 
2328 2328
 // Handle ajax request for import/export.
2329
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2330
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2329
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2330
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2331 2331
 
2332 2332
 
2333 2333
 /**
@@ -2338,40 +2338,40 @@  discard block
 block discarded – undo
2338 2338
  * @param $post_id int $post_id The post ID of the post being saved.
2339 2339
  * @param $post object $post The post object of the post being saved.
2340 2340
  */
2341
-function geodir_update_location_prefix($post_id,$post){
2342
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2343
-        update_option('geodir_location_prefix',$post->post_name);
2341
+function geodir_update_location_prefix($post_id, $post) {
2342
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2343
+        update_option('geodir_location_prefix', $post->post_name);
2344 2344
     }
2345 2345
 
2346 2346
 }
2347 2347
 
2348
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2348
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2349 2349
 
2350
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2350
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2351 2351
 
2352
-function geodir_ga_callback(){
2352
+function geodir_ga_callback() {
2353 2353
 
2354
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2354
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2355 2355
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2356 2356
     $code = "code=".$_REQUEST['code'];
2357 2357
     $grant_type = "&grant_type=authorization_code";
2358
-    $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2358
+    $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
2359 2359
     $client_id = "&client_id=".get_option('geodir_ga_client_id');
2360 2360
     $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2361 2361
 
2362
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2362
+    $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret;
2363 2363
 
2364 2364
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2365 2365
 
2366 2366
     //print_r($response);
2367 2367
 
2368
-    $error_msg =  __('Something went wrong','geodirectory');
2369
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2368
+    $error_msg = __('Something went wrong', 'geodirectory');
2369
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2370 2370
 
2371 2371
         $parts = json_decode($response['body']);
2372 2372
         //print_r($parts);
2373
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2374
-        else{
2373
+        if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
2374
+        else {
2375 2375
 
2376 2376
             update_option('gd_ga_access_token', $parts->access_token);
2377 2377
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2380,18 +2380,18 @@  discard block
 block discarded – undo
2380 2380
 
2381 2381
 
2382 2382
     }
2383
-    elseif(!empty($response['response']['code'])) {
2383
+    elseif (!empty($response['response']['code'])) {
2384 2384
         $parts = json_decode($response['body']);
2385 2385
 
2386
-        if(isset($parts->error)){
2387
-            echo $parts->error.": ".$parts->error_description;exit;
2388
-        }else{
2389
-            echo $error_msg." - #2";exit;
2386
+        if (isset($parts->error)) {
2387
+            echo $parts->error.": ".$parts->error_description; exit;
2388
+        } else {
2389
+            echo $error_msg." - #2"; exit;
2390 2390
         }
2391 2391
 
2392
-    }else{
2392
+    } else {
2393 2393
 
2394
-        echo $error_msg." - #3";exit;
2394
+        echo $error_msg." - #3"; exit;
2395 2395
 
2396 2396
     }
2397 2397
 }
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 function geodir_uninstall_settings($general_settings) {
2414 2414
     $settings   = array();
2415 2415
     $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
2416
-    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
2416
+    $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
2417 2417
     
2418 2418
     $plugins    = get_plugins();
2419 2419
     $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
             if (in_array($plugin_name, $un_plugins)) {
2426 2426
                 $settings[] = array(
2427 2427
                     'type' => 'checkbox',
2428
-                    'id' => 'geodir_un_' . $plugin_name,
2428
+                    'id' => 'geodir_un_'.$plugin_name,
2429 2429
                     'name' => $data['Name'],
2430 2430
                     'desc' => __('Remove all data when deleted?', 'geodirectory'),
2431 2431
                     'std' => '0'
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
  * @since 1.6.9
2460 2460
  */
2461 2461
 function geodir_uninstall_settings_desc() {
2462
-    echo '<p class="gd-un-settings-desc">' . __('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory') . '</p>';
2462
+    echo '<p class="gd-un-settings-desc">'.__('Select the plugins that you would like to completely remove all of its data when the plugin is deleted.', 'geodirectory').'</p>';
2463 2463
 }
2464 2464
 add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
2465 2465
 
@@ -2523,12 +2523,12 @@  discard block
 block discarded – undo
2523 2523
 
2524 2524
 
2525 2525
     if ($delete) {
2526
-            $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
2526
+            $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
2527 2527
         ob_start();
2528 2528
         geodir_diagnose_version_clear();
2529 2529
         ob_end_clean();
2530
-    }else{
2531
-        $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
2530
+    } else {
2531
+        $output_str .= "<li><strong>".__('Seomething went wrong.', 'geodirectory')."</strong></li>";
2532 2532
     }
2533 2533
 
2534 2534
     if ($is_error_during_diagnose) {
Please login to merge, or discard this patch.
Braces   +61 added lines, -54 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
              *
@@ -324,8 +327,9 @@  discard block
 block discarded – undo
324 327
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
325 328
 
326 329
         foreach ($notification as $key => $value) {
327
-            if ($value['type'] == 'textarea')
328
-                $notification[$key]['type'] = 'editor';
330
+            if ($value['type'] == 'textarea') {
331
+                            $notification[$key]['type'] = 'editor';
332
+            }
329 333
         }
330 334
 
331 335
     }
@@ -350,8 +354,9 @@  discard block
 block discarded – undo
350 354
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
351 355
 
352 356
         foreach ($design_setting as $key => $value) {
353
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
354
-                $design_setting[$key]['type'] = 'editor';
357
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
358
+                            $design_setting[$key]['type'] = 'editor';
359
+            }
355 360
         }
356 361
 
357 362
     }
@@ -470,9 +475,9 @@  discard block
 block discarded – undo
470 475
                    class="gd-draggable-form-items  gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);">
471 476
                     <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
472 477
                         echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>';
473
-                    }elseif(isset($val['field_icon']) && $val['field_icon'] ){
478
+                    } elseif(isset($val['field_icon']) && $val['field_icon'] ){
474 479
                         echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
475
-                    }else{
480
+                    } else{
476 481
                         echo '<i class="fa fa-cog" aria-hidden="true"></i>';
477 482
                     }?>
478 483
                     <?php echo $val['site_title'];?>
@@ -702,9 +707,9 @@  discard block
 block discarded – undo
702 707
         <?php
703 708
         if($type=='predefined'){
704 709
             $cfs = geodir_custom_fields_predefined($listing_type);
705
-        }elseif($type=='custom'){
710
+        } elseif($type=='custom'){
706 711
             $cfs = geodir_custom_fields_custom($listing_type);
707
-        }else{
712
+        } else{
708 713
             $cfs = geodir_custom_fields($listing_type);
709 714
             ?>
710 715
             <ul class="full gd-cf-tooltip-wrap">
@@ -759,7 +764,7 @@  discard block
 block discarded – undo
759 764
             </li>
760 765
             <?php
761 766
         }
762
-    }else{
767
+    } else{
763 768
         _e('There are no custom fields here yet.', 'geodirectory');
764 769
     }
765 770
         ?>
@@ -956,8 +961,9 @@  discard block
 block discarded – undo
956 961
 
957 962
     if (!get_option('geodir_remove_unnecessary_fields')) {
958 963
 
959
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
960
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
964
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
965
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
966
+        }
961 967
 
962 968
         update_option('geodir_remove_unnecessary_fields', '1');
963 969
 
@@ -993,8 +999,9 @@  discard block
 block discarded – undo
993 999
                 break;
994 1000
 
995 1001
             case 'diagnosis-fix' :
996
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
997
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1002
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
1003
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
1004
+                }
998 1005
                 call_user_func('geodir_diagnose_' . $diagnose_this);
999 1006
                 exit();
1000 1007
                 break;
@@ -1609,11 +1616,11 @@  discard block
 block discarded – undo
1609 1616
     //////////////////////////////////
1610 1617
     $option_value = get_option('geodir_home_page');
1611 1618
     $page = get_post($option_value);
1612
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1619
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1613 1620
 
1614
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1615
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1616
-    else {
1621
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1622
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1623
+    } else {
1617 1624
         $is_error_during_diagnose = true;
1618 1625
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1619 1626
         if ($fix) {
@@ -1634,11 +1641,11 @@  discard block
 block discarded – undo
1634 1641
     //////////////////////////////////
1635 1642
     $option_value = get_option('geodir_add_listing_page');
1636 1643
     $page = get_post($option_value);
1637
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1644
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1638 1645
 
1639
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1640
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1641
-    else {
1646
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1647
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1648
+    } else {
1642 1649
         $is_error_during_diagnose = true;
1643 1650
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1644 1651
         if ($fix) {
@@ -1660,11 +1667,11 @@  discard block
 block discarded – undo
1660 1667
     //////////////////////////////////
1661 1668
     $option_value = get_option('geodir_preview_page');
1662 1669
     $page = get_post($option_value);
1663
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1670
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1664 1671
 
1665
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1666
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1667
-    else {
1672
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1673
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1674
+    } else {
1668 1675
         $is_error_during_diagnose = true;
1669 1676
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1670 1677
         if ($fix) {
@@ -1685,11 +1692,11 @@  discard block
 block discarded – undo
1685 1692
     //////////////////////////////////
1686 1693
     $option_value = get_option('geodir_success_page');
1687 1694
     $page = get_post($option_value);
1688
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1695
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1689 1696
 
1690
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1691
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1692
-    else {
1697
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1698
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1699
+    } else {
1693 1700
         $is_error_during_diagnose = true;
1694 1701
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1695 1702
         if ($fix) {
@@ -1710,11 +1717,11 @@  discard block
 block discarded – undo
1710 1717
     //////////////////////////////////
1711 1718
     $option_value = get_option('geodir_info_page');
1712 1719
     $page = get_post($option_value);
1713
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1720
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1714 1721
 
1715
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1716
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1717
-    else {
1722
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1723
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1724
+    } else {
1718 1725
         $is_error_during_diagnose = true;
1719 1726
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1720 1727
         if ($fix) {
@@ -1735,11 +1742,11 @@  discard block
 block discarded – undo
1735 1742
     //////////////////////////////////
1736 1743
     $option_value = get_option('geodir_login_page');
1737 1744
     $page = get_post($option_value);
1738
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1745
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1739 1746
 
1740
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1741
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1742
-    else {
1747
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1748
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1749
+    } else {
1743 1750
         $is_error_during_diagnose = true;
1744 1751
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1745 1752
         if ($fix) {
@@ -1760,11 +1767,11 @@  discard block
 block discarded – undo
1760 1767
     //////////////////////////////////
1761 1768
     $option_value = get_option('geodir_location_page');
1762 1769
     $page = get_post($option_value);
1763
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1770
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1764 1771
 
1765
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1766
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1767
-    else {
1772
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1773
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1774
+    } else {
1768 1775
         $is_error_during_diagnose = true;
1769 1776
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1770 1777
         if ($fix) {
@@ -2209,8 +2216,9 @@  discard block
 block discarded – undo
2209 2216
                             );
2210 2217
 
2211 2218
                             $post_location_info = $request_info['post_location'];
2212
-                            if ($location_id = geodir_add_new_location($post_location_info))
2213
-                                $post_location_id = $location_id;
2219
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
2220
+                                                            $post_location_id = $location_id;
2221
+                            }
2214 2222
                         } else {
2215 2223
                             $post_location_id = 0;
2216 2224
                         }
@@ -2273,8 +2281,9 @@  discard block
 block discarded – undo
2273 2281
                             $attachment_set = '';
2274 2282
 
2275 2283
                             foreach ($attachment as $key => $val) {
2276
-                                if ($val != '')
2277
-                                    $attachment_set .= $key . " = '" . $val . "', ";
2284
+                                if ($val != '') {
2285
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2286
+                                }
2278 2287
                             }
2279 2288
                             $attachment_set = trim($attachment_set, ", ");
2280 2289
 
@@ -2370,8 +2379,7 @@  discard block
 block discarded – undo
2370 2379
 
2371 2380
         $parts = json_decode($response['body']);
2372 2381
         //print_r($parts);
2373
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2374
-        else{
2382
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2375 2383
 
2376 2384
             update_option('gd_ga_access_token', $parts->access_token);
2377 2385
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2379,17 +2387,16 @@  discard block
 block discarded – undo
2379 2387
         }
2380 2388
 
2381 2389
 
2382
-    }
2383
-    elseif(!empty($response['response']['code'])) {
2390
+    } elseif(!empty($response['response']['code'])) {
2384 2391
         $parts = json_decode($response['body']);
2385 2392
 
2386 2393
         if(isset($parts->error)){
2387 2394
             echo $parts->error.": ".$parts->error_description;exit;
2388
-        }else{
2395
+        } else{
2389 2396
             echo $error_msg." - #2";exit;
2390 2397
         }
2391 2398
 
2392
-    }else{
2399
+    } else{
2393 2400
 
2394 2401
         echo $error_msg." - #3";exit;
2395 2402
 
@@ -2527,7 +2534,7 @@  discard block
 block discarded – undo
2527 2534
         ob_start();
2528 2535
         geodir_diagnose_version_clear();
2529 2536
         ob_end_clean();
2530
-    }else{
2537
+    } else{
2531 2538
         $output_str .= "<li><strong>" . __('Seomething went wrong.', 'geodirectory') . "</strong></li>";
2532 2539
     }
2533 2540
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 2 patches
Indentation   +549 added lines, -549 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,38 +334,38 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
337
+		case 'design_settings' :
338 338
 
339
-            add_thickbox();
340
-            geodir_admin_fields($geodir_settings['design_settings']);
339
+			add_thickbox();
340
+			geodir_admin_fields($geodir_settings['design_settings']);
341 341
 
342 342
 
343 343
 
344
-            ?>
344
+			?>
345 345
 			<p class="submit">
346 346
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
347 347
 			<input type="hidden" name="subtab" id="last_tab" />
348 348
 			</p>
349 349
 			</div>
350 350
         <?php break;
351
-        case 'permalink_settings' :
352
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351
+		case 'permalink_settings' :
352
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
353 353
             <p class="submit">
354 354
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
355 355
             <input type="hidden" name="subtab" id="last_tab" />
356 356
             </p>
357 357
             </div>	
358 358
 		<?php break;
359
-        case 'title_meta_settings' :
360
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359
+		case 'title_meta_settings' :
360
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
361 361
             <p class="submit">
362 362
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
363 363
             <input type="hidden" name="subtab" id="last_tab" />
364 364
             </p>
365 365
             </div>
366 366
 		<?php break;
367
-        case 'notifications_settings' :
368
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367
+		case 'notifications_settings' :
368
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
369 369
 			
370 370
 			<p class="submit">
371 371
 				
@@ -375,36 +375,36 @@  discard block
 block discarded – undo
375 375
 			</div>
376 376
 			
377 377
 		<?php break;
378
-        case 'default_location_settings' :
379
-            ?>
378
+		case 'default_location_settings' :
379
+			?>
380 380
             <div class="inner_content_tab_main">
381 381
                 <div class="gd-content-heading">
382 382
                     <?php global $wpdb;
383 383
 
384 384
 
385
-                    $location_result = geodir_get_default_location();
385
+					$location_result = geodir_get_default_location();
386 386
 
387
-                    $prefix = '';
387
+					$prefix = '';
388 388
 
389 389
 
390
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
391
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
392
-                    $city = isset($location_result->city) ? $location_result->city : '';
393
-                    $region = isset($location_result->region) ? $location_result->region : '';
394
-                    $country = isset($location_result->country) ? $location_result->country : '';
390
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
391
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
392
+					$city = isset($location_result->city) ? $location_result->city : '';
393
+					$region = isset($location_result->region) ? $location_result->region : '';
394
+					$country = isset($location_result->country) ? $location_result->country : '';
395 395
 
396 396
 
397
-                    $map_title = __("Set Address On Map", 'geodirectory');
397
+					$map_title = __("Set Address On Map", 'geodirectory');
398 398
 
399
-                    ?>
399
+					?>
400 400
 
401 401
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
402 402
 
403 403
                     <input type="hidden" name="add_location" value="location">
404 404
 
405 405
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
406
-                        echo $location_result->location_id;
407
-                    } ?>">
406
+						echo $location_result->location_id;
407
+					} ?>">
408 408
 
409 409
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
410 410
 
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
                                     <input class="require" type="text" size="80" style="width:440px"
418 418
                                            id="<?php echo $prefix;?>city" name="city"
419 419
                                            value="<?php if (isset($location_result->city)) {
420
-                                               echo $location_result->city;
421
-                                           } ?>"/>
420
+											   echo $location_result->city;
421
+										   } ?>"/>
422 422
 
423 423
                                     <div
424 424
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
                                     <input class="require" type="text" size="80" style="width:440px"
434 434
                                            id="<?php echo $prefix;?>region" name="region"
435 435
                                            value="<?php if (isset($location_result->region)) {
436
-                                               echo $location_result->region;
437
-                                           } ?>"/>
436
+											   echo $location_result->region;
437
+										   } ?>"/>
438 438
 
439 439
                                     <div
440 440
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
449 449
                                     <?php
450 450
 
451
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
452
-                                    ?>
451
+									$country_result = isset($location_result->country) ? $location_result->country : '';
452
+									?>
453 453
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
454 454
                                             data-location_type="country" name="<?php echo $prefix ?>country"
455 455
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -472,12 +472,12 @@  discard block
 block discarded – undo
472 472
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
473 473
                             <td class="forminp">
474 474
                                 <?php
475
-                                /**
476
-                                 * Contains add listing page map functions.
477
-                                 *
478
-                                 * @since 1.0.0
479
-                                 */
480
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
475
+								/**
476
+								 * Contains add listing page map functions.
477
+								 *
478
+								 * @since 1.0.0
479
+								 */
480
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
481 481
                             </td>
482 482
                         </tr>
483 483
                         <tr valign="top" class="single_select_page">
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
                                     <input type="text" class="require" size="80" style="width:440px"
488 488
                                            id="<?php echo $prefix;?>latitude" name="latitude"
489 489
                                            value="<?php if (isset($location_result->city_latitude)) {
490
-                                               echo $location_result->city_latitude;
491
-                                           } ?>"/>
490
+											   echo $location_result->city_latitude;
491
+										   } ?>"/>
492 492
 
493 493
                                     <div
494 494
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
                                     <input type="text" class="require" size="80" style="width:440px"
505 505
                                            id="<?php echo $prefix;?>longitude" name="longitude"
506 506
                                            value="<?php if (isset($location_result->city_longitude)) {
507
-                                               echo $location_result->city_longitude;
508
-                                           } ?>"/>
507
+											   echo $location_result->city_longitude;
508
+										   } ?>"/>
509 509
 
510 510
                                     <div
511 511
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
                 </div>
538 538
             </div>
539 539
             <?php break;
540
-        case $listing_type . '_fields_settings' :
540
+		case $listing_type . '_fields_settings' :
541 541
 
542
-            geodir_custom_post_type_form();
542
+			geodir_custom_post_type_form();
543 543
 
544
-            break;
545
-        case 'tools_settings' :
546
-            geodir_diagnostic_tools_setting_page();
547
-            break;
548
-        case 'compatibility_settings' :
549
-            geodir_theme_compatibility_setting_page();
550
-            break;		
544
+			break;
545
+		case 'tools_settings' :
546
+			geodir_diagnostic_tools_setting_page();
547
+			break;
548
+		case 'compatibility_settings' :
549
+			geodir_theme_compatibility_setting_page();
550
+			break;		
551 551
 		case 'import_export' :
552
-            geodir_import_export_page();
553
-            break;
552
+			geodir_import_export_page();
553
+			break;
554 554
 
555
-    }// end of switch
555
+	}// end of switch
556 556
 }
557 557
 
558 558
 
@@ -592,170 +592,170 @@  discard block
 block discarded – undo
592 592
 function geodir_update_options_compatibility_settings()
593 593
 {
594 594
 
595
-    global $wpdb;
595
+	global $wpdb;
596 596
 
597 597
 
598
-    $theme_settings = array();
598
+	$theme_settings = array();
599 599
 
600
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
601
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
602
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
600
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
601
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
602
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
604
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
605 605
 
606
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
607
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
608
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
606
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
607
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
608
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
609 609
 
610
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
610
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
611 611
 
612
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
613
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
614
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
612
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
613
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
614
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
615 615
 
616
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
616
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
617 617
 
618
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
619
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
620
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
618
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
619
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
620
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
622
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
623 623
 
624
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
625
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
626
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
624
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
625
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
626
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
627 627
 
628
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
628
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
629 629
 
630
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
631
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
632
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
630
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
631
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
632
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
633 633
 
634
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
634
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
635 635
 
636 636
 // Other Actions
637
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
638
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
638
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
639 639
 
640 640
 // Filters
641
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
642
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
643
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
644
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
645
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
646
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
647
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
648
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
649
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
650
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
641
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
642
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
643
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
644
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
645
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
646
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
647
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
648
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
649
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
650
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
651 651
 //location manager filters
652
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
654
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
655
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
654
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
655
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
656 656
 
657 657
 
658 658
 // theme required css
659
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
659
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
660 660
 
661 661
 // theme required js
662
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
662
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
663 663
 
664 664
 // theme compat name
665
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
666
-    if ($theme_settings['gd_theme_compat'] == '') {
667
-        update_option('gd_theme_compat', '');
668
-        update_option('theme_compatibility_setting', '');
669
-        return;
670
-    }
665
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
666
+	if ($theme_settings['gd_theme_compat'] == '') {
667
+		update_option('gd_theme_compat', '');
668
+		update_option('theme_compatibility_setting', '');
669
+		return;
670
+	}
671 671
 
672 672
 // theme default options
673
-    $theme_settings['geodir_theme_compat_default_options'] = '';
673
+	$theme_settings['geodir_theme_compat_default_options'] = '';
674 674
 
675 675
 
676 676
 //supported theme code
677
-    $theme_settings['geodir_theme_compat_code'] = false;
678
-
679
-    $theme = wp_get_theme();
680
-
681
-    if ($theme->parent()) {
682
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
683
-    } else {
684
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
685
-    }
686
-
687
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News','Kleo','Twenty_Seventeen'))) {// list of themes that have php files
688
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
689
-    }
690
-
691
-
692
-    $theme_name = $theme_name . "_custom";
693
-    $theme_arr = get_option('gd_theme_compats');
694
-    update_option('gd_theme_compat', $theme_name);
695
-    /**
696
-     * Called before the theme compatibility settings are saved to the DB.
697
-     *
698
-     * @since 1.4.0
699
-     * @param array $theme_settings {
700
-     *    Attributes of the theme compatibility settings array.
701
-     *
702
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
703
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
704
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
705
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
706
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
707
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
708
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
709
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
710
-     *    @type string $geodir_article_open_id Geodir article open html id.
711
-     *    @type string $geodir_article_open_class Geodir article open html class.
712
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
713
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
714
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
715
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
716
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
717
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
718
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
719
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
720
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
721
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
722
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
723
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
724
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
725
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
726
-     *    @type string $geodir_top_content_add Geodir top content add.
727
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
728
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
729
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
730
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
731
-     *    @type string $geodir_before_title_filter Geodir before title filter.
732
-     *    @type string $geodir_after_title_filter Geodir after title filter.
733
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
734
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
735
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
736
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
737
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
739
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
740
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
741
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
742
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
743
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
744
-     *    @type string $gd_theme_compat Gd theme compatibility.
745
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
746
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
747
-     *
748
-     * }
749
-     */
750
-    do_action('gd_compat_save_settings', $theme_settings);
677
+	$theme_settings['geodir_theme_compat_code'] = false;
678
+
679
+	$theme = wp_get_theme();
680
+
681
+	if ($theme->parent()) {
682
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
683
+	} else {
684
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
685
+	}
686
+
687
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News','Kleo','Twenty_Seventeen'))) {// list of themes that have php files
688
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
689
+	}
690
+
691
+
692
+	$theme_name = $theme_name . "_custom";
693
+	$theme_arr = get_option('gd_theme_compats');
694
+	update_option('gd_theme_compat', $theme_name);
695
+	/**
696
+	 * Called before the theme compatibility settings are saved to the DB.
697
+	 *
698
+	 * @since 1.4.0
699
+	 * @param array $theme_settings {
700
+	 *    Attributes of the theme compatibility settings array.
701
+	 *
702
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
703
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
704
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
705
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
706
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
707
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
708
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
709
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
710
+	 *    @type string $geodir_article_open_id Geodir article open html id.
711
+	 *    @type string $geodir_article_open_class Geodir article open html class.
712
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
713
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
714
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
715
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
716
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
717
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
718
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
719
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
720
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
721
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
722
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
723
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
724
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
725
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
726
+	 *    @type string $geodir_top_content_add Geodir top content add.
727
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
728
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
729
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
730
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
731
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
732
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
733
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
734
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
735
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
736
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
737
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
739
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
740
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
741
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
742
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
743
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
744
+	 *    @type string $gd_theme_compat Gd theme compatibility.
745
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
746
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
747
+	 *
748
+	 * }
749
+	 */
750
+	do_action('gd_compat_save_settings', $theme_settings);
751 751
 
752 752
 //if($_POST['gd_theme_compat'])==
753
-    $theme_arr[$theme_name] = $theme_settings;
754
-    update_option('gd_theme_compats', $theme_arr);
753
+	$theme_arr[$theme_name] = $theme_settings;
754
+	update_option('gd_theme_compats', $theme_arr);
755 755
 
756 756
 
757 757
 //print_r($theme_settings);exit;
758
-    update_option('theme_compatibility_setting', $theme_settings);
758
+	update_option('theme_compatibility_setting', $theme_settings);
759 759
 
760 760
 }
761 761
 
@@ -768,12 +768,12 @@  discard block
 block discarded – undo
768 768
  */
769 769
 function geodir_theme_compatibility_setting_page()
770 770
 {
771
-    global $wpdb;
772
-    $tc = get_option('theme_compatibility_setting');
773
-    //print_r($tc);
774
-    //print_r(wp_get_theme());
771
+	global $wpdb;
772
+	$tc = get_option('theme_compatibility_setting');
773
+	//print_r($tc);
774
+	//print_r(wp_get_theme());
775 775
 
776
-    ?>
776
+	?>
777 777
     <div class="inner_content_tab_main">
778 778
         <div class="gd-content-heading">
779 779
 
@@ -815,21 +815,21 @@  discard block
 block discarded – undo
815 815
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
816 816
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
817 817
                 <?php
818
-                $theme_arr = get_option('gd_theme_compats');
819
-                $theme_active = get_option('gd_theme_compat');
820
-                if (is_array($theme_arr)) {
821
-                    foreach ($theme_arr as $key => $theme) {
822
-                        $sel = '';
823
-                        if ($theme_active == $key) {
824
-                            $sel = "selected";
825
-                        }
826
-                        echo "<option $sel>$key</option>";
827
-                    }
818
+				$theme_arr = get_option('gd_theme_compats');
819
+				$theme_active = get_option('gd_theme_compat');
820
+				if (is_array($theme_arr)) {
821
+					foreach ($theme_arr as $key => $theme) {
822
+						$sel = '';
823
+						if ($theme_active == $key) {
824
+							$sel = "selected";
825
+						}
826
+						echo "<option $sel>$key</option>";
827
+					}
828 828
 
829 829
 
830
-                }
830
+				}
831 831
 
832
-                ?>
832
+				?>
833 833
             </select>
834 834
             <button onclick="gd_comp_export();" type="button"
835 835
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
                         <small>geodir_wrapper_open</small>
939 939
                     </td>
940 940
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
941
-                            echo $tc['geodir_wrapper_open_id'];
942
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941
+							echo $tc['geodir_wrapper_open_id'];
942
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
943 943
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
944
-                            echo $tc['geodir_wrapper_open_class'];
945
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944
+							echo $tc['geodir_wrapper_open_class'];
945
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
946 946
                 </tr>
947 947
 
948 948
                 <tr class="gd-theme-comp-out">
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
                         <span><?php _e('Output:', 'geodirectory');?></span>
951 951
                         <textarea name="geodir_wrapper_open_replace"
952 952
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
953
-                                echo $tc['geodir_wrapper_open_replace'];
954
-                            }?></textarea>
953
+								echo $tc['geodir_wrapper_open_replace'];
954
+							}?></textarea>
955 955
                     </td>
956 956
                 </tr>
957 957
 
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
                         <span><?php _e('Output:', 'geodirectory');?></span>
972 972
                         <textarea name="geodir_wrapper_close_replace"
973 973
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
974
-                                echo $tc['geodir_wrapper_close_replace'];
975
-                            }?></textarea>
974
+								echo $tc['geodir_wrapper_close_replace'];
975
+							}?></textarea>
976 976
                     </td>
977 977
                 </tr>
978 978
 
@@ -982,12 +982,12 @@  discard block
 block discarded – undo
982 982
                         <small>geodir_wrapper_content_open</small>
983 983
                     </td>
984 984
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
985
-                            echo $tc['geodir_wrapper_content_open_id'];
986
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985
+							echo $tc['geodir_wrapper_content_open_id'];
986
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
987 987
                     </td>
988 988
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
989
-                            echo $tc['geodir_wrapper_content_open_class'];
990
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989
+							echo $tc['geodir_wrapper_content_open_class'];
990
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
991 991
                 </tr>
992 992
 
993 993
                 <tr class="gd-theme-comp-out">
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
                         <span><?php _e('Output:', 'geodirectory');?></span>
996 996
                         <textarea name="geodir_wrapper_content_open_replace"
997 997
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
998
-                                echo $tc['geodir_wrapper_content_open_replace'];
999
-                            }?></textarea>
998
+								echo $tc['geodir_wrapper_content_open_replace'];
999
+							}?></textarea>
1000 1000
                     </td>
1001 1001
                 </tr>
1002 1002
 
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
                         <span><?php _e('Output:', 'geodirectory');?></span>
1017 1017
                         <textarea name="geodir_wrapper_content_close_replace"
1018 1018
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1019
-                                echo $tc['geodir_wrapper_content_close_replace'];
1020
-                            }?></textarea>
1019
+								echo $tc['geodir_wrapper_content_close_replace'];
1020
+							}?></textarea>
1021 1021
                     </td>
1022 1022
                 </tr>
1023 1023
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
                         <small>geodir_article_open</small>
1027 1027
                     </td>
1028 1028
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1029
-                            echo $tc['geodir_article_open_id'];
1030
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029
+							echo $tc['geodir_article_open_id'];
1030
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1031 1031
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1032
-                            echo $tc['geodir_article_open_class'];
1033
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032
+							echo $tc['geodir_article_open_class'];
1033
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1034 1034
                 </tr>
1035 1035
 
1036 1036
                 <tr class="gd-theme-comp-out">
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
                         <span><?php _e('Output:', 'geodirectory');?></span>
1039 1039
                         <textarea name="geodir_article_open_replace"
1040 1040
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1041
-                                echo $tc['geodir_article_open_replace'];
1042
-                            }?></textarea>
1041
+								echo $tc['geodir_article_open_replace'];
1042
+							}?></textarea>
1043 1043
                     </td>
1044 1044
                 </tr>
1045 1045
 
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
                         <span><?php _e('Output:', 'geodirectory');?></span>
1059 1059
                         <textarea name="geodir_article_close_replace"
1060 1060
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1061
-                                echo $tc['geodir_article_close_replace'];
1062
-                            }?></textarea>
1061
+								echo $tc['geodir_article_close_replace'];
1062
+							}?></textarea>
1063 1063
                     </td>
1064 1064
                 </tr>
1065 1065
 
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
                         <small>geodir_sidebar_right_open</small>
1069 1069
                     </td>
1070 1070
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1071
-                            echo $tc['geodir_sidebar_right_open_id'];
1072
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071
+							echo $tc['geodir_sidebar_right_open_id'];
1072
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1073 1073
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1074
-                            echo $tc['geodir_sidebar_right_open_class'];
1075
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1074
+							echo $tc['geodir_sidebar_right_open_class'];
1075
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1076 1076
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1077 1077
                 </tr>
1078 1078
 
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
                         <span><?php _e('Output:', 'geodirectory');?></span>
1082 1082
                         <textarea name="geodir_sidebar_right_open_replace"
1083 1083
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1084
-                                echo $tc['geodir_sidebar_right_open_replace'];
1085
-                            }?></textarea>
1084
+								echo $tc['geodir_sidebar_right_open_replace'];
1085
+							}?></textarea>
1086 1086
                     </td>
1087 1087
                 </tr>
1088 1088
 
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
                         <span><?php _e('Output:', 'geodirectory');?></span>
1102 1102
                         <textarea name="geodir_sidebar_right_close_replace"
1103 1103
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1104
-                                echo $tc['geodir_sidebar_right_close_replace'];
1105
-                            }?></textarea>
1104
+								echo $tc['geodir_sidebar_right_close_replace'];
1105
+							}?></textarea>
1106 1106
                     </td>
1107 1107
                 </tr>
1108 1108
 
@@ -1112,11 +1112,11 @@  discard block
 block discarded – undo
1112 1112
                         <small>geodir_sidebar_left_open</small>
1113 1113
                     </td>
1114 1114
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1115
-                            echo $tc['geodir_sidebar_left_open_id'];
1116
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115
+							echo $tc['geodir_sidebar_left_open_id'];
1116
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1117 1117
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1118
-                            echo $tc['geodir_sidebar_left_open_class'];
1119
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1118
+							echo $tc['geodir_sidebar_left_open_class'];
1119
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1120 1120
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1121 1121
                 </tr>
1122 1122
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
                         <span><?php _e('Output:', 'geodirectory');?></span>
1126 1126
                         <textarea name="geodir_sidebar_left_open_replace"
1127 1127
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1128
-                                echo $tc['geodir_sidebar_left_open_replace'];
1129
-                            }?></textarea>
1128
+								echo $tc['geodir_sidebar_left_open_replace'];
1129
+							}?></textarea>
1130 1130
                     </td>
1131 1131
                 </tr>
1132 1132
 
@@ -1145,8 +1145,8 @@  discard block
 block discarded – undo
1145 1145
                         <span><?php _e('Output:', 'geodirectory');?></span>
1146 1146
                         <textarea name="geodir_sidebar_left_close_replace"
1147 1147
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1148
-                                echo $tc['geodir_sidebar_left_close_replace'];
1149
-                            }?></textarea>
1148
+								echo $tc['geodir_sidebar_left_close_replace'];
1149
+							}?></textarea>
1150 1150
                     </td>
1151 1151
                 </tr>
1152 1152
 
@@ -1155,11 +1155,11 @@  discard block
 block discarded – undo
1155 1155
                         <small>geodir_main_content_open</small>
1156 1156
                     </td>
1157 1157
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1158
-                            echo $tc['geodir_main_content_open_id'];
1159
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158
+							echo $tc['geodir_main_content_open_id'];
1159
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1160 1160
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1161
-                            echo $tc['geodir_main_content_open_class'];
1162
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161
+							echo $tc['geodir_main_content_open_class'];
1162
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1163 1163
                 </tr>
1164 1164
 
1165 1165
                 <tr class="gd-theme-comp-out">
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
                         <span><?php _e('Output:', 'geodirectory');?></span>
1168 1168
                         <textarea name="geodir_main_content_open_replace"
1169 1169
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1170
-                                echo $tc['geodir_main_content_open_replace'];
1171
-                            }?></textarea>
1170
+								echo $tc['geodir_main_content_open_replace'];
1171
+							}?></textarea>
1172 1172
                     </td>
1173 1173
                 </tr>
1174 1174
 
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
                         <span><?php _e('Output:', 'geodirectory');?></span>
1188 1188
                         <textarea name="geodir_main_content_close_replace"
1189 1189
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1190
-                                echo $tc['geodir_main_content_close_replace'];
1191
-                            }?></textarea>
1190
+								echo $tc['geodir_main_content_close_replace'];
1191
+							}?></textarea>
1192 1192
                     </td>
1193 1193
                 </tr>
1194 1194
 
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
                     </td>
1213 1213
                     <td><textarea name="geodir_top_content_add"
1214 1214
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1215
-                                echo $tc['geodir_top_content_add'];
1216
-                            }?></textarea></td>
1215
+								echo $tc['geodir_top_content_add'];
1216
+							}?></textarea></td>
1217 1217
                 </tr>
1218 1218
 
1219 1219
                 <tr>
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
                     </td>
1223 1223
                     <td><textarea name="geodir_before_main_content_add"
1224 1224
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1225
-                                echo $tc['geodir_before_main_content_add'];
1226
-                            }?></textarea></td>
1225
+								echo $tc['geodir_before_main_content_add'];
1226
+							}?></textarea></td>
1227 1227
                 </tr>
1228 1228
 
1229 1229
 
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
                     </td>
1247 1247
                     <td><textarea name="geodir_full_page_class_filter"
1248 1248
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1249
-                                echo $tc['geodir_full_page_class_filter'];
1250
-                            }?></textarea></td>
1249
+								echo $tc['geodir_full_page_class_filter'];
1250
+							}?></textarea></td>
1251 1251
                 </tr>
1252 1252
 
1253 1253
                 <tr>
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
                     </td>
1257 1257
                     <td><textarea name="geodir_before_widget_filter"
1258 1258
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1259
-                                echo $tc['geodir_before_widget_filter'];
1260
-                            }?></textarea></td>
1259
+								echo $tc['geodir_before_widget_filter'];
1260
+							}?></textarea></td>
1261 1261
                 </tr>
1262 1262
 
1263 1263
                 <tr>
@@ -1266,8 +1266,8 @@  discard block
 block discarded – undo
1266 1266
                     </td>
1267 1267
                     <td><textarea name="geodir_after_widget_filter"
1268 1268
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1269
-                                echo $tc['geodir_after_widget_filter'];
1270
-                            }?></textarea></td>
1269
+								echo $tc['geodir_after_widget_filter'];
1270
+							}?></textarea></td>
1271 1271
                 </tr>
1272 1272
 
1273 1273
                 <tr>
@@ -1276,8 +1276,8 @@  discard block
 block discarded – undo
1276 1276
                     </td>
1277 1277
                     <td><textarea name="geodir_before_title_filter"
1278 1278
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1279
-                                echo $tc['geodir_before_title_filter'];
1280
-                            }?></textarea></td>
1279
+								echo $tc['geodir_before_title_filter'];
1280
+							}?></textarea></td>
1281 1281
                 </tr>
1282 1282
 
1283 1283
                 <tr>
@@ -1286,8 +1286,8 @@  discard block
 block discarded – undo
1286 1286
                     </td>
1287 1287
                     <td><textarea name="geodir_after_title_filter"
1288 1288
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1289
-                                echo $tc['geodir_after_title_filter'];
1290
-                            }?></textarea></td>
1289
+								echo $tc['geodir_after_title_filter'];
1290
+							}?></textarea></td>
1291 1291
                 </tr>
1292 1292
 
1293 1293
                 <tr>
@@ -1296,8 +1296,8 @@  discard block
 block discarded – undo
1296 1296
                     </td>
1297 1297
                     <td><textarea name="geodir_menu_li_class_filter"
1298 1298
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1299
-                                echo $tc['geodir_menu_li_class_filter'];
1300
-                            }?></textarea></td>
1299
+								echo $tc['geodir_menu_li_class_filter'];
1300
+							}?></textarea></td>
1301 1301
                 </tr>
1302 1302
 
1303 1303
                 <tr>
@@ -1306,8 +1306,8 @@  discard block
 block discarded – undo
1306 1306
                     </td>
1307 1307
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1308 1308
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1309
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1310
-                            }?></textarea></td>
1309
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1310
+							}?></textarea></td>
1311 1311
                 </tr>
1312 1312
 
1313 1313
                 <tr>
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
                     </td>
1317 1317
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1318 1318
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1319
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1320
-                            }?></textarea></td>
1319
+								echo $tc['geodir_sub_menu_li_class_filter'];
1320
+							}?></textarea></td>
1321 1321
                 </tr>
1322 1322
 
1323 1323
                 <tr>
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
                     </td>
1327 1327
                     <td><textarea name="geodir_menu_a_class_filter"
1328 1328
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1329
-                                echo $tc['geodir_menu_a_class_filter'];
1330
-                            }?></textarea></td>
1329
+								echo $tc['geodir_menu_a_class_filter'];
1330
+							}?></textarea></td>
1331 1331
                 </tr>
1332 1332
 
1333 1333
                 <tr>
@@ -1336,8 +1336,8 @@  discard block
 block discarded – undo
1336 1336
                     </td>
1337 1337
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1338 1338
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1339
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1340
-                            }?></textarea></td>
1339
+								echo $tc['geodir_sub_menu_a_class_filter'];
1340
+							}?></textarea></td>
1341 1341
                 </tr>
1342 1342
 
1343 1343
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
                     </td>
1348 1348
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1349 1349
                                   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'])) {
1350
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1351
-                            }?></textarea></td>
1350
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1351
+							}?></textarea></td>
1352 1352
                 </tr>
1353 1353
 
1354 1354
                 <tr>
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
                     </td>
1358 1358
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1359 1359
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1360
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1361
-                            }?></textarea></td>
1360
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1361
+							}?></textarea></td>
1362 1362
                 </tr>
1363 1363
 
1364 1364
                 <tr>
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
                     </td>
1368 1368
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1369 1369
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1370
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1371
-                            }?></textarea></td>
1370
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1371
+							}?></textarea></td>
1372 1372
                 </tr>
1373 1373
 
1374 1374
                 <tr>
@@ -1377,21 +1377,21 @@  discard block
 block discarded – undo
1377 1377
                     </td>
1378 1378
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1379 1379
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1380
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1381
-                            }?></textarea></td>
1380
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1381
+							}?></textarea></td>
1382 1382
                 </tr>
1383 1383
 
1384 1384
 
1385 1385
 
1386 1386
                 <?php
1387
-                /**
1388
-                 * Allows more filter setting to be added to theme compatibility settings page.
1389
-                 *
1390
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1391
-                 *
1392
-                 * @since 1.4.0
1393
-                 */
1394
-                do_action('gd_compat_other_filters');?>
1387
+				/**
1388
+				 * Allows more filter setting to be added to theme compatibility settings page.
1389
+				 *
1390
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1391
+				 *
1392
+				 * @since 1.4.0
1393
+				 */
1394
+				do_action('gd_compat_other_filters');?>
1395 1395
 
1396 1396
                 </tbody>
1397 1397
             </table>
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
                 <tr>
1405 1405
                     <td><textarea name="geodir_theme_compat_css"
1406 1406
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1407
-                                echo $tc['geodir_theme_compat_css'];
1408
-                            }?></textarea></td>
1407
+								echo $tc['geodir_theme_compat_css'];
1408
+							}?></textarea></td>
1409 1409
                 </tr>
1410 1410
 
1411 1411
 
@@ -1419,8 +1419,8 @@  discard block
 block discarded – undo
1419 1419
                 <tr>
1420 1420
                     <td><textarea name="geodir_theme_compat_js"
1421 1421
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1422
-                                echo $tc['geodir_theme_compat_js'];
1423
-                            }?></textarea></td>
1422
+								echo $tc['geodir_theme_compat_js'];
1423
+							}?></textarea></td>
1424 1424
                 </tr>
1425 1425
 
1426 1426
 
@@ -1447,23 +1447,23 @@  discard block
 block discarded – undo
1447 1447
  */
1448 1448
 function geodir_custom_post_type_form()
1449 1449
 {
1450
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1450
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1451 1451
 
1452
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1452
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1453 1453
 
1454 1454
 
1455
-    ?>
1455
+	?>
1456 1456
 
1457 1457
     <div class="gd-content-heading">
1458 1458
         <?php
1459
-        /**
1460
-         * Filter custom fields panel heading.
1461
-         *
1462
-         * @since 1.0.0
1463
-         * @param string $sub_tab Sub tab name.
1464
-         * @param string $listing_type Post type.
1465
-         */
1466
-        ?>
1459
+		/**
1460
+		 * Filter custom fields panel heading.
1461
+		 *
1462
+		 * @since 1.0.0
1463
+		 * @param string $sub_tab Sub tab name.
1464
+		 * @param string $listing_type Post type.
1465
+		 */
1466
+		?>
1467 1467
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1468 1468
     </div>
1469 1469
     <div id="container_general" class="clearfix">
@@ -1471,25 +1471,25 @@  discard block
 block discarded – undo
1471 1471
 
1472 1472
             <div class="side-sortables" id="geodir-available-fields">
1473 1473
                 <?php
1474
-                /**
1475
-                 * Filter custom field available fields heading.
1476
-                 *
1477
-                 * @since 1.0.0
1478
-                 * @param string $sub_tab Sub tab name.
1479
-                 * @param string $listing_type Post type.
1480
-                 */
1481
-                ?>
1474
+				/**
1475
+				 * Filter custom field available fields heading.
1476
+				 *
1477
+				 * @since 1.0.0
1478
+				 * @param string $sub_tab Sub tab name.
1479
+				 * @param string $listing_type Post type.
1480
+				 */
1481
+				?>
1482 1482
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1483 1483
 							</span></h3>
1484 1484
                 <?php
1485
-                /**
1486
-                 * Filter custom field available fields note text.
1487
-                 *
1488
-                 * @since 1.0.0
1489
-                 * @param string $sub_tab Sub tab name.
1490
-                 * @param string $listing_type Post type.
1491
-                 */
1492
-                ?>
1485
+				/**
1486
+				 * Filter custom field available fields note text.
1487
+				 *
1488
+				 * @since 1.0.0
1489
+				 * @param string $sub_tab Sub tab name.
1490
+				 * @param string $listing_type Post type.
1491
+				 */
1492
+				?>
1493 1493
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1494 1494
 
1495 1495
                 <h3><?php _e('Setup New Field','geodirectory');?></h3>
@@ -1498,13 +1498,13 @@  discard block
 block discarded – undo
1498 1498
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1499 1499
 
1500 1500
                         <?php
1501
-                        /**
1502
-                         * Adds the available fields to the custom fields settings page per post type.
1503
-                         *
1504
-                         * @since 1.0.0
1505
-                         * @param string $sub_tab The current settings tab name.
1506
-                         */
1507
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1501
+						/**
1502
+						 * Adds the available fields to the custom fields settings page per post type.
1503
+						 *
1504
+						 * @since 1.0.0
1505
+						 * @param string $sub_tab The current settings tab name.
1506
+						 */
1507
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1508 1508
 
1509 1509
                         <div style="clear:both"></div>
1510 1510
                     </div>
@@ -1519,13 +1519,13 @@  discard block
 block discarded – undo
1519 1519
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1520 1520
 
1521 1521
                         <?php
1522
-                        /**
1523
-                         * Adds the available fields to the custom fields predefined settings page per post type.
1524
-                         *
1525
-                         * @since 1.6.9
1526
-                         * @param string $sub_tab The current settings tab name.
1527
-                         */
1528
-                        do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1522
+						/**
1523
+						 * Adds the available fields to the custom fields predefined settings page per post type.
1524
+						 *
1525
+						 * @since 1.6.9
1526
+						 * @param string $sub_tab The current settings tab name.
1527
+						 */
1528
+						do_action('geodir_manage_available_fields_predefined', $sub_tab); ?>
1529 1529
 
1530 1530
                         <div style="clear:both"></div>
1531 1531
                     </div>
@@ -1538,13 +1538,13 @@  discard block
 block discarded – undo
1538 1538
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1539 1539
 
1540 1540
                         <?php
1541
-                        /**
1542
-                         * Adds the available fields to the custom fields custom added settings page per post type.
1543
-                         *
1544
-                         * @since 1.6.9
1545
-                         * @param string $sub_tab The current settings tab name.
1546
-                         */
1547
-                        do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1541
+						/**
1542
+						 * Adds the available fields to the custom fields custom added settings page per post type.
1543
+						 *
1544
+						 * @since 1.6.9
1545
+						 * @param string $sub_tab The current settings tab name.
1546
+						 */
1547
+						do_action('geodir_manage_available_fields_custom', $sub_tab); ?>
1548 1548
 
1549 1549
                         <div style="clear:both"></div>
1550 1550
                     </div>
@@ -1561,25 +1561,25 @@  discard block
 block discarded – undo
1561 1561
             <div class="side-sortables" id="geodir-selected-fields">
1562 1562
                 <h3 class="hndle">
1563 1563
                     <?php
1564
-                    /**
1565
-                     * Filter custom field selected fields heading.
1566
-                     *
1567
-                     * @since 1.0.0
1568
-                     * @param string $sub_tab Sub tab name.
1569
-                     * @param string $listing_type Post type.
1570
-                     */
1571
-                    ?>
1564
+					/**
1565
+					 * Filter custom field selected fields heading.
1566
+					 *
1567
+					 * @since 1.0.0
1568
+					 * @param string $sub_tab Sub tab name.
1569
+					 * @param string $listing_type Post type.
1570
+					 */
1571
+					?>
1572 1572
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1573 1573
                 </h3>
1574 1574
                 <?php
1575
-                /**
1576
-                 * Filter custom field selected fields note text.
1577
-                 *
1578
-                 * @since 1.0.0
1579
-                 * @param string $sub_tab Sub tab name.
1580
-                 * @param string $listing_type Post type.
1581
-                 */
1582
-                ?>
1575
+				/**
1576
+				 * Filter custom field selected fields note text.
1577
+				 *
1578
+				 * @since 1.0.0
1579
+				 * @param string $sub_tab Sub tab name.
1580
+				 * @param string $listing_type Post type.
1581
+				 */
1582
+				?>
1583 1583
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1584 1584
 
1585 1585
                 <div class="inside">
@@ -1587,13 +1587,13 @@  discard block
 block discarded – undo
1587 1587
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1588 1588
                         <div class="field_row_main">
1589 1589
                             <?php
1590
-                            /**
1591
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1592
-                             *
1593
-                             * @since 1.0.0
1594
-                             * @param string $sub_tab The current settings tab name.
1595
-                             */
1596
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1590
+							/**
1591
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1592
+							 *
1593
+							 * @since 1.0.0
1594
+							 * @param string $sub_tab The current settings tab name.
1595
+							 */
1596
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1597 1597
                         </div>
1598 1598
                         <div style="clear:both"></div>
1599 1599
                     </div>
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
  */
1617 1617
 function geodir_diagnostic_tools_setting_page()
1618 1618
 {
1619
-    ?>
1619
+	?>
1620 1620
     <div class="inner_content_tab_main">
1621 1621
         <div class="gd-content-heading">
1622 1622
 
@@ -1680,27 +1680,27 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
                 <tr>
1682 1682
                     <?php
1683
-                    $l_count = geodir_total_listings_count();
1684
-                    $step_max_items = geodir_get_diagnose_step_max_items();
1685
-                    if ($l_count > $step_max_items) {
1686
-                        $multiple = 'data-step="1"';
1687
-                    } else {
1688
-                        $multiple = "";
1689
-                    }
1690
-                    ?>
1683
+					$l_count = geodir_total_listings_count();
1684
+					$step_max_items = geodir_get_diagnose_step_max_items();
1685
+					if ($l_count > $step_max_items) {
1686
+						$multiple = 'data-step="1"';
1687
+					} else {
1688
+						$multiple = "";
1689
+					}
1690
+					?>
1691 1691
                     <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1692 1692
                     <td>
1693 1693
                         <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1694 1694
                         <?php
1695
-                        if ($l_count > $step_max_items) {
1696
-                            ?>
1695
+						if ($l_count > $step_max_items) {
1696
+							?>
1697 1697
                             <table id="tags_sync_sub_table" class="widefat" style="display: none">
1698 1698
                                 <?php
1699
-                                $all_postypes = geodir_get_posttypes('array');
1699
+								$all_postypes = geodir_get_posttypes('array');
1700 1700
 
1701
-                                if (!empty($all_postypes)) {
1702
-                                    foreach ($all_postypes as $key => $value) {
1703
-                                        ?>
1701
+								if (!empty($all_postypes)) {
1702
+									foreach ($all_postypes as $key => $value) {
1703
+										?>
1704 1704
                                         <tr id="tags_sync_<?php echo $key; ?>">
1705 1705
                                             <td>
1706 1706
                                                 <?php echo $value['labels']['name']; ?>
@@ -1711,13 +1711,13 @@  discard block
 block discarded – undo
1711 1711
                                             </td>
1712 1712
                                         </tr>
1713 1713
                                         <?php
1714
-                                    }
1715
-                                }
1716
-                                ?>
1714
+									}
1715
+								}
1716
+								?>
1717 1717
                             </table>
1718 1718
                             <?php
1719
-                        }
1720
-                        ?>
1719
+						}
1720
+						?>
1721 1721
                     </td>
1722 1722
                     <td>
1723 1723
                         <input type="button" value="<?php _e('Run', 'geodirectory');?>"
@@ -1765,13 +1765,13 @@  discard block
 block discarded – undo
1765 1765
                     </td>
1766 1766
                 </tr>
1767 1767
                 <?php
1768
-                /**
1769
-                 * Allows you to add more setting to the GD>Tools settings page.
1770
-                 *
1771
-                 * Called after the last setting on the GD>Tools page.
1772
-                 * @since 1.0.0
1773
-                 */
1774
-                do_action('geodir_diagnostic_tool');?>
1768
+				/**
1769
+				 * Allows you to add more setting to the GD>Tools settings page.
1770
+				 *
1771
+				 * Called after the last setting on the GD>Tools page.
1772
+				 * @since 1.0.0
1773
+				 */
1774
+				do_action('geodir_diagnostic_tool');?>
1775 1775
 
1776 1776
                 </tbody>
1777 1777
             </table>
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 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
             
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
                     ?>
400 400
 
401
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
401
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
402 402
 
403 403
                     <input type="hidden" name="add_location" value="location">
404 404
 
@@ -406,16 +406,16 @@  discard block
 block discarded – undo
406 406
                         echo $location_result->location_id;
407 407
                     } ?>">
408 408
 
409
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
409
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
410 410
 
411 411
                     <table class="form-table default_location_form">
412 412
                         <tbody>
413 413
                         <tr valign="top" class="single_select_page">
414
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
414
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
415 415
                             <td class="forminp">
416 416
                                 <div class="gtd-formfeild required">
417 417
                                     <input class="require" type="text" size="80" style="width:440px"
418
-                                           id="<?php echo $prefix;?>city" name="city"
418
+                                           id="<?php echo $prefix; ?>city" name="city"
419 419
                                            value="<?php if (isset($location_result->city)) {
420 420
                                                echo $location_result->city;
421 421
                                            } ?>"/>
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
                             </td>
428 428
                         </tr>
429 429
                         <tr valign="top" class="single_select_page">
430
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
430
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
431 431
                             <td class="forminp">
432 432
                                 <div class="gtd-formfeild required">
433 433
                                     <input class="require" type="text" size="80" style="width:440px"
434
-                                           id="<?php echo $prefix;?>region" name="region"
434
+                                           id="<?php echo $prefix; ?>region" name="region"
435 435
                                            value="<?php if (isset($location_result->region)) {
436 436
                                                echo $location_result->region;
437 437
                                            } ?>"/>
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                             </td>
444 444
                         </tr>
445 445
                         <tr valign="top" class="single_select_page">
446
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
446
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
447 447
                             <td class="forminp">
448 448
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
449 449
                                     <?php
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                                     ?>
453 453
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
454 454
                                             data-location_type="country" name="<?php echo $prefix ?>country"
455
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
455
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
456 456
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
457 457
                                             data-showeverywhere="0">
458 458
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                         </tr>
470 470
                         <tr valign="top" class="single_select_page gd-add-location-map">
471 471
                             <th class="titledesc"
472
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
472
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
473 473
                             <td class="forminp">
474 474
                                 <?php
475 475
                                 /**
@@ -477,15 +477,15 @@  discard block
 block discarded – undo
477 477
                                  *
478 478
                                  * @since 1.0.0
479 479
                                  */
480
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
480
+                                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
481 481
                             </td>
482 482
                         </tr>
483 483
                         <tr valign="top" class="single_select_page">
484
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
484
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
485 485
                             <td class="forminp">
486 486
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
487 487
                                     <input type="text" class="require" size="80" style="width:440px"
488
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
488
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
489 489
                                            value="<?php if (isset($location_result->city_latitude)) {
490 490
                                                echo $location_result->city_latitude;
491 491
                                            } ?>"/>
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
                         </tr>
499 499
                         <tr valign="top" class="single_select_page">
500 500
                             <th class="titledesc"
501
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
501
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
502 502
                             <td class="forminp">
503 503
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
504 504
                                     <input type="text" class="require" size="80" style="width:440px"
505
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
505
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
506 506
                                            value="<?php if (isset($location_result->city_longitude)) {
507 507
                                                echo $location_result->city_longitude;
508 508
                                            } ?>"/>
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 </div>
538 538
             </div>
539 539
             <?php break;
540
-        case $listing_type . '_fields_settings' :
540
+        case $listing_type.'_fields_settings' :
541 541
 
542 542
             geodir_custom_post_type_form();
543 543
 
@@ -684,12 +684,12 @@  discard block
 block discarded – undo
684 684
         $theme_name = str_replace(" ", "_", $theme->get('Name'));
685 685
     }
686 686
 
687
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News','Kleo','Twenty_Seventeen'))) {// list of themes that have php files
687
+    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News', 'Kleo', 'Twenty_Seventeen'))) {// list of themes that have php files
688 688
         $theme_settings['geodir_theme_compat_code'] = $theme_name;
689 689
     }
690 690
 
691 691
 
692
-    $theme_name = $theme_name . "_custom";
692
+    $theme_name = $theme_name."_custom";
693 693
     $theme_arr = get_option('gd_theme_compats');
694 694
     update_option('gd_theme_compat', $theme_name);
695 695
     /**
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
         <div class="gd-content-heading">
779 779
 
780 780
 
781
-            <h3><?php _e('Theme Compatibility Settings', 'geodirectory');?></h3>
781
+            <h3><?php _e('Theme Compatibility Settings', 'geodirectory'); ?></h3>
782 782
             <style>
783 783
                 .gd-theme-compat-table {
784 784
                     width: 100%;
@@ -809,11 +809,11 @@  discard block
 block discarded – undo
809 809
                 </div>
810 810
             <?php }?>
811 811
 
812
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
812
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
813 813
 
814 814
             <select name="gd_theme_compat" id="gd_theme_compat">
815
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
816
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
816
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
817 817
                 <?php
818 818
                 $theme_arr = get_option('gd_theme_compats');
819 819
                 $theme_active = get_option('gd_theme_compat');
@@ -832,20 +832,20 @@  discard block
 block discarded – undo
832 832
                 ?>
833 833
             </select>
834 834
             <button onclick="gd_comp_export();" type="button"
835
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
836 836
             <button onclick="gd_comp_import();" type="button"
837
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
837
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
838 838
 
839 839
             <div class="gd-comp-import-export">
840 840
                 <textarea id="gd-import-export-theme-comp"
841
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
841
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
842 842
             </div>
843 843
             <script>
844 844
 
845 845
                 function gd_comp_export() {
846 846
                     theme = jQuery('#gd_theme_compat').val();
847 847
                     if (theme == '' || theme == 'custom') {
848
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
848
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
849 849
                         return false;
850 850
                     }
851 851
                     jQuery('.gd-comp-import-export').show();
@@ -879,9 +879,9 @@  discard block
 block discarded – undo
879 879
 
880 880
                     jQuery.post(ajaxurl, data, function (response) {
881 881
                         if (response == '0') {
882
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
882
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
883 883
                         } else {
884
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
884
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
885 885
                             jQuery('#gd-import-export-theme-comp').val('');
886 886
                             jQuery('.gd-comp-import-export').hide();
887 887
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -922,14 +922,14 @@  discard block
 block discarded – undo
922 922
 
923 923
             </script>
924 924
 
925
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
925
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
926 926
 
927 927
             <table class="form-table gd-theme-compat-table">
928 928
                 <tbody>
929 929
                 <tr>
930
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
931
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
932
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
930
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
931
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
932
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
933 933
                 </tr>
934 934
 
935 935
 
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 
948 948
                 <tr class="gd-theme-comp-out">
949 949
                     <td colspan="3">
950
-                        <span><?php _e('Output:', 'geodirectory');?></span>
950
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
951 951
                         <textarea name="geodir_wrapper_open_replace"
952 952
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
953 953
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -961,14 +961,14 @@  discard block
 block discarded – undo
961 961
                         <small>geodir_wrapper_close</small>
962 962
                     </td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
966
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
966
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
967 967
                 </tr>
968 968
 
969 969
                 <tr class="gd-theme-comp-out">
970 970
                     <td colspan="3">
971
-                        <span><?php _e('Output:', 'geodirectory');?></span>
971
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
972 972
                         <textarea name="geodir_wrapper_close_replace"
973 973
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
974 974
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
                 <tr class="gd-theme-comp-out">
994 994
                     <td colspan="3">
995
-                        <span><?php _e('Output:', 'geodirectory');?></span>
995
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
996 996
                         <textarea name="geodir_wrapper_content_open_replace"
997 997
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
998 998
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1006,14 +1006,14 @@  discard block
 block discarded – undo
1006 1006
                         <small>geodir_wrapper_content_close</small>
1007 1007
                     </td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1011
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1011
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1012 1012
                 </tr>
1013 1013
 
1014 1014
                 <tr class="gd-theme-comp-out">
1015 1015
                     <td colspan="3">
1016
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1016
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1017 1017
                         <textarea name="geodir_wrapper_content_close_replace"
1018 1018
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1019 1019
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
                 <tr class="gd-theme-comp-out">
1037 1037
                     <td colspan="3">
1038
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1038
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1039 1039
                         <textarea name="geodir_article_open_replace"
1040 1040
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1041 1041
                                 echo $tc['geodir_article_open_replace'];
@@ -1048,14 +1048,14 @@  discard block
 block discarded – undo
1048 1048
                         <small>geodir_article_close</small>
1049 1049
                     </td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1053
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1053
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1054 1054
                 </tr>
1055 1055
 
1056 1056
                 <tr class="gd-theme-comp-out">
1057 1057
                     <td colspan="3">
1058
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1058
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1059 1059
                         <textarea name="geodir_article_close_replace"
1060 1060
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1061 1061
                                 echo $tc['geodir_article_close_replace'];
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
                 <tr class="gd-theme-comp-out">
1080 1080
                     <td colspan="3">
1081
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1081
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1082 1082
                         <textarea name="geodir_sidebar_right_open_replace"
1083 1083
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1084 1084
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1091,14 +1091,14 @@  discard block
 block discarded – undo
1091 1091
                         <small>geodir_sidebar_right_close</small>
1092 1092
                     </td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1096
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1096
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1097 1097
                 </tr>
1098 1098
 
1099 1099
                 <tr class="gd-theme-comp-out">
1100 1100
                     <td colspan="3">
1101
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1101
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1102 1102
                         <textarea name="geodir_sidebar_right_close_replace"
1103 1103
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1104 1104
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
                 <tr class="gd-theme-comp-out">
1124 1124
                     <td colspan="3">
1125
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1125
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1126 1126
                         <textarea name="geodir_sidebar_left_open_replace"
1127 1127
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1128 1128
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1135,14 +1135,14 @@  discard block
 block discarded – undo
1135 1135
                         <small>geodir_sidebar_left_close</small>
1136 1136
                     </td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1140
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1140
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1141 1141
                 </tr>
1142 1142
 
1143 1143
                 <tr class="gd-theme-comp-out">
1144 1144
                     <td colspan="3">
1145
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1145
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1146 1146
                         <textarea name="geodir_sidebar_left_close_replace"
1147 1147
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1148 1148
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 
1165 1165
                 <tr class="gd-theme-comp-out">
1166 1166
                     <td colspan="3">
1167
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1167
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1168 1168
                         <textarea name="geodir_main_content_open_replace"
1169 1169
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1170 1170
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1177,14 +1177,14 @@  discard block
 block discarded – undo
1177 1177
                         <small>geodir_main_content_close</small>
1178 1178
                     </td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1182
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1182
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1183 1183
                 </tr>
1184 1184
 
1185 1185
                 <tr class="gd-theme-comp-out">
1186 1186
                     <td colspan="3">
1187
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1187
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1188 1188
                         <textarea name="geodir_main_content_close_replace"
1189 1189
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1190 1190
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1196,13 +1196,13 @@  discard block
 block discarded – undo
1196 1196
                 </tbody>
1197 1197
             </table>
1198 1198
 
1199
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1199
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1200 1200
 
1201 1201
             <table class="form-table gd-theme-compat-table">
1202 1202
                 <tbody>
1203 1203
                 <tr>
1204
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1205
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1204
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1205
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1206 1206
                 </tr>
1207 1207
 
1208 1208
 
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
             </table>
1232 1232
 
1233 1233
 
1234
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1234
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1235 1235
 
1236 1236
             <table class="form-table gd-theme-compat-table">
1237 1237
                 <tbody>
1238 1238
                 <tr>
1239
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1240
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1239
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1240
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1241 1241
                 </tr>
1242 1242
 
1243 1243
                 <tr>
@@ -1391,13 +1391,13 @@  discard block
 block discarded – undo
1391 1391
                  *
1392 1392
                  * @since 1.4.0
1393 1393
                  */
1394
-                do_action('gd_compat_other_filters');?>
1394
+                do_action('gd_compat_other_filters'); ?>
1395 1395
 
1396 1396
                 </tbody>
1397 1397
             </table>
1398 1398
 
1399 1399
 
1400
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1400
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1401 1401
 
1402 1402
             <table class="form-table gd-theme-compat-table">
1403 1403
                 <tbody>
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
                 </tbody>
1413 1413
             </table>
1414 1414
 
1415
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1415
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1416 1416
 
1417 1417
             <table class="form-table gd-theme-compat-table">
1418 1418
                 <tbody>
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
             <p class="submit">
1432 1432
                 <input name="save" class="button-primary" type="submit"
1433
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1433
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1434 1434
             </p>
1435 1435
 
1436 1436
         </div>
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
          * @param string $listing_type Post type.
1465 1465
          */
1466 1466
         ?>
1467
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1467
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1468 1468
     </div>
1469 1469
     <div id="container_general" class="clearfix">
1470 1470
         <div class="general-form-builder-frame">
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
                  * @param string $listing_type Post type.
1480 1480
                  */
1481 1481
                 ?>
1482
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1482
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1483 1483
 							</span></h3>
1484 1484
                 <?php
1485 1485
                 /**
@@ -1490,9 +1490,9 @@  discard block
 block discarded – undo
1490 1490
                  * @param string $listing_type Post type.
1491 1491
                  */
1492 1492
                 ?>
1493
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1493
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1494 1494
 
1495
-                <h3><?php _e('Setup New Field','geodirectory');?></h3>
1495
+                <h3><?php _e('Setup New Field', 'geodirectory'); ?></h3>
1496 1496
                 <div class="inside">
1497 1497
 
1498 1498
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1511,9 +1511,9 @@  discard block
 block discarded – undo
1511 1511
 
1512 1512
                 </div>
1513 1513
 
1514
-                <?php if($sub_tab=='custom_fields'){ ?>
1514
+                <?php if ($sub_tab == 'custom_fields') { ?>
1515 1515
 
1516
-                <h3><?php _e('Predefined Fields','geodirectory');?></h3>
1516
+                <h3><?php _e('Predefined Fields', 'geodirectory'); ?></h3>
1517 1517
                 <div class="inside">
1518 1518
 
1519 1519
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
                 </div>
1534 1534
 
1535
-                <h3><?php _e('Custom Fields','geodirectory');?></h3>
1535
+                <h3><?php _e('Custom Fields', 'geodirectory'); ?></h3>
1536 1536
                 <div class="inside">
1537 1537
 
1538 1538
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
                      * @param string $listing_type Post type.
1570 1570
                      */
1571 1571
                     ?>
1572
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1572
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1573 1573
                 </h3>
1574 1574
                 <?php
1575 1575
                 /**
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
                  * @param string $listing_type Post type.
1581 1581
                  */
1582 1582
                 ?>
1583
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1583
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1584 1584
 
1585 1585
                 <div class="inside">
1586 1586
 
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
         <div class="gd-content-heading">
1622 1622
 
1623 1623
 
1624
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1624
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1625 1625
             <style>
1626 1626
                 .gd-tools-table {
1627 1627
                     width: 100%;
@@ -1640,40 +1640,40 @@  discard block
 block discarded – undo
1640 1640
             <table class="form-table gd-tools-table">
1641 1641
                 <tbody>
1642 1642
                 <tr>
1643
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1644
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1645
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1643
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1644
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1645
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1646 1646
                 </tr>
1647 1647
 
1648 1648
 
1649 1649
                 <tr>
1650
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1650
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1651 1651
                     <td>
1652
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1652
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1653 1653
                     </td>
1654 1654
                     <td>
1655
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1655
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1656 1656
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1657 1657
                     </td>
1658 1658
                 </tr>
1659 1659
 
1660 1660
 
1661 1661
                 <tr>
1662
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1662
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1663 1663
                     <td>
1664
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1664
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1665 1665
                     </td>
1666
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1666
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1667 1667
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1668 1668
                     </td>
1669 1669
                 </tr>
1670 1670
 
1671 1671
                 <tr>
1672
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1672
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1673 1673
                     <td>
1674
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1674
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1675 1675
                     </td>
1676
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1676
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1677 1677
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1678 1678
                     </td>
1679 1679
                 </tr>
@@ -1688,9 +1688,9 @@  discard block
 block discarded – undo
1688 1688
                         $multiple = "";
1689 1689
                     }
1690 1690
                     ?>
1691
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1691
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1692 1692
                     <td>
1693
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1693
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1694 1694
                         <?php
1695 1695
                         if ($l_count > $step_max_items) {
1696 1696
                             ?>
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
                                                 <?php echo $value['labels']['name']; ?>
1707 1707
                                             </td>
1708 1708
                                             <td>
1709
-                                                <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1709
+                                                <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1710 1710
                                                        class="button-primary geodir_diagnosis_button" data-ptype="<?php echo $key; ?>" data-diagnose="tags_sync"/>
1711 1711
                                             </td>
1712 1712
                                         </tr>
@@ -1720,48 +1720,48 @@  discard block
 block discarded – undo
1720 1720
                         ?>
1721 1721
                     </td>
1722 1722
                     <td>
1723
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1723
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1724 1724
                                class="button-primary geodir_diagnosis_button" <?php echo $multiple; ?> data-diagnose="tags_sync"/>
1725 1725
 
1726 1726
                     </td>
1727 1727
                 </tr>
1728 1728
 
1729 1729
                 <tr>
1730
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1730
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1731 1731
                     <td>
1732
-                        <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>
1732
+                        <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>
1733 1733
                     </td>
1734
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1734
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1735 1735
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1736 1736
                     </td>
1737 1737
                 </tr>
1738 1738
 
1739 1739
 
1740 1740
                 <tr>
1741
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1741
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1742 1742
                     <td>
1743
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1743
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1744 1744
                     </td>
1745
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1745
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1746 1746
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1747 1747
                     </td>
1748 1748
                 </tr>
1749 1749
 				<tr>
1750
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1750
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1751 1751
 					<td>
1752
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1752
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1753 1753
 					</td>
1754 1754
 					<td>
1755
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1755
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1756 1756
 					</td>
1757 1757
 				</tr>
1758 1758
                 <tr>
1759
-                    <td><?php _e('Reload Countries table', 'geodirectory');?></td>
1759
+                    <td><?php _e('Reload Countries table', 'geodirectory'); ?></td>
1760 1760
                     <td>
1761
-                        <small><?php _e('This tool will drop and re-add the countries table, it is meant to refresh the list when countries are added/removed, if you have duplicate country problems you should merge those first or you could have orphaned posts.', 'geodirectory');?></small>
1761
+                        <small><?php _e('This tool will drop and re-add the countries table, it is meant to refresh the list when countries are added/removed, if you have duplicate country problems you should merge those first or you could have orphaned posts.', 'geodirectory'); ?></small>
1762 1762
                     </td>
1763 1763
                     <td>
1764
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="reload_db_countries"/>
1764
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="reload_db_countries"/>
1765 1765
                     </td>
1766 1766
                 </tr>
1767 1767
                 <?php
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
                  * Called after the last setting on the GD>Tools page.
1772 1772
                  * @since 1.0.0
1773 1773
                  */
1774
-                do_action('geodir_diagnostic_tool');?>
1774
+                do_action('geodir_diagnostic_tool'); ?>
1775 1775
 
1776 1776
                 </tbody>
1777 1777
             </table>
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (function_exists('icl_object_id')) {
196
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
  * @return string The untranslated date string.
573 573
  * @since 1.6.5
574 574
  */
575
-function geodir_maybe_untranslate_date($date){
575
+function geodir_maybe_untranslate_date($date) {
576 576
 	$english_long_months = array(
577 577
 		'January',
578 578
 		'February',
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		'December',
589 589
 	);
590 590
 
591
-	$non_english_long_months  = array(
591
+	$non_english_long_months = array(
592 592
 		__('January'),
593 593
 		__('February'),
594 594
 		__('March'),
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		__('November'),
603 603
 		__('December'),
604 604
 	);
605
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
605
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
606 606
 
607 607
 
608 608
 	$english_short_months = array(
@@ -621,21 +621,21 @@  discard block
 block discarded – undo
621 621
 	);
622 622
 
623 623
 	$non_english_short_months = array(
624
-		' '._x( 'Jan', 'January abbreviation' ).' ',
625
-		' '._x( 'Feb', 'February abbreviation' ).' ',
626
-		' '._x( 'Mar', 'March abbreviation' ).' ',
627
-		' '._x( 'Apr', 'April abbreviation' ).' ',
628
-		' '._x( 'May', 'May abbreviation' ).' ',
629
-		' '._x( 'Jun', 'June abbreviation' ).' ',
630
-		' '._x( 'Jul', 'July abbreviation' ).' ',
631
-		' '._x( 'Aug', 'August abbreviation' ).' ',
632
-		' '._x( 'Sep', 'September abbreviation' ).' ',
633
-		' '._x( 'Oct', 'October abbreviation' ).' ',
634
-		' '._x( 'Nov', 'November abbreviation' ).' ',
635
-		' '._x( 'Dec', 'December abbreviation' ).' ',
624
+		' '._x('Jan', 'January abbreviation').' ',
625
+		' '._x('Feb', 'February abbreviation').' ',
626
+		' '._x('Mar', 'March abbreviation').' ',
627
+		' '._x('Apr', 'April abbreviation').' ',
628
+		' '._x('May', 'May abbreviation').' ',
629
+		' '._x('Jun', 'June abbreviation').' ',
630
+		' '._x('Jul', 'July abbreviation').' ',
631
+		' '._x('Aug', 'August abbreviation').' ',
632
+		' '._x('Sep', 'September abbreviation').' ',
633
+		' '._x('Oct', 'October abbreviation').' ',
634
+		' '._x('Nov', 'November abbreviation').' ',
635
+		' '._x('Dec', 'December abbreviation').' ',
636 636
 	);
637 637
 
638
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
638
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
639 639
 
640 640
 
641 641
 	return $date;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
  * @return string Trimmed string.
708 708
  */
709 709
 function geodir_excerpt($text, $length = 100, $options = array()) {
710
-    if (!(int)$length > 0) {
710
+    if (!(int) $length > 0) {
711 711
         return $text;
712 712
     }
713 713
     $default = array(
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         $length = $truncateLength;
770 770
 
771 771
         foreach ($openTags as $tag) {
772
-            $suffix .= '</' . $tag . '>';
772
+            $suffix .= '</'.$tag.'>';
773 773
         }
774 774
     } else {
775 775
         if (geodir_strlen($text, $options) <= $length) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         }
792 792
     }
793 793
 
794
-    return $prefix . $result . $suffix;
794
+    return $prefix.$result.$suffix;
795 795
 }
796 796
 
797 797
 /**
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829 829
     $replace = preg_replace_callback(
830 830
         $pattern,
831
-        function ($match) use ($strlen) {
831
+        function($match) use ($strlen) {
832 832
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833 833
 
834 834
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     }
890 890
 
891 891
     if (empty($options['html'])) {
892
-        return (string)$substr($text, $start, $length);
892
+        return (string) $substr($text, $start, $length);
893 893
     }
894 894
 
895 895
     $totalOffset = 0;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 
915 915
         $len = geodir_strlen($part, $options);
916 916
         if ($offset !== 0 || $totalLength + $len > $length) {
917
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
917
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
918 918
                 // Entities cannot be passed substr.
919 919
                 continue;
920 920
             }
@@ -960,39 +960,39 @@  discard block
 block discarded – undo
960 960
     return '';
961 961
 }
962 962
 
963
-function geodir_tool_restore_cpt_from_taxonomies(){
963
+function geodir_tool_restore_cpt_from_taxonomies() {
964 964
 
965 965
 	$cpts = get_option('geodir_post_types');
966 966
 
967
-	if(!empty($cpts)){return;}
967
+	if (!empty($cpts)) {return; }
968 968
 
969 969
 	$taxonomies = get_option('geodir_taxonomies');
970 970
 
971
-	if(empty($taxonomies)){return;}
971
+	if (empty($taxonomies)) {return; }
972 972
 
973 973
 	$cpts = array();
974 974
 
975
-	foreach($taxonomies as $key => $val){
975
+	foreach ($taxonomies as $key => $val) {
976 976
 
977
-		if(strpos($val['listing_slug'], '/') === false) {
978
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
977
+		if (strpos($val['listing_slug'], '/') === false) {
978
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
979 979
 		}
980 980
 
981 981
 	}
982 982
 
983
-	if(empty($cpts)){return;}
983
+	if (empty($cpts)) {return; }
984 984
 
985 985
 
986 986
 	$cpts_restore = $cpts;
987 987
 
988
-	foreach($cpts as $cpt){
988
+	foreach ($cpts as $cpt) {
989 989
 
990 990
 
991
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
991
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
992 992
 
993
-		$cpts_restore[$cpt['cpt']] = array (
993
+		$cpts_restore[$cpt['cpt']] = array(
994 994
 				'labels' =>
995
-					array (
995
+					array(
996 996
 						'name' => $cpt['slug'],
997 997
 						'singular_name' => $cpt['slug'],
998 998
 						'add_new' => 'Add New',
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 				'public' => true,
1021 1021
 				'query_var' => true,
1022 1022
 				'rewrite' =>
1023
-					array (
1023
+					array(
1024 1024
 						'slug' => $cpt['slug'],
1025 1025
 						'with_front' => false,
1026 1026
 						'hierarchical' => true,
1027 1027
 						'feeds' => true,
1028 1028
 					),
1029 1029
 				'supports' =>
1030
-					array (
1030
+					array(
1031 1031
 						0 => 'title',
1032 1032
 						1 => 'editor',
1033 1033
 						2 => 'author',
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
1037 1037
 						6 => 'comments',
1038 1038
 					),
1039 1039
 				'taxonomies' =>
1040
-					array (
1040
+					array(
1041 1041
 						0 => $cpt['cpt'].'category',
1042 1042
 						1 => $cpt['cpt'].'_tags',
1043 1043
 					),
1044 1044
 				'is_custom' => $is_custom,
1045 1045
 				'listing_order' => '1',
1046 1046
 				'seo' =>
1047
-					array (
1047
+					array(
1048 1048
 						'meta_keyword' => '',
1049 1049
 						'meta_description' => '',
1050 1050
 					),
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	}
1057 1057
 
1058 1058
 
1059
-	update_option('geodir_post_types',$cpts_restore);
1059
+	update_option('geodir_post_types', $cpts_restore);
1060 1060
 
1061 1061
 }
1062 1062
 
@@ -1068,13 +1068,13 @@  discard block
 block discarded – undo
1068 1068
 	$count = 0;
1069 1069
 	
1070 1070
 	if ($post_type) {
1071
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1071
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1072 1072
 	} else {
1073 1073
 		$all_postypes = geodir_get_posttypes();
1074 1074
 
1075 1075
 		if (!empty($all_postypes)) {
1076 1076
 			foreach ($all_postypes as $key) {
1077
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1077
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1078 1078
 			}
1079 1079
 		}	
1080 1080
 	}
Please login to merge, or discard this patch.