Test Failed
Pull Request — master (#421)
by Kiran
16:02
created
geodirectory-functions/compatibility/Twenty_Seventeen.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-add_filter('post_thumbnail_html','geodir_2017_remove_header',10,5);
5
-function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr){
6
-	if($size=='twentyseventeen-featured-image'){
4
+add_filter('post_thumbnail_html', 'geodir_2017_remove_header', 10, 5);
5
+function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr) {
6
+	if ($size == 'twentyseventeen-featured-image') {
7 7
 
8
-		if(geodir_is_page('detail') || geodir_is_page('add-listing')){
9
-			$html = '';// nothing up top
8
+		if (geodir_is_page('detail') || geodir_is_page('add-listing')) {
9
+			$html = ''; // nothing up top
10 10
 		}
11 11
 
12 12
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 }
65 65
 
66
-function geodir_twentyseventeen_body_classes($classes){
66
+function geodir_twentyseventeen_body_classes($classes) {
67 67
 
68
-	if(geodir_is_page('add-listing')
68
+	if (geodir_is_page('add-listing')
69 69
 	   || geodir_is_page('preview')
70 70
 	   || geodir_is_page('home')
71 71
 	   || geodir_is_page('location')
72 72
 	   || geodir_is_page('listing')
73 73
 	   || geodir_is_page('search')
74 74
 	   || geodir_is_page('author')
75
-	){
75
+	) {
76 76
 		$classes[] = 'has-sidebar';
77 77
 	}
78 78
 	return $classes;
79 79
 }
80
-add_filter( 'body_class', 'geodir_twentyseventeen_body_classes' );
80
+add_filter('body_class', 'geodir_twentyseventeen_body_classes');
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,17 +46,13 @@
 block discarded – undo
46 46
 
47 47
 	if (is_page_geodir_home() || geodir_is_page('location')) {
48 48
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
49
-	}
50
-	elseif (geodir_is_page('listing')) {
49
+	} elseif (geodir_is_page('listing')) {
51 50
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
52
-	}
53
-	elseif (geodir_is_page('detail')) {
51
+	} elseif (geodir_is_page('detail')) {
54 52
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
55
-	}
56
-	elseif (geodir_is_page('search')) {
53
+	} elseif (geodir_is_page('search')) {
57 54
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
58
-	}
59
-	elseif (geodir_is_page('author')) {
55
+	} elseif (geodir_is_page('author')) {
60 56
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
61 57
 	}
62 58
 
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -16,100 +16,100 @@
 block discarded – undo
16 16
 
17 17
 $field_ids = array();
18 18
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
19
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
20
-        $field_ids[] = sanitize_text_field($lic_id);
21
-    }
19
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
20
+		$field_ids[] = sanitize_text_field($lic_id);
21
+	}
22 22
 }
23 23
 
24 24
 /* ------- check nonce field ------- */
25 25
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
26
-    echo godir_set_field_order($field_ids);
26
+	echo godir_set_field_order($field_ids);
27 27
 }
28 28
 
29 29
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
30
-    $response = godir_set_sort_field_order($field_ids);
31
-    if (is_array($response)) {
32
-        wp_send_json($response);
33
-    } else {
34
-        echo $response;
35
-    }
30
+	$response = godir_set_sort_field_order($field_ids);
31
+	if (is_array($response)) {
32
+		wp_send_json($response);
33
+	} else {
34
+		echo $response;
35
+	}
36 36
 }
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
+		return;
51 51
     
52
-    echo geodir_custom_field_delete($field_id);
52
+	echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
56
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
+		return;
58 58
     
59
-    echo geodir_custom_sort_field_delete($field_id);
59
+	echo geodir_custom_sort_field_delete($field_id);
60 60
 }
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
-
67
-    foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
-            $tags = 'skip_field';
70
-        } else {
71
-            $tags = '';
72
-        }
73
-
74
-        if ($tags != 'skip_field') {
75
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
-        }
77
-    }
78
-
79
-    $return = geodir_custom_field_save($_REQUEST);
80
-
81
-    if (is_int($return)) {
82
-        $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
-    } else {
85
-        echo $return;
86
-    }
64
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
+		return;
66
+
67
+	foreach ($_REQUEST as $pkey => $pval) {
68
+		if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
+			$tags = 'skip_field';
70
+		} else {
71
+			$tags = '';
72
+		}
73
+
74
+		if ($tags != 'skip_field') {
75
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
+		}
77
+	}
78
+
79
+	$return = geodir_custom_field_save($_REQUEST);
80
+
81
+	if (is_int($return)) {
82
+		$lastid = $return;
83
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
+	} else {
85
+		echo $return;
86
+	}
87 87
 }
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
93
-
94
-    foreach ($_REQUEST as $pkey => $pval) {
95
-        if (is_array($_REQUEST[$pkey])) {
96
-            $tags = 'skip_field';
97
-        } else {
98
-            $tags = '';
99
-        }
100
-
101
-        if ($tags != 'skip_field') {
102
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
-        }
104
-    }
105
-
106
-    $return = geodir_custom_sort_field_save($_REQUEST);
107
-
108
-    if (is_int($return)) {
109
-        $lastid = $return;
110
-        $default = false;
111
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
-    } else {
113
-        echo $return;
114
-    }
91
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
+		return;
93
+
94
+	foreach ($_REQUEST as $pkey => $pval) {
95
+		if (is_array($_REQUEST[$pkey])) {
96
+			$tags = 'skip_field';
97
+		} else {
98
+			$tags = '';
99
+		}
100
+
101
+		if ($tags != 'skip_field') {
102
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
+		}
104
+	}
105
+
106
+	$return = geodir_custom_sort_field_save($_REQUEST);
107
+
108
+	if (is_int($return)) {
109
+		$lastid = $return;
110
+		$default = false;
111
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
+	} else {
113
+		echo $return;
114
+	}
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+    geodir_custom_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
50 50
         return;
51 51
     
52 52
     echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
56
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
57 57
         return;
58 58
     
59 59
     echo geodir_custom_sort_field_delete($field_id);
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
64
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
65 65
         return;
66 66
 
67 67
     foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
68
+        if (is_array($_REQUEST[$pkey]) || $pkey == 'default_value') {
69 69
             $tags = 'skip_field';
70 70
         } else {
71 71
             $tags = '';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     if (is_int($return)) {
82 82
         $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
83
+        geodir_custom_field_adminhtml($field_type, $lastid, 'submit', $field_type_key);
84 84
     } else {
85 85
         echo $return;
86 86
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
91
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
92 92
         return;
93 93
 
94 94
     foreach ($_REQUEST as $pkey => $pval) {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,23 +46,26 @@  discard block
 block discarded – undo
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
50
+            return;
51
+    }
51 52
     
52 53
     echo geodir_custom_field_delete($field_id);
53 54
 }
54 55
 
55 56
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
57
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
58
+            return;
59
+    }
58 60
     
59 61
     echo geodir_custom_sort_field_delete($field_id);
60 62
 }
61 63
 
62 64
 /* ---- Save field  ---- */
63 65
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
67
+            return;
68
+    }
66 69
 
67 70
     foreach ($_REQUEST as $pkey => $pval) {
68 71
         if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 
89 92
 /* ---- Save sort field  ---- */
90 93
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
94
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
95
+            return;
96
+    }
93 97
 
94 98
     foreach ($_REQUEST as $pkey => $pval) {
95 99
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 3 patches
Braces   +30 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
19
+    if (!session_id()) {
20
+    	session_start();
21
+    }
20 22
     global $geodir_add_location_url;
21 23
 
22 24
     $geodir_add_location_url = NULL;
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
     if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 90
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
91
+        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') {
92
+        	$_REQUEST['scat'] = '';
93
+        }
90 94
         //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 95
 
92 96
         if (isset($_REQUEST['sdist'])) {
@@ -198,8 +202,9 @@  discard block
 block discarded – undo
198 202
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 203
         add_filter('posts_join', 'geodir_posts_join', 1);
200 204
         geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
205
+        if (!is_admin()) {
206
+                    add_filter('posts_orderby', 'geodir_posts_orderby', 1);
207
+        }
203 208
 
204 209
         // advanced filter for popular post view widget
205 210
         global $wp_query;
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
     $sort_by = '';
350 355
     $orderby = ' ';
351 356
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
357
+    if (get_query_var('order_by')) {
358
+            $sort_by = get_query_var('order_by');
359
+    }
354 360
 
355 361
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 362
         $current_term = $wp_query->get_queried_object();
@@ -370,14 +376,16 @@  discard block
 block discarded – undo
370 376
         $orderby .= " distance,";
371 377
     }
372 378
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
379
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
380
+            $sort_by = esc_attr($_REQUEST['sort_by']);
381
+    }
375 382
 
376 383
 
377 384
     if ($sort_by == '') {
378 385
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
386
+        if (!empty($default_sort)) {
387
+                    $sort_by = $default_sort;
388
+        }
381 389
     }
382 390
 
383 391
     /*
@@ -572,8 +580,9 @@  discard block
 block discarded – undo
572 580
 
573 581
             add_filter('posts_where', 'searching_filter_where', 1);
574 582
 
575
-            if ($snear != '')
576
-                add_filter('posts_where', 'searching_filter_where', 1);
583
+            if ($snear != '') {
584
+                            add_filter('posts_where', 'searching_filter_where', 1);
585
+            }
577 586
 
578 587
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
579 588
 
@@ -727,10 +736,11 @@  discard block
 block discarded – undo
727 736
 
728 737
     $where = '';
729 738
     $better_search_terms = '';
730
-    if (isset($_REQUEST['stype']))
731
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
732
-    else
733
-        $post_types = 'gd_place';
739
+    if (isset($_REQUEST['stype'])) {
740
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
741
+    } else {
742
+            $post_types = 'gd_place';
743
+    }
734 744
 
735 745
     if ($s != '') {
736 746
         $keywords = explode(" ", $s);
@@ -767,7 +777,7 @@  discard block
 block discarded – undo
767 777
     if($taxonomies) {
768 778
         $taxonomies = implode("','", $taxonomies);
769 779
         $taxonomies = "'" . $taxonomies . "'";
770
-    }else{$taxonomies='';}
780
+    } else{$taxonomies='';}
771 781
 
772 782
     $content_where = $terms_where = '';
773 783
 	if ($s != '') {
@@ -887,8 +897,9 @@  discard block
 block discarded – undo
887 897
             $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
888 898
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
889 899
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
890
-        } else
891
-            $where .= " AND $wpdb->posts.post_author = $user_id";
900
+        } else {
901
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
902
+        }
892 903
 
893 904
         if ($user_id == (int)get_current_user_id()) {
894 905
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  * @global string $s_A Extra parameters.
66 66
  * @global string $s_SA Extra parameters.
67 67
  */
68
-function set_listing_request($query )
68
+function set_listing_request($query)
69 69
 {
70 70
     global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         } //  Distance
100 100
 
101 101
         if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
102
+            $mylat = (float) esc_attr($_REQUEST['sgeo_lat']);
103 103
         } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
104
+            $mylat = (float) geodir_get_current_city_lat();
105 105
         } //  Latitude
106 106
 
107 107
         if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
108
+            $mylon = (float) esc_attr($_REQUEST['sgeo_lon']);
109 109
         } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
110
+            $mylon = (float) geodir_get_current_city_lng();
111 111
         } //  Distance
112 112
 
113 113
         if (isset($_REQUEST['snear'])) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         if ($snear == 'NEAR ME') {
122 122
             $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
123
+            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
124 124
             $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126 126
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             $s_AA = str_replace(" ", "", $s);
131 131
             $s_A = explode(",", $s_AA);
132 132
             $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
133
+            $s_A = '"'.$s_A.'"';
134 134
         } else {
135
-            $s_A = '"' . $s . '"';
135
+            $s_A = '"'.$s.'"';
136 136
         }
137 137
 
138 138
         if (strstr($s, ' ')) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195 195
 
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
196
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
197 197
 
198 198
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 199
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235 235
     // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
236
+    $fields .= ", ".$table.".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
245 245
 
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
246
+        $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247 247
     }
248 248
 
249 249
     global $s;
250 250
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251 251
         $keywords = explode(" ", $s);
252 252
 
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (geodir_utf8_strlen($kword) <= $klimit) {
256 256
                     unset($keywords[$kkey]);
257 257
                 }
258 258
             }
@@ -270,24 +270,24 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
273
+                    $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
274 274
 					$count++;
275 275
                     if ($count < count($keywords)) {
276 276
                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
277
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." ";
278 278
                     } else {
279 279
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ";
281 281
                     }
282 282
                 }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.",";
284 284
             }
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
290
-		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
290
+		$fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
291 291
     }
292 292
 
293 293
     return $fields;
@@ -311,18 +311,18 @@  discard block
 block discarded – undo
311 311
 
312 312
     ########### WPML ###########
313 313
 
314
-    if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
314
+    if (geodir_wpml_is_post_type_translated($geodir_post_type)) {
315 315
         global $sitepress;
316 316
         $lang_code = ICL_LANGUAGE_CODE;
317 317
         $default_lang_code = $sitepress->get_default_language();
318 318
         if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
319
+            $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
320 320
         }
321 321
 
322 322
     }
323 323
     ########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
325
+    $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID)  ";
326 326
     //===old code start
327 327
     //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             $sort_by = 'az';
392 392
         }
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
394
+        if ($snear != '' && $sort_by != 'farthest') {
395 395
             $sort_by = 'nearest';
396 396
         }
397 397
     }
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
             break;
406 406
         case 'low_review':
407 407
         case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
408
+            $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, ";
409 409
             break;
410 410
         case 'high_review':
411 411
         case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
412
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
413 413
             break;
414 414
         case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
415
+            $orderby = "( ".$table.".overall_rating  ) ASC, ".$table.".rating_count ASC,  ";
416 416
             break;
417 417
         case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
418
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
419 419
             break;
420 420
         case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
421
+            $orderby = $table.".is_featured asc, ";
422 422
             break;
423 423
         case 'nearest':
424 424
             $orderby = " distance asc, ";
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
             break;
435 435
         // sort by rating
436 436
         case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
437
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
438 438
             break;
439 439
         case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
440
+            $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, ";
441 441
             break;
442 442
         default:
443 443
 
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460 460
         $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
461
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
462
+            foreach ($keywords as $kkey=>$kword) {
463
+                if (geodir_utf8_strlen($kword) <= $klimit) {
464 464
                     unset($keywords[$kkey]);
465 465
                 }
466 466
             }
467 467
         }
468 468
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469 469
             if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
470
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471 471
             } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
472
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473 473
             }
474 474
         } else {
475 475
             if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
476
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
477 477
             } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
478
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
479 479
             }
480 480
         }
481 481
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      */
491 491
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495 495
     return $orderby;
496 496
 }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+    if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
516 516
 
517 517
         $sort_array = explode('_', $sort_by);
518 518
 
@@ -522,31 +522,31 @@  discard block
 block discarded – undo
522 522
 
523 523
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+            $sort_by = str_replace('_'.$order, '', $sort_by);
526 526
 
527 527
             switch ($sort_by):
528 528
 
529 529
                 case 'post_date':
530 530
                 case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
532
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
533 533
                     break;
534 534
 
535 535
                 case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
536
+                    $orderby = $sort_by." ".$order.", ";
537 537
                     break;
538 538
 
539 539
 
540 540
                 // sort by rating
541 541
                 case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
542
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
543 543
 
544 544
                     break;
545 545
 
546 546
 
547 547
                 default:
548 548
                     if (geodir_column_exist($table, $sort_by)) {
549
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
549
+						$orderby = $table.".".$sort_by." ".$order.", ";
550 550
 					}
551 551
                     break;
552 552
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
597
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
598 598
 
599 599
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666 666
         //echo '##########'.$q_post_type;
667 667
         if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
668
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
669 669
             //$where .= " AND icl_t.language_code = '$lang_code' ";
670 670
         }
671 671
 
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
735
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
736
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
737 737
 
738 738
     $where = '';
739 739
     $better_search_terms = '';
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 
745 745
     if ($s != '') {
746 746
         $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
747
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
748
+            foreach ($keywords as $kkey=>$kword) {
749
+                if (geodir_utf8_strlen($kword) <= $klimit) {
750 750
                     unset($keywords[$kkey]);
751 751
                 }
752 752
             }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         if (!empty($keywords)) {
756 756
             foreach ($keywords as $keyword) {
757 757
                 $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
758
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
759 759
                 if ($keyword != '') {
760 760
                     /**
761 761
                      * Filter the search query keywords SQL.
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                      * @param array $keywords The array of keywords for the query.
767 767
                      * @param string $keyword The single keyword being searched.
768 768
                      */
769
-					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
769
+					$better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
770 770
                 }
771 771
             }
772 772
         }
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 
775 775
     /* get taxonomy */
776 776
     $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
777
+    if ($taxonomies) {
778 778
         $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
779
+        $taxonomies = "'".$taxonomies."'";
780
+    } else {$taxonomies = ''; }
781 781
 
782 782
     $content_where = $terms_where = '';
783 783
 	if ($s != '') {
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
          * @package GeoDirectory
789 789
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790 790
          */
791
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
791
+		$content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792 792
         /**
793 793
          * Filter the search query term values.
794 794
          *
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
          * @package GeoDirectory
797 797
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798 798
          */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
799
+        $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802 802
     if ($snear != '') {
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 							)
832 832
 						AND $wpdb->posts.post_type in ('{$post_types}')
833 833
 						AND ($wpdb->posts.post_status = 'publish')
834
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
834
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
835
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837 837
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838 838
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
839
+            $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
840 840
         }
841 841
 
842 842
     } else {
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
 	########### WPML ###########
860
-    if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
860
+    if (geodir_wpml_is_post_type_translated($post_types)) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
864
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
865 865
         }
866 866
     }
867 867
     ########### WPML ###########
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
     global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886 886
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
887
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
888 888
 
889 889
     if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
890
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
891 891
     } else {
892 892
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893 893
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         } else
901 901
             $where .= " AND $wpdb->posts.post_author = $user_id";
902 902
 
903
-        if ($user_id == (int)get_current_user_id()) {
903
+        if ($user_id == (int) get_current_user_id()) {
904 904
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905 905
         } else {
906 906
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
     if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
914 914
         $lang_code = ICL_LANGUAGE_CODE;
915 915
         if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
916
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
917 917
         }
918 918
 
919 919
     }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 {
937 937
     global $wp_query, $table;
938 938
     if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
939
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
940 940
     }
941 941
     return $join;
942 942
 }
@@ -955,16 +955,16 @@  discard block
 block discarded – undo
955 955
 {
956 956
     global $wp_query, $table;
957 957
     if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
958
+        $where .= " AND ".$table.".is_featured = '1'";
959 959
     }
960 960
     if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
961
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
962 962
     }
963 963
     if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
964
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
965 965
     }
966 966
     if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
967
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
968 968
     }
969 969
     return $where;
970 970
 }
@@ -973,18 +973,18 @@  discard block
 block discarded – undo
973 973
 function geodir_related_posts_fields($fields) {
974 974
     global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+    $fields .= ", ".$table.".* ";
977 977
 
978 978
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980 980
     $mylat = $post->post_latitude;
981 981
     $mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
983
+    $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984 984
     return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
987
+    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988 988
         && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989 989
         && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990 990
     ) {
@@ -1003,25 +1003,25 @@  discard block
 block discarded – undo
1003 1003
  * @param string $table Listing table name.
1004 1004
  * @return string|null If field exists in table returns order by clause else returns empty.
1005 1005
  */
1006
-function geodir_prepare_custom_sorting( $sorting, $table ) {
1006
+function geodir_prepare_custom_sorting($sorting, $table) {
1007 1007
     $orderby = '';
1008 1008
     
1009
-    if ( empty( $sorting ) || empty( $table ) ) {
1009
+    if (empty($sorting) || empty($table)) {
1010 1010
         return $orderby;
1011 1011
     }
1012 1012
     
1013
-    if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
-        $sorting_array = explode( '_', $sorting );
1013
+    if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) {
1014
+        $sorting_array = explode('_', $sorting);
1015 1015
         
1016
-        if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
-            $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
-            array_pop( $sorting_array );
1016
+        if (($count = count($sorting_array)) > 1) {
1017
+            $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : '';
1018
+            array_pop($sorting_array);
1019 1019
             
1020
-            if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
-                $sort_by = implode( '_', $sorting_array );
1020
+            if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) {
1021
+                $sort_by = implode('_', $sorting_array);
1022 1022
                 
1023
-                if ( geodir_column_exist( $table, $sort_by ) ) {
1024
-                    $orderby = $table . "." . $sort_by . " " . $order;
1023
+                if (geodir_column_exist($table, $sort_by)) {
1024
+                    $orderby = $table.".".$sort_by." ".$order;
1025 1025
                 }
1026 1026
             }
1027 1027
         }
Please login to merge, or discard this patch.
Indentation   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
20
-    global $geodir_add_location_url;
19
+	if (!session_id()) session_start();
20
+	global $geodir_add_location_url;
21 21
 
22
-    $geodir_add_location_url = NULL;
22
+	$geodir_add_location_url = NULL;
23 23
 }
24 24
 
25 25
 /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_modified_query($query)
35 35
 {
36
-    if ($query->is_main_query() && (
37
-            (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
-            || geodir_is_page('listing')
39
-            || geodir_is_page('author')
40
-            || geodir_is_page('search')
41
-            || geodir_is_page('detail'))
42
-    ) {
43
-
44
-        $query->set('is_geodir_loop', true);
45
-    }
36
+	if ($query->is_main_query() && (
37
+			(geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
+			|| geodir_is_page('listing')
39
+			|| geodir_is_page('author')
40
+			|| geodir_is_page('search')
41
+			|| geodir_is_page('detail'))
42
+	) {
43
+
44
+		$query->set('is_geodir_loop', true);
45
+	}
46 46
 
47
-    return $query;
47
+	return $query;
48 48
 }
49 49
 
50 50
 /**
@@ -67,81 +67,81 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function set_listing_request($query )
69 69
 {
70
-    global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
70
+	global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
72 72
 
73
-    // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
-    if (!geodir_is_geodir_page()) {
75
-        return;
76
-    }
73
+	// fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
+	if (!geodir_is_geodir_page()) {
75
+		return;
76
+	}
77 77
 
78
-    /* remove all pre filters */
79
-    remove_all_filters('query');
80
-    remove_all_filters('posts_search');
81
-    remove_all_filters('posts_fields');
82
-    remove_all_filters('posts_join');
83
-    remove_all_filters('posts_orderby');
84
-    remove_all_filters('posts_where');
78
+	/* remove all pre filters */
79
+	remove_all_filters('query');
80
+	remove_all_filters('posts_search');
81
+	remove_all_filters('posts_fields');
82
+	remove_all_filters('posts_join');
83
+	remove_all_filters('posts_orderby');
84
+	remove_all_filters('posts_where');
85 85
 
86 86
 
87
-    if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
87
+	if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 88
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
-        //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
89
+		if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
+		//if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 91
 
92
-        if (isset($_REQUEST['sdist'])) {
93
-            ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
-        } elseif (get_option('geodir_search_dist') != '') {
95
-            $dist = get_option('geodir_search_dist');
92
+		if (isset($_REQUEST['sdist'])) {
93
+			($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
+		} elseif (get_option('geodir_search_dist') != '') {
95
+			$dist = get_option('geodir_search_dist');
96 96
 
97
-        } else {
98
-            $dist = 25000;
99
-        } //  Distance
97
+		} else {
98
+			$dist = 25000;
99
+		} //  Distance
100 100
 
101
-        if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
-        } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
105
-        } //  Latitude
101
+		if (isset($_REQUEST['sgeo_lat'])) {
102
+			$mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
+		} else {
104
+			$mylat = (float)geodir_get_current_city_lat();
105
+		} //  Latitude
106 106
 
107
-        if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
-        } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
111
-        } //  Distance
107
+		if (isset($_REQUEST['sgeo_lon'])) {
108
+			$mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
+		} else {
110
+			$mylon = (float)geodir_get_current_city_lng();
111
+		} //  Distance
112 112
 
113
-        if (isset($_REQUEST['snear'])) {
114
-            $snear = trim(esc_attr($_REQUEST['snear']));
115
-        }
113
+		if (isset($_REQUEST['snear'])) {
114
+			$snear = trim(esc_attr($_REQUEST['snear']));
115
+		}
116 116
 
117
-        if (isset($_REQUEST['s'])) {
118
-            $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
-        }
117
+		if (isset($_REQUEST['s'])) {
118
+			$s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
+		}
120 120
 
121
-        if ($snear == 'NEAR ME') {
122
-            $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
-            $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125
-            $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126
-        }
121
+		if ($snear == 'NEAR ME') {
122
+			$ip = $_SERVER['REMOTE_ADDR'];
123
+			$addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
+			$mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125
+			$mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126
+		}
127 127
 
128 128
 
129
-        if (strstr($s, ',')) {
130
-            $s_AA = str_replace(" ", "", $s);
131
-            $s_A = explode(",", $s_AA);
132
-            $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
134
-        } else {
135
-            $s_A = '"' . $s . '"';
136
-        }
129
+		if (strstr($s, ',')) {
130
+			$s_AA = str_replace(" ", "", $s);
131
+			$s_A = explode(",", $s_AA);
132
+			$s_A = implode('","', $s_A);
133
+			$s_A = '"' . $s_A . '"';
134
+		} else {
135
+			$s_A = '"' . $s . '"';
136
+		}
137 137
 
138
-        if (strstr($s, ' ')) {
139
-            $s_SA = explode(" ", $s);
140
-        } else {
141
-            $s_SA = '';
142
-        }
138
+		if (strstr($s, ' ')) {
139
+			$s_SA = explode(" ", $s);
140
+		} else {
141
+			$s_SA = '';
142
+		}
143 143
 
144
-    endif;
144
+	endif;
145 145
 
146 146
 
147 147
 
@@ -162,56 +162,56 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function geodir_listing_loop_filter($query)
164 164
 {
165
-    global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
165
+	global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
166 166
 
167
-    // fix wp_reset_query for popular post view widget
168
-    if (!geodir_is_geodir_page()) {
169
-        return;
170
-    }
167
+	// fix wp_reset_query for popular post view widget
168
+	if (!geodir_is_geodir_page()) {
169
+		return;
170
+	}
171 171
 
172
-    $geodir_post_type = geodir_get_current_posttype();
173
-
174
-    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
-        $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
-
177
-        if (isset($wp_query->query[$taxonomies[0]])) {
178
-            $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
-            $request_term = end($request_term);
180
-            if (!term_exists($request_term)) {
181
-                $args = array('number' => '1',);
182
-                $terms_arr = get_terms($taxonomies[0], $args);
183
-                foreach ($terms_arr as $location_term) {
184
-                    $term_arr = $location_term;
185
-                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
-                }
187
-                $wp_query->queried_object_id = 1;
188
-                $wp_query->queried_object = $term_arr;
189
-                //print_r($wp_query) ;
190
-            }
191
-        }
172
+	$geodir_post_type = geodir_get_current_posttype();
173
+
174
+	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
+		$taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
+
177
+		if (isset($wp_query->query[$taxonomies[0]])) {
178
+			$request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
+			$request_term = end($request_term);
180
+			if (!term_exists($request_term)) {
181
+				$args = array('number' => '1',);
182
+				$terms_arr = get_terms($taxonomies[0], $args);
183
+				foreach ($terms_arr as $location_term) {
184
+					$term_arr = $location_term;
185
+					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
+				}
187
+				$wp_query->queried_object_id = 1;
188
+				$wp_query->queried_object = $term_arr;
189
+				//print_r($wp_query) ;
190
+			}
191
+		}
192 192
 
193
-    }
194
-    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195
-
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
197
-
198
-        add_filter('posts_fields', 'geodir_posts_fields', 1);
199
-        add_filter('posts_join', 'geodir_posts_join', 1);
200
-        geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
-
204
-        // advanced filter for popular post view widget
205
-        global $wp_query;
206
-        if (!is_admin()) {
207
-            if (!empty($wp_query->query['with_pics_only'])) {
208
-                add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
-            }
210
-            add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
-        }
193
+	}
194
+	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
212 195
 
213
-    }
214
-    return $query;
196
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
197
+
198
+		add_filter('posts_fields', 'geodir_posts_fields', 1);
199
+		add_filter('posts_join', 'geodir_posts_join', 1);
200
+		geodir_post_where();
201
+		if (!is_admin())
202
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
+
204
+		// advanced filter for popular post view widget
205
+		global $wp_query;
206
+		if (!is_admin()) {
207
+			if (!empty($wp_query->query['with_pics_only'])) {
208
+				add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
+			}
210
+			add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
+		}
212
+
213
+	}
214
+	return $query;
215 215
 }
216 216
 
217 217
 
@@ -230,67 +230,67 @@  discard block
 block discarded – undo
230 230
  * @return string Modified fields query string.
231 231
  */
232 232
 function geodir_posts_fields($fields) {
233
-    global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
233
+	global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235
-    // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
235
+	// Filter-Location-Manager to add location table.
236
+	$fields .= ", " . $table . ".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239
-        $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
239
+		$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
240 240
 
241 241
 		if ($gd_session->get('all_near_me')) {
242
-            $mylat = $gd_session->get('user_lat');
243
-            $mylon = $gd_session->get('user_lon');
244
-        }
245
-
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
-    }
248
-
249
-    global $s;
250
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
-        $keywords = explode(" ", $s);
252
-
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
256
-                    unset($keywords[$kkey]);
257
-                }
258
-            }
259
-        }
242
+			$mylat = $gd_session->get('user_lat');
243
+			$mylon = $gd_session->get('user_lon');
244
+		}
260 245
 
246
+		$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
+	}
261 248
 
262
-        if (count($keywords) > 1) {
263
-            $parts = array(
264
-                'AND' => 'gd_alltitlematch_part',
265
-                'OR' => 'gd_titlematch_part'
266
-            );
267
-            $gd_titlematch_part = "";
268
-            foreach ($parts as $key => $part) {
269
-                $gd_titlematch_part .= " CASE WHEN ";
270
-                $count = 0;
271
-                foreach ($keywords as $keyword) {
272
-                    $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
249
+	global $s;
250
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
+		$keywords = explode(" ", $s);
252
+
253
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
+			foreach($keywords as $kkey=>$kword){
255
+				if(geodir_utf8_strlen($kword)<=$klimit){
256
+					unset($keywords[$kkey]);
257
+				}
258
+			}
259
+		}
260
+
261
+
262
+		if (count($keywords) > 1) {
263
+			$parts = array(
264
+				'AND' => 'gd_alltitlematch_part',
265
+				'OR' => 'gd_titlematch_part'
266
+			);
267
+			$gd_titlematch_part = "";
268
+			foreach ($parts as $key => $part) {
269
+				$gd_titlematch_part .= " CASE WHEN ";
270
+				$count = 0;
271
+				foreach ($keywords as $keyword) {
272
+					$keyword = trim($keyword);
273
+					$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
274 274
 					$count++;
275
-                    if ($count < count($keywords)) {
276
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
275
+					if ($count < count($keywords)) {
276
+					   // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277 277
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
278
-                    } else {
279
-                        //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
278
+					} else {
279
+						//$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280 280
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
281
-                    }
282
-                }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
-            }
285
-        } else {
286
-            $gd_titlematch_part = "";
287
-        }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
281
+					}
282
+				}
283
+				$gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
+			}
285
+		} else {
286
+			$gd_titlematch_part = "";
287
+		}
288
+		$s = stripslashes_deep( $s );
289
+		$s = wp_specialchars_decode($s,ENT_QUOTES);
290 290
 		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
291
-    }
291
+	}
292 292
 
293
-    return $fields;
293
+	return $fields;
294 294
 }
295 295
 
296 296
 
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function geodir_posts_join($join)
309 309
 {
310
-    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
310
+	global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
311 311
 
312
-    ########### WPML ###########
312
+	########### WPML ###########
313 313
 
314
-    if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
315
-        global $sitepress;
316
-        $lang_code = ICL_LANGUAGE_CODE;
317
-        $default_lang_code = $sitepress->get_default_language();
318
-        if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
-        }
314
+	if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
315
+		global $sitepress;
316
+		$lang_code = ICL_LANGUAGE_CODE;
317
+		$default_lang_code = $sitepress->get_default_language();
318
+		if ($lang_code) {
319
+			$join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
+		}
321 321
 
322
-    }
323
-    ########### WPML ###########
322
+	}
323
+	########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
-    //===old code start
327
-    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
325
+	$join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
+	//===old code start
327
+	//$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
329
-    return $join;
329
+	return $join;
330 330
 }
331 331
 
332 332
 
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function geodir_posts_orderby($orderby)
346 346
 {
347
-    global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
347
+	global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
348 348
 
349
-    $sort_by = '';
350
-    $orderby = ' ';
349
+	$sort_by = '';
350
+	$orderby = ' ';
351 351
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
352
+	if (get_query_var('order_by'))
353
+		$sort_by = get_query_var('order_by');
354 354
 
355
-    /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
355
+	/*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 356
         $current_term = $wp_query->get_queried_object();
357 357
     }
358 358
 
@@ -366,133 +366,133 @@  discard block
 block discarded – undo
366 366
     }*/
367 367
 
368 368
 
369
-    if ($snear != '') {
370
-        $orderby .= " distance,";
371
-    }
369
+	if ($snear != '') {
370
+		$orderby .= " distance,";
371
+	}
372 372
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
373
+	if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
+		$sort_by = esc_attr($_REQUEST['sort_by']);
375 375
 
376 376
 
377
-    if ($sort_by == '') {
378
-        $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
381
-    }
377
+	if ($sort_by == '') {
378
+		$default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
+		if (!empty($default_sort))
380
+			$sort_by = $default_sort;
381
+	}
382 382
 
383
-    /*
383
+	/*
384 384
     if search by term & no location then order always "relevance"
385 385
     if search by location then order always "nearest"
386 386
     */
387
-    if (is_main_query() && geodir_is_page('search')) {
388
-        $search_term = get_query_var('s');
387
+	if (is_main_query() && geodir_is_page('search')) {
388
+		$search_term = get_query_var('s');
389 389
 
390
-        if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
-            $sort_by = 'az';
392
-        }
390
+		if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
+			$sort_by = 'az';
392
+		}
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
398
-
399
-    switch ($sort_by):
400
-        case 'newest':
401
-            $orderby = "$wpdb->posts.post_date desc, ";
402
-            break;
403
-        case 'oldest':
404
-            $orderby = "$wpdb->posts.post_date asc, ";
405
-            break;
406
-        case 'low_review':
407
-        case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
-            break;
410
-        case 'high_review':
411
-        case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
-            break;
414
-        case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
-            break;
417
-        case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
-            break;
420
-        case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
422
-            break;
423
-        case 'nearest':
424
-            $orderby = " distance asc, ";
425
-            break;
426
-        case 'farthest':
427
-            $orderby = " distance desc, ";
428
-            break;
429
-        case 'random':
430
-            $orderby = " rand(), ";
431
-            break;
432
-        case 'az':
433
-            $orderby = "$wpdb->posts.post_title asc, ";
434
-            break;
435
-        // sort by rating
436
-        case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
-            break;
439
-        case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
-            break;
442
-        default:
443
-
444
-            break;
445
-    endswitch;
446
-
447
-    if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
-        if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
-            $orderby = "$wpdb->posts.comment_count DESC, ";
450
-            $sort_by = 'comment_count_desc';
451
-        } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
-            $orderby = "$wpdb->posts.comment_count ASC, ";
453
-            $sort_by = 'comment_count_asc';
454
-        }
455
-    }
394
+		if ($snear != '' &&  $sort_by!='farthest') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
456 398
 
457
-    global $s;
399
+	switch ($sort_by):
400
+		case 'newest':
401
+			$orderby = "$wpdb->posts.post_date desc, ";
402
+			break;
403
+		case 'oldest':
404
+			$orderby = "$wpdb->posts.post_date asc, ";
405
+			break;
406
+		case 'low_review':
407
+		case 'rating_count_asc':
408
+			$orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
+			break;
410
+		case 'high_review':
411
+		case 'rating_count_desc':
412
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
+			break;
414
+		case 'low_rating':
415
+			$orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
+			break;
417
+		case 'high_rating':
418
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
+			break;
420
+		case 'featured':
421
+			$orderby = $table . ".is_featured asc, ";
422
+			break;
423
+		case 'nearest':
424
+			$orderby = " distance asc, ";
425
+			break;
426
+		case 'farthest':
427
+			$orderby = " distance desc, ";
428
+			break;
429
+		case 'random':
430
+			$orderby = " rand(), ";
431
+			break;
432
+		case 'az':
433
+			$orderby = "$wpdb->posts.post_title asc, ";
434
+			break;
435
+		// sort by rating
436
+		case 'overall_rating_desc':
437
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
+			break;
439
+		case 'overall_rating_asc':
440
+			$orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
+			break;
442
+		default:
443
+
444
+			break;
445
+	endswitch;
446
+
447
+	if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
+		if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
+			$orderby = "$wpdb->posts.comment_count DESC, ";
450
+			$sort_by = 'comment_count_desc';
451
+		} else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
+			$orderby = "$wpdb->posts.comment_count ASC, ";
453
+			$sort_by = 'comment_count_asc';
454
+		}
455
+	}
458 456
 
459
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
-        $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
464
-                    unset($keywords[$kkey]);
465
-                }
466
-            }
467
-        }
468
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
-            if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
-            } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
-            }
474
-        } else {
475
-            if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
-            } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
-            }
480
-        }
481
-    }
457
+	global $s;
458
+
459
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
+		$keywords = explode(" ", $s);
461
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
+			foreach($keywords as $kkey=>$kword){
463
+				if(geodir_utf8_strlen($kword)<=$klimit){
464
+					unset($keywords[$kkey]);
465
+				}
466
+			}
467
+		}
468
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
+			if (count($keywords) > 1) {
470
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
+			} else {
472
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
+			}
474
+		} else {
475
+			if (count($keywords) > 1) {
476
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
+			} else {
478
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
+			}
480
+		}
481
+	}
482 482
 
483
-    /**
484
-     * Filter order by SQL.
485
-     *
486
-     * @since 1.0.0
487
-     * @param string $orderby The orderby query string.
488
-     * @param string $sort_by Sortby query string.
489
-     * @param string $table Listing table name.
490
-     */
491
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
483
+	/**
484
+	 * Filter order by SQL.
485
+	 *
486
+	 * @since 1.0.0
487
+	 * @param string $orderby The orderby query string.
488
+	 * @param string $sort_by Sortby query string.
489
+	 * @param string $table Listing table name.
490
+	 */
491
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495
-    return $orderby;
495
+	return $orderby;
496 496
 }
497 497
 
498 498
 
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
511 511
 {
512 512
 
513
-    global $wpdb;
513
+	global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+	if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
516 516
 
517
-        $sort_array = explode('_', $sort_by);
517
+		$sort_array = explode('_', $sort_by);
518 518
 
519
-        $sort_by_count = count($sort_array);
519
+		$sort_by_count = count($sort_array);
520 520
 
521
-        $order = $sort_array[$sort_by_count - 1];
521
+		$order = $sort_array[$sort_by_count - 1];
522 522
 
523
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
523
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+			$sort_by = str_replace('_' . $order, '', $sort_by);
526 526
 
527
-            switch ($sort_by):
527
+			switch ($sort_by):
528 528
 
529
-                case 'post_date':
530
-                case 'comment_count':
529
+				case 'post_date':
530
+				case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
-                    break;
532
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
+					break;
534 534
 
535
-                case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
537
-                    break;
535
+				case 'distance':
536
+					$orderby = $sort_by . " " . $order . ", ";
537
+					break;
538 538
 
539 539
 
540
-                // sort by rating
541
-                case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
540
+				// sort by rating
541
+				case 'overall_rating':
542
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
543 543
 
544
-                    break;
544
+					break;
545 545
 
546 546
 
547
-                default:
548
-                    if (geodir_column_exist($table, $sort_by)) {
547
+				default:
548
+					if (geodir_column_exist($table, $sort_by)) {
549 549
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
550 550
 					}
551
-                    break;
551
+					break;
552 552
 
553
-            endswitch;
553
+			endswitch;
554 554
 
555
-        }
555
+		}
556 556
 
557
-    }
557
+	}
558 558
 
559
-    return $orderby;
559
+	return $orderby;
560 560
 }
561 561
 
562 562
 /**
@@ -571,34 +571,34 @@  discard block
 block discarded – undo
571 571
 {
572 572
 
573 573
 
574
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
574
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
575 575
 
576
-    if (!is_admin()) {
576
+	if (!is_admin()) {
577 577
 
578
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
578
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
580 580
 
581
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
581
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
582 582
 
583
-            add_filter('posts_where', 'searching_filter_where', 1);
583
+			add_filter('posts_where', 'searching_filter_where', 1);
584 584
 
585
-            if ($snear != '')
586
-                add_filter('posts_where', 'searching_filter_where', 1);
585
+			if ($snear != '')
586
+				add_filter('posts_where', 'searching_filter_where', 1);
587 587
 
588
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
588
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
589 589
 
590
-        } elseif (geodir_is_page('author')) {
590
+		} elseif (geodir_is_page('author')) {
591 591
 
592
-            add_filter('posts_where', 'author_filter_where', 1);
592
+			add_filter('posts_where', 'author_filter_where', 1);
593 593
 
594
-        }
594
+		}
595 595
 
596
-        //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
596
+		//if (!geodir_is_page('detail'))
597
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
598 598
 
599
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
599
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
601
-    }
601
+	}
602 602
 }
603 603
 
604 604
 /**
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_preview_post_cap($allcaps, $caps, $args)
615 615
 {
616
-    $user_id = get_current_user_id();
617
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
616
+	$user_id = get_current_user_id();
617
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
618 618
 
619
-        $allcaps['edit_posts'] = true;
620
-    }
621
-    //print_r($allcaps);
622
-    return $allcaps;
619
+		$allcaps['edit_posts'] = true;
620
+	}
621
+	//print_r($allcaps);
622
+	return $allcaps;
623 623
 }
624 624
 
625 625
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
  */
635 635
 function geodir_edit_listing_where($where)
636 636
 {
637
-    global $wpdb;
638
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
-    return $where;
637
+	global $wpdb;
638
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
+	return $where;
640 640
 }
641 641
 
642 642
 
@@ -653,29 +653,29 @@  discard block
 block discarded – undo
653 653
  */
654 654
 function geodir_default_where($where)
655 655
 {
656
-    global $wp_query, $wpdb;
657
-
658
-    //print_r($wp_query);
659
-    ########### WPML ###########
660
-
661
-    if (geodir_is_wpml()) {
662
-        global $sitepress, $table_prefix;
663
-        $lang_code = ICL_LANGUAGE_CODE;
664
-        $default_lang_code = $sitepress->get_default_language();
665
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
-        //echo '##########'.$q_post_type;
667
-        if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
670
-        }
656
+	global $wp_query, $wpdb;
671 657
 
672
-    }
673
-    ########### WPML ###########
658
+	//print_r($wp_query);
659
+	########### WPML ###########
674 660
 
661
+	if (geodir_is_wpml()) {
662
+		global $sitepress, $table_prefix;
663
+		$lang_code = ICL_LANGUAGE_CODE;
664
+		$default_lang_code = $sitepress->get_default_language();
665
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
+		//echo '##########'.$q_post_type;
667
+		if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) {
668
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
670
+		}
675 671
 
676
-    return $where = str_replace("0 = 1", "1=1", $where);
672
+	}
673
+	########### WPML ###########
674
+
675
+
676
+	return $where = str_replace("0 = 1", "1=1", $where);
677 677
 
678
-    /* ====== old code start ===
678
+	/* ====== old code start ===
679 679
     $where = str_replace("0 = 1", "1=1", $where);
680 680
     $country = get_query_var('gd_country');
681 681
     $region = get_query_var('gd_region');
@@ -716,108 +716,108 @@  discard block
 block discarded – undo
716 716
  * @return string Modified where query string.
717 717
  */
718 718
 function searching_filter_where($where) {
719
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
719
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
720 720
 
721
-    $search_term = 'OR';
722
-    $search_term = 'AND';
723
-    $geodir_custom_search = '';
724
-    $category_search_range = '';
721
+	$search_term = 'OR';
722
+	$search_term = 'AND';
723
+	$geodir_custom_search = '';
724
+	$category_search_range = '';
725 725
 
726
-    if (is_single() && get_query_var('post_type')) {
726
+	if (is_single() && get_query_var('post_type')) {
727 727
 		return $where;
728 728
 	}
729 729
 
730
-    if (is_tax()) {
730
+	if (is_tax()) {
731 731
 		return $where;
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
-
738
-    $where = '';
739
-    $better_search_terms = '';
740
-    if (isset($_REQUEST['stype']))
741
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
-    else
743
-        $post_types = 'gd_place';
744
-
745
-    if ($s != '') {
746
-        $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
750
-                    unset($keywords[$kkey]);
751
-                }
752
-            }
753
-        }
735
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
+
738
+	$where = '';
739
+	$better_search_terms = '';
740
+	if (isset($_REQUEST['stype']))
741
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
+	else
743
+		$post_types = 'gd_place';
754 744
 
755
-        if (!empty($keywords)) {
756
-            foreach ($keywords as $keyword) {
757
-                $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
-                if ($keyword != '') {
760
-                    /**
761
-                     * Filter the search query keywords SQL.
762
-                     *
763
-                     * @since 1.5.9
764
-                     * @package GeoDirectory
765
-                     * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
-                     * @param array $keywords The array of keywords for the query.
767
-                     * @param string $keyword The single keyword being searched.
768
-                     */
745
+	if ($s != '') {
746
+		$keywords = explode(" ", $s);
747
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
+			foreach($keywords as $kkey=>$kword){
749
+				if(geodir_utf8_strlen($kword)<=$klimit){
750
+					unset($keywords[$kkey]);
751
+				}
752
+			}
753
+		}
754
+
755
+		if (!empty($keywords)) {
756
+			foreach ($keywords as $keyword) {
757
+				$keyword = trim($keyword);
758
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
+				if ($keyword != '') {
760
+					/**
761
+					 * Filter the search query keywords SQL.
762
+					 *
763
+					 * @since 1.5.9
764
+					 * @package GeoDirectory
765
+					 * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
+					 * @param array $keywords The array of keywords for the query.
767
+					 * @param string $keyword The single keyword being searched.
768
+					 */
769 769
 					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
770
-                }
771
-            }
772
-        }
773
-    }
770
+				}
771
+			}
772
+		}
773
+	}
774 774
 
775
-    /* get taxonomy */
776
-    $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
778
-        $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
775
+	/* get taxonomy */
776
+	$taxonomies = geodir_get_taxonomies($post_types, true);
777
+	if($taxonomies) {
778
+		$taxonomies = implode("','", $taxonomies);
779
+		$taxonomies = "'" . $taxonomies . "'";
780
+	}else{$taxonomies='';}
781 781
 
782
-    $content_where = $terms_where = '';
782
+	$content_where = $terms_where = '';
783 783
 	if ($s != '') {
784
-        /**
785
-         * Filter the search query content where values.
786
-         *
787
-         * @since 1.5.0
788
-         * @package GeoDirectory
789
-         * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
-         */
784
+		/**
785
+		 * Filter the search query content where values.
786
+		 *
787
+		 * @since 1.5.0
788
+		 * @package GeoDirectory
789
+		 * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
+		 */
791 791
 		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792
-        /**
793
-         * Filter the search query term values.
794
-         *
795
-         * @since 1.5.0
796
-         * @package GeoDirectory
797
-         * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
-         */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
792
+		/**
793
+		 * Filter the search query term values.
794
+		 *
795
+		 * @since 1.5.0
796
+		 * @package GeoDirectory
797
+		 * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
+		 */
799
+		$terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802
-    if ($snear != '') {
802
+	if ($snear != '') {
803 803
 
804 804
 
805
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
-            $dist = $gd_session->get('near_me_range');
807
-        }
808
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
-        $lat1 = $mylat - ($dist / 69);
811
-        $lat2 = $mylat + ($dist / 69);
805
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
+			$dist = $gd_session->get('near_me_range');
807
+		}
808
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
+		$lat1 = $mylat - ($dist / 69);
811
+		$lat2 = $mylat + ($dist / 69);
812 812
 
813
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
813
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
817 817
 
818 818
 
819 819
 
820
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
820
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
821 821
 			                    $content_where 
822 822
 								OR ($wpdb->posts.ID IN( 
823 823
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835 835
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
-        }
837
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
+			$where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
+		}
841 841
 
842
-    } else {
843
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
842
+	} else {
843
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
844 844
                             $content_where  
845 845
 							OR ( $wpdb->posts.ID IN(	
846 846
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -854,19 +854,19 @@  discard block
 block discarded – undo
854 854
 					) 
855 855
 				AND $wpdb->posts.post_type in ('$post_types')
856 856
 				AND ($wpdb->posts.post_status = 'publish') ";
857
-    }
857
+	}
858 858
 
859 859
 	########### WPML ###########
860
-    if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
860
+	if ( geodir_wpml_is_post_type_translated( $post_types ) ) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
-        }
866
-    }
867
-    ########### WPML ###########
864
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
+		}
866
+	}
867
+	########### WPML ###########
868 868
 
869
-    return $where;
869
+	return $where;
870 870
 }
871 871
 
872 872
 
@@ -881,45 +881,45 @@  discard block
 block discarded – undo
881 881
  * @return string Modified where query string.
882 882
  */
883 883
 function author_filter_where($where) {
884
-    global $wpdb, $geodir_post_type, $table, $curr;
884
+	global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
886
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
888 888
 
889
-    if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
-    } else {
892
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
-    }
889
+	if (isset($_REQUEST['stype'])) {
890
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
+	} else {
892
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
+	}
894 894
 
895
-    if ($user_id > 0) {
896
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
-        } else
901
-            $where .= " AND $wpdb->posts.post_author = $user_id";
902
-
903
-        if ($user_id == (int)get_current_user_id()) {
904
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
-        } else {
906
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
907
-        }
908
-    } else {
909
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
-    }
895
+	if ($user_id > 0) {
896
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
+		} else
901
+			$where .= " AND $wpdb->posts.post_author = $user_id";
902
+
903
+		if ($user_id == (int)get_current_user_id()) {
904
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
+		} else {
906
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
907
+		}
908
+	} else {
909
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
+	}
911 911
 
912
-    ########### WPML ###########
913
-    if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
914
-        $lang_code = ICL_LANGUAGE_CODE;
915
-        if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
-        }
912
+	########### WPML ###########
913
+	if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) {
914
+		$lang_code = ICL_LANGUAGE_CODE;
915
+		if ($lang_code) {
916
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
+		}
918 918
 
919
-    }
920
-    ########### WPML ###########
919
+	}
920
+	########### WPML ###########
921 921
 
922
-    return $where;
922
+	return $where;
923 923
 }
924 924
 
925 925
 /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_filter_widget_join($join)
936 936
 {
937
-    global $wp_query, $table;
938
-    if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
-    }
941
-    return $join;
937
+	global $wp_query, $table;
938
+	if (!empty($wp_query->query['with_pics_only'])) {
939
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
+	}
941
+	return $join;
942 942
 }
943 943
 
944 944
 /**
@@ -953,43 +953,43 @@  discard block
 block discarded – undo
953 953
  */
954 954
 function geodir_filter_widget_where($where)
955 955
 {
956
-    global $wp_query, $table;
957
-    if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
959
-    }
960
-    if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
-    }
963
-    if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
-    }
966
-    if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
-    }
969
-    return $where;
956
+	global $wp_query, $table;
957
+	if (!empty($wp_query->query['show_featured_only'])) {
958
+		$where .= " AND " . $table . ".is_featured = '1'";
959
+	}
960
+	if (!empty($wp_query->query['show_special_only'])) {
961
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
+	}
963
+	if (!empty($wp_query->query['with_pics_only'])) {
964
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
+	}
966
+	if (!empty($wp_query->query['with_videos_only'])) {
967
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
+	}
969
+	return $where;
970 970
 }
971 971
 
972 972
 
973 973
 function geodir_related_posts_fields($fields) {
974
-    global $wp_query, $wpdb, $table, $post;
974
+	global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+	$fields .= ", " . $table . ".* ";
977 977
 
978
-    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
978
+	$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980
-    $mylat = $post->post_latitude;
981
-    $mylon = $post->post_longitude;
980
+	$mylat = $post->post_latitude;
981
+	$mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
-    return $fields;
983
+	$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
+	return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
-        && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
-        && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
-    ) {
991
-        add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
-    }
987
+	if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
+		&& isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
+		&& isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
+	) {
991
+		add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
+	}
993 993
 }
994 994
 add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
995 995
 
@@ -1004,28 +1004,28 @@  discard block
 block discarded – undo
1004 1004
  * @return string|null If field exists in table returns order by clause else returns empty.
1005 1005
  */
1006 1006
 function geodir_prepare_custom_sorting( $sorting, $table ) {
1007
-    $orderby = '';
1007
+	$orderby = '';
1008 1008
     
1009
-    if ( empty( $sorting ) || empty( $table ) ) {
1010
-        return $orderby;
1011
-    }
1009
+	if ( empty( $sorting ) || empty( $table ) ) {
1010
+		return $orderby;
1011
+	}
1012 1012
     
1013
-    if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
-        $sorting_array = explode( '_', $sorting );
1013
+	if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
+		$sorting_array = explode( '_', $sorting );
1015 1015
         
1016
-        if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
-            $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
-            array_pop( $sorting_array );
1016
+		if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
+			$order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
+			array_pop( $sorting_array );
1019 1019
             
1020
-            if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
-                $sort_by = implode( '_', $sorting_array );
1020
+			if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
+				$sort_by = implode( '_', $sorting_array );
1022 1022
                 
1023
-                if ( geodir_column_exist( $table, $sort_by ) ) {
1024
-                    $orderby = $table . "." . $sort_by . " " . $order;
1025
-                }
1026
-            }
1027
-        }
1028
-    }
1023
+				if ( geodir_column_exist( $table, $sort_by ) ) {
1024
+					$orderby = $table . "." . $sort_by . " " . $order;
1025
+				}
1026
+			}
1027
+		}
1028
+	}
1029 1029
 
1030
-    return $orderby;
1030
+	return $orderby;
1031 1031
 }
1032 1032
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 4 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
 	if ( $new_style ) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else{
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262 2262
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 	if ( $new_style ) {
2284 2284
 	?>
2285 2285
 		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2286
+<?php } else{?>
2287 2287
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
@@ -2333,17 +2333,17 @@  discard block
 block discarded – undo
2333 2333
 			if ( $new_style ) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2336
+		} else{
2337 2337
 			if(! empty( $post_types )){
2338 2338
 				$pt_arr = (array)$post_types;
2339 2339
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2340
+			} else{
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	} elseif ( ! empty( $post_types ) ) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
  * @param object|string $post The post object.
162 162
  * @param string $post_type   The post type.
163 163
  *
164
- * @return object Returns filtered package info as an object.
164
+ * @return string Returns filtered package info as an object.
165 165
  */
166 166
 function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
167 167
 	$package_info['pid']              = 0;
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
  *
2514 2514
  * @since 1.5.0
2515 2515
  *
2516
- * @return True if WPML is active else False.
2516
+ * @return boolean if WPML is active else False.
2517 2517
  */
2518 2518
 function geodir_is_wpml() {
2519 2519
     if (class_exists('SitePress') && function_exists('icl_object_id')) {
@@ -2588,7 +2588,6 @@  discard block
 block discarded – undo
2588 2588
  * @since 1.6.16 Sync reviews if sync comments allowed.
2589 2589
  *
2590 2590
  * @param int $post_id The Post ID.
2591
- * @param string $lang Language code for translating post.
2592 2591
  * @param array $request_info The post details in an array.
2593 2592
  */
2594 2593
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
@@ -2675,7 +2674,7 @@  discard block
 block discarded – undo
2675 2674
  * @param int $master_post_id Original Post ID.
2676 2675
  * @param int $tr_post_id Translation Post ID.
2677 2676
  * @param string $lang Language code for translating post.
2678
- * @return bool True for success, False for fail.
2677
+ * @return boolean|null True for success, False for fail.
2679 2678
  */
2680 2679
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2681 2680
     global $sitepress, $wpdb;
@@ -2918,8 +2917,6 @@  discard block
 block discarded – undo
2918 2917
  *
2919 2918
  * @since 1.6.16
2920 2919
  *
2921
- * @param string $post_type WP post type or WP texonomy. Ex: gd_place.
2922
- * @param bool $taxonomy Whether $post_type is taxonomy or not.
2923 2920
  * @return bool True if review star disabled, otherwise false.
2924 2921
  */ 
2925 2922
 function geodir_rating_disabled_post_types() {
@@ -3191,7 +3188,7 @@  discard block
 block discarded – undo
3191 3188
  * @param string      $element_type               Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc.
3192 3189
  *                                                You can also pass 'any', to let WPML guess the type, but this will only work for posts.
3193 3190
  * @param bool        $return_original_if_missing Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing).
3194
- * @param string|NULL $language_code              Optional, default is NULL. If missing, it will use the current language.
3191
+ * @param string|NULL $ulanguage_code              Optional, default is NULL. If missing, it will use the current language.
3195 3192
  *                                                If set to a language code, it will return a translation for that language code or
3196 3193
  *                                                the original if the translation is missing and $return_original_if_missing is set to TRUE.
3197 3194
  *
Please login to merge, or discard this patch.
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -2386,10 +2386,10 @@  discard block
 block discarded – undo
2386 2386
 	?>
2387 2387
 	<input class="search_text" name="s"
2388 2388
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2389
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2390
-	       } else {
2391
-		       echo $default_search_for_text;
2392
-	       } ?>" type="text"
2389
+			   echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2390
+		   } else {
2391
+			   echo $default_search_for_text;
2392
+		   } ?>" type="text"
2393 2393
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2394 2394
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2395 2395
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
@@ -2516,11 +2516,11 @@  discard block
 block discarded – undo
2516 2516
  * @return True if WPML is active else False.
2517 2517
  */
2518 2518
 function geodir_is_wpml() {
2519
-    if (class_exists('SitePress') && function_exists('icl_object_id')) {
2520
-        return true;
2521
-    }
2519
+	if (class_exists('SitePress') && function_exists('icl_object_id')) {
2520
+		return true;
2521
+	}
2522 2522
 
2523
-    return false;
2523
+	return false;
2524 2524
 }
2525 2525
 
2526 2526
 /**
@@ -2535,9 +2535,9 @@  discard block
 block discarded – undo
2535 2535
  * @return Language code.
2536 2536
  */
2537 2537
 function geodir_get_language_for_element($element_id, $element_type) {
2538
-    global $sitepress;
2538
+	global $sitepress;
2539 2539
 
2540
-    return $sitepress->get_language_for_element($element_id, $element_type);
2540
+	return $sitepress->get_language_for_element($element_id, $element_type);
2541 2541
 }
2542 2542
 
2543 2543
 /**
@@ -2554,31 +2554,31 @@  discard block
 block discarded – undo
2554 2554
  *                         Added to fix duplicate translation for front end.
2555 2555
  */
2556 2556
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) {
2557
-    global $sitepress;
2557
+	global $sitepress;
2558 2558
     
2559
-    $post_type = get_post_type($master_post_id);
2560
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2561
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2562
-        $icl_ajx_action = true;
2563
-    }
2559
+	$post_type = get_post_type($master_post_id);
2560
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2561
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2562
+		$icl_ajx_action = true;
2563
+	}
2564 2564
     
2565
-    if (in_array($post_type, geodir_get_posttypes())) {
2566
-        if ($icl_ajx_action || $after_save) {
2567
-            // Duplicate post details
2568
-            geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2565
+	if (in_array($post_type, geodir_get_posttypes())) {
2566
+		if ($icl_ajx_action || $after_save) {
2567
+			// Duplicate post details
2568
+			geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2569 2569
             
2570
-            // Duplicate taxonomies
2571
-            geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2570
+			// Duplicate taxonomies
2571
+			geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2572 2572
             
2573
-            // Duplicate post images
2574
-            geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2575
-        }
2573
+			// Duplicate post images
2574
+			geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2575
+		}
2576 2576
         
2577
-        // Sync post reviews
2578
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2579
-            geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2580
-        }
2581
-    }
2577
+		// Sync post reviews
2578
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2579
+			geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2580
+		}
2581
+	}
2582 2582
 }
2583 2583
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2584 2584
 
@@ -2592,18 +2592,18 @@  discard block
 block discarded – undo
2592 2592
  * @param array $request_info The post details in an array.
2593 2593
  */
2594 2594
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
2595
-    global $sitepress;
2595
+	global $sitepress;
2596 2596
     
2597
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2598
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2599
-        $icl_ajx_action = true;
2600
-    }
2597
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2598
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2599
+		$icl_ajx_action = true;
2600
+	}
2601 2601
     
2602
-    if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2603
-        foreach ($post_duplicates as $lang => $dup_post_id) {
2604
-            geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2605
-        }
2606
-    }
2602
+	if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2603
+		foreach ($post_duplicates as $lang => $dup_post_id) {
2604
+			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2605
+		}
2606
+	}
2607 2607
 }
2608 2608
 
2609 2609
 /**
@@ -2619,17 +2619,17 @@  discard block
 block discarded – undo
2619 2619
  * @return bool True for success, False for fail.
2620 2620
  */
2621 2621
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2622
-    global $wpdb;
2622
+	global $wpdb;
2623 2623
 
2624
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2624
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2625 2625
 
2626
-    if (!empty($reviews)) {
2627
-        foreach ($reviews as $review) {
2628
-            geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2629
-        }
2630
-    }
2626
+	if (!empty($reviews)) {
2627
+		foreach ($reviews as $review) {
2628
+			geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2629
+		}
2630
+	}
2631 2631
 
2632
-    return false;
2632
+	return false;
2633 2633
 }
2634 2634
 
2635 2635
 /**
@@ -2646,22 +2646,22 @@  discard block
 block discarded – undo
2646 2646
  * @return bool True for success, False for fail.
2647 2647
  */
2648 2648
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
2649
-    global $wpdb, $plugin_prefix;
2649
+	global $wpdb, $plugin_prefix;
2650 2650
 
2651
-    $post_type = get_post_type($master_post_id);
2652
-    $post_table = $plugin_prefix . $post_type . '_detail';
2651
+	$post_type = get_post_type($master_post_id);
2652
+	$post_table = $plugin_prefix . $post_type . '_detail';
2653 2653
 
2654
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2655
-    $data = (array)$wpdb->get_row($query);
2654
+	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2655
+	$data = (array)$wpdb->get_row($query);
2656 2656
 
2657
-    if ( !empty( $data ) ) {
2658
-        $data['post_id'] = $tr_post_id;
2659
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2660
-        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2661
-        return true;
2662
-    }
2657
+	if ( !empty( $data ) ) {
2658
+		$data['post_id'] = $tr_post_id;
2659
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2660
+		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2661
+		return true;
2662
+	}
2663 2663
 
2664
-    return false;
2664
+	return false;
2665 2665
 }
2666 2666
 
2667 2667
 /**
@@ -2678,40 +2678,40 @@  discard block
 block discarded – undo
2678 2678
  * @return bool True for success, False for fail.
2679 2679
  */
2680 2680
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2681
-    global $sitepress, $wpdb;
2682
-    $post_type = get_post_type($master_post_id);
2681
+	global $sitepress, $wpdb;
2682
+	$post_type = get_post_type($master_post_id);
2683 2683
 
2684
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2684
+	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2685 2685
 
2686
-    $taxonomies = get_object_taxonomies($post_type);
2687
-    foreach ($taxonomies as $taxonomy) {
2688
-        $terms = get_the_terms($master_post_id, $taxonomy);
2689
-        $terms_array = array();
2686
+	$taxonomies = get_object_taxonomies($post_type);
2687
+	foreach ($taxonomies as $taxonomy) {
2688
+		$terms = get_the_terms($master_post_id, $taxonomy);
2689
+		$terms_array = array();
2690 2690
         
2691
-        if ($terms) {
2692
-            foreach ($terms as $term) {
2693
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2691
+		if ($terms) {
2692
+			foreach ($terms as $term) {
2693
+				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2694 2694
                 
2695
-                if (!is_null($tr_id)){
2696
-                    // not using get_term - unfiltered get_term
2697
-                    $translated_term = $wpdb->get_row($wpdb->prepare("
2695
+				if (!is_null($tr_id)){
2696
+					// not using get_term - unfiltered get_term
2697
+					$translated_term = $wpdb->get_row($wpdb->prepare("
2698 2698
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
2699 2699
 
2700
-                    $terms_array[] = $translated_term->term_id;
2701
-                }
2702
-            }
2700
+					$terms_array[] = $translated_term->term_id;
2701
+				}
2702
+			}
2703 2703
 
2704
-            if (!is_taxonomy_hierarchical($taxonomy)){
2705
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2706
-            }
2704
+			if (!is_taxonomy_hierarchical($taxonomy)){
2705
+				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2706
+			}
2707 2707
 
2708
-            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2708
+			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2709 2709
             
2710
-            if ($taxonomy == $post_type . 'category') {
2711
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2712
-            }
2713
-        }
2714
-    }
2710
+			if ($taxonomy == $post_type . 'category') {
2711
+				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2712
+			}
2713
+		}
2714
+	}
2715 2715
 }
2716 2716
 
2717 2717
 /**
@@ -2727,29 +2727,29 @@  discard block
 block discarded – undo
2727 2727
  * @return bool True for success, False for fail.
2728 2728
  */
2729 2729
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2730
-    global $wpdb;
2730
+	global $wpdb;
2731 2731
 
2732
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2733
-    $wpdb->query($query);
2732
+	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2733
+	$wpdb->query($query);
2734 2734
 
2735
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2736
-    $post_images = $wpdb->get_results($query);
2735
+	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2736
+	$post_images = $wpdb->get_results($query);
2737 2737
 
2738
-    if ( !empty( $post_images ) ) {
2739
-        foreach ( $post_images as $post_image) {
2740
-            $image_data = (array)$post_image;
2741
-            unset($image_data['ID']);
2742
-            $image_data['post_id'] = $tr_post_id;
2738
+	if ( !empty( $post_images ) ) {
2739
+		foreach ( $post_images as $post_image) {
2740
+			$image_data = (array)$post_image;
2741
+			unset($image_data['ID']);
2742
+			$image_data['post_id'] = $tr_post_id;
2743 2743
             
2744
-            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2744
+			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2745 2745
             
2746
-            geodir_set_wp_featured_image($tr_post_id);
2747
-        }
2746
+			geodir_set_wp_featured_image($tr_post_id);
2747
+		}
2748 2748
         
2749
-        return true;
2750
-    }
2749
+		return true;
2750
+	}
2751 2751
 
2752
-    return false;
2752
+	return false;
2753 2753
 }
2754 2754
 
2755 2755
 
@@ -2768,73 +2768,73 @@  discard block
 block discarded – undo
2768 2768
  * @return bool True for success, False for fail.
2769 2769
  */
2770 2770
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2771
-    global $wpdb, $plugin_prefix, $sitepress;
2772
-
2773
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2774
-
2775
-    if (empty($review)) {
2776
-        return false;
2777
-    }
2778
-    if ($review['post_id'] != $master_post_id) {
2779
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2780
-        geodir_update_postrating($master_post_id, $post_type);
2781
-    }
2782
-
2783
-    $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2784
-
2785
-    if (empty($tr_comment_id)) {
2786
-        return false;
2787
-    }
2788
-
2789
-    $post_type = get_post_type($master_post_id);
2790
-    $post_table = $plugin_prefix . $post_type . '_detail';
2791
-
2792
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2793
-    if (empty($translated_post)) {
2794
-        return false;
2795
-    }
2796
-
2797
-    $review['comment_id'] = $tr_comment_id;
2798
-    $review['post_id'] = $tr_post_id;
2799
-    $review['post_title'] = $translated_post['post_title'];
2800
-    $review['post_city'] = $translated_post['post_city'];
2801
-    $review['post_region'] = $translated_post['post_region'];
2802
-    $review['post_country'] = $translated_post['post_country'];
2803
-    $review['post_latitude'] = $translated_post['post_latitude'];
2804
-    $review['post_longitude'] = $translated_post['post_longitude'];
2805
-
2806
-    if (isset($review['id'])) {
2807
-        unset($review['id']);
2808
-    }
2809
-
2810
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2811
-
2812
-    if ($tr_review_id) { // update review
2813
-        $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2814
-    } else { // insert review
2815
-        $wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2816
-        $tr_review_id = $wpdb->insert_id;
2817
-    }
2818
-
2819
-    if ($tr_post_id) {
2820
-        geodir_update_postrating($tr_post_id, $post_type);
2771
+	global $wpdb, $plugin_prefix, $sitepress;
2772
+
2773
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2774
+
2775
+	if (empty($review)) {
2776
+		return false;
2777
+	}
2778
+	if ($review['post_id'] != $master_post_id) {
2779
+		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2780
+		geodir_update_postrating($master_post_id, $post_type);
2781
+	}
2782
+
2783
+	$tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2784
+
2785
+	if (empty($tr_comment_id)) {
2786
+		return false;
2787
+	}
2788
+
2789
+	$post_type = get_post_type($master_post_id);
2790
+	$post_table = $plugin_prefix . $post_type . '_detail';
2791
+
2792
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2793
+	if (empty($translated_post)) {
2794
+		return false;
2795
+	}
2796
+
2797
+	$review['comment_id'] = $tr_comment_id;
2798
+	$review['post_id'] = $tr_post_id;
2799
+	$review['post_title'] = $translated_post['post_title'];
2800
+	$review['post_city'] = $translated_post['post_city'];
2801
+	$review['post_region'] = $translated_post['post_region'];
2802
+	$review['post_country'] = $translated_post['post_country'];
2803
+	$review['post_latitude'] = $translated_post['post_latitude'];
2804
+	$review['post_longitude'] = $translated_post['post_longitude'];
2805
+
2806
+	if (isset($review['id'])) {
2807
+		unset($review['id']);
2808
+	}
2809
+
2810
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2811
+
2812
+	if ($tr_review_id) { // update review
2813
+		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2814
+	} else { // insert review
2815
+		$wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2816
+		$tr_review_id = $wpdb->insert_id;
2817
+	}
2818
+
2819
+	if ($tr_post_id) {
2820
+		geodir_update_postrating($tr_post_id, $post_type);
2821 2821
         
2822
-        if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2823
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2824
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2825
-
2826
-            if (!empty($likes)) {
2827
-                foreach ($likes as $like) {
2828
-                    unset($like['like_id']);
2829
-                    $like['comment_id'] = $tr_comment_id;
2822
+		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2823
+			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2824
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2825
+
2826
+			if (!empty($likes)) {
2827
+				foreach ($likes as $like) {
2828
+					unset($like['like_id']);
2829
+					$like['comment_id'] = $tr_comment_id;
2830 2830
                     
2831
-                    $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2832
-                }
2833
-            }
2834
-        }
2835
-    }
2831
+					$wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2832
+				}
2833
+			}
2834
+		}
2835
+	}
2836 2836
 
2837
-    return $tr_review_id;
2837
+	return $tr_review_id;
2838 2838
 }
2839 2839
 
2840 2840
 /**
@@ -2849,36 +2849,36 @@  discard block
 block discarded – undo
2849 2849
  * @param int $comment_id The Comment ID.
2850 2850
  */
2851 2851
 function gepdir_wpml_sync_comment($comment_id) {
2852
-    global $wpdb, $sitepress, $gd_wpml_posttypes;
2853
-
2854
-    if (empty($gd_post_types)) {
2855
-        $gd_wpml_posttypes = geodir_get_posttypes();
2856
-    }
2857
-
2858
-    $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2859
-    if (empty($comment)) {
2860
-        return;
2861
-    }
2862
-
2863
-    $post_id = $comment['comment_post_ID'];
2864
-    $post_type = $post_id ? get_post_type($post_id) : NULL;
2865
-
2866
-    if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2867
-        return;
2868
-    }
2869
-
2870
-    $post_duplicates = $sitepress->get_duplicates($post_id);
2871
-    if (empty($post_duplicates)) {
2872
-        return;
2873
-    }
2874
-
2875
-    foreach ($post_duplicates as $lang => $dup_post_id) {
2876
-        if (empty($comment['comment_parent'])) {
2877
-            geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2878
-        }
2879
-    }
2852
+	global $wpdb, $sitepress, $gd_wpml_posttypes;
2853
+
2854
+	if (empty($gd_post_types)) {
2855
+		$gd_wpml_posttypes = geodir_get_posttypes();
2856
+	}
2857
+
2858
+	$comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2859
+	if (empty($comment)) {
2860
+		return;
2861
+	}
2862
+
2863
+	$post_id = $comment['comment_post_ID'];
2864
+	$post_type = $post_id ? get_post_type($post_id) : NULL;
2865
+
2866
+	if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2867
+		return;
2868
+	}
2869
+
2870
+	$post_duplicates = $sitepress->get_duplicates($post_id);
2871
+	if (empty($post_duplicates)) {
2872
+		return;
2873
+	}
2874
+
2875
+	foreach ($post_duplicates as $lang => $dup_post_id) {
2876
+		if (empty($comment['comment_parent'])) {
2877
+			geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2878
+		}
2879
+	}
2880 2880
     
2881
-    return true;
2881
+	return true;
2882 2882
 }
2883 2883
 
2884 2884
 /**
@@ -2893,11 +2893,11 @@  discard block
 block discarded – undo
2893 2893
  * @return int The duplicate comment ID.
2894 2894
  */
2895 2895
 function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
2896
-    global $wpdb;
2896
+	global $wpdb;
2897 2897
 
2898
-    $duplicate = $wpdb->get_var(
2899
-        $wpdb->prepare(
2900
-            "   SELECT comm.comment_ID
2898
+	$duplicate = $wpdb->get_var(
2899
+		$wpdb->prepare(
2900
+			"   SELECT comm.comment_ID
2901 2901
                 FROM {$wpdb->comments} comm
2902 2902
                 JOIN {$wpdb->commentmeta} cm
2903 2903
                     ON comm.comment_ID = cm.comment_id
@@ -2905,12 +2905,12 @@  discard block
 block discarded – undo
2905 2905
                     AND cm.meta_key = '_icl_duplicate_of'
2906 2906
                     AND cm.meta_value = %d
2907 2907
                 LIMIT 1",
2908
-            $dup_post_id,
2909
-            $original_cid
2910
-        )
2911
-    );
2908
+			$dup_post_id,
2909
+			$original_cid
2910
+		)
2911
+	);
2912 2912
 
2913
-    return $duplicate;
2913
+	return $duplicate;
2914 2914
 }
2915 2915
 
2916 2916
 /**
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
  * @return bool True if Yoast SEO disabled on GD pages.
2983 2983
  */
2984 2984
 function geodir_disable_yoast_seo_metas() {
2985
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2985
+	return (bool)get_option( 'geodir_disable_yoast_meta' );
2986 2986
 }
2987 2987
 
2988 2988
 /**
@@ -2994,39 +2994,39 @@  discard block
 block discarded – undo
2994 2994
  * @return bool True if allowed.
2995 2995
  */
2996 2996
 function geodir_wpml_allowed_to_duplicate( $post_id ) {
2997
-    $allowed = false;
2997
+	$allowed = false;
2998 2998
     
2999
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
3000
-        return $allowed;
3001
-    }
2999
+	if ( !geodir_is_wpml() || empty( $post_id ) ) {
3000
+		return $allowed;
3001
+	}
3002 3002
     
3003
-    $user_id = (int)get_current_user_id();
3003
+	$user_id = (int)get_current_user_id();
3004 3004
     
3005
-    if ( empty( $user_id ) ) {
3006
-        return $allowed;
3007
-    }
3005
+	if ( empty( $user_id ) ) {
3006
+		return $allowed;
3007
+	}
3008 3008
     
3009
-    $post_type = get_post_type( $post_id );
3010
-    if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3011
-        return $allowed;
3012
-    }
3009
+	$post_type = get_post_type( $post_id );
3010
+	if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3011
+		return $allowed;
3012
+	}
3013 3013
     
3014
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3015
-        $allowed = true;
3016
-    }
3014
+	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3015
+		$allowed = true;
3016
+	}
3017 3017
     
3018
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3019
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3020
-        $allowed = false;
3021
-    }
3018
+	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3019
+	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3020
+		$allowed = false;
3021
+	}
3022 3022
     
3023
-    /**
3024
-     * Filter the user allowed to duplicate listing or not for WPML.
3025
-     *
3026
-     * @param bool $allowed True if allowed.
3027
-     * @param int $post_id The post ID.
3028
-     */
3029
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3023
+	/**
3024
+	 * Filter the user allowed to duplicate listing or not for WPML.
3025
+	 *
3026
+	 * @param bool $allowed True if allowed.
3027
+	 * @param int $post_id The post ID.
3028
+	 */
3029
+	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3030 3030
 }
3031 3031
 
3032 3032
 /**
@@ -3042,71 +3042,71 @@  discard block
 block discarded – undo
3042 3042
  * @return string Filtered html of the geodir_edit_post_link() function.
3043 3043
  */
3044 3044
 function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3045
-    global $post, $preview, $sitepress;
3045
+	global $post, $preview, $sitepress;
3046 3046
     
3047
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3048
-        $post_id = $post->ID;
3049
-        $element_type = 'post_' . get_post_type( $post_id );
3050
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3047
+	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3048
+		$post_id = $post->ID;
3049
+		$element_type = 'post_' . get_post_type( $post_id );
3050
+		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3051 3051
         
3052
-        if ( $original_post_id == $post_id ) {
3053
-            $wpml_languages = $sitepress->get_active_languages();
3054
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3052
+		if ( $original_post_id == $post_id ) {
3053
+			$wpml_languages = $sitepress->get_active_languages();
3054
+			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3055 3055
             
3056
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3057
-                unset( $wpml_languages[ $post_language ] );
3058
-            }
3056
+			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3057
+				unset( $wpml_languages[ $post_language ] );
3058
+			}
3059 3059
             
3060
-            if ( !empty( $wpml_languages ) ) {
3061
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3062
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3063
-                $duplicates = $sitepress->get_duplicates( $post_id );
3060
+			if ( !empty( $wpml_languages ) ) {
3061
+				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3062
+				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3063
+				$duplicates = $sitepress->get_duplicates( $post_id );
3064 3064
                 
3065
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3066
-                $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3067
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3065
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3066
+				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3067
+				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3068 3068
                 
3069
-                $needs_translation = false;
3069
+				$needs_translation = false;
3070 3070
                 
3071
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3072
-                    $duplicates_text = '';
3073
-                    $translated = false;
3071
+				foreach ( $wpml_languages as $lang_code => $lang ) {
3072
+					$duplicates_text = '';
3073
+					$translated = false;
3074 3074
                     
3075
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3076
-                        $translated = true;
3075
+					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3076
+						$translated = true;
3077 3077
                         
3078
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3079
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3080
-                        }
3081
-                    } else {
3082
-                        $needs_translation = true;
3083
-                    }
3078
+						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3079
+							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3080
+						}
3081
+					} else {
3082
+						$needs_translation = true;
3083
+					}
3084 3084
                     
3085
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3085
+					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3086 3086
                     
3087
-                    if ( $translated ) {
3088
-                        $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3089
-                    } else {
3090
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3091
-                    }
3087
+					if ( $translated ) {
3088
+						$wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3089
+					} else {
3090
+						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3091
+					}
3092 3092
                     
3093
-                    $wpml_content .= '</td></tr>';
3094
-                }
3093
+					$wpml_content .= '</td></tr>';
3094
+				}
3095 3095
                 
3096
-                if ( $needs_translation ) {
3097
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3098
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3099
-                }
3096
+				if ( $needs_translation ) {
3097
+					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3098
+					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3099
+				}
3100 3100
                 
3101
-                $wpml_content .= '</tbody></table>';
3102
-                $wpml_content .= '</div>';
3101
+				$wpml_content .= '</tbody></table>';
3102
+				$wpml_content .= '</div>';
3103 3103
                 
3104
-                $content_html .= $wpml_content;
3105
-            }
3106
-        }
3107
-    }
3104
+				$content_html .= $wpml_content;
3105
+			}
3106
+		}
3107
+	}
3108 3108
     
3109
-    return $content_html;
3109
+	return $content_html;
3110 3110
 }
3111 3111
 
3112 3112
 /**
@@ -3118,28 +3118,28 @@  discard block
 block discarded – undo
3118 3118
  * @return array Filtered GD design settings array..
3119 3119
  */
3120 3120
 function geodir_wpml_duplicate_settings( $settings = array() ) {
3121
-    $new_settings = array();
3121
+	$new_settings = array();
3122 3122
     
3123
-    foreach ( $settings as $key => $setting ) {
3123
+	foreach ( $settings as $key => $setting ) {
3124 3124
         
3125
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3126
-            $new_settings[] = array(
3127
-                'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3128
-                'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3129
-                'tip' => '',
3130
-                'id' => 'geodir_wpml_disable_duplicate',
3131
-                'css' => 'min-width:300px;',
3132
-                'std' => '',
3133
-                'type' => 'multiselect',
3134
-                'placeholder_text' => __('Select post types', 'geodirectory'),
3135
-                'class' => 'chosen_select',
3136
-                'options' => array_unique(geodir_post_type_setting_fun())
3137
-            );
3138
-        }
3139
-        $new_settings[] = $setting;
3140
-    }
3125
+		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3126
+			$new_settings[] = array(
3127
+				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3128
+				'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3129
+				'tip' => '',
3130
+				'id' => 'geodir_wpml_disable_duplicate',
3131
+				'css' => 'min-width:300px;',
3132
+				'std' => '',
3133
+				'type' => 'multiselect',
3134
+				'placeholder_text' => __('Select post types', 'geodirectory'),
3135
+				'class' => 'chosen_select',
3136
+				'options' => array_unique(geodir_post_type_setting_fun())
3137
+			);
3138
+		}
3139
+		$new_settings[] = $setting;
3140
+	}
3141 3141
     
3142
-    return $new_settings;
3142
+	return $new_settings;
3143 3143
 }
3144 3144
 
3145 3145
 /**
@@ -3151,15 +3151,15 @@  discard block
 block discarded – undo
3151 3151
  * @return bool true if the taxonomy is currently set to being translatable in WPML.
3152 3152
  */
3153 3153
 function geodir_wpml_is_taxonomy_translated( $taxonomy ) {
3154
-    if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3155
-        return false;
3156
-    }
3154
+	if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3155
+		return false;
3156
+	}
3157 3157
     
3158
-    if ( is_taxonomy_translated( $taxonomy ) ) {
3159
-        return true;
3160
-    }
3158
+	if ( is_taxonomy_translated( $taxonomy ) ) {
3159
+		return true;
3160
+	}
3161 3161
     
3162
-    return false;
3162
+	return false;
3163 3163
 }
3164 3164
 
3165 3165
 /**
@@ -3171,15 +3171,15 @@  discard block
 block discarded – undo
3171 3171
  * @return bool true if the post_type is currently set to being translatable in WPML.
3172 3172
  */
3173 3173
 function geodir_wpml_is_post_type_translated( $post_type ) {
3174
-    if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3175
-        return false;
3176
-    }
3174
+	if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3175
+		return false;
3176
+	}
3177 3177
     
3178
-    if ( is_post_type_translated( $post_type ) ) {
3179
-        return true;
3180
-    }
3178
+	if ( is_post_type_translated( $post_type ) ) {
3179
+		return true;
3180
+	}
3181 3181
     
3182
-    return false;
3182
+	return false;
3183 3183
 }
3184 3184
 
3185 3185
 /**
@@ -3198,13 +3198,13 @@  discard block
 block discarded – undo
3198 3198
  * @return int|NULL
3199 3199
  */
3200 3200
 function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
3201
-    if ( geodir_is_wpml() ) {
3202
-        if ( function_exists( 'wpml_object_id_filter' ) ) {
3203
-            return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3204
-        } else {
3205
-            return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3206
-        }
3207
-    }
3201
+	if ( geodir_is_wpml() ) {
3202
+		if ( function_exists( 'wpml_object_id_filter' ) ) {
3203
+			return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3204
+		} else {
3205
+			return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3206
+		}
3207
+	}
3208 3208
     
3209
-    return $element_id;
3209
+	return $element_id;
3210 3210
 }
3211 3211
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +718 added lines, -718 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1036,20 +1036,20 @@  discard block
 block discarded – undo
1036 1036
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1037 1037
 
1038 1038
 	$is_geodir_page = geodir_is_geodir_page();
1039
-	if ( ! $is_geodir_page ) {
1039
+	if (!$is_geodir_page) {
1040 1040
 		return;
1041 1041
 	}// if non GD page, bail
1042 1042
 
1043 1043
 	$use_gd_meta = true;
1044
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1044
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1045 1045
 		$use_gd_meta = false;
1046 1046
 
1047
-		if ( geodir_is_page( 'search' ) ) {
1047
+		if (geodir_is_page('search')) {
1048 1048
 			$use_gd_meta = true;
1049 1049
 		}
1050 1050
 	}
1051 1051
 
1052
-	if ( ! $use_gd_meta ) {
1052
+	if (!$use_gd_meta) {
1053 1053
 		return;
1054 1054
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1055 1055
 
@@ -1057,68 +1057,68 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 	$all_postypes = geodir_get_posttypes();
1059 1059
 
1060
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1060
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1061 1061
 
1062 1062
 	$meta_desc = '';
1063 1063
 	$meta_key  = '';
1064
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1064
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1065 1065
 		/**
1066 1066
 		 * Filter SEO meta location description.
1067 1067
 		 *
1068 1068
 		 * @since 1.0.0
1069 1069
 		 */
1070
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1070
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1071 1071
 		$meta_desc .= '';
1072 1072
 	}
1073
-	if ( have_posts() && is_single() OR is_page() ) {
1074
-		while ( have_posts() ) {
1073
+	if (have_posts() && is_single() OR is_page()) {
1074
+		while (have_posts()) {
1075 1075
 			the_post();
1076 1076
 
1077
-			if ( has_excerpt() ) {
1078
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1079
-				if ( empty( $out_excerpt ) ) {
1080
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1077
+			if (has_excerpt()) {
1078
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1079
+				if (empty($out_excerpt)) {
1080
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1081 1081
 				}
1082
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1082
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1083 1083
 			} else {
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1085
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1086
-				if ( empty( $out_excerpt ) ) {
1087
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1085
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1086
+				if (empty($out_excerpt)) {
1087
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1088 1088
 				}
1089
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1089
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1090 1090
 			}
1091 1091
 
1092 1092
 			$meta_desc .= $out_excerpt;
1093 1093
 		}
1094
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1095
-		if ( is_category() ) {
1096
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1097
-		} elseif ( is_tag() ) {
1098
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1094
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1095
+		if (is_category()) {
1096
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1097
+		} elseif (is_tag()) {
1098
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1099 1099
 		}
1100
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1101
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1100
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1101
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1102 1102
 	}
1103 1103
 
1104 1104
 
1105 1105
 	$geodir_post_type       = geodir_get_current_posttype();
1106
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1107
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1108
-
1109
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1110
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1111
-
1112
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1113
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1114
-
1115
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1116
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1117
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1119
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1120
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1121
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1106
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1107
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1108
+
1109
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1110
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1111
+
1112
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1113
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1114
+
1115
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1116
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1117
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1119
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1120
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1121
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1122 1122
 	/**
1123 1123
 	 * Filter the Everywhere text in location description.
1124 1124
 	 *
@@ -1126,108 +1126,108 @@  discard block
 block discarded – undo
1126 1126
 	 * 
1127 1127
 	 * @param string $replace_location Everywhere text.
1128 1128
 	 */
1129
-	$replace_location        = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) );
1129
+	$replace_location        = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory'));
1130 1130
 	$location_id             = null;
1131
-	if ( $geodir_location_manager ) {
1132
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1133
-		$location_id   = (int) $wpdb->get_var( $sql );
1131
+	if ($geodir_location_manager) {
1132
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1133
+		$location_id   = (int) $wpdb->get_var($sql);
1134 1134
 		$location_type = geodir_what_is_current_location();
1135
-		if ( $location_type == 'city' ) {
1136
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1137
-		} elseif ( $location_type == 'region' ) {
1138
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1139
-		} elseif ( $location_type == 'country' ) {
1140
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1141
-			$replace_location = __( $replace_location, 'geodirectory' );
1135
+		if ($location_type == 'city') {
1136
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1137
+		} elseif ($location_type == 'region') {
1138
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1139
+		} elseif ($location_type == 'country') {
1140
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1141
+			$replace_location = __($replace_location, 'geodirectory');
1142 1142
 		}
1143
-		$country          = get_query_var( 'gd_country' );
1144
-		$region           = get_query_var( 'gd_region' );
1145
-		$city             = get_query_var( 'gd_city' );
1143
+		$country          = get_query_var('gd_country');
1144
+		$region           = get_query_var('gd_region');
1145
+		$city             = get_query_var('gd_city');
1146 1146
 		$current_location = '';
1147
-		if ( $country != '' ) {
1148
-			$current_location = get_actual_location_name( 'country', $country, true );
1147
+		if ($country != '') {
1148
+			$current_location = get_actual_location_name('country', $country, true);
1149 1149
 		}
1150
-		if ( $region != '' ) {
1151
-			$current_location = get_actual_location_name( 'region', $region );
1150
+		if ($region != '') {
1151
+			$current_location = get_actual_location_name('region', $region);
1152 1152
 		}
1153
-		if ( $city != '' ) {
1154
-			$current_location = get_actual_location_name( 'city', $city );
1153
+		if ($city != '') {
1154
+			$current_location = get_actual_location_name('city', $city);
1155 1155
 		}
1156 1156
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1157 1157
 	}
1158 1158
 
1159 1159
 	$geodir_meta_keys = '';
1160 1160
 	$geodir_meta_desc = '';
1161
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1162
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1163
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1161
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1162
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1163
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1164 1164
 
1165
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1166
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1165
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1166
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1167 1167
 
1168
-			if ( $geodir_is_category ) {
1169
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1170
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1168
+			if ($geodir_is_category) {
1169
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1170
+				if (isset($category->term_id) && !empty($category->term_id)) {
1171 1171
 					$category_id   = $category->term_id;
1172
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1173
-					if ( $location_id ) {
1174
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1175
-						$cat_loc_option = get_option( $option_name );
1176
-
1177
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1178
-						if ( ! $gd_cat_loc_default ) {
1179
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1180
-							$option        = get_option( $option_name );
1181
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1172
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1173
+					if ($location_id) {
1174
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1175
+						$cat_loc_option = get_option($option_name);
1176
+
1177
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1178
+						if (!$gd_cat_loc_default) {
1179
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1180
+							$option        = get_option($option_name);
1181
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1182 1182
 						}
1183 1183
 					}
1184
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1184
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1185 1185
 				}
1186
-			} else if ( $geodir_is_tag ) {
1187
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1186
+			} else if ($geodir_is_tag) {
1187
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1188 1188
 			}
1189 1189
 		}
1190 1190
 	}
1191 1191
 
1192 1192
 
1193 1193
 	$gd_page = '';
1194
-	if ( geodir_is_page( 'home' ) ) {
1194
+	if (geodir_is_page('home')) {
1195 1195
 		$gd_page   = 'home';
1196
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1197
-	} elseif ( geodir_is_page( 'detail' ) ) {
1196
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1197
+	} elseif (geodir_is_page('detail')) {
1198 1198
 		$gd_page   = 'detail';
1199
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1200
-	} elseif ( geodir_is_page( 'pt' ) ) {
1199
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1200
+	} elseif (geodir_is_page('pt')) {
1201 1201
 		$gd_page   = 'pt';
1202
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1203
-	} elseif ( geodir_is_page( 'listing' ) ) {
1202
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1203
+	} elseif (geodir_is_page('listing')) {
1204 1204
 		$gd_page   = 'listing';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'location' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1206
+	} elseif (geodir_is_page('location')) {
1207 1207
 		$gd_page   = 'location';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1209
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1208
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1209
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1210 1210
 
1211
-	} elseif ( geodir_is_page( 'search' ) ) {
1211
+	} elseif (geodir_is_page('search')) {
1212 1212
 		$gd_page   = 'search';
1213
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1214
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1213
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1214
+	} elseif (geodir_is_page('add-listing')) {
1215 1215
 		$gd_page   = 'add-listing';
1216
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1217
-	} elseif ( geodir_is_page( 'author' ) ) {
1216
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1217
+	} elseif (geodir_is_page('author')) {
1218 1218
 		$gd_page   = 'author';
1219
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1220
-	} elseif ( geodir_is_page( 'login' ) ) {
1219
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1220
+	} elseif (geodir_is_page('login')) {
1221 1221
 		$gd_page   = 'login';
1222
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1223
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1222
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1223
+	} elseif (geodir_is_page('listing-success')) {
1224 1224
 		$gd_page   = 'listing-success';
1225
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1225
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1226 1226
 	}
1227 1227
 
1228 1228
 
1229
-	if ( $meta_desc ) {
1230
-		$meta_desc = stripslashes_deep( $meta_desc );
1229
+	if ($meta_desc) {
1230
+		$meta_desc = stripslashes_deep($meta_desc);
1231 1231
 		/**
1232 1232
 		 * Filter page description to replace variables.
1233 1233
 		 *
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		 * @param string $title   The page description including variables.
1237 1237
 		 * @param string $gd_page The GeoDirectory page type if any.
1238 1238
 		 */
1239
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1239
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1240 1240
 
1241 1241
 		/**
1242 1242
 		 * Filter SEO meta description.
@@ -1245,49 +1245,49 @@  discard block
 block discarded – undo
1245 1245
 		 *
1246 1246
 		 * @param string $meta_desc Meta description content.
1247 1247
 		 */
1248
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1248
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1249 1249
 	}
1250 1250
 
1251 1251
 	// meta keywords
1252
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1253
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1254
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1252
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1253
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1254
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1255 1255
 
1256
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1256
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1257 1257
 	} else {
1258 1258
 		$posttags = get_the_tags();
1259
-		if ( $posttags ) {
1260
-			foreach ( $posttags as $tag ) {
1261
-				$meta_key .= $tag->name . ' ';
1259
+		if ($posttags) {
1260
+			foreach ($posttags as $tag) {
1261
+				$meta_key .= $tag->name.' ';
1262 1262
 			}
1263 1263
 		} else {
1264
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1264
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1265 1265
 			$xt   = 1;
1266 1266
 
1267
-			foreach ( $tags as $tag ) {
1268
-				if ( $xt <= 20 ) {
1269
-					$meta_key .= $tag->name . ", ";
1267
+			foreach ($tags as $tag) {
1268
+				if ($xt <= 20) {
1269
+					$meta_key .= $tag->name.", ";
1270 1270
 				}
1271 1271
 
1272
-				$xt ++;
1272
+				$xt++;
1273 1273
 			}
1274 1274
 		}
1275 1275
 	}
1276 1276
 
1277
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1278
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1279
-	if ( $geodir_meta_keys != '' ) {
1280
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1281
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1282
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1283
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1284
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1277
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1278
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1279
+	if ($geodir_meta_keys != '') {
1280
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1281
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1282
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1283
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1284
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1285 1285
 
1286
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1286
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1287 1287
 	}
1288 1288
 
1289
-	if ( $meta_key ) {
1290
-		$meta_key = stripslashes_deep( $meta_key );
1289
+	if ($meta_key) {
1290
+		$meta_key = stripslashes_deep($meta_key);
1291 1291
 		/**
1292 1292
 		 * Filter SEO meta keywords.
1293 1293
 		 *
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 		 *
1296 1296
 		 * @param string $meta_desc Meta keywords.
1297 1297
 		 */
1298
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1298
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1299 1299
 	}
1300 1300
 
1301 1301
 }
@@ -1315,8 +1315,8 @@  discard block
 block discarded – undo
1315 1315
 
1316 1316
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1317 1317
 
1318
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1319
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1318
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1319
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1320 1320
 	}
1321 1321
 
1322 1322
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1338,57 +1338,57 @@  discard block
 block discarded – undo
1338 1338
 	 * @since 1.0.0
1339 1339
 	 */
1340 1340
 	$arr_tabs['post_profile'] = array(
1341
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1341
+		'heading_text'  => __('Profile', 'geodirectory'),
1342 1342
 		'is_active_tab' => true,
1343
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1343
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1344 1344
 		'tab_content'   => ''
1345 1345
 	);
1346
-	$arr_tabs['post_info']    = array(
1347
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1346
+	$arr_tabs['post_info'] = array(
1347
+		'heading_text'  => __('More Info', 'geodirectory'),
1348 1348
 		'is_active_tab' => false,
1349
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1349
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1350 1350
 		'tab_content'   => ''
1351 1351
 	);
1352 1352
 
1353 1353
 	$arr_tabs['post_images'] = array(
1354
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1354
+		'heading_text'  => __('Photos', 'geodirectory'),
1355 1355
 		'is_active_tab' => false,
1356
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1356
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1357 1357
 		'tab_content'   => ''
1358 1358
 	);
1359 1359
 
1360 1360
 	$arr_tabs['post_video'] = array(
1361
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1361
+		'heading_text'  => __('Video', 'geodirectory'),
1362 1362
 		'is_active_tab' => false,
1363
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1363
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1364 1364
 		'tab_content'   => ''
1365 1365
 	);
1366 1366
 
1367 1367
 	$arr_tabs['special_offers'] = array(
1368
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1368
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1369 1369
 		'is_active_tab' => false,
1370
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1370
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1371 1371
 		'tab_content'   => ''
1372 1372
 	);
1373 1373
 
1374 1374
 	$arr_tabs['post_map'] = array(
1375
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1375
+		'heading_text'  => __('Map', 'geodirectory'),
1376 1376
 		'is_active_tab' => false,
1377
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1377
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1378 1378
 		'tab_content'   => ''
1379 1379
 	);
1380 1380
 
1381 1381
 	$arr_tabs['reviews'] = array(
1382
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1382
+		'heading_text'  => __('Reviews', 'geodirectory'),
1383 1383
 		'is_active_tab' => false,
1384
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1384
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1385 1385
 		'tab_content'   => 'review display'
1386 1386
 	);
1387 1387
 
1388 1388
 	$arr_tabs['related_listing'] = array(
1389
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1389
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1390 1390
 		'is_active_tab' => false,
1391
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1391
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1392 1392
 		'tab_content'   => ''
1393 1393
 	);
1394 1394
 
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 	 *
1398 1398
 	 * @since 1.0.0
1399 1399
 	 */
1400
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1400
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1401 1401
 
1402 1402
 
1403 1403
 }
@@ -1411,13 +1411,13 @@  discard block
 block discarded – undo
1411 1411
  * @return mixed|array Tabs array.
1412 1412
  */
1413 1413
 function geodir_detail_page_tabs_list() {
1414
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1414
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1415 1415
 	$tabs_array    = geodir_detail_page_tabs_array();
1416 1416
 
1417
-	if ( ! empty( $tabs_excluded ) ) {
1418
-		foreach ( $tabs_excluded as $tab ) {
1419
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1420
-				unset( $tabs_array[ $tab ] );
1417
+	if (!empty($tabs_excluded)) {
1418
+		foreach ($tabs_excluded as $tab) {
1419
+			if (array_key_exists($tab, $tabs_array)) {
1420
+				unset($tabs_array[$tab]);
1421 1421
 			}
1422 1422
 		}
1423 1423
 	}
@@ -1441,66 +1441,66 @@  discard block
 block discarded – undo
1441 1441
 function geodir_show_detail_page_tabs() {
1442 1442
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1443 1443
 
1444
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1445
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1446
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1444
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1445
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1446
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1447 1447
 
1448
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1449
-		$post = geodir_get_post_info( $request_post_id );
1450
-		setup_postdata( $post );
1448
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1449
+		$post = geodir_get_post_info($request_post_id);
1450
+		setup_postdata($post);
1451 1451
 	}
1452 1452
 
1453
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1453
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1454 1454
 
1455 1455
 	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1456 1456
 	$image_limit = '';
1457 1457
 	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1458
-		$image_limit = (int)$package_info->image_limit;
1458
+		$image_limit = (int) $package_info->image_limit;
1459 1459
 	}
1460 1460
 
1461
-	if ( geodir_is_page( 'detail' ) ) {
1462
-		$video                 = geodir_get_video( $post->ID );
1463
-		$special_offers        = geodir_get_special_offers( $post->ID );
1461
+	if (geodir_is_page('detail')) {
1462
+		$video                 = geodir_get_video($post->ID);
1463
+		$special_offers        = geodir_get_special_offers($post->ID);
1464 1464
 		$related_listing_array = array();
1465
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1466
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1465
+		if (get_option('geodir_add_related_listing_posttypes')) {
1466
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1467 1467
 		}
1468 1468
 
1469
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1470
-		if ( ! $excluded_tabs ) {
1469
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1470
+		if (!$excluded_tabs) {
1471 1471
 			$excluded_tabs = array();
1472 1472
 		}
1473 1473
 
1474 1474
 		$related_listing = '';
1475
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1475
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1476 1476
 			$request = array(
1477
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1478
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1479
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1480
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1481
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1482
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1477
+				'post_number'         => get_option('geodir_related_post_count'),
1478
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1479
+				'layout'              => get_option('geodir_related_post_listing_view'),
1480
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1481
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1482
+				'character_count'     => get_option('geodir_related_post_excerpt')
1483 1483
 			);
1484 1484
 
1485
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1486
-				$related_listing = geodir_get_detail_page_related_events( $request );
1485
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1486
+				$related_listing = geodir_get_detail_page_related_events($request);
1487 1487
 			} else {
1488
-				$related_listing = geodir_related_posts_display( $request );
1488
+				$related_listing = geodir_related_posts_display($request);
1489 1489
 			}
1490 1490
 
1491 1491
 		}
1492 1492
 
1493
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1493
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1494 1494
 		$thumb_image = '';
1495
-		if ( ! empty( $post_images ) ) {
1495
+		if (!empty($post_images)) {
1496 1496
 			$count = 1;
1497
-			foreach ( $post_images as $image ) {
1497
+			foreach ($post_images as $image) {
1498 1498
 				if ($image_limit !== '' && $count > $image_limit) {
1499 1499
 					 break;
1500 1500
 				}
1501
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1502
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1503
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1501
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1502
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1503
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1504 1504
 				$thumb_image .= '</a>';
1505 1505
 				$count++;
1506 1506
 			}
@@ -1510,11 +1510,11 @@  discard block
 block discarded – undo
1510 1510
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1511 1511
 		$map_args['width']           = '600';
1512 1512
 		$map_args['height']          = '300';
1513
-		if ( $post->post_mapzoom ) {
1514
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1513
+		if ($post->post_mapzoom) {
1514
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1515 1515
 		}
1516 1516
 		$map_args['autozoom']                 = false;
1517
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1517
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1518 1518
 		$map_args['child_collapse']           = '0';
1519 1519
 		$map_args['enable_cat_filters']       = false;
1520 1520
 		$map_args['enable_text_search']       = false;
@@ -1523,29 +1523,29 @@  discard block
 block discarded – undo
1523 1523
 		$map_args['enable_jason_on_load']     = true;
1524 1524
 		$map_args['enable_map_direction']     = true;
1525 1525
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1526
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1527
-	} else if ( geodir_is_page( 'preview' ) ) {
1528
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1529
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1526
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1527
+	} else if (geodir_is_page('preview')) {
1528
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1529
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1530 1530
 
1531
-		if ( isset( $post->post_images ) ) {
1532
-			$post->post_images = trim( $post->post_images, "," );
1531
+		if (isset($post->post_images)) {
1532
+			$post->post_images = trim($post->post_images, ",");
1533 1533
 		}
1534 1534
 
1535
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1536
-			$post_images = explode( ",", $post->post_images );
1535
+		if (isset($post->post_images) && !empty($post->post_images)) {
1536
+			$post_images = explode(",", $post->post_images);
1537 1537
 		}
1538 1538
 
1539 1539
 		$thumb_image = '';
1540
-		if ( ! empty( $post_images ) ) {
1540
+		if (!empty($post_images)) {
1541 1541
 			$count = 1;
1542
-			foreach ( $post_images as $image ) {
1543
-				if ( $image != '' ) {
1542
+			foreach ($post_images as $image) {
1543
+				if ($image != '') {
1544 1544
 					if ($image_limit !== '' && $count > $image_limit) {
1545 1545
 						 break;
1546 1546
 					}
1547
-					$thumb_image .= '<a href="' . $image . '">';
1548
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1547
+					$thumb_image .= '<a href="'.$image.'">';
1548
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1549 1549
 					$thumb_image .= '</a>';
1550 1550
 					$count++;
1551 1551
 				}
@@ -1553,18 +1553,18 @@  discard block
 block discarded – undo
1553 1553
 		}
1554 1554
 
1555 1555
 		global $map_jason;
1556
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1557
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1558
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1556
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1557
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1558
+		$icon_size        = geodir_get_marker_size($marker_icon);
1559 1559
 		$marker_json['w'] = $icon_size['w'];
1560 1560
 		$marker_json['h'] = $icon_size['h'];
1561
-		$map_jason[]      = json_encode( $marker_json );
1561
+		$map_jason[]      = json_encode($marker_json);
1562 1562
 
1563
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1564
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1565
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1566
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1567
-		if ( ! $mapzoom ) {
1563
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1564
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1565
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1566
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1567
+		if (!$mapzoom) {
1568 1568
 			$mapzoom = 12;
1569 1569
 		}
1570 1570
 
@@ -1587,37 +1587,37 @@  discard block
 block discarded – undo
1587 1587
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1588 1588
 	}
1589 1589
 
1590
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1590
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1591 1591
 
1592 1592
 	$active_tab       = '';
1593 1593
 	$active_tab_name  = '';
1594 1594
 	$default_tab      = '';
1595 1595
 	$default_tab_name = '';
1596
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1597
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1596
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1597
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1598 1598
 			$active_tab      = $tab_index;
1599
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1599
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1600 1600
 		}
1601 1601
 
1602
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1602
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1603 1603
 			$default_tab      = $tab_index;
1604
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1604
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1605 1605
 		}
1606 1606
 	}
1607 1607
 
1608
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1609
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1610
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1608
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1609
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1610
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1611 1611
 		}
1612 1612
 
1613
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1613
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1614 1614
 		$active_tab                                            = $default_tab;
1615 1615
 		$active_tab_name                                       = $default_tab_name;
1616 1616
 	}
1617
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1617
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1618 1618
 	?>
1619 1619
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1620
-		<?php if ( ! $tab_list ){ ?>
1620
+		<?php if (!$tab_list) { ?>
1621 1621
 		<div id="geodir-tab-mobile-menu">
1622 1622
 			<i class="fa fa-bars"></i>
1623 1623
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1632,26 +1632,26 @@  discard block
 block discarded – undo
1632 1632
 			 * @since 1.0.0
1633 1633
 			 * @see   'geodir_after_tab_list'
1634 1634
 			 */
1635
-			do_action( 'geodir_before_tab_list' ); ?>
1635
+			do_action('geodir_before_tab_list'); ?>
1636 1636
 			<?php
1637 1637
 
1638
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1639
-				if ( $detail_page_tab['is_display'] ) {
1638
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1639
+				if ($detail_page_tab['is_display']) {
1640 1640
 
1641
-					if ( ! $tab_list ) {
1641
+					if (!$tab_list) {
1642 1642
 						?>
1643 1643
 						<dt></dt> <!-- added to comply with validation -->
1644
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1644
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1645 1645
 								data-tab="#<?php echo $tab_index; ?>"
1646
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1646
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1647 1647
 						</dd>
1648 1648
 						<?php
1649 1649
 					}
1650 1650
 					ob_start() // start tab content buffering
1651 1651
 					?>
1652 1652
 					<li id="<?php echo $tab_index; ?>Tab">
1653
-						<?php if ( $tab_list ) {
1654
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1653
+						<?php if ($tab_list) {
1654
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1655 1655
 							/**
1656 1656
 							 * Filter the tab list title html.
1657 1657
 							 *
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 							 * @param string $tab_index      The tab index type.
1662 1662
 							 * @param array $detail_page_tab The array of values including title text.
1663 1663
 							 */
1664
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1664
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1665 1665
 						} ?>
1666 1666
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1667 1667
 						<?php
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 						 *
1673 1673
 						 * @param string $tab_index The tab name ID.
1674 1674
 						 */
1675
-						do_action( 'geodir_before_tab_content', $tab_index );
1675
+						do_action('geodir_before_tab_content', $tab_index);
1676 1676
 
1677 1677
 						/**
1678 1678
 						 * Called before the details tab content is output per tab.
@@ -1682,21 +1682,21 @@  discard block
 block discarded – undo
1682 1682
 						 * @since 1.0.0
1683 1683
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1684 1684
 						 */
1685
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1685
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1686 1686
 						/// write a code to generate content of each tab
1687
-						switch ( $tab_index ) {
1687
+						switch ($tab_index) {
1688 1688
 							case 'post_profile':
1689 1689
 								/**
1690 1690
 								 * Called before the listing description content on the details page tab.
1691 1691
 								 *
1692 1692
 								 * @since 1.0.0
1693 1693
 								 */
1694
-								do_action( 'geodir_before_description_on_listing_detail' );
1695
-								if ( geodir_is_page( 'detail' ) ) {
1694
+								do_action('geodir_before_description_on_listing_detail');
1695
+								if (geodir_is_page('detail')) {
1696 1696
 									the_content();
1697 1697
 								} else {
1698 1698
 									/** This action is documented in geodirectory_template_actions.php */
1699
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1699
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1700 1700
 								}
1701 1701
 
1702 1702
 								/**
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 								 *
1705 1705
 								 * @since 1.0.0
1706 1706
 								 */
1707
-								do_action( 'geodir_after_description_on_listing_detail' );
1707
+								do_action('geodir_after_description_on_listing_detail');
1708 1708
 								break;
1709 1709
 							case 'post_info':
1710 1710
 								echo $geodir_post_detail_fields;
@@ -1714,32 +1714,32 @@  discard block
 block discarded – undo
1714 1714
 								break;
1715 1715
 							case 'post_video':
1716 1716
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1717
-								if ( $preview ) {
1718
-									if ( $video ) {
1719
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1717
+								if ($preview) {
1718
+									if ($video) {
1719
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1720 1720
 									}
1721 1721
 								} else {
1722 1722
 
1723 1723
 									// stop payment manager filtering content length
1724
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1725
-									if ( false !== $filter_priority ) {
1726
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1724
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1725
+									if (false !== $filter_priority) {
1726
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1727 1727
 									}
1728 1728
 
1729 1729
 									/** This action is documented in geodirectory_template_actions.php */
1730
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1730
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1731 1731
 
1732
-									if ( false !== $filter_priority ) {
1733
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1732
+									if (false !== $filter_priority) {
1733
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1734 1734
 									}
1735 1735
 								}
1736 1736
 								break;
1737 1737
 							case 'special_offers':
1738
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1738
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1739 1739
 
1740 1740
 								break;
1741 1741
 							case 'post_map':
1742
-								geodir_draw_map( $map_args );
1742
+								geodir_draw_map($map_args);
1743 1743
 								break;
1744 1744
 							case 'reviews':
1745 1745
 								comments_template();
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 								echo $related_listing;
1749 1749
 								break;
1750 1750
 							default: {
1751
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1751
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1752 1752
 									echo $detail_page_tab['tab_content'];
1753 1753
 								}
1754 1754
 							}
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 						 *
1761 1761
 						 * @since 1.0.0
1762 1762
 						 */
1763
-						do_action( 'geodir_after_tab_content', $tab_index );
1763
+						do_action('geodir_after_tab_content', $tab_index);
1764 1764
 
1765 1765
 						/**
1766 1766
 						 * Called after the details tab content is output per tab.
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
 						 * @since 1.0.0
1771 1771
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1772 1772
 						 */
1773
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1773
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1774 1774
 						?> </li>
1775 1775
 					<?php
1776 1776
 					/**
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 					 *
1779 1779
 					 * @since 1.0.0
1780 1780
 					 */
1781
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1781
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1782 1782
 				} // end of if for is_display
1783 1783
 			}// end of foreach
1784 1784
 
@@ -1788,14 +1788,14 @@  discard block
 block discarded – undo
1788 1788
 			 * @since 1.0.0
1789 1789
 			 * @see   'geodir_before_tab_list'
1790 1790
 			 */
1791
-			do_action( 'geodir_after_tab_list' );
1791
+			do_action('geodir_after_tab_list');
1792 1792
 			?>
1793
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1794
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1793
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1794
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1795 1795
 		    style="position:relative;">
1796 1796
 			<?php
1797
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1798
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1797
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1798
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1799 1799
 					echo $detail_page_tab['tab_content'];
1800 1800
 				}// end of if
1801 1801
 			}// end of foreach
@@ -1805,11 +1805,11 @@  discard block
 block discarded – undo
1805 1805
 			 *
1806 1806
 			 * @since 1.0.0
1807 1807
 			 */
1808
-			do_action( 'geodir_add_tab_content' ); ?>
1808
+			do_action('geodir_add_tab_content'); ?>
1809 1809
 		</ul>
1810 1810
 		<!--gd-tabs-content ul end-->
1811 1811
 	</div>
1812
-	<?php if ( ! $tab_list ) { ?>
1812
+	<?php if (!$tab_list) { ?>
1813 1813
 		<script>
1814 1814
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1815 1815
 				hashVal = window.location.hash;
@@ -1841,31 +1841,31 @@  discard block
 block discarded – undo
1841 1841
  *
1842 1842
  * @return mixed Image file.
1843 1843
  */
1844
-function geodir_exif( $file ) {
1845
-	if ( empty( $file ) || ! is_array( $file ) ) {
1844
+function geodir_exif($file) {
1845
+	if (empty($file) || !is_array($file)) {
1846 1846
 		return $file;
1847 1847
 	}
1848 1848
 
1849
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1850
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1849
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1850
+	if (!($file_path && file_exists($file_path))) {
1851 1851
 		return $file;
1852 1852
 	}
1853 1853
 	$file['file'] = $file_path;
1854 1854
 
1855
-	if ( ! file_is_valid_image( $file_path ) ) {
1855
+	if (!file_is_valid_image($file_path)) {
1856 1856
 		return $file; // Bail if file is not an image.
1857 1857
 	}
1858 1858
 
1859
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1859
+	if (!function_exists('wp_get_image_editor')) {
1860 1860
 		return $file;
1861 1861
 	}
1862 1862
 
1863 1863
 	$mime_type = $file['type'];
1864 1864
 	$exif      = array();
1865
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1865
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1866 1866
 		try {
1867
-			$exif = exif_read_data( $file_path );
1868
-		} catch ( Exception $e ) {
1867
+			$exif = exif_read_data($file_path);
1868
+		} catch (Exception $e) {
1869 1869
 			$exif = array();
1870 1870
 		}
1871 1871
 	}
@@ -1874,13 +1874,13 @@  discard block
 block discarded – undo
1874 1874
 	$flip        = false;
1875 1875
 	$modify      = false;
1876 1876
 	$orientation = 0;
1877
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1878
-		switch ( (int) $exif['Orientation'] ) {
1877
+	if (!empty($exif) && isset($exif['Orientation'])) {
1878
+		switch ((int) $exif['Orientation']) {
1879 1879
 			case 1:
1880 1880
 				// do nothing
1881 1881
 				break;
1882 1882
 			case 2:
1883
-				$flip   = array( false, true );
1883
+				$flip   = array(false, true);
1884 1884
 				$modify = true;
1885 1885
 				break;
1886 1886
 			case 3:
@@ -1889,13 +1889,13 @@  discard block
 block discarded – undo
1889 1889
 				$modify      = true;
1890 1890
 				break;
1891 1891
 			case 4:
1892
-				$flip   = array( true, false );
1892
+				$flip   = array(true, false);
1893 1893
 				$modify = true;
1894 1894
 				break;
1895 1895
 			case 5:
1896 1896
 				$orientation = - 90;
1897 1897
 				$rotate      = true;
1898
-				$flip        = array( false, true );
1898
+				$flip        = array(false, true);
1899 1899
 				$modify      = true;
1900 1900
 				break;
1901 1901
 			case 6:
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
 			case 7:
1907 1907
 				$orientation = - 270;
1908 1908
 				$rotate      = true;
1909
-				$flip        = array( false, true );
1909
+				$flip        = array(false, true);
1910 1910
 				$modify      = true;
1911 1911
 				break;
1912 1912
 			case 8:
@@ -1932,31 +1932,31 @@  discard block
 block discarded – undo
1932 1932
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1933 1933
 	 * @param string $quality   Image mime type.
1934 1934
 	 */
1935
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1936
-	if ( $quality !== null ) {
1935
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1936
+	if ($quality !== null) {
1937 1937
 		$modify = true;
1938 1938
 	}
1939 1939
 
1940
-	if ( ! $modify ) {
1940
+	if (!$modify) {
1941 1941
 		return $file; // no change
1942 1942
 	}
1943 1943
 
1944
-	$image = wp_get_image_editor( $file_path );
1945
-	if ( ! is_wp_error( $image ) ) {
1946
-		if ( $rotate ) {
1947
-			$image->rotate( $orientation );
1944
+	$image = wp_get_image_editor($file_path);
1945
+	if (!is_wp_error($image)) {
1946
+		if ($rotate) {
1947
+			$image->rotate($orientation);
1948 1948
 		}
1949 1949
 
1950
-		if ( ! empty( $flip ) ) {
1951
-			$image->flip( $flip[0], $flip[1] );
1950
+		if (!empty($flip)) {
1951
+			$image->flip($flip[0], $flip[1]);
1952 1952
 		}
1953 1953
 
1954
-		if ( $quality !== null ) {
1955
-			$image->set_quality( (int) $quality );
1954
+		if ($quality !== null) {
1955
+			$image->set_quality((int) $quality);
1956 1956
 		}
1957 1957
 
1958
-		$result = $image->save( $file_path );
1959
-		if ( ! is_wp_error( $result ) ) {
1958
+		$result = $image->save($file_path);
1959
+		if (!is_wp_error($result)) {
1960 1960
 			$file['file']     = $result['path'];
1961 1961
 			$file['tmp_name'] = $result['path'];
1962 1962
 		}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
  *
1985 1985
  * @return string Returns the recent reviews html.
1986 1986
  */
1987
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1987
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1988 1988
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1989 1989
 	$tablecomments = $wpdb->comments;
1990 1990
 	$tableposts    = $wpdb->posts;
@@ -1994,17 +1994,17 @@  discard block
 block discarded – undo
1994 1994
 	$region_filter  = '';
1995 1995
 	$country_filter = '';
1996 1996
 
1997
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1998
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1999
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1997
+	if ($gd_session->get('gd_multi_location')) {
1998
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1999
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
2000 2000
 		}
2001 2001
 
2002
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
2003
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
2002
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
2003
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
2004 2004
 		}
2005 2005
 
2006
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
2007
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
2006
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
2007
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
2008 2008
 		}
2009 2009
 	}
2010 2010
 	
@@ -2015,84 +2015,84 @@  discard block
 block discarded – undo
2015 2015
 		$lang_code = ICL_LANGUAGE_CODE;
2016 2016
 		
2017 2017
 		if ($lang_code) {
2018
-			$join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2019
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2018
+			$join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2019
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2020 2020
 		}
2021 2021
 	}
2022 2022
 	
2023
-	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2023
+	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2024 2024
 	
2025
-	$comments = $wpdb->get_results( $request );
2025
+	$comments = $wpdb->get_results($request);
2026 2026
 	
2027
-	foreach ( $comments as $comment ) {
2027
+	foreach ($comments as $comment) {
2028 2028
 		// Set the extra comment info needed.
2029
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2029
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2030 2030
 		$comment->comment_content      = $comment_extra->comment_content;
2031 2031
 		$comment->comment_author       = $comment_extra->comment_author;
2032 2032
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2033 2033
 
2034 2034
 		$comment_id      = '';
2035 2035
 		$comment_id      = $comment->comment_ID;
2036
-		$comment_content = strip_tags( $comment->comment_content );
2036
+		$comment_content = strip_tags($comment->comment_content);
2037 2037
 
2038
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2038
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2039 2039
 
2040
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2040
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2041 2041
 		$comment_author_email = $comment->comment_author_email;
2042 2042
 		$comment_post_ID      = $comment->post_id;
2043 2043
 
2044
-		$post_title        = get_the_title( $comment_post_ID );
2045
-		$permalink         = get_permalink( $comment_post_ID );
2046
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2047
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2044
+		$post_title        = get_the_title($comment_post_ID);
2045
+		$permalink         = get_permalink($comment_post_ID);
2046
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2047
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2048 2048
 
2049
-		$comment_content_length = strlen( $comment_content );
2050
-		if ( $comment_content_length > $comment_lenth ) {
2051
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2049
+		$comment_content_length = strlen($comment_content);
2050
+		if ($comment_content_length > $comment_lenth) {
2051
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2052 2052
 		} else {
2053 2053
 			$comment_excerpt = $comment_content;
2054 2054
 		}
2055 2055
 
2056
-		if ( $comment->user_id ) {
2057
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2056
+		if ($comment->user_id) {
2057
+			$user_profile_url = get_author_posts_url($comment->user_id);
2058 2058
 		} else {
2059 2059
 			$user_profile_url = '';
2060 2060
 		}
2061 2061
 
2062
-		if ( $comment_id ) {
2062
+		if ($comment_id) {
2063 2063
 			$comments_echo .= '<li class="clearfix">';
2064
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2065
-			if ( function_exists( 'get_avatar' ) ) {
2066
-				if ( ! isset( $comment->comment_type ) ) {
2067
-					if ( $user_profile_url ) {
2068
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2064
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2065
+			if (function_exists('get_avatar')) {
2066
+				if (!isset($comment->comment_type)) {
2067
+					if ($user_profile_url) {
2068
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2069 2069
 					}
2070
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2071
-					if ( $user_profile_url ) {
2070
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2071
+					if ($user_profile_url) {
2072 2072
 						$comments_echo .= '</a>';
2073 2073
 					}
2074
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2075
-					if ( $user_profile_url ) {
2076
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2074
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2075
+					if ($user_profile_url) {
2076
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2077 2077
 					}
2078
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2078
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2079 2079
 				}
2080
-			} elseif ( function_exists( 'gravatar' ) ) {
2081
-				if ( $user_profile_url ) {
2082
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2080
+			} elseif (function_exists('gravatar')) {
2081
+				if ($user_profile_url) {
2082
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2083 2083
 				}
2084 2084
 				$comments_echo .= "<img src=\"";
2085
-				if ( '' == $comment->comment_type ) {
2086
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2087
-					if ( $user_profile_url ) {
2085
+				if ('' == $comment->comment_type) {
2086
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2087
+					if ($user_profile_url) {
2088 2088
 						$comments_echo .= '</a>';
2089 2089
 					}
2090
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2091
-					if ( $user_profile_url ) {
2092
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2090
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2091
+					if ($user_profile_url) {
2092
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2093 2093
 					}
2094
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2095
-					if ( $user_profile_url ) {
2094
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2095
+					if ($user_profile_url) {
2096 2096
 						$comments_echo .= '</a>';
2097 2097
 					}
2098 2098
 				}
@@ -2102,17 +2102,17 @@  discard block
 block discarded – undo
2102 2102
 			$comments_echo .= "</span>\n";
2103 2103
 
2104 2104
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2105
-			if ( $comment->user_id ) {
2106
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2105
+			if ($comment->user_id) {
2106
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2107 2107
 			}
2108
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2109
-			if ( $comment->user_id ) {
2108
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2109
+			if ($comment->user_id) {
2110 2110
 				$comments_echo .= '</a>';
2111 2111
 			}
2112
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2113
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2114
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2115
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2112
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2113
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2114
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2115
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2116 2116
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2117 2117
 			$comments_echo .= '</p>';
2118 2118
 
@@ -2132,25 +2132,25 @@  discard block
 block discarded – undo
2132 2132
  * @return array Returns post categories as an array.
2133 2133
  */
2134 2134
 function geodir_home_map_cats_key_value_array() {
2135
-	$post_types = geodir_get_posttypes( 'object' );
2135
+	$post_types = geodir_get_posttypes('object');
2136 2136
 
2137 2137
 	$return = array();
2138
-	if ( ! empty( $post_types ) ) {
2139
-		foreach ( $post_types as $key => $post_type ) {
2140
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2141
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2142
-			$taxonomies     = geodir_get_taxonomies( $key );
2143
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2144
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2145
-
2146
-			if ( ! empty( $cat_terms ) ) {
2147
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2148
-
2149
-				foreach ( $cat_terms as $cat_term ) {
2150
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2138
+	if (!empty($post_types)) {
2139
+		foreach ($post_types as $key => $post_type) {
2140
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2141
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2142
+			$taxonomies     = geodir_get_taxonomies($key);
2143
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2144
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2145
+
2146
+			if (!empty($cat_terms)) {
2147
+				$return['optgroup_start-'.$key] = $post_type_name;
2148
+
2149
+				foreach ($cat_terms as $cat_term) {
2150
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2151 2151
 				}
2152 2152
 
2153
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2153
+				$return['optgroup_end-'.$key] = $post_type_name;
2154 2154
 			}
2155 2155
 		}
2156 2156
 	}
@@ -2166,14 +2166,14 @@  discard block
 block discarded – undo
2166 2166
  * @package GeoDirectory
2167 2167
  */
2168 2168
 function geodir_twitter_tweet_button() {
2169
-	if ( isset( $_GET['gde'] ) ) {
2170
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2169
+	if (isset($_GET['gde'])) {
2170
+		$link = '?url='.urlencode(geodir_curPageURL());
2171 2171
 	} else {
2172 2172
 		$link = '';
2173 2173
 	}
2174 2174
 	?>
2175 2175
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2176
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2176
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2177 2177
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2178 2178
 	<?php
2179 2179
 }
@@ -2190,10 +2190,10 @@  discard block
 block discarded – undo
2190 2190
 function geodir_fb_like_button() {
2191 2191
 	global $post;
2192 2192
 	?>
2193
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2193
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2194 2194
 		echo 'allowtransparency="true"';
2195 2195
 	} ?> class="facebook"
2196
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2196
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2197 2197
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2198 2198
 	<?php
2199 2199
 }
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
 
2225 2225
 
2226 2226
 function geodir_listing_bounce_map_pin_on_hover() {
2227
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2227
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2228 2228
 		?>
2229 2229
 		<script>
2230 2230
 			jQuery(function ($) {
@@ -2247,44 +2247,44 @@  discard block
 block discarded – undo
2247 2247
 	}
2248 2248
 }
2249 2249
 
2250
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2250
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2251 2251
 
2252
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2253
-function geodir_output_favourite_html_listings( $post_id ) {
2254
-	geodir_favourite_html( '', $post_id );
2252
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2253
+function geodir_output_favourite_html_listings($post_id) {
2254
+	geodir_favourite_html('', $post_id);
2255 2255
 }
2256 2256
 
2257
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2258
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2257
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2258
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2259 2259
 	global $wp_query;
2260 2260
 
2261 2261
 	$show_pin_point = $wp_query->is_main_query();
2262 2262
 
2263
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2264
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2265
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2263
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2264
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2265
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2266 2266
 		?>
2267 2267
 		<span class="geodir-pinpoint"
2268
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2268
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2269 2269
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2270 2270
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2271 2271
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2272
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2272
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2273 2273
 		<?php
2274 2274
 	}
2275 2275
 }
2276 2276
 
2277 2277
 function geodir_search_form_submit_button() {
2278 2278
 
2279
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2279
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2280 2280
 
2281
-	if ( $new_style ) {
2281
+	if ($new_style) {
2282 2282
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2283
-	}else{
2283
+	} else {
2284 2284
 		$default_search_button_label = 'Search';
2285 2285
 	}
2286
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2287
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2286
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2287
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2288 2288
 	}
2289 2289
 
2290 2290
 	/**
@@ -2296,78 +2296,78 @@  discard block
 block discarded – undo
2296 2296
 	 *
2297 2297
 	 * @param string $default_search_button_label The current search button text.
2298 2298
 	 */
2299
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2299
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2300 2300
 
2301 2301
 	$fa_class = '';
2302
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2302
+	if (strpos($default_search_button_label, '&#') !== false) {
2303 2303
 		$fa_class = 'fa';
2304 2304
 	}
2305 2305
 
2306 2306
 
2307
-	if ( $new_style ) {
2307
+	if ($new_style) {
2308 2308
 	?>
2309
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2310
-<?php }else{?>
2311
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2309
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2310
+<?php } else {?>
2311
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2312 2312
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2313 2313
 	<?php }
2314 2314
 }
2315 2315
 
2316
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2316
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2317 2317
 
2318 2318
 function geodir_search_form_post_type_input() {
2319 2319
 	global $geodir_search_post_type;
2320
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2320
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2321 2321
 	$curr_post_type = $geodir_search_post_type;
2322 2322
 
2323
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2323
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2324 2324
 
2325
-		foreach ( $post_types as $post_type => $info ){
2325
+		foreach ($post_types as $post_type => $info) {
2326 2326
 			global $wpdb;
2327
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2328
-			if ( ! $has_posts ) {
2327
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2328
+			if (!$has_posts) {
2329 2329
 				unset($post_types->{$post_type});
2330 2330
 			}
2331 2331
 		}
2332 2332
 
2333
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2333
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2334 2334
 
2335
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2336
-			if ( $new_style ) {
2335
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2336
+			if ($new_style) {
2337 2337
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2338 2338
 			}
2339 2339
 			?>
2340 2340
 			<select name="stype" class="search_by_post">
2341
-				<?php foreach ( $post_types as $post_type => $info ):
2341
+				<?php foreach ($post_types as $post_type => $info):
2342 2342
 					global $wpdb;
2343 2343
 					?>
2344 2344
 
2345
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2346
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2347
-						if ( $post_type == $_REQUEST['stype'] ) {
2345
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2346
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2347
+						if ($post_type == $_REQUEST['stype']) {
2348 2348
 							echo 'selected="selected"';
2349 2349
 						}
2350
-					} elseif ( $curr_post_type == $post_type ) {
2350
+					} elseif ($curr_post_type == $post_type) {
2351 2351
 						echo 'selected="selected"';
2352
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2352
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2353 2353
 
2354 2354
 				<?php endforeach; ?>
2355 2355
 			</select>
2356 2356
 			<?php
2357
-			if ( $new_style ) {
2357
+			if ($new_style) {
2358 2358
 				echo "</div>";
2359 2359
 			}
2360
-		}else{
2361
-			if(! empty( $post_types )){
2362
-				$pt_arr = (array)$post_types;
2363
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2364
-			}else{
2360
+		} else {
2361
+			if (!empty($post_types)) {
2362
+				$pt_arr = (array) $post_types;
2363
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2364
+			} else {
2365 2365
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2366 2366
 			}
2367 2367
 
2368 2368
 		}
2369 2369
 
2370
-	}elseif ( ! empty( $post_types ) ) {
2370
+	}elseif (!empty($post_types)) {
2371 2371
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2372 2372
 	}
2373 2373
 }
@@ -2375,26 +2375,26 @@  discard block
 block discarded – undo
2375 2375
 function geodir_search_form_search_input() {
2376 2376
 
2377 2377
 	$default_search_for_text = SEARCH_FOR_TEXT;
2378
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2379
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2378
+	if (get_option('geodir_search_field_default_text')) {
2379
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2380 2380
 	}
2381 2381
 
2382 2382
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2383
-	if($new_style){
2383
+	if ($new_style) {
2384 2384
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2385 2385
 	}
2386 2386
 	?>
2387 2387
 	<input class="search_text" name="s"
2388
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2389
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2388
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2389
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2390 2390
 	       } else {
2391 2391
 		       echo $default_search_for_text;
2392 2392
 	       } ?>" type="text"
2393
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2394
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2393
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2394
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2395 2395
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2396 2396
 	<?php
2397
-	if($new_style){
2397
+	if ($new_style) {
2398 2398
 		echo "</div>";
2399 2399
 	}
2400 2400
 }
@@ -2402,12 +2402,12 @@  discard block
 block discarded – undo
2402 2402
 function geodir_search_form_near_input() {
2403 2403
 
2404 2404
 	$default_near_text = NEAR_TEXT;
2405
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2406
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2405
+	if (get_option('geodir_near_field_default_text')) {
2406
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2407 2407
 	}
2408 2408
 
2409
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2410
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2409
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2410
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2411 2411
 	} else {
2412 2412
 		$near = $default_near_text;
2413 2413
 	}
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @since 1.6.9
2422 2422
 	 * @param string $curr_post_type The current post type.
2423 2423
 	 */
2424
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2424
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2425 2425
 
2426 2426
 
2427 2427
 	/**
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 	 * @param string $near              The current near value.
2435 2435
 	 * @param string $default_near_text The default near value.
2436 2436
 	 */
2437
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2437
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2438 2438
 	/**
2439 2439
 	 * Filter the default "Near" text value for the search form.
2440 2440
 	 *
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
 	 * @param string $near              The current near value.
2446 2446
 	 * @param string $default_near_text The default near value.
2447 2447
 	 */
2448
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2448
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2449 2449
 	/**
2450 2450
 	 * Filter the class for the near search input.
2451 2451
 	 *
@@ -2453,10 +2453,10 @@  discard block
 block discarded – undo
2453 2453
 	 *
2454 2454
 	 * @param string $class The class for the HTML near input, default is blank.
2455 2455
 	 */
2456
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2456
+	$near_class = apply_filters('geodir_search_near_class', '');
2457 2457
 
2458 2458
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2459
-	if($new_style){
2459
+	if ($new_style) {
2460 2460
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2461 2461
 		
2462 2462
 		do_action('geodir_before_near_input');
@@ -2464,30 +2464,30 @@  discard block
 block discarded – undo
2464 2464
 
2465 2465
 	?>
2466 2466
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2467
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2468
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2469
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2467
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2468
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2469
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2470 2470
 	<?php
2471
-	if($new_style){
2471
+	if ($new_style) {
2472 2472
 		do_action('geodir_after_near_input');
2473 2473
 
2474 2474
 		echo "</div>";
2475 2475
 	}
2476 2476
 }
2477 2477
 
2478
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2479
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2480
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2478
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2479
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2480
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2481 2481
 
2482
-function geodir_get_search_post_type($pt=''){
2482
+function geodir_get_search_post_type($pt = '') {
2483 2483
 	global $geodir_search_post_type;
2484 2484
 
2485
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2486
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2485
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2486
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2487 2487
 
2488 2488
 	$geodir_search_post_type = geodir_get_current_posttype();
2489 2489
 
2490
-	if(!$geodir_search_post_type) {
2490
+	if (!$geodir_search_post_type) {
2491 2491
 		$geodir_search_post_type = geodir_get_default_posttype();
2492 2492
 	}
2493 2493
 
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 	return $geodir_search_post_type;
2496 2496
 }
2497 2497
 
2498
-function geodir_search_form(){
2498
+function geodir_search_form() {
2499 2499
 
2500 2500
 	geodir_get_search_post_type();
2501 2501
 
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 	die();
2506 2506
 }
2507 2507
 
2508
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2509
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2508
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2509
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2510 2510
 
2511 2511
 /**
2512 2512
  * Check wpml active or not.
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
         }
2581 2581
     }
2582 2582
 }
2583
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2583
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2584 2584
 
2585 2585
 /**
2586 2586
  * Duplicate post listing manually after listing saved.
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2622 2622
     global $wpdb;
2623 2623
 
2624
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2624
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2625 2625
 
2626 2626
     if (!empty($reviews)) {
2627 2627
         foreach ($reviews as $review) {
@@ -2649,14 +2649,14 @@  discard block
 block discarded – undo
2649 2649
     global $wpdb, $plugin_prefix;
2650 2650
 
2651 2651
     $post_type = get_post_type($master_post_id);
2652
-    $post_table = $plugin_prefix . $post_type . '_detail';
2652
+    $post_table = $plugin_prefix.$post_type.'_detail';
2653 2653
 
2654
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2655
-    $data = (array)$wpdb->get_row($query);
2654
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2655
+    $data = (array) $wpdb->get_row($query);
2656 2656
 
2657
-    if ( !empty( $data ) ) {
2657
+    if (!empty($data)) {
2658 2658
         $data['post_id'] = $tr_post_id;
2659
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2659
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2660 2660
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2661 2661
         return true;
2662 2662
     }
@@ -2681,7 +2681,7 @@  discard block
 block discarded – undo
2681 2681
     global $sitepress, $wpdb;
2682 2682
     $post_type = get_post_type($master_post_id);
2683 2683
 
2684
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2684
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2685 2685
 
2686 2686
     $taxonomies = get_object_taxonomies($post_type);
2687 2687
     foreach ($taxonomies as $taxonomy) {
@@ -2690,9 +2690,9 @@  discard block
 block discarded – undo
2690 2690
         
2691 2691
         if ($terms) {
2692 2692
             foreach ($terms as $term) {
2693
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2693
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2694 2694
                 
2695
-                if (!is_null($tr_id)){
2695
+                if (!is_null($tr_id)) {
2696 2696
                     // not using get_term - unfiltered get_term
2697 2697
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2698 2698
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2701,14 +2701,14 @@  discard block
 block discarded – undo
2701 2701
                 }
2702 2702
             }
2703 2703
 
2704
-            if (!is_taxonomy_hierarchical($taxonomy)){
2705
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2704
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2705
+                $terms_array = array_unique(array_map('intval', $terms_array));
2706 2706
             }
2707 2707
 
2708 2708
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2709 2709
             
2710
-            if ($taxonomy == $post_type . 'category') {
2711
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2710
+            if ($taxonomy == $post_type.'category') {
2711
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2712 2712
             }
2713 2713
         }
2714 2714
     }
@@ -2729,15 +2729,15 @@  discard block
 block discarded – undo
2729 2729
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2730 2730
     global $wpdb;
2731 2731
 
2732
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2732
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2733 2733
     $wpdb->query($query);
2734 2734
 
2735
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2735
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2736 2736
     $post_images = $wpdb->get_results($query);
2737 2737
 
2738
-    if ( !empty( $post_images ) ) {
2739
-        foreach ( $post_images as $post_image) {
2740
-            $image_data = (array)$post_image;
2738
+    if (!empty($post_images)) {
2739
+        foreach ($post_images as $post_image) {
2740
+            $image_data = (array) $post_image;
2741 2741
             unset($image_data['ID']);
2742 2742
             $image_data['post_id'] = $tr_post_id;
2743 2743
             
@@ -2770,13 +2770,13 @@  discard block
 block discarded – undo
2770 2770
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2771 2771
     global $wpdb, $plugin_prefix, $sitepress;
2772 2772
 
2773
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2773
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2774 2774
 
2775 2775
     if (empty($review)) {
2776 2776
         return false;
2777 2777
     }
2778 2778
     if ($review['post_id'] != $master_post_id) {
2779
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2779
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2780 2780
         geodir_update_postrating($master_post_id, $post_type);
2781 2781
     }
2782 2782
 
@@ -2787,9 +2787,9 @@  discard block
 block discarded – undo
2787 2787
     }
2788 2788
 
2789 2789
     $post_type = get_post_type($master_post_id);
2790
-    $post_table = $plugin_prefix . $post_type . '_detail';
2790
+    $post_table = $plugin_prefix.$post_type.'_detail';
2791 2791
 
2792
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2792
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2793 2793
     if (empty($translated_post)) {
2794 2794
         return false;
2795 2795
     }
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
         unset($review['id']);
2808 2808
     }
2809 2809
 
2810
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2810
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2811 2811
 
2812 2812
     if ($tr_review_id) { // update review
2813 2813
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2820,8 +2820,8 @@  discard block
 block discarded – undo
2820 2820
         geodir_update_postrating($tr_post_id, $post_type);
2821 2821
         
2822 2822
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2823
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2824
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2823
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2824
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2825 2825
 
2826 2826
             if (!empty($likes)) {
2827 2827
                 foreach ($likes as $like) {
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
  * @return bool True if review star disabled, otherwise false.
2924 2924
  */ 
2925 2925
 function geodir_rating_disabled_post_types() {
2926
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2926
+	$post_types = get_option('geodir_disable_rating_cpt');
2927 2927
 	
2928 2928
 	/**
2929 2929
 	 * Filter the post types array which have rating disabled.
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
 	 *
2933 2933
 	 * @param array $post_types Array of post types which have rating starts disabled.
2934 2934
 	 */
2935
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2935
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2936 2936
 }
2937 2937
 
2938 2938
 /**
@@ -2944,30 +2944,30 @@  discard block
 block discarded – undo
2944 2944
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2945 2945
  * @return bool True if review star disabled, otherwise false.
2946 2946
  */ 
2947
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2947
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2948 2948
 	$post_types = geodir_rating_disabled_post_types();
2949 2949
 	
2950
-	if ( empty( $post_types ) ) {
2950
+	if (empty($post_types)) {
2951 2951
 		return false;
2952 2952
 	}
2953 2953
 	
2954
-	if ( is_int( $post_type ) ) {
2955
-		$post_type = get_post_type( $post_type );
2954
+	if (is_int($post_type)) {
2955
+		$post_type = get_post_type($post_type);
2956 2956
 	}
2957 2957
 	
2958
-	if ( $taxonomy && !empty( $post_types ) ) {
2958
+	if ($taxonomy && !empty($post_types)) {
2959 2959
 		$posttypes = array();
2960 2960
 		
2961
-		foreach ( $post_types as $posttype ) {
2962
-			$posttypes[] = $posttype . 'category';
2963
-			$posttypes[] = $posttype . '_tags';
2961
+		foreach ($post_types as $posttype) {
2962
+			$posttypes[] = $posttype.'category';
2963
+			$posttypes[] = $posttype.'_tags';
2964 2964
 		}
2965 2965
 		
2966 2966
 		$post_types = $posttypes;
2967 2967
 	}
2968 2968
 
2969 2969
 	$return = false;
2970
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2970
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2971 2971
 		$return = true;
2972 2972
 	}
2973 2973
 
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
  * @return bool True if Yoast SEO disabled on GD pages.
2983 2983
  */
2984 2984
 function geodir_disable_yoast_seo_metas() {
2985
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2985
+    return (bool) get_option('geodir_disable_yoast_meta');
2986 2986
 }
2987 2987
 
2988 2988
 /**
@@ -2993,30 +2993,30 @@  discard block
 block discarded – undo
2993 2993
  * @param int $post_id The post ID.
2994 2994
  * @return bool True if allowed.
2995 2995
  */
2996
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
2996
+function geodir_wpml_allowed_to_duplicate($post_id) {
2997 2997
     $allowed = false;
2998 2998
     
2999
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2999
+    if (!geodir_is_wpml() || empty($post_id)) {
3000 3000
         return $allowed;
3001 3001
     }
3002 3002
     
3003
-    $user_id = (int)get_current_user_id();
3003
+    $user_id = (int) get_current_user_id();
3004 3004
     
3005
-    if ( empty( $user_id ) ) {
3005
+    if (empty($user_id)) {
3006 3006
         return $allowed;
3007 3007
     }
3008 3008
     
3009
-    $post_type = get_post_type( $post_id );
3010
-    if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3009
+    $post_type = get_post_type($post_id);
3010
+    if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
3011 3011
         return $allowed;
3012 3012
     }
3013 3013
     
3014
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3014
+    if (geodir_listing_belong_to_current_user($post_id)) {
3015 3015
         $allowed = true;
3016 3016
     }
3017 3017
     
3018
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3019
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3018
+    $disable_cpts = get_option('geodir_wpml_disable_duplicate');
3019
+    if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
3020 3020
         $allowed = false;
3021 3021
     }
3022 3022
     
@@ -3026,7 +3026,7 @@  discard block
 block discarded – undo
3026 3026
      * @param bool $allowed True if allowed.
3027 3027
      * @param int $post_id The post ID.
3028 3028
      */
3029
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3029
+    return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3030 3030
 }
3031 3031
 
3032 3032
 /**
@@ -3041,61 +3041,61 @@  discard block
 block discarded – undo
3041 3041
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3042 3042
  * @return string Filtered html of the geodir_edit_post_link() function.
3043 3043
  */
3044
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3044
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3045 3045
     global $post, $preview, $sitepress;
3046 3046
     
3047
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3047
+    if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3048 3048
         $post_id = $post->ID;
3049
-        $element_type = 'post_' . get_post_type( $post_id );
3050
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3049
+        $element_type = 'post_'.get_post_type($post_id);
3050
+        $original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3051 3051
         
3052
-        if ( $original_post_id == $post_id ) {
3052
+        if ($original_post_id == $post_id) {
3053 3053
             $wpml_languages = $sitepress->get_active_languages();
3054
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3054
+            $post_language = $sitepress->get_language_for_element($post_id, $element_type);
3055 3055
             
3056
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3057
-                unset( $wpml_languages[ $post_language ] );
3056
+            if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3057
+                unset($wpml_languages[$post_language]);
3058 3058
             }
3059 3059
             
3060
-            if ( !empty( $wpml_languages ) ) {
3061
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3062
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3063
-                $duplicates = $sitepress->get_duplicates( $post_id );
3060
+            if (!empty($wpml_languages)) {
3061
+                $trid = $sitepress->get_element_trid($post_id, $element_type);
3062
+                $element_translations = $sitepress->get_element_translations($trid, $element_type);
3063
+                $duplicates = $sitepress->get_duplicates($post_id);
3064 3064
                 
3065
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3065
+                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3066 3066
                 $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3067
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3067
+                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3068 3068
                 
3069 3069
                 $needs_translation = false;
3070 3070
                 
3071
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3071
+                foreach ($wpml_languages as $lang_code => $lang) {
3072 3072
                     $duplicates_text = '';
3073 3073
                     $translated = false;
3074 3074
                     
3075
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3075
+                    if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3076 3076
                         $translated = true;
3077 3077
                         
3078
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3079
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3078
+                        if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3079
+                            $duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3080 3080
                         }
3081 3081
                     } else {
3082 3082
                         $needs_translation = true;
3083 3083
                     }
3084 3084
                     
3085
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3085
+                    $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3086 3086
                     
3087
-                    if ( $translated ) {
3087
+                    if ($translated) {
3088 3088
                         $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3089 3089
                     } else {
3090
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3090
+                        $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3091 3091
                     }
3092 3092
                     
3093 3093
                     $wpml_content .= '</td></tr>';
3094 3094
                 }
3095 3095
                 
3096
-                if ( $needs_translation ) {
3097
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3098
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3096
+                if ($needs_translation) {
3097
+                    $nonce = wp_create_nonce('geodir_duplicate_nonce');
3098
+                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3099 3099
                 }
3100 3100
                 
3101 3101
                 $wpml_content .= '</tbody></table>';
@@ -3117,12 +3117,12 @@  discard block
 block discarded – undo
3117 3117
  * @param array $settings GD design settings array.
3118 3118
  * @return array Filtered GD design settings array..
3119 3119
  */
3120
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3120
+function geodir_wpml_duplicate_settings($settings = array()) {
3121 3121
     $new_settings = array();
3122 3122
     
3123
-    foreach ( $settings as $key => $setting ) {
3123
+    foreach ($settings as $key => $setting) {
3124 3124
         
3125
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3125
+        if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3126 3126
             $new_settings[] = array(
3127 3127
                 'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3128 3128
                 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
@@ -3150,12 +3150,12 @@  discard block
 block discarded – undo
3150 3150
  * @param string $taxonomy name/slug of a taxonomy.
3151 3151
  * @return bool true if the taxonomy is currently set to being translatable in WPML.
3152 3152
  */
3153
-function geodir_wpml_is_taxonomy_translated( $taxonomy ) {
3154
-    if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3153
+function geodir_wpml_is_taxonomy_translated($taxonomy) {
3154
+    if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) {
3155 3155
         return false;
3156 3156
     }
3157 3157
     
3158
-    if ( is_taxonomy_translated( $taxonomy ) ) {
3158
+    if (is_taxonomy_translated($taxonomy)) {
3159 3159
         return true;
3160 3160
     }
3161 3161
     
@@ -3170,12 +3170,12 @@  discard block
 block discarded – undo
3170 3170
  * @param string $post_type name/slug of a post_type.
3171 3171
  * @return bool true if the post_type is currently set to being translatable in WPML.
3172 3172
  */
3173
-function geodir_wpml_is_post_type_translated( $post_type ) {
3174
-    if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3173
+function geodir_wpml_is_post_type_translated($post_type) {
3174
+    if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) {
3175 3175
         return false;
3176 3176
     }
3177 3177
     
3178
-    if ( is_post_type_translated( $post_type ) ) {
3178
+    if (is_post_type_translated($post_type)) {
3179 3179
         return true;
3180 3180
     }
3181 3181
     
@@ -3197,12 +3197,12 @@  discard block
 block discarded – undo
3197 3197
  *
3198 3198
  * @return int|NULL
3199 3199
  */
3200
-function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
3201
-    if ( geodir_is_wpml() ) {
3202
-        if ( function_exists( 'wpml_object_id_filter' ) ) {
3203
-            return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3200
+function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) {
3201
+    if (geodir_is_wpml()) {
3202
+        if (function_exists('wpml_object_id_filter')) {
3203
+            return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3204 3204
         } else {
3205
-            return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3205
+            return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3206 3206
         }
3207 3207
     }
3208 3208
     
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -225,10 +225,11 @@  discard block
 block discarded – undo
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
228
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
229
+                                    $show_entire_cat_panel = "none";
230
+                } else {
231
+                                    $show_entire_cat_panel = "''";
232
+                }
232 233
                 ?>
233 234
 
234 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -302,8 +303,9 @@  discard block
 block discarded – undo
302 303
 				}
303 304
 				
304 305
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
305
-				if (empty($geodir_default_map_search_pt))
306
-					$geodir_default_map_search_pt = 'gd_place';
306
+				if (empty($geodir_default_map_search_pt)) {
307
+									$geodir_default_map_search_pt = 'gd_place';
308
+				}
307 309
 
308 310
                 global $gd_session;
309 311
                 $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 
130 130
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131 131
     } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
132
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
133 133
     }
134 134
 
135 135
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136 136
     } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
137
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
138 138
     }
139 139
 
140 140
     /**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
169
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
173 173
 
174 174
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190 190
         ?>
191
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
191
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
194
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
195
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
196
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
194
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
195
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
196
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
197 197
 
198 198
                 <div class="map_background">
199 199
                     <div class="top_banner_section_in clearfix">
200
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
202
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
203
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
200
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
202
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
203
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
204 204
                             <!-- new map start -->
205 205
                             <div class="iprelative">
206
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
207
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
208
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
209
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
206
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
207
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
208
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
209
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
210 210
                                 <!--<div id="home_map_counter"></div>        -->
211
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
211
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
212 212
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
213
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
213
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
214 214
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
215 215
                             </div>
216 216
                             <!-- new map end -->
217 217
                         </div>
218
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
218
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
219 219
                     </div>
220 220
                 </div>
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
222
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224 224
                     ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228 228
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                       <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><input type="button" value="<?php _e('Get Directions', 'geodirectory'); ?>" class="<?php echo $map_canvas_name; ?>_getdirection" id="directions" onclick="calcRoute('<?php echo $map_canvas_name; ?>')" /></div>
243 243
                     </div>
244 244
                     <script>
245
-                        <?php if(geodir_is_page('detail')){?>
245
+                        <?php if (geodir_is_page('detail')) {?>
246 246
                         jQuery(function () {
247 247
                             gd_initialize_ac();
248 248
                         });
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                 // Create the autocomplete object, restricting the search
254 254
                                 // to geographical location types.
255 255
                                 autocomplete = new google.maps.places.Autocomplete(
256
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
256
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
257 257
                                     {types: ['geocode']});
258 258
                                 // When the user selects an address from the dropdown,
259 259
                                 // populate the address fields in the form.
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                 
268 268
                                 if (window.gdMaps == 'osm') {
269 269
                                     window.setTimeout(function() {
270
-                                        calcRoute('<?php echo $map_canvas_name;?>');
270
+                                        calcRoute('<?php echo $map_canvas_name; ?>');
271 271
                                     }, 1000);
272 272
                                 }
273 273
                             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				 */
322 322
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
323 323
 				?>
324
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
324
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
325 325
                     <?php
326 326
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327 327
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 					}
332 332
                     ?>
333 333
                     <div
334
-                        class="map-category-listing<?php echo $map_cat_class;?>">
334
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
335 335
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
336
-                        <div id="<?php echo $map_canvas_name;?>_cat"
337
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
338
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
339
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
336
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
337
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
338
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
339
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
340 340
                             <input
341 341
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
342 342
                                 type="text"
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
349 349
                                 <?php } else {$child_collapse = "0";
350 350
                                     ?>
351
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
351
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
352 352
                                 <?php } ?>
353 353
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
354 354
                                 <div class="geodir_toggle">
355
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
355
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
356 356
                                     <script>jQuery( document ).ready(function() {
357 357
                                             geodir_show_sub_cat_collapse_button();
358 358
                                         });</script>
@@ -381,21 +381,21 @@  discard block
 block discarded – undo
381 381
 					$city = $country != 'me' ? $city : '';
382 382
                     $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
383 383
                     ?>
384
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
385
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
386
-                           value="<?php echo $country;?>"/>
387
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
388
-                           value="<?php echo $region;?>"/>
389
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
390
-                           value="<?php echo $city;?>"/>
391
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
392
-                           value="<?php echo $gd_neighbourhood;?>"/>
384
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
385
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
386
+                           value="<?php echo $country; ?>"/>
387
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
388
+                           value="<?php echo $region; ?>"/>
389
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
390
+                           value="<?php echo $city; ?>"/>
391
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
392
+                           value="<?php echo $gd_neighbourhood; ?>"/>
393 393
                 <?php } else { //end of location filter
394 394
                     ?>
395
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
395
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
396 396
                 <?php }?>
397 397
 
398
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
398
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
399 399
 
400 400
                 <input type="hidden" name="limitstart" value=""/>
401 401
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
                     }
413 413
                     if (count($map_post_types) > 1) {
414 414
                         ?>
415
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
416
-                             style="max-width:<?php echo $map_width;?>!important;">
415
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
416
+                             style="max-width:<?php echo $map_width; ?>!important;">
417 417
 
418 418
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
419 419
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                                     foreach ($post_types as $post_type => $args) {
425 425
                                         if (!in_array($post_type, $exclude_post_types)) {
426 426
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
427
-											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
427
+											echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__($args->labels->name, 'geodirectory').'</a></li>';
428 428
                                         }
429 429
                                     }
430 430
                                     ?>
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
         <script type="text/javascript">
450 450
 
451 451
             jQuery(document).ready(function () {
452
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
453
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
454
-                map_sticky('<?php echo $map_canvas_name;?>');
452
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
453
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
454
+                map_sticky('<?php echo $map_canvas_name; ?>');
455 455
             });
456 456
 
457 457
         </script>
@@ -462,18 +462,18 @@  discard block
 block discarded – undo
462 462
             <script>
463 463
                 (function () {
464 464
                     var screenH = jQuery(window).height();
465
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
465
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
466 466
 
467 467
                     var ptypeH = '';
468
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
469
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
468
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
469
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
470 470
                     }
471 471
 
472
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
473
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
474
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
475
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
476
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
472
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
473
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
474
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
475
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
476
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
477 477
 
478 478
                 }());
479 479
             </script>
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
             <script>
486 486
                 (function () {
487 487
                     var screenH = jQuery(window).height();
488
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
488
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
489 489
                     var ptypeH = '';
490
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
491
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
490
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
491
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
492 492
                     }
493 493
 
494
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
494
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
495 495
 
496 496
                 }());
497 497
             </script>
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
          * @param array $geodir_map_options Array of map settings.
507 507
          * @param string $map_canvas_name The canvas name and ID for the map.
508 508
          */
509
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
509
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
510 510
 
511 511
 
512 512
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -67,78 +67,78 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'fullscreenControl' => false,
116
-        'maptype' => $maptype,
117
-        'showPreview' => '0',
118
-        'maxZoom' => 21,
119
-        'autozoom' => true,
120
-        'bubble_size' => 'small',
121
-        'token' => '68f48005e256696074e1da9bf9f67f06',
122
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
123
-    );
124
-
125
-    if (!empty($map_args)) {
126
-        foreach ($map_args as $map_option_key => $map_option_value) {
127
-            $geodir_map_options[$map_option_key] = $map_option_value;
128
-        }
129
-    }
130
-
131
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
132
-    } else {
133
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
134
-    }
135
-
136
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
137
-    } else {
138
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
139
-    }
140
-
141
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'fullscreenControl' => false,
116
+		'maptype' => $maptype,
117
+		'showPreview' => '0',
118
+		'maxZoom' => 21,
119
+		'autozoom' => true,
120
+		'bubble_size' => 'small',
121
+		'token' => '68f48005e256696074e1da9bf9f67f06',
122
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
123
+	);
124
+
125
+	if (!empty($map_args)) {
126
+		foreach ($map_args as $map_option_key => $map_option_value) {
127
+			$geodir_map_options[$map_option_key] = $map_option_value;
128
+		}
129
+	}
130
+
131
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
132
+	} else {
133
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
134
+	}
135
+
136
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
137
+	} else {
138
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
139
+	}
140
+
141
+	/**
142 142
 	 * Filter the options to use in google map.
143 143
 	 *
144 144
 	 * @since 1.0.0
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
149 149
 
150
-    $map_canvas_arr[$map_canvas_name] = array();
150
+	$map_canvas_arr[$map_canvas_name] = array();
151 151
 
152
-    /**
152
+	/**
153 153
 	 * Filter the post types to display data on map.
154 154
 	 *
155 155
 	 * @since 1.0.0
@@ -167,20 +167,20 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
169 169
 
170
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
171
-        // Set default map options
170
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
171
+		// Set default map options
172 172
 
173
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
174 174
 
175
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
176 176
 
177
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
178
-            $map_width = '100%';
179
-        } else {
180
-            $map_width = $geodir_map_options['width'];
181
-        }
177
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
178
+			$map_width = '100%';
179
+		} else {
180
+			$map_width = $geodir_map_options['width'];
181
+		}
182 182
 
183
-        /**
183
+		/**
184 184
 		 * Filter the width of map.
185 185
 		 *
186 186
 		 * @since 1.0.0
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		 * @param int $map_width Width of map box, eg: gd_place.
189 189
 		 */
190 190
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
191
-        ?>
191
+		?>
192 192
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
193 193
         <div class="stick_trigger_container">
194 194
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
223 223
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
224 224
                 <?php } else {
225
-                    ?>
225
+					?>
226 226
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
227 227
                 <?php }
228 228
 
229
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
230
-                    $show_entire_cat_panel = "none";
231
-                else
232
-                    $show_entire_cat_panel = "''";
233
-                ?>
229
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
230
+					$show_entire_cat_panel = "none";
231
+				else
232
+					$show_entire_cat_panel = "''";
233
+				?>
234 234
 
235 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
236 236
                     <div class="gd-input-group gd-get-directions">
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
294 294
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
295 295
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
296
-                                echo 'selected="selected"';
297
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
296
+								echo 'selected="selected"';
297
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
298 298
                         </select>
299 299
                     </div>
300 300
 
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 				if (empty($geodir_default_map_search_pt))
307 307
 					$geodir_default_map_search_pt = 'gd_place';
308 308
 
309
-                global $gd_session;
310
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
309
+				global $gd_session;
310
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
311 311
 
312
-                if ($homemap_catlist_ptype) {
313
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
314
-                }
312
+				if ($homemap_catlist_ptype) {
313
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
314
+				}
315 315
 
316 316
 				/**
317 317
 				 * Filter the post type to retrieve data for map
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 				?>
325 325
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
326 326
                     <?php
327
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
328
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
327
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
328
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
329 329
 					$map_cat_class = '';
330 330
 					if ($geodir_map_options['enable_post_type_filters']) {
331 331
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
332 332
 					}
333
-                    ?>
333
+					?>
334 334
                     <div
335 335
                         class="map-category-listing<?php echo $map_cat_class;?>">
336 336
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
349 349
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
350 350
                                 <?php } else {$child_collapse = "0";
351
-                                    ?>
351
+									?>
352 352
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
353 353
                                 <?php } ?>
354 354
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
                 <!-- map-category-listings-->
371 371
 
372 372
                 <?php
373
-                if ($geodir_map_options['enable_location_filters']) {
374
-                    $country = get_query_var('gd_country');
373
+				if ($geodir_map_options['enable_location_filters']) {
374
+					$country = get_query_var('gd_country');
375 375
 					$region = get_query_var('gd_region');
376 376
 					$city = get_query_var('gd_city');
377
-                    $gd_neighbourhood = get_query_var('gd_neighbourhood');
377
+					$gd_neighbourhood = get_query_var('gd_neighbourhood');
378 378
                     
379
-                    //fix for location/me page
380
-                    $country = $country != 'me' ? $country : '';
379
+					//fix for location/me page
380
+					$country = $country != 'me' ? $country : '';
381 381
 					$region = $region != 'me' ? $region : '';
382 382
 					$city = $country != 'me' ? $city : '';
383
-                    $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
384
-                    ?>
383
+					$gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
384
+					?>
385 385
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
386 386
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
387 387
                            value="<?php echo $country;?>"/>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
393 393
                            value="<?php echo $gd_neighbourhood;?>"/>
394 394
                 <?php } else { //end of location filter
395
-                    ?>
395
+					?>
396 396
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
397 397
                 <?php }?>
398 398
 
@@ -403,16 +403,16 @@  discard block
 block discarded – undo
403 403
 
404 404
 
405 405
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
406
-                    $post_types = geodir_get_posttypes('object');
407
-                    $all_post_types = geodir_get_posttypes('names');
408
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
409
-                    if (is_array($exclude_post_types)) {
410
-                        $map_post_types = array_diff($all_post_types, $exclude_post_types);
411
-                    } else {
412
-                        $map_post_types = $all_post_types;
413
-                    }
414
-                    if (count($map_post_types) > 1) {
415
-                        ?>
406
+					$post_types = geodir_get_posttypes('object');
407
+					$all_post_types = geodir_get_posttypes('names');
408
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
409
+					if (is_array($exclude_post_types)) {
410
+						$map_post_types = array_diff($all_post_types, $exclude_post_types);
411
+					} else {
412
+						$map_post_types = $all_post_types;
413
+					}
414
+					if (count($map_post_types) > 1) {
415
+						?>
416 416
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
417 417
                              style="max-width:<?php echo $map_width;?>!important;">
418 418
 
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
                                     <?php
423 423
 
424 424
 
425
-                                    foreach ($post_types as $post_type => $args) {
426
-                                        if (!in_array($post_type, $exclude_post_types)) {
427
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
425
+									foreach ($post_types as $post_type => $args) {
426
+										if (!in_array($post_type, $exclude_post_types)) {
427
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
428 428
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
429
-                                        }
430
-                                    }
431
-                                    ?>
429
+										}
430
+									}
431
+									?>
432 432
                                 </ul>
433 433
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
434 434
                             </div><?php } ?>
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 
443 443
                         </div> <!-- map-places-listings-->
444 444
                     <?php }
445
-                } // end of post type filter if
446
-                ?>
445
+				} // end of post type filter if
446
+				?>
447 447
 
448 448
             </div>
449 449
         </div> <!--end of stick trigger container-->
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
         </script>
459 459
         <?php
460 460
 
461
-        if (strpos($geodir_map_options['height'], 'vh')) {
462
-            ?>
461
+		if (strpos($geodir_map_options['height'], 'vh')) {
462
+			?>
463 463
             <script>
464 464
                 (function () {
465 465
                     var screenH = jQuery(window).height();
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 
482 482
         <?php
483 483
 
484
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
485
-            ?>
484
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
485
+			?>
486 486
             <script>
487 487
                 (function () {
488 488
                     var screenH = jQuery(window).height();
@@ -497,20 +497,20 @@  discard block
 block discarded – undo
497 497
                 }());
498 498
             </script>
499 499
         <?php
500
-        }
500
+		}
501 501
 
502
-        /**
503
-         * Action that runs after all the map code has been output;
504
-         *
505
-         * @since 1.5.3
506
-         *
507
-         * @param array $geodir_map_options Array of map settings.
508
-         * @param string $map_canvas_name The canvas name and ID for the map.
509
-         */
510
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
502
+		/**
503
+		 * Action that runs after all the map code has been output;
504
+		 *
505
+		 * @since 1.5.3
506
+		 *
507
+		 * @param array $geodir_map_options Array of map settings.
508
+		 * @param string $map_canvas_name The canvas name and ID for the map.
509
+		 */
510
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
511 511
 
512 512
 
513
-    endif; // Exclude posttypes if end
513
+	endif; // Exclude posttypes if end
514 514
 }
515 515
 
516 516
 /**
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 3 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -111,11 +111,13 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
 
114
-    if (!empty($field_default_cat))
115
-        $field_default_cat = '';
114
+    if (!empty($field_default_cat)) {
115
+            $field_default_cat = '';
116
+    }
116 117
 
117
-    if (!empty($cat_find_array))
118
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
118
+    if (!empty($cat_find_array)) {
119
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
120
+    }
119 121
 
120 122
     $main_query_array = $map_cat_ids_array;
121 123
   
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
         $gd_posttype = " AND p.post_type = %s";
148 150
         $main_query_array[] = $_REQUEST['gd_posttype'];
149 151
 
150
-    } else
151
-        $table = $plugin_prefix . 'gd_place_detail';
152
+    } else {
153
+            $table = $plugin_prefix . 'gd_place_detail';
154
+    }
152 155
 
153 156
     $join = ", " . $table . " AS pd ";
154 157
 
@@ -326,8 +329,7 @@  discard block
 block discarded – undo
326 329
 
327 330
     if (!empty($cat_content_info)) {
328 331
         return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
-    }
330
-    else {
332
+    } else {
331 333
         return '[{"totalcount":"0"}]';
332 334
     }
333 335
 }
334 336
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +343 added lines, -343 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
10
-    global $gd_session;
11
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
16
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
-    die;
10
+	global $gd_session;
11
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
16
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
+	die;
18 18
 }
19 19
 
20 20
 // Send the content-type header with correct encoding
21 21
 header("Content-type: text/javascript; charset=utf-8");
22 22
 
23 23
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
24
-    echo get_markers();
25
-    exit;
24
+	echo get_markers();
25
+	exit;
26 26
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
27
-    /**
28
-     * @global object $wpdb WordPress Database object.
29
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
30
-     * @global object $gd_session GeoDirectory Session object.
31
-     */
32
-    global $wpdb, $plugin_prefix, $gd_session;
33
-
34
-    if ($_REQUEST['m_id'] != '') {
35
-        $pid = (int)$_REQUEST['m_id'];
36
-    } else {
37
-        echo __('No marker data found', 'geodirectory');
38
-        exit;
39
-    }
40
-
41
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
-        $post = (object)$gd_ses_listing;
43
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
-    } else {
45
-        $geodir_post_type = get_post_type($pid);
46
-
47
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
48
-
49
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
-
51
-        $postinfo = $wpdb->get_results($sql);
52
-
53
-        $data_arr = array();
54
-
55
-        if ($postinfo) {
56
-            $srcharr = array("'", "/", "-", '"', '\\');
57
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58
-
59
-            foreach ($postinfo as $postinfo_obj) {
60
-                echo geodir_get_infowindow_html($postinfo_obj);
61
-            }
62
-        }
63
-    }
64
-    exit;
27
+	/**
28
+	 * @global object $wpdb WordPress Database object.
29
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
30
+	 * @global object $gd_session GeoDirectory Session object.
31
+	 */
32
+	global $wpdb, $plugin_prefix, $gd_session;
33
+
34
+	if ($_REQUEST['m_id'] != '') {
35
+		$pid = (int)$_REQUEST['m_id'];
36
+	} else {
37
+		echo __('No marker data found', 'geodirectory');
38
+		exit;
39
+	}
40
+
41
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
+		$post = (object)$gd_ses_listing;
43
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
+	} else {
45
+		$geodir_post_type = get_post_type($pid);
46
+
47
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
48
+
49
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
+
51
+		$postinfo = $wpdb->get_results($sql);
52
+
53
+		$data_arr = array();
54
+
55
+		if ($postinfo) {
56
+			$srcharr = array("'", "/", "-", '"', '\\');
57
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58
+
59
+			foreach ($postinfo as $postinfo_obj) {
60
+				echo geodir_get_infowindow_html($postinfo_obj);
61
+			}
62
+		}
63
+	}
64
+	exit;
65 65
 }
66 66
 
67 67
 /**
@@ -80,80 +80,80 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function get_markers() {
82 82
 
83
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
83
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
84 84
 
85
-    $search = '';
86
-    $main_query_array;
85
+	$search = '';
86
+	$main_query_array;
87 87
 
88
-    $srcharr = array("'", "/", "-", '"', '\\', '&#39;');
89
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
88
+	$srcharr = array("'", "/", "-", '"', '\\', '&#39;');
89
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
90 90
 
91
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
91
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
92 92
 
93
-    $map_cat_ids_array = array('0');
94
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
93
+	$map_cat_ids_array = array('0');
94
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
95 95
 
96 96
 
97
-    $field_default_cat = '';
98
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
99
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
97
+	$field_default_cat = '';
98
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
99
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
100 100
 
101
-        if (!empty($map_cat_arr)) {
102
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
101
+		if (!empty($map_cat_arr)) {
102
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
103 103
 
104
-            $map_cat_ids_array = explode(',', $map_cat_arr);
105
-            $cat_find_array = array();
106
-            foreach ($map_cat_ids_array as $cat_id) {
107
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
108
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
109
-                $main_query_array[] = $cat_id;
110
-            }
104
+			$map_cat_ids_array = explode(',', $map_cat_arr);
105
+			$cat_find_array = array();
106
+			foreach ($map_cat_ids_array as $cat_id) {
107
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
108
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
109
+				$main_query_array[] = $cat_id;
110
+			}
111 111
 
112
-        }
113
-    }
112
+		}
113
+	}
114 114
 
115
-    if (!empty($field_default_cat))
116
-        $field_default_cat = '';
115
+	if (!empty($field_default_cat))
116
+		$field_default_cat = '';
117 117
 
118
-    if (!empty($cat_find_array))
119
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
118
+	if (!empty($cat_find_array))
119
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
120 120
 
121
-    $main_query_array = $map_cat_ids_array;
121
+	$main_query_array = $map_cat_ids_array;
122 122
   
123
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
124
-        $search .= " AND p.post_title LIKE %s";
125
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
126
-    }
127
-
128
-    /**
129
-     * Filter the marker query search SQL, values are replaces with %s or %d.
130
-     *
131
-     * @since 1.5.3
132
-     *
133
-     * @param string $search The SQL query for search/where.
134
-     */
135
-    $search = apply_filters('geodir_marker_search', $search);
136
-    /**
137
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
138
-     *
139
-     * @since 1.5.3
140
-     *
141
-     * @param array $main_query_array The SQL query values for search/where.
142
-     */
143
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
144
-
145
-    $gd_posttype = '';
146
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
147
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
148
-        $gd_posttype = " AND p.post_type = %s";
149
-        $main_query_array[] = $_REQUEST['gd_posttype'];
150
-
151
-    } else
152
-        $table = $plugin_prefix . 'gd_place_detail';
153
-
154
-    $join = ", " . $table . " AS pd ";
155
-
156
-    /**
123
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
124
+		$search .= " AND p.post_title LIKE %s";
125
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
126
+	}
127
+
128
+	/**
129
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
130
+	 *
131
+	 * @since 1.5.3
132
+	 *
133
+	 * @param string $search The SQL query for search/where.
134
+	 */
135
+	$search = apply_filters('geodir_marker_search', $search);
136
+	/**
137
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
138
+	 *
139
+	 * @since 1.5.3
140
+	 *
141
+	 * @param array $main_query_array The SQL query values for search/where.
142
+	 */
143
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
144
+
145
+	$gd_posttype = '';
146
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
147
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
148
+		$gd_posttype = " AND p.post_type = %s";
149
+		$main_query_array[] = $_REQUEST['gd_posttype'];
150
+
151
+	} else
152
+		$table = $plugin_prefix . 'gd_place_detail';
153
+
154
+	$join = ", " . $table . " AS pd ";
155
+
156
+	/**
157 157
 	 * Filter the SQL JOIN clause for the markers data
158 158
 	 *
159 159
 	 * @since 1.0.0
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 	 * @param string $search Row of searched fields to use in WHERE clause.
171 171
 	 */
172 172
 	$search = apply_filters('geodir_home_map_listing_where', $search);
173
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
174
-    $cat_type = $post_type . 'category';
175
-    if ($post_type == 'gd_event') {
176
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
177
-    } else {
178
-        $event_select = "";
179
-    }
180
-
181
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
182
-    /**
173
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
174
+	$cat_type = $post_type . 'category';
175
+	if ($post_type == 'gd_event') {
176
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
177
+	} else {
178
+		$event_select = "";
179
+	}
180
+
181
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
182
+	/**
183 183
 	 * Filter the SQL SELECT clause to retrive fields data
184 184
 	 *
185 185
 	 * @since 1.0.0
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
200 200
 
201
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
201
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
202 202
     
203 203
 	/**
204 204
 	 * Filter the SQL query to retrive markers data
@@ -214,265 +214,265 @@  discard block
 block discarded – undo
214 214
 //    print_r($gd_session);
215 215
 //    print_r($_SESSION);
216 216
 
217
-    $catinfo = $wpdb->get_results($catsql);
217
+	$catinfo = $wpdb->get_results($catsql);
218 218
 	
219
-    $cat_content_info = array();
220
-    $content_data = array();
221
-    $post_ids = array();
222
-
223
-    /**
224
-     * Called before marker data is processed into JSON.
225
-     *
226
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
227
-     *
228
-     * @since 1.5.3
229
-     * @param object $catinfo The posts object containing all marker data.
230
-     * @see 'geodir_after_marker_post_process'
231
-     */
232
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
233
-
234
-    /**
235
-     * Called before marker data is processed into JSON.
236
-     *
237
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
238
-     *
239
-     * @since 1.4.9
240
-     * @param object $catinfo The posts object containing all marker data.
241
-     * @see 'geodir_after_marker_post_process'
242
-     */
243
-    do_action('geodir_before_marker_post_process_action', $catinfo);
244
-
245
-    // Sort any posts into a ajax array
246
-    if (!empty($catinfo)) {
247
-        $geodir_cat_icons = geodir_get_term_icon();
248
-        global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
249
-
250
-        $today = strtotime(date_i18n('Y-m-d'));
251
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
219
+	$cat_content_info = array();
220
+	$content_data = array();
221
+	$post_ids = array();
222
+
223
+	/**
224
+	 * Called before marker data is processed into JSON.
225
+	 *
226
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
227
+	 *
228
+	 * @since 1.5.3
229
+	 * @param object $catinfo The posts object containing all marker data.
230
+	 * @see 'geodir_after_marker_post_process'
231
+	 */
232
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
233
+
234
+	/**
235
+	 * Called before marker data is processed into JSON.
236
+	 *
237
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
238
+	 *
239
+	 * @since 1.4.9
240
+	 * @param object $catinfo The posts object containing all marker data.
241
+	 * @see 'geodir_after_marker_post_process'
242
+	 */
243
+	do_action('geodir_before_marker_post_process_action', $catinfo);
244
+
245
+	// Sort any posts into a ajax array
246
+	if (!empty($catinfo)) {
247
+		$geodir_cat_icons = geodir_get_term_icon();
248
+		global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
249
+
250
+		$today = strtotime(date_i18n('Y-m-d'));
251
+		$show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
252 252
         
253
-        foreach ($catinfo as $catinfo_obj) {
254
-            $post_title = $catinfo_obj->post_title;
253
+		foreach ($catinfo as $catinfo_obj) {
254
+			$post_title = $catinfo_obj->post_title;
255 255
             
256
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
257
-                $event_dates = '';
258
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
256
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
257
+				$event_dates = '';
258
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
259 259
 
260
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
260
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
261 261
                 
262
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
263
-                    $starttimes = '';
264
-                    $endtimes = '';
265
-                    $astarttimes = array();
266
-                    $aendtimes = array();
267
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
268
-                        $recurring_data['repeat_type'] = 'custom';
269
-                    }
270
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
271
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
262
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
263
+					$starttimes = '';
264
+					$endtimes = '';
265
+					$astarttimes = array();
266
+					$aendtimes = array();
267
+					if ( !isset( $recurring_data['repeat_type'] ) ) {
268
+						$recurring_data['repeat_type'] = 'custom';
269
+					}
270
+					$repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
271
+					$different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
272 272
         
273
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
273
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
274 274
                     
275
-                    if ( !empty( $recurring_dates ) ) {
276
-                        if ( empty( $recurring_data['all_day'] ) ) {
277
-                            if ( $repeat_type == 'custom' && $different_times ) {
278
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
279
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
280
-                            } else {
281
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
282
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
283
-                            }
284
-                        }
275
+					if ( !empty( $recurring_dates ) ) {
276
+						if ( empty( $recurring_data['all_day'] ) ) {
277
+							if ( $repeat_type == 'custom' && $different_times ) {
278
+								$astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
279
+								$aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
280
+							} else {
281
+								$starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
282
+								$endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
283
+							}
284
+						}
285 285
                         
286
-                        $e = 0;
287
-                        foreach( $recurring_dates as $key => $date ) {
288
-                            if ( $repeat_type == 'custom' && $different_times ) {
289
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
290
-                                    $starttimes = $astarttimes[$key];
291
-                                    $endtimes = $aendtimes[$key];
292
-                                } else {
293
-                                    $starttimes = '';
294
-                                    $endtimes = '';
295
-                                }
296
-                            }
286
+						$e = 0;
287
+						foreach( $recurring_dates as $key => $date ) {
288
+							if ( $repeat_type == 'custom' && $different_times ) {
289
+								if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
290
+									$starttimes = $astarttimes[$key];
291
+									$endtimes = $aendtimes[$key];
292
+								} else {
293
+									$starttimes = '';
294
+									$endtimes = '';
295
+								}
296
+							}
297 297
                             
298
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
299
-                            $duration--;
300
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
298
+							$duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
299
+							$duration--;
300
+							$enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
301 301
                             
302
-                            // Hide past dates
303
-                            if ( strtotime( $enddate ) < $today ) {
304
-                                continue;
305
-                            }
302
+							// Hide past dates
303
+							if ( strtotime( $enddate ) < $today ) {
304
+								continue;
305
+							}
306 306
                                     
307
-                            $sdate = strtotime( $date . ' ' . $starttimes );
308
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
307
+							$sdate = strtotime( $date . ' ' . $starttimes );
308
+							$edate = strtotime( $enddate . ' ' . $endtimes );
309 309
                                         
310
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
311
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
310
+							$start_date = date_i18n( $geodir_date_time_format, $sdate );
311
+							$end_date = date_i18n( $geodir_date_time_format, $edate );
312 312
                             
313
-                            $same_day = false;
314
-                            $full_day = false;
315
-                            $same_datetime = false;
313
+							$same_day = false;
314
+							$full_day = false;
315
+							$same_datetime = false;
316 316
                             
317
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
318
-                                $full_day = true;
319
-                            }
317
+							if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
318
+								$full_day = true;
319
+							}
320 320
                             
321
-                            if ( $start_date == $end_date && $full_day ) {
322
-                                $same_datetime = true;
323
-                            }
324
-
325
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
326
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
327
-                            if ( $full_day ) {
328
-                                $start_date = $title_date;
329
-                                $end_date = date_i18n( $geodir_date_format, $edate );
330
-                            }
321
+							if ( $start_date == $end_date && $full_day ) {
322
+								$same_datetime = true;
323
+							}
324
+
325
+							$link_date = date_i18n( 'Y-m-d', $sdate );
326
+							$title_date = date_i18n( $geodir_date_format, $sdate );
327
+							if ( $full_day ) {
328
+								$start_date = $title_date;
329
+								$end_date = date_i18n( $geodir_date_format, $edate );
330
+							}
331 331
                             
332
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
333
-                                $same_day = true;
332
+							if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
333
+								$same_day = true;
334 334
                                 
335
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
336
-                            }
335
+								$start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
336
+							}
337 337
                             
338
-                            $event_dates .= ' :: ' . $start_date;
338
+							$event_dates .= ' :: ' . $start_date;
339 339
                         
340
-                            if ( !$same_day && !$same_datetime ) {
341
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
342
-                            }
340
+							if ( !$same_day && !$same_datetime ) {
341
+								$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
342
+							}
343 343
                             
344
-                            $e++;
344
+							$e++;
345 345
                             
346
-                            if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
347
-                                break;
348
-                            }
349
-                        }
350
-                    }
351
-                } else {
352
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
353
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
354
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
355
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
356
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
346
+							if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
347
+								break;
348
+							}
349
+						}
350
+					}
351
+				} else {
352
+					$start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
353
+					$end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
354
+					$all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
355
+					$starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
356
+					$endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
357 357
                 
358
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
359
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
360
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
358
+					$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
359
+					$starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
360
+					$endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
361 361
                     
362
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
363
-                        $start_date = $event_recurring_dates[0];
364
-                    }
362
+					if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
363
+						$start_date = $event_recurring_dates[0];
364
+					}
365 365
                                 
366
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
367
-                        $end_date = $start_date;
368
-                    }
366
+					if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
367
+						$end_date = $start_date;
368
+					}
369 369
                     
370
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
371
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
372
-                            $starttime = $starttimes[0];
373
-                            $endtime = $endtimes[0];
374
-                        }
370
+					if ($end_date != '' && strtotime($end_date) >= $today) {
371
+						if ( $starttime == '' && !empty( $starttimes ) ) {
372
+							$starttime = $starttimes[0];
373
+							$endtime = $endtimes[0];
374
+						}
375 375
                         
376
-                        $same_day = false;
377
-                        $one_day = false;
378
-                        if ( $start_date == $end_date && $all_day ) {
379
-                            $one_day = true;
380
-                        }
381
-
382
-                        if ( $all_day ) {
383
-                            $start_datetime = strtotime( $start_date );
384
-                            $end_datetime = strtotime( $end_date );
376
+						$same_day = false;
377
+						$one_day = false;
378
+						if ( $start_date == $end_date && $all_day ) {
379
+							$one_day = true;
380
+						}
381
+
382
+						if ( $all_day ) {
383
+							$start_datetime = strtotime( $start_date );
384
+							$end_datetime = strtotime( $end_date );
385 385
                             
386
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
387
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
388
-                            if ( $start_date == $end_date ) {
389
-                                $one_day = true;
390
-                            }
391
-                        } else {
392
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
393
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
394
-                                $one_day = false;
395
-                            }
396
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
397
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
386
+							$start_date = date_i18n( $geodir_date_format, $start_datetime );
387
+							$end_date = date_i18n( $geodir_date_format, $end_datetime );
388
+							if ( $start_date == $end_date ) {
389
+								$one_day = true;
390
+							}
391
+						} else {
392
+							if ( $start_date == $end_date && $starttime == $endtime ) {
393
+								$end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
394
+								$one_day = false;
395
+							}
396
+							$start_datetime = strtotime( $start_date . ' ' . $starttime );
397
+							$end_datetime = strtotime( $end_date . ' ' . $endtime );
398 398
                             
399
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
400
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
401
-                        }
399
+							$start_date = date_i18n( $geodir_date_time_format, $start_datetime );
400
+							$end_date = date_i18n( $geodir_date_time_format, $end_datetime );
401
+						}
402 402
 
403
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
404
-                            $same_day = true;
403
+						if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
404
+							$same_day = true;
405 405
                             
406
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
407
-                        }
406
+							$start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
407
+						}
408 408
                         
409
-                        $event_dates .= ' :: ' . $start_date;
409
+						$event_dates .= ' :: ' . $start_date;
410 410
                         
411
-                        if ( !$same_day && !$one_day ) {
412
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
413
-                        }
414
-                    }
415
-                }
416
-
417
-                if (empty($event_dates)) {
418
-                    continue;
419
-                }
411
+						if ( !$same_day && !$one_day ) {
412
+							$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
413
+						}
414
+					}
415
+				}
416
+
417
+				if (empty($event_dates)) {
418
+					continue;
419
+				}
420 420
                 
421
-                $post_title .= $event_dates;
422
-            }
421
+				$post_title .= $event_dates;
422
+			}
423 423
 
424
-            $map_cat_ids_array;
425
-            $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
424
+			$map_cat_ids_array;
425
+			$default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
426 426
 
427
-            // if single cat lets just show that icon
428
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
429
-                $default_cat = (int)$map_cat_ids_array[0];
430
-            }
427
+			// if single cat lets just show that icon
428
+			if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
429
+				$default_cat = (int)$map_cat_ids_array[0];
430
+			}
431 431
 
432
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
433
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
434
-            $title = str_replace($srcharr, $replarr, $post_title);
432
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
433
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
434
+			$title = str_replace($srcharr, $replarr, $post_title);
435 435
             
436
-            if ($icon != '') {
437
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
436
+			if ($icon != '') {
437
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
438 438
                 
439
-                if (isset($gd_marker_sizes[$icon])) {
440
-                    $icon_size = $gd_marker_sizes[$icon];
441
-                } else {
442
-                    $icon_size = geodir_get_marker_size($icon);
443
-                    $gd_marker_sizes[$icon] = $icon_size;
444
-                }               
445
-            } else {
446
-                $icon_size = array('w' => 36, 'h' => 45);
447
-            }
448
-
449
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
450
-            $post_ids[] = $catinfo_obj->post_id;
451
-        }
452
-    }
453
-
454
-    /**
455
-     * Called after marker data is processed into JSON.
456
-     *
457
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
458
-     *
459
-     * @since 1.4.9
460
-     * @param array $content_data The array containing all markers in JSON format.
461
-     * @param object $catinfo The posts object containing all marker data.
462
-     * @see 'geodir_before_marker_post_process'
463
-     */
464
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
465
-
466
-    if (!empty($content_data)) {
467
-        $cat_content_info[] = implode(',', $content_data);
468
-    }
469
-
470
-    $totalcount = count(array_unique($post_ids));
471
-
472
-    if (!empty($cat_content_info)) {
473
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
474
-    }
475
-    else {
476
-        return '[{"totalcount":"0"}]';
477
-    }
439
+				if (isset($gd_marker_sizes[$icon])) {
440
+					$icon_size = $gd_marker_sizes[$icon];
441
+				} else {
442
+					$icon_size = geodir_get_marker_size($icon);
443
+					$gd_marker_sizes[$icon] = $icon_size;
444
+				}               
445
+			} else {
446
+				$icon_size = array('w' => 36, 'h' => 45);
447
+			}
448
+
449
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
450
+			$post_ids[] = $catinfo_obj->post_id;
451
+		}
452
+	}
453
+
454
+	/**
455
+	 * Called after marker data is processed into JSON.
456
+	 *
457
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
458
+	 *
459
+	 * @since 1.4.9
460
+	 * @param array $content_data The array containing all markers in JSON format.
461
+	 * @param object $catinfo The posts object containing all marker data.
462
+	 * @see 'geodir_before_marker_post_process'
463
+	 */
464
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
465
+
466
+	if (!empty($content_data)) {
467
+		$cat_content_info[] = implode(',', $content_data);
468
+	}
469
+
470
+	$totalcount = count(array_unique($post_ids));
471
+
472
+	if (!empty($cat_content_info)) {
473
+		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
474
+	}
475
+	else {
476
+		return '[{"totalcount":"0"}]';
477
+	}
478 478
 }
479 479
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     $gd_session->set('homemap_catlist_ptype', $gd_post_type);
13 13
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
14 14
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
15
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
16 16
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17 17
     die;
18 18
 }
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
     global $wpdb, $plugin_prefix, $gd_session;
33 33
 
34 34
     if ($_REQUEST['m_id'] != '') {
35
-        $pid = (int)$_REQUEST['m_id'];
35
+        $pid = (int) $_REQUEST['m_id'];
36 36
     } else {
37 37
         echo __('No marker data found', 'geodirectory');
38 38
         exit;
39 39
     }
40 40
 
41 41
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
-        $post = (object)$gd_ses_listing;
42
+        $post = (object) $gd_ses_listing;
43 43
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44 44
     } else {
45 45
         $geodir_post_type = get_post_type($pid);
46 46
 
47
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
47
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
48 48
 
49
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
49
+        $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
50 50
 
51 51
         $postinfo = $wpdb->get_results($sql);
52 52
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function get_markers() {
82 82
 
83
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
83
+    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session;
84 84
 
85 85
     $search = '';
86 86
     $main_query_array;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
92 92
 
93 93
     $map_cat_ids_array = array('0');
94
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
94
+    $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
95 95
 
96 96
 
97 97
     $field_default_cat = '';
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
         $map_cat_arr = trim($_REQUEST['cat_id'], ',');
100 100
 
101 101
         if (!empty($map_cat_arr)) {
102
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
102
+            $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
103 103
 
104 104
             $map_cat_ids_array = explode(',', $map_cat_arr);
105 105
             $cat_find_array = array();
106 106
             foreach ($map_cat_ids_array as $cat_id) {
107
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
108
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
107
+                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id ";
108
+                $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)";
109 109
                 $main_query_array[] = $cat_id;
110 110
             }
111 111
 
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
         $field_default_cat = '';
117 117
 
118 118
     if (!empty($cat_find_array))
119
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
119
+        $search .= "AND (".implode(' OR ', $cat_find_array).")";
120 120
 
121 121
     $main_query_array = $map_cat_ids_array;
122 122
   
123 123
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
124 124
         $search .= " AND p.post_title LIKE %s";
125
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
125
+        $main_query_array[] = "%".$_REQUEST['search']."%";
126 126
     }
127 127
 
128 128
     /**
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 
145 145
     $gd_posttype = '';
146 146
     if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
147
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
147
+        $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail';
148 148
         $gd_posttype = " AND p.post_type = %s";
149 149
         $main_query_array[] = $_REQUEST['gd_posttype'];
150 150
 
151 151
     } else
152
-        $table = $plugin_prefix . 'gd_place_detail';
152
+        $table = $plugin_prefix.'gd_place_detail';
153 153
 
154
-    $join = ", " . $table . " AS pd ";
154
+    $join = ", ".$table." AS pd ";
155 155
 
156 156
     /**
157 157
 	 * Filter the SQL JOIN clause for the markers data
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	$search = apply_filters('geodir_home_map_listing_where', $search);
173 173
     $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
174
-    $cat_type = $post_type . 'category';
174
+    $cat_type = $post_type.'category';
175 175
     if ($post_type == 'gd_event') {
176 176
         $event_select = ", pd.recurring_dates, pd.is_recurring";
177 177
     } else {
178 178
         $event_select = "";
179 179
     }
180 180
 
181
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
181
+    $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select;
182 182
     /**
183 183
 	 * Filter the SQL SELECT clause to retrive fields data
184 184
 	 *
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
200 200
 
201
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
201
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
202 202
     
203 203
 	/**
204 204
 	 * Filter the SQL query to retrive markers data
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
249 249
 
250 250
         $today = strtotime(date_i18n('Y-m-d'));
251
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
251
+        $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
252 252
         
253 253
         foreach ($catinfo as $catinfo_obj) {
254 254
             $post_title = $catinfo_obj->post_title;
@@ -264,29 +264,29 @@  discard block
 block discarded – undo
264 264
                     $endtimes = '';
265 265
                     $astarttimes = array();
266 266
                     $aendtimes = array();
267
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
267
+                    if (!isset($recurring_data['repeat_type'])) {
268 268
                         $recurring_data['repeat_type'] = 'custom';
269 269
                     }
270
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
271
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
270
+                    $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
271
+                    $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false;
272 272
         
273 273
                     $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
274 274
                     
275
-                    if ( !empty( $recurring_dates ) ) {
276
-                        if ( empty( $recurring_data['all_day'] ) ) {
277
-                            if ( $repeat_type == 'custom' && $different_times ) {
278
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
279
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
275
+                    if (!empty($recurring_dates)) {
276
+                        if (empty($recurring_data['all_day'])) {
277
+                            if ($repeat_type == 'custom' && $different_times) {
278
+                                $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
279
+                                $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
280 280
                             } else {
281
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
282
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
281
+                                $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
282
+                                $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
283 283
                             }
284 284
                         }
285 285
                         
286 286
                         $e = 0;
287
-                        foreach( $recurring_dates as $key => $date ) {
288
-                            if ( $repeat_type == 'custom' && $different_times ) {
289
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
287
+                        foreach ($recurring_dates as $key => $date) {
288
+                            if ($repeat_type == 'custom' && $different_times) {
289
+                                if (!empty($astarttimes) && isset($astarttimes[$key])) {
290 290
                                     $starttimes = $astarttimes[$key];
291 291
                                     $endtimes = $aendtimes[$key];
292 292
                                 } else {
@@ -295,50 +295,50 @@  discard block
 block discarded – undo
295 295
                                 }
296 296
                             }
297 297
                             
298
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
298
+                            $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1;
299 299
                             $duration--;
300
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
300
+                            $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
301 301
                             
302 302
                             // Hide past dates
303
-                            if ( strtotime( $enddate ) < $today ) {
303
+                            if (strtotime($enddate) < $today) {
304 304
                                 continue;
305 305
                             }
306 306
                                     
307
-                            $sdate = strtotime( $date . ' ' . $starttimes );
308
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
307
+                            $sdate = strtotime($date.' '.$starttimes);
308
+                            $edate = strtotime($enddate.' '.$endtimes);
309 309
                                         
310
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
311
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
310
+                            $start_date = date_i18n($geodir_date_time_format, $sdate);
311
+                            $end_date = date_i18n($geodir_date_time_format, $edate);
312 312
                             
313 313
                             $same_day = false;
314 314
                             $full_day = false;
315 315
                             $same_datetime = false;
316 316
                             
317
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
317
+                            if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
318 318
                                 $full_day = true;
319 319
                             }
320 320
                             
321
-                            if ( $start_date == $end_date && $full_day ) {
321
+                            if ($start_date == $end_date && $full_day) {
322 322
                                 $same_datetime = true;
323 323
                             }
324 324
 
325
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
326
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
327
-                            if ( $full_day ) {
325
+                            $link_date = date_i18n('Y-m-d', $sdate);
326
+                            $title_date = date_i18n($geodir_date_format, $sdate);
327
+                            if ($full_day) {
328 328
                                 $start_date = $title_date;
329
-                                $end_date = date_i18n( $geodir_date_format, $edate );
329
+                                $end_date = date_i18n($geodir_date_format, $edate);
330 330
                             }
331 331
                             
332
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
332
+                            if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
333 333
                                 $same_day = true;
334 334
                                 
335
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
335
+                                $start_date .= ' - '.date_i18n($geodir_time_format, $edate);
336 336
                             }
337 337
                             
338
-                            $event_dates .= ' :: ' . $start_date;
338
+                            $event_dates .= ' :: '.$start_date;
339 339
                         
340
-                            if ( !$same_day && !$same_datetime ) {
341
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
340
+                            if (!$same_day && !$same_datetime) {
341
+                                $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
342 342
                             }
343 343
                             
344 344
                             $e++;
@@ -349,67 +349,67 @@  discard block
 block discarded – undo
349 349
                         }
350 350
                     }
351 351
                 } else {
352
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
353
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
354
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
355
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
356
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
352
+                    $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : '';
353
+                    $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date;
354
+                    $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false;
355
+                    $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
356
+                    $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
357 357
                 
358
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
359
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
360
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
358
+                    $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
359
+                    $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
360
+                    $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
361 361
                     
362
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
362
+                    if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
363 363
                         $start_date = $event_recurring_dates[0];
364 364
                     }
365 365
                                 
366
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
366
+                    if (strtotime($end_date) < strtotime($start_date)) {
367 367
                         $end_date = $start_date;
368 368
                     }
369 369
                     
370 370
                     if ($end_date != '' && strtotime($end_date) >= $today) {
371
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
371
+                        if ($starttime == '' && !empty($starttimes)) {
372 372
                             $starttime = $starttimes[0];
373 373
                             $endtime = $endtimes[0];
374 374
                         }
375 375
                         
376 376
                         $same_day = false;
377 377
                         $one_day = false;
378
-                        if ( $start_date == $end_date && $all_day ) {
378
+                        if ($start_date == $end_date && $all_day) {
379 379
                             $one_day = true;
380 380
                         }
381 381
 
382
-                        if ( $all_day ) {
383
-                            $start_datetime = strtotime( $start_date );
384
-                            $end_datetime = strtotime( $end_date );
382
+                        if ($all_day) {
383
+                            $start_datetime = strtotime($start_date);
384
+                            $end_datetime = strtotime($end_date);
385 385
                             
386
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
387
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
388
-                            if ( $start_date == $end_date ) {
386
+                            $start_date = date_i18n($geodir_date_format, $start_datetime);
387
+                            $end_date = date_i18n($geodir_date_format, $end_datetime);
388
+                            if ($start_date == $end_date) {
389 389
                                 $one_day = true;
390 390
                             }
391 391
                         } else {
392
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
393
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
392
+                            if ($start_date == $end_date && $starttime == $endtime) {
393
+                                $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
394 394
                                 $one_day = false;
395 395
                             }
396
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
397
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
396
+                            $start_datetime = strtotime($start_date.' '.$starttime);
397
+                            $end_datetime = strtotime($end_date.' '.$endtime);
398 398
                             
399
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
400
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
399
+                            $start_date = date_i18n($geodir_date_time_format, $start_datetime);
400
+                            $end_date = date_i18n($geodir_date_time_format, $end_datetime);
401 401
                         }
402 402
 
403
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
403
+                        if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
404 404
                             $same_day = true;
405 405
                             
406
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
406
+                            $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime);
407 407
                         }
408 408
                         
409
-                        $event_dates .= ' :: ' . $start_date;
409
+                        $event_dates .= ' :: '.$start_date;
410 410
                         
411
-                        if ( !$same_day && !$one_day ) {
412
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
411
+                        if (!$same_day && !$one_day) {
412
+                            $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
413 413
                         }
414 414
                     }
415 415
                 }
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
             $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
426 426
 
427 427
             // if single cat lets just show that icon
428
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
429
-                $default_cat = (int)$map_cat_ids_array[0];
428
+            if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
429
+                $default_cat = (int) $map_cat_ids_array[0];
430 430
             }
431 431
 
432 432
             $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
                 $icon_size = array('w' => 36, 'h' => 45);
447 447
             }
448 448
 
449
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
449
+            $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
450 450
             $post_ids[] = $catinfo_obj->post_id;
451 451
         }
452 452
     }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     $totalcount = count(array_unique($post_ids));
471 471
 
472 472
     if (!empty($cat_content_info)) {
473
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
473
+        return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
474 474
     }
475 475
     else {
476 476
         return '[{"totalcount":"0"}]';
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48 48
     $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
51
-}
49
+    if (isset($_REQUEST['add_hood'])) {
50
+            $mapzoom = 10;
51
+    }
52
+    }
52 53
 
53 54
 /**
54 55
  * Filter the auto change address fields values
@@ -737,8 +738,9 @@  discard block
 block discarded – undo
737 738
 </script>
738 739
 <?php
739 740
 $set_button_class = 'geodir_button';
740
-if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+if (is_admin()) {
742
+    $set_button_class = 'button-primary';
743
+}
742 744
 ?>
743 745
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 746
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
36 36
 $lat_lng_blank = false;
37 37
 if ($lat == '' && $lng == '') {
38
-    $lat_lng_blank = true;
39
-    $city = $defaultcity;
40
-    $region = isset($default_location->region) ? $default_location->region : '';
41
-    $country = isset($default_location->country) ? $default_location->country : '';
42
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
38
+	$lat_lng_blank = true;
39
+	$city = $defaultcity;
40
+	$region = isset($default_location->region) ? $default_location->region : '';
41
+	$country = isset($default_location->country) ? $default_location->country : '';
42
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
44 44
 }
45 45
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48
-    $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
48
+	$mapzoom = 4;
49
+	if (isset($_REQUEST['add_hood']))
50
+		$mapzoom = 10;
51 51
 }
52 52
 
53 53
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Fires at the start of the add javascript on the add lsitings map.
69 69
 	 *
70 70
 	 * @since 1.0.0
71
-     * @param string $prefix The prefix for all elements.
71
+	 * @param string $prefix The prefix for all elements.
72 72
 	 */
73 73
 	do_action('geodir_add_listing_js_start', $prefix);
74 74
 	?>
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             // fix for regions in GB
261 261
 
262 262
             $country_arr = <?php
263
-            /**
264
-             * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
-             *
266
-             * @since 1.6.16
267
-             */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
263
+			/**
264
+			 * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
+			 *
266
+			 * @since 1.6.16
267
+			 */
268
+			echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
                 getZip = postal_code.long_name;
347 347
             }
348 348
             <?php 
349
-            /**
350
-             * Fires to add javascript variable to use in google map.
351
-             *
352
-             * @since 1.0.0
353
-             */
354
-            do_action('geodir_add_listing_geocode_js_vars');
355
-            ?>
349
+			/**
350
+			 * Fires to add javascript variable to use in google map.
351
+			 *
352
+			 * @since 1.0.0
353
+			 */
354
+			do_action('geodir_add_listing_geocode_js_vars');
355
+			?>
356 356
             <?php if ($is_map_restrict) { ?>
357 357
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358 358
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
             }
434 434
         }
435 435
         <?php
436
-        /**
437
-         * Fires when marker address updated on map.
438
-         *
439
-         * @since 1.0.0
440
-         * @param string $prefix Identifier used as a prefix for field name
441
-         */
442
-        do_action('geodir_update_marker_address', $prefix);
443
-        echo $updateMarkerAddress = ob_get_clean();
444
-        ?>
436
+		/**
437
+		 * Fires when marker address updated on map.
438
+		 *
439
+		 * @since 1.0.0
440
+		 * @param string $prefix Identifier used as a prefix for field name
441
+		 */
442
+		do_action('geodir_update_marker_address', $prefix);
443
+		echo $updateMarkerAddress = ob_get_clean();
444
+		?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447 447
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
-                global $wpdb;
461
-                $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
-                    echo "ISO2 = '$ISO2';";
465
-                }
466
-            }
459
+			if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
+				global $wpdb;
461
+				$location_result = geodir_get_default_location();
462
+				if(!empty($location_result)){
463
+					$ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
+					echo "ISO2 = '$ISO2';";
465
+				}
466
+			}
467 467
 
468 468
 
469
-            ?>
469
+			?>
470 470
         }
471 471
         if (ISO2 == '--') {
472 472
             ISO2 = '';
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
489
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
490
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
-        ?>
489
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
490
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
+		?>
492 492
         if (set_on_map && is_restrict) {
493 493
             if (zip != '' && address != '') {
494 494
                 address = address + ',' + zip;
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+			if(is_admin() && isset($_REQUEST['tab'])){?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
507 507
             <?php
508
-               }?>
508
+			   }?>
509 509
 
510 510
             if (ISO2 == 'GB') {
511 511
                 address = address + ',' + city + ',' + country; // UK is funny with regions
@@ -521,15 +521,15 @@  discard block
 block discarded – undo
521 521
             address =  address.replace(",null,", ",");
522 522
         }
523 523
         <?php $codeAddress = ob_get_clean();
524
-        /**
525
-         * Filter the address variable
526
-         *
527
-         * @since 1.0.0
528
-         *
529
-         * @param string $codeAddress Row of address to use in google map.
530
-         */
531
-        echo apply_filters('geodir_codeaddress', $codeAddress);
532
-        ?>
524
+		/**
525
+		 * Filter the address variable
526
+		 *
527
+		 * @since 1.0.0
528
+		 *
529
+		 * @param string $codeAddress Row of address to use in google map.
530
+		 */
531
+		echo apply_filters('geodir_codeaddress', $codeAddress);
532
+		?>
533 533
         if (!window.gdMaps) { // No Google Map Loaded
534 534
             return;
535 535
         }
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
                         updateMarkerPosition(baseMarker.getPosition());
555 555
                         //if(set_on_map && is_restrict) {
556 556
                         <?php 
557
-                        /**
558
-                         * Fires before set geocode position.
559
-                         *
560
-                         * @since 1.0.0
561
-                         */
562
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
563
-                        ?>
557
+						/**
558
+						 * Fires before set geocode position.
559
+						 *
560
+						 * @since 1.0.0
561
+						 */
562
+						do_action('geodir_add_listing_codeaddress_before_geocode');
563
+						?>
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
@@ -606,13 +606,13 @@  discard block
 block discarded – undo
606 606
                 updateMarkerPositionOSM(baseMarker.getLatLng());
607 607
             }
608 608
             <?php 
609
-            /**
610
-             * Fires to add javascript variable to use in google map.
611
-             *
612
-             * @since 1.0.0
613
-             */
614
-            do_action('geodir_add_listing_geocode_js_vars');
615
-            ?>
609
+			/**
610
+			 * Fires to add javascript variable to use in google map.
611
+			 *
612
+			 * @since 1.0.0
613
+			 */
614
+			do_action('geodir_add_listing_geocode_js_vars');
615
+			?>
616 616
             <?php if ($is_map_restrict) { ?>
617 617
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618 618
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 <?php
762 762
 $set_button_class = 'geodir_button';
763 763
 if (is_admin())
764
-    $set_button_class = 'button-primary';
764
+	$set_button_class = 'button-primary';
765 765
 ?>
766 766
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
767 767
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
              *
266 266
              * @since 1.6.16
267 267
              */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
268
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
             do_action('geodir_add_listing_geocode_js_vars');
355 355
             ?>
356 356
             <?php if ($is_map_restrict) { ?>
357
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
359
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
357
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
358
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
359
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
360 360
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
361 361
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
362 362
                 updateMarkerPosition(baseMarker.getPosition());
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
             <?php } ?>
366 366
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
367 367
         } else {
368
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
368
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
369 369
         }
370 370
     }
371 371
     function centerMap(latlng) {
372
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
372
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
373 373
         if (window.gdMaps == 'google') {
374 374
             jQuery.goMap.map.panTo(baseMarker.getPosition());
375 375
         } else if (window.gdMaps == 'osm') {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         }
379 379
     }
380 380
     function centerMarker() {
381
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
381
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
382 382
         var center = jQuery.goMap.map.getCenter();
383 383
         if (window.gdMaps == 'google') {
384 384
             baseMarker.setPosition(center);
@@ -387,48 +387,48 @@  discard block
 block discarded – undo
387 387
         }
388 388
     }
389 389
     function updateMapZoom(zoom) {
390
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
390
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
391 391
     }
392 392
     function updateMarkerPosition(markerlatLng) {
393
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
394
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
395
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
393
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
394
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
395
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
396 396
     }
397 397
     function updateMarkerPositionOSM(markerlatLng) {
398
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
399
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
398
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
399
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
400 400
     }
401 401
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
402
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
403
-        <?php ob_start();?>
404
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
405
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
402
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
403
+        <?php ob_start(); ?>
404
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
405
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
406 406
         
407
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
408
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
407
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
408
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
409 409
         }
410 410
         if (getAddress) {
411 411
             oldstr_address = getAddress;
412 412
         }
413 413
 
414
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
414
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
415 415
         if (getZip) {
416 416
             oldstr_zip = getZip;
417 417
         }
418 418
         if (set_map_val_in_fields) {
419 419
             if (getCountry) {
420
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
421
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
420
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
421
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
423 423
             }
424 424
             if (getState) {
425
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
426
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
425
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
426
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
427 427
                 }
428 428
             }
429 429
             if (getCity) {
430
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
431
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
430
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
431
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
432 432
                 }
433 433
             }
434 434
         }
@@ -444,23 +444,23 @@  discard block
 block discarded – undo
444 444
         ?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
448
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
449
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
450
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
451
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
452
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
447
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
448
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
449
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
450
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
451
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
452
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
453 453
         var ISO2 = country_selected.data('country_code');
454
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
455
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
454
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
455
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
459
+            if (!defined('GEODIRLOCATION_TEXTDOMAIN')) {
460 460
                 global $wpdb;
461 461
                 $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
462
+                if (!empty($location_result)) {
463
+                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country=%s", $location_result->country));
464 464
                     echo "ISO2 = '$ISO2';";
465 465
                 }
466 466
             }
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
             zip = '';
477 477
         }
478 478
         if (typeof city == "undefined") {
479
-            city = '<?php echo addslashes_gpc($city);?>';
479
+            city = '<?php echo addslashes_gpc($city); ?>';
480 480
         }
481 481
         if (typeof region == "undefined") {
482
-            region = '<?php echo addslashes_gpc($region);?>';
482
+            region = '<?php echo addslashes_gpc($region); ?>';
483 483
         }
484 484
         if (typeof country == "undefined") {
485
-            country = '<?php echo addslashes_gpc($country);?>';
485
+            country = '<?php echo addslashes_gpc($country); ?>';
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
             geocoder.geocode({'address': address, 'country': ISO2},
548 548
                 function (results, status) {
549 549
                     console.log(status);
550
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
550
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
551 551
                     if (status == google.maps.GeocoderStatus.OK) {
552 552
                         baseMarker.setPosition(results[0].geometry.location);
553 553
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -564,21 +564,21 @@  discard block
 block discarded – undo
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
567
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
567
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
568 568
                     }
569 569
                 });
570 570
         }
571 571
     }
572 572
     function gdMaxMap() {
573
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
573
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
574 574
 
575
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
575
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
576 576
         jQuery('.map_category').toggleClass('map_category_fullscreen');
577
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
577
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
578 578
         jQuery('body').toggleClass('body_fullscreen');
579
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
580
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
581
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
579
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
580
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
581
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
582 582
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
583 583
         window.setTimeout(function () {
584 584
             if (window.gdMaps == 'google') {
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
             do_action('geodir_add_listing_geocode_js_vars');
615 615
             ?>
616 616
             <?php if ($is_map_restrict) { ?>
617
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
619
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
617
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
618
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
619
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
620 620
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
621 621
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
622 622
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -625,39 +625,39 @@  discard block
 block discarded – undo
625 625
             <?php } ?>
626 626
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
627 627
         } else {
628
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
628
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
629 629
         }
630 630
     }
631 631
     
632 632
     jQuery(function ($) {
633
-        $("#<?php echo $prefix.'map';?>").goMap({
634
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
635
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
636
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
633
+        $("#<?php echo $prefix.'map'; ?>").goMap({
634
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
635
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
636
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
637 637
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
638 638
             streetViewControl: true,
639
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
639
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
640 640
         });
641 641
 
642 642
         if (window.gdMaps) {
643 643
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
644 644
 
645 645
             baseMarker = $.goMap.createMarker({
646
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
647
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
646
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
647
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
648 648
                 id: 'baseMarker',
649
-                icon: '<?php echo $marker_icon;?>',
649
+                icon: '<?php echo $marker_icon; ?>',
650 650
                 draggable: true,
651 651
                 addToMap: true, // For OSM
652
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
653
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
652
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
653
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
654 654
             });
655 655
         } else {
656
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
657
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
656
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
657
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
658 658
         }
659 659
         
660
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
660
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
661 661
             var set_on_map = true;
662 662
             geodir_codeAddress(set_on_map);
663 663
         });
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
                 updateMapZoom($.goMap.map.zoom);
693 693
             });
694 694
 
695
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
695
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
696 696
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
697 697
 
698 698
             <?php if ($is_map_restrict) { ?>
699
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
699
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
700 700
             geocoder.geocode({'address': CITY_ADDRESS},
701 701
                 function (results, status) {
702
-                    $("#<?php echo $prefix.'map';?>").goMap();
702
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
703 703
                     if (status == google.maps.GeocoderStatus.OK) {
704 704
                         // Bounds for North America
705 705
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -710,13 +710,13 @@  discard block
 block discarded – undo
710 710
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
711 711
                         );
712 712
                     } else {
713
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
713
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
714 714
                     }
715 715
                 });
716 716
             <?php } ?>
717 717
             // Limit the zoom level
718 718
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
719
-                $("#<?php echo $prefix.'map';?>").goMap();
719
+                $("#<?php echo $prefix.'map'; ?>").goMap();
720 720
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
721 721
             });
722 722
         } else if (window.gdMaps == 'osm') {
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
                 updateMapZoom($.goMap.map.getZoom());
743 743
             });
744 744
 
745
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
745
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
746 746
 
747 747
             <?php if ($is_map_restrict) { ?>
748
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
748
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
749 749
             geocodePositionOSM('', CITY_ADDRESS);
750 750
             <?php } ?>
751 751
             // Limit the zoom level
@@ -768,14 +768,14 @@  discard block
 block discarded – undo
768 768
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
769 769
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
770 770
     <div class="TopRight"></div>
771
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
771
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
772 772
         <!-- new map start -->
773 773
         <div class="iprelative">
774
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
774
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
775 775
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
776 776
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
777 777
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
778
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
778
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
779 779
         </div>
780 780
         <!-- new map end -->
781 781
     </div>
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/notifications_settings_array.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         'id' => 'geodir_post_submited_success_email_subject_admin',
130 130
         'type' => 'text',
131 131
         'css' => 'min-width:300px;',
132
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
132
+        'std' => __('Post Submitted Successfully', 'geodirectory') // Default value for the page title - changed in settings
133 133
     ),
134 134
      array(
135 135
         'name' => '',
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         'id' => 'geodir_post_submited_success_email_content_admin',
138 138
         'css' => 'width:500px; height: 150px;',
139 139
         'type' => 'textarea',
140
-        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
140
+        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>', 'geodirectory')
141 141
     ),
142 142
     array(
143 143
         'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         'id' => 'geodir_post_submited_success_email_subject',
189 189
         'type' => 'text',
190 190
         'css' => 'min-width:300px;',
191
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
191
+        'std' => __('Post Submitted Successfully', 'geodirectory') // Default value for the page title - changed in settings
192 192
     ),
193 193
     array(
194 194
         'name' => '',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         'id' => 'geodir_post_submited_success_email_content',
197 197
         'css' => 'width:500px; height: 150px;',
198 198
         'type' => 'textarea',
199
-        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
199
+        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>', 'geodirectory')
200 200
     ),
201 201
 
202 202
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         'id' => 'geodir_forgot_password_content',
215 215
         'css' => 'width:500px; height: 150px;',
216 216
         'type' => 'textarea',
217
-        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
217
+        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory')
218 218
     ),
219 219
 
220 220
     array(
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         'id' => 'geodir_registration_success_email_content',
232 232
         'css' => 'width:500px; height: 150px;',
233 233
         'type' => 'textarea',
234
-        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
234
+        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory')
235 235
     ),
236 236
     array(
237 237
         'name' => __('Listing published email', 'geodirectory'),
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         'id' => 'geodir_email_friend_content',
271 271
         'css' => 'width:500px; height: 150px;',
272 272
         'type' => 'textarea',
273
-        'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
273
+        'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>", 'geodirectory')
274 274
     ),
275 275
 
276 276
     array(
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         'id' => 'geodir_email_enquiry_content',
288 288
         'css' => 'width:500px; height: 150px;',
289 289
         'type' => 'textarea',
290
-        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
290
+        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>", 'geodirectory')
291 291
     ),
292 292
 
293 293
     array('type' => 'sectionend', 'id' => 'other_emails'),
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         'id' => 'geodir_post_added_success_msg_content',
304 304
         'css' => 'width:500px; height: 150px;',
305 305
         'type' => 'textarea',
306
-        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
306
+        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>', 'geodirectory')
307 307
     ),
308 308
 
309 309
 
Please login to merge, or discard this patch.
Indentation   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -17,314 +17,314 @@
 block discarded – undo
17 17
 $geodir_settings['notifications_settings'] = apply_filters('geodir_notifications_settings', array(
18 18
 
19 19
 
20
-    array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
-
22
-
23
-    array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
-
25
-    array(
26
-        'name' => __('List of usable shortcodes', 'geodirectory'),
27
-        'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
-        'id' => 'geodir_list_of_usable_shordcodes',
29
-        'type' => 'html_content',
30
-        'css' => 'min-width:300px;',
31
-        'std' => 'All Places' // Default value for the page title - changed in settings
32
-    ),
33
-
34
-    array(
35
-        'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
-        'desc' => __('Yes', 'geodirectory'),
37
-        'id' => 'geodir_tiny_editor',
38
-        'std' => 'yes',
39
-        'type' => 'radio',
40
-        'value' => '1',
41
-        'radiogroup' => 'start'
42
-    ),
43
-    array(
44
-        'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
-        'desc' => __('No', 'geodirectory'),
46
-        'id' => 'geodir_tiny_editor',
47
-        'std' => 'yes',
48
-        'type' => 'radio',
49
-        'value' => '0',
50
-        'radiogroup' => 'end'
51
-    ),
52
-
53
-
54
-    array('type' => 'sectionend', 'id' => 'notification_options'),
55
-
56
-
57
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
-
59
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
-
61
-    array(
62
-        'name' => __('New user registration', 'geodirectory'),
63
-        'desc' => __('Yes', 'geodirectory'),
64
-        'id' => 'geodir_bcc_new_user',
65
-        'std' => 'yes',
66
-        'type' => 'radio',
67
-        'value' => '1',
68
-        'radiogroup' => 'start'
69
-    ),
70
-    array(
71
-        'name' => __('New user registration', 'geodirectory'),
72
-        'desc' => __('No', 'geodirectory'),
73
-        'id' => 'geodir_bcc_new_user',
74
-        'std' => 'yes',
75
-        'type' => 'radio',
76
-        'value' => '0',
77
-        'radiogroup' => 'end'
78
-    ),
79
-
80
-    array(
81
-        'name' => __('Send to friend', 'geodirectory'),
82
-        'desc' => __('Yes', 'geodirectory'),
83
-        'id' => 'geodir_bcc_friend',
84
-        'std' => 'yes',
85
-        'type' => 'radio',
86
-        'value' => '1',
87
-        'radiogroup' => 'start'
88
-    ),
89
-    array(
90
-        'name' => __('Send to friend', 'geodirectory'),
91
-        'desc' => __('No', 'geodirectory'),
92
-        'id' => 'geodir_bcc_friend',
93
-        'std' => 'yes',
94
-        'type' => 'radio',
95
-        'value' => '0',
96
-        'radiogroup' => 'end'
97
-    ),
98
-
99
-    array(
100
-        'name' => __('Send enquiry', 'geodirectory'),
101
-        'desc' => __('Yes', 'geodirectory'),
102
-        'id' => 'geodir_bcc_enquiry',
103
-        'std' => 'yes',
104
-        'type' => 'radio',
105
-        'value' => '1',
106
-        'radiogroup' => 'start'
107
-    ),
108
-    array(
109
-        'name' => __('Send enquiry', 'geodirectory'),
110
-        'desc' => __('No', 'geodirectory'),
111
-        'id' => 'geodir_bcc_enquiry',
112
-        'std' => 'yes',
113
-        'type' => 'radio',
114
-        'value' => '0',
115
-        'radiogroup' => 'end'
116
-    ),
117
-
118
-
119
-    array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
-
121
-
122
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
-
124
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
-
126
-    array(
127
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
128
-        'desc' => __('Yes', 'geodirectory'),
129
-        'id' => 'geodir_notify_post_submit',
130
-        'std' => '1',
131
-        'type' => 'radio',
132
-        'value' => '1',
133
-        'radiogroup' => 'start'
134
-    ),
135
-    array(
136
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
137
-        'desc' => __('No', 'geodirectory'),
138
-        'id' => 'geodir_notify_post_submit',
139
-        'std' => '1',
140
-        'type' => 'radio',
141
-        'value' => '0',
142
-        'radiogroup' => 'end'
143
-    ),
144
-    array(
145
-        'name' => __('Post submit success to admin email', 'geodirectory'),
146
-        'desc' => '',
147
-        'id' => 'geodir_post_submited_success_email_subject_admin',
148
-        'type' => 'text',
149
-        'css' => 'min-width:300px;',
150
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
151
-    ),
152
-     array(
153
-        'name' => '',
154
-        'desc' => '',
155
-        'id' => 'geodir_post_submited_success_email_content_admin',
156
-        'css' => 'width:500px; height: 150px;',
157
-        'type' => 'textarea',
158
-        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
159
-    ),
160
-    array(
161
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
162
-        'desc' => __('Yes', 'geodirectory'),
163
-        'id' => 'geodir_notify_post_edited',
164
-        'std' => '0',
165
-        'type' => 'radio',
166
-        'value' => '1',
167
-        'radiogroup' => 'start'
168
-    ),
169
-    array(
170
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
171
-        'desc' => __('No', 'geodirectory'),
172
-        'id' => 'geodir_notify_post_edited',
173
-        'std' => '0',
174
-        'type' => 'radio',
175
-        'value' => '0',
176
-        'radiogroup' => 'end'
177
-    ),
178
-    array(
179
-        'name' => __('Listing edited by Author', 'geodirectory'),
180
-        'desc' => '',
181
-        'id' => 'geodir_post_edited_email_subject_admin',
182
-        'type' => 'text',
183
-        'css' => 'min-width:300px;',
184
-        'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
185
-    ),
186
-    array(
187
-        'name' => '',
188
-        'desc' => '',
189
-        'id' => 'geodir_post_edited_email_content_admin',
190
-        'css' => 'width:500px; height: 150px;',
191
-        'type' => 'textarea',
192
-        'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
193
-    ),
194
-
195
-
196
-    array('type' => 'sectionend', 'id' => 'admin_emails'),
197
-
198
-
199
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
200
-
201
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
202
-
203
-    array(
204
-        'name' => __('Post submit success to client email', 'geodirectory'),
205
-        'desc' => '',
206
-        'id' => 'geodir_post_submited_success_email_subject',
207
-        'type' => 'text',
208
-        'css' => 'min-width:300px;',
209
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
210
-    ),
211
-    array(
212
-        'name' => '',
213
-        'desc' => '',
214
-        'id' => 'geodir_post_submited_success_email_content',
215
-        'css' => 'width:500px; height: 150px;',
216
-        'type' => 'textarea',
217
-        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
218
-    ),
219
-
220
-
221
-    array(
222
-        'name' => __('User forgot password email', 'geodirectory'),
223
-        'desc' => '',
224
-        'id' => 'geodir_forgot_password_subject',
225
-        'type' => 'text',
226
-        'css' => 'min-width:300px;',
227
-        'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
228
-    ),
229
-    array(
230
-        'name' => '',
231
-        'desc' => '',
232
-        'id' => 'geodir_forgot_password_content',
233
-        'css' => 'width:500px; height: 150px;',
234
-        'type' => 'textarea',
235
-        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Registration success email', 'geodirectory'),
240
-        'desc' => '',
241
-        'id' => 'geodir_registration_success_email_subject',
242
-        'type' => 'text',
243
-        'css' => 'min-width:300px;',
244
-        'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
245
-    ),
246
-    array(
247
-        'name' => '',
248
-        'desc' => '',
249
-        'id' => 'geodir_registration_success_email_content',
250
-        'css' => 'width:500px; height: 150px;',
251
-        'type' => 'textarea',
252
-        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
253
-    ),
254
-    array(
255
-        'name' => __('Listing published email', 'geodirectory'),
256
-        'desc' => '',
257
-        'id' => 'geodir_post_published_email_subject',
258
-        'type' => 'text',
259
-        'css' => 'min-width:300px;',
260
-        'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
261
-    ),
262
-    array(
263
-        'name' => '',
264
-        'desc' => '',
265
-        'id' => 'geodir_post_published_email_content',
266
-        'css' => 'width:500px; height: 150px;',
267
-        'type' => 'textarea',
268
-        'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
269
-    ),
270
-
271
-    array('type' => 'sectionend', 'id' => 'client_emails'),
272
-
273
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
274
-
275
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
276
-
277
-    array(
278
-        'name' => __('Send to friend', 'geodirectory'),
279
-        'desc' => '',
280
-        'id' => 'geodir_email_friend_subject',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
284
-    ),
285
-    array(
286
-        'name' => '',
287
-        'desc' => '',
288
-        'id' => 'geodir_email_friend_content',
289
-        'css' => 'width:500px; height: 150px;',
290
-        'type' => 'textarea',
291
-        'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
292
-    ),
293
-
294
-    array(
295
-        'name' => __('Email enquiry', 'geodirectory'),
296
-        'desc' => '',
297
-        'id' => 'geodir_email_enquiry_subject',
298
-        'type' => 'text',
299
-        'css' => 'min-width:300px;',
300
-        'std' => __('Website Enquiry', 'geodirectory')
301
-    ),
302
-    array(
303
-        'name' => '',
304
-        'desc' => '',
305
-        'id' => 'geodir_email_enquiry_content',
306
-        'css' => 'width:500px; height: 150px;',
307
-        'type' => 'textarea',
308
-        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
309
-    ),
310
-
311
-    array('type' => 'sectionend', 'id' => 'other_emails'),
312
-
313
-
314
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
315
-
316
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
317
-
318
-    array(
319
-        'name' => __('Post submitted success', 'geodirectory'),
320
-        'desc' => '',
321
-        'id' => 'geodir_post_added_success_msg_content',
322
-        'css' => 'width:500px; height: 150px;',
323
-        'type' => 'textarea',
324
-        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
325
-    ),
326
-
327
-
328
-    array('type' => 'sectionend', 'id' => 'messages'),
20
+	array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
+
22
+
23
+	array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
+
25
+	array(
26
+		'name' => __('List of usable shortcodes', 'geodirectory'),
27
+		'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
+		'id' => 'geodir_list_of_usable_shordcodes',
29
+		'type' => 'html_content',
30
+		'css' => 'min-width:300px;',
31
+		'std' => 'All Places' // Default value for the page title - changed in settings
32
+	),
33
+
34
+	array(
35
+		'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
+		'desc' => __('Yes', 'geodirectory'),
37
+		'id' => 'geodir_tiny_editor',
38
+		'std' => 'yes',
39
+		'type' => 'radio',
40
+		'value' => '1',
41
+		'radiogroup' => 'start'
42
+	),
43
+	array(
44
+		'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
+		'desc' => __('No', 'geodirectory'),
46
+		'id' => 'geodir_tiny_editor',
47
+		'std' => 'yes',
48
+		'type' => 'radio',
49
+		'value' => '0',
50
+		'radiogroup' => 'end'
51
+	),
52
+
53
+
54
+	array('type' => 'sectionend', 'id' => 'notification_options'),
55
+
56
+
57
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
+
59
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
+
61
+	array(
62
+		'name' => __('New user registration', 'geodirectory'),
63
+		'desc' => __('Yes', 'geodirectory'),
64
+		'id' => 'geodir_bcc_new_user',
65
+		'std' => 'yes',
66
+		'type' => 'radio',
67
+		'value' => '1',
68
+		'radiogroup' => 'start'
69
+	),
70
+	array(
71
+		'name' => __('New user registration', 'geodirectory'),
72
+		'desc' => __('No', 'geodirectory'),
73
+		'id' => 'geodir_bcc_new_user',
74
+		'std' => 'yes',
75
+		'type' => 'radio',
76
+		'value' => '0',
77
+		'radiogroup' => 'end'
78
+	),
79
+
80
+	array(
81
+		'name' => __('Send to friend', 'geodirectory'),
82
+		'desc' => __('Yes', 'geodirectory'),
83
+		'id' => 'geodir_bcc_friend',
84
+		'std' => 'yes',
85
+		'type' => 'radio',
86
+		'value' => '1',
87
+		'radiogroup' => 'start'
88
+	),
89
+	array(
90
+		'name' => __('Send to friend', 'geodirectory'),
91
+		'desc' => __('No', 'geodirectory'),
92
+		'id' => 'geodir_bcc_friend',
93
+		'std' => 'yes',
94
+		'type' => 'radio',
95
+		'value' => '0',
96
+		'radiogroup' => 'end'
97
+	),
98
+
99
+	array(
100
+		'name' => __('Send enquiry', 'geodirectory'),
101
+		'desc' => __('Yes', 'geodirectory'),
102
+		'id' => 'geodir_bcc_enquiry',
103
+		'std' => 'yes',
104
+		'type' => 'radio',
105
+		'value' => '1',
106
+		'radiogroup' => 'start'
107
+	),
108
+	array(
109
+		'name' => __('Send enquiry', 'geodirectory'),
110
+		'desc' => __('No', 'geodirectory'),
111
+		'id' => 'geodir_bcc_enquiry',
112
+		'std' => 'yes',
113
+		'type' => 'radio',
114
+		'value' => '0',
115
+		'radiogroup' => 'end'
116
+	),
117
+
118
+
119
+	array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
+
121
+
122
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
+
124
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
+
126
+	array(
127
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
128
+		'desc' => __('Yes', 'geodirectory'),
129
+		'id' => 'geodir_notify_post_submit',
130
+		'std' => '1',
131
+		'type' => 'radio',
132
+		'value' => '1',
133
+		'radiogroup' => 'start'
134
+	),
135
+	array(
136
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
137
+		'desc' => __('No', 'geodirectory'),
138
+		'id' => 'geodir_notify_post_submit',
139
+		'std' => '1',
140
+		'type' => 'radio',
141
+		'value' => '0',
142
+		'radiogroup' => 'end'
143
+	),
144
+	array(
145
+		'name' => __('Post submit success to admin email', 'geodirectory'),
146
+		'desc' => '',
147
+		'id' => 'geodir_post_submited_success_email_subject_admin',
148
+		'type' => 'text',
149
+		'css' => 'min-width:300px;',
150
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
151
+	),
152
+	 array(
153
+		'name' => '',
154
+		'desc' => '',
155
+		'id' => 'geodir_post_submited_success_email_content_admin',
156
+		'css' => 'width:500px; height: 150px;',
157
+		'type' => 'textarea',
158
+		'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
159
+	),
160
+	array(
161
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
162
+		'desc' => __('Yes', 'geodirectory'),
163
+		'id' => 'geodir_notify_post_edited',
164
+		'std' => '0',
165
+		'type' => 'radio',
166
+		'value' => '1',
167
+		'radiogroup' => 'start'
168
+	),
169
+	array(
170
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
171
+		'desc' => __('No', 'geodirectory'),
172
+		'id' => 'geodir_notify_post_edited',
173
+		'std' => '0',
174
+		'type' => 'radio',
175
+		'value' => '0',
176
+		'radiogroup' => 'end'
177
+	),
178
+	array(
179
+		'name' => __('Listing edited by Author', 'geodirectory'),
180
+		'desc' => '',
181
+		'id' => 'geodir_post_edited_email_subject_admin',
182
+		'type' => 'text',
183
+		'css' => 'min-width:300px;',
184
+		'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
185
+	),
186
+	array(
187
+		'name' => '',
188
+		'desc' => '',
189
+		'id' => 'geodir_post_edited_email_content_admin',
190
+		'css' => 'width:500px; height: 150px;',
191
+		'type' => 'textarea',
192
+		'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
193
+	),
194
+
195
+
196
+	array('type' => 'sectionend', 'id' => 'admin_emails'),
197
+
198
+
199
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
200
+
201
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
202
+
203
+	array(
204
+		'name' => __('Post submit success to client email', 'geodirectory'),
205
+		'desc' => '',
206
+		'id' => 'geodir_post_submited_success_email_subject',
207
+		'type' => 'text',
208
+		'css' => 'min-width:300px;',
209
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
210
+	),
211
+	array(
212
+		'name' => '',
213
+		'desc' => '',
214
+		'id' => 'geodir_post_submited_success_email_content',
215
+		'css' => 'width:500px; height: 150px;',
216
+		'type' => 'textarea',
217
+		'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
218
+	),
219
+
220
+
221
+	array(
222
+		'name' => __('User forgot password email', 'geodirectory'),
223
+		'desc' => '',
224
+		'id' => 'geodir_forgot_password_subject',
225
+		'type' => 'text',
226
+		'css' => 'min-width:300px;',
227
+		'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
228
+	),
229
+	array(
230
+		'name' => '',
231
+		'desc' => '',
232
+		'id' => 'geodir_forgot_password_content',
233
+		'css' => 'width:500px; height: 150px;',
234
+		'type' => 'textarea',
235
+		'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
236
+	),
237
+
238
+	array(
239
+		'name' => __('Registration success email', 'geodirectory'),
240
+		'desc' => '',
241
+		'id' => 'geodir_registration_success_email_subject',
242
+		'type' => 'text',
243
+		'css' => 'min-width:300px;',
244
+		'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
245
+	),
246
+	array(
247
+		'name' => '',
248
+		'desc' => '',
249
+		'id' => 'geodir_registration_success_email_content',
250
+		'css' => 'width:500px; height: 150px;',
251
+		'type' => 'textarea',
252
+		'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
253
+	),
254
+	array(
255
+		'name' => __('Listing published email', 'geodirectory'),
256
+		'desc' => '',
257
+		'id' => 'geodir_post_published_email_subject',
258
+		'type' => 'text',
259
+		'css' => 'min-width:300px;',
260
+		'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
261
+	),
262
+	array(
263
+		'name' => '',
264
+		'desc' => '',
265
+		'id' => 'geodir_post_published_email_content',
266
+		'css' => 'width:500px; height: 150px;',
267
+		'type' => 'textarea',
268
+		'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
269
+	),
270
+
271
+	array('type' => 'sectionend', 'id' => 'client_emails'),
272
+
273
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
274
+
275
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
276
+
277
+	array(
278
+		'name' => __('Send to friend', 'geodirectory'),
279
+		'desc' => '',
280
+		'id' => 'geodir_email_friend_subject',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
284
+	),
285
+	array(
286
+		'name' => '',
287
+		'desc' => '',
288
+		'id' => 'geodir_email_friend_content',
289
+		'css' => 'width:500px; height: 150px;',
290
+		'type' => 'textarea',
291
+		'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
292
+	),
293
+
294
+	array(
295
+		'name' => __('Email enquiry', 'geodirectory'),
296
+		'desc' => '',
297
+		'id' => 'geodir_email_enquiry_subject',
298
+		'type' => 'text',
299
+		'css' => 'min-width:300px;',
300
+		'std' => __('Website Enquiry', 'geodirectory')
301
+	),
302
+	array(
303
+		'name' => '',
304
+		'desc' => '',
305
+		'id' => 'geodir_email_enquiry_content',
306
+		'css' => 'width:500px; height: 150px;',
307
+		'type' => 'textarea',
308
+		'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
309
+	),
310
+
311
+	array('type' => 'sectionend', 'id' => 'other_emails'),
312
+
313
+
314
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
315
+
316
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
317
+
318
+	array(
319
+		'name' => __('Post submitted success', 'geodirectory'),
320
+		'desc' => '',
321
+		'id' => 'geodir_post_added_success_msg_content',
322
+		'css' => 'width:500px; height: 150px;',
323
+		'type' => 'textarea',
324
+		'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
325
+	),
326
+
327
+
328
+	array('type' => 'sectionend', 'id' => 'messages'),
329 329
 
330 330
 )); // End Manage NOtifications settings
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/general_settings_array.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     ),
99 99
     array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101
-));/* General Options End*/
101
+)); /* General Options End*/
102 102
 
103 103
 /**
104 104
  * Filter GD Google Analytic Settings array.
Please login to merge, or discard this patch.
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable review stars for CPT', 'geodirectory'),
79
-        'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
-        'tip' => '',
81
-        'id' => 'geodir_disable_rating_cpt',
82
-        'css' => 'min-width:300px;',
83
-        'std' => '',
84
-        'type' => 'multiselect',
85
-        'placeholder_text' => __('Select post types', 'geodirectory'),
86
-        'class' => 'chosen_select',
87
-        'options' => array_unique(geodir_post_type_setting_fun())
88
-    ),
89
-    array(
90
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
91
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
-        'id' => 'geodir_disable_perm_delete',
93
-        'type' => 'checkbox',
94
-        'std' => '1'
95
-    ),
96
-    array(
97
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
-        'id' => 'geodir_upload_max_filesize',
100
-        'type' => 'text',
101
-        'css' => 'min-width:300px;',
102
-        'std' => '2'
103
-    ),
104
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable review stars for CPT', 'geodirectory'),
79
+		'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
+		'tip' => '',
81
+		'id' => 'geodir_disable_rating_cpt',
82
+		'css' => 'min-width:300px;',
83
+		'std' => '',
84
+		'type' => 'multiselect',
85
+		'placeholder_text' => __('Select post types', 'geodirectory'),
86
+		'class' => 'chosen_select',
87
+		'options' => array_unique(geodir_post_type_setting_fun())
88
+	),
89
+	array(
90
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
91
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
+		'id' => 'geodir_disable_perm_delete',
93
+		'type' => 'checkbox',
94
+		'std' => '1'
95
+	),
96
+	array(
97
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
+		'id' => 'geodir_upload_max_filesize',
100
+		'type' => 'text',
101
+		'css' => 'min-width:300px;',
102
+		'std' => '2'
103
+	),
104
+	array('type' => 'sectionend', 'id' => 'general_options'),
105 105
 
106 106
 ));/* General Options End*/
107 107
 
@@ -113,104 +113,104 @@  discard block
 block discarded – undo
113 113
  */
114 114
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
115 115
 
116
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
-
118
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
-
120
-
121
-
122
-    array(
123
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
-        'desc' => __('Yes', 'geodirectory'),
125
-        'id' => 'geodir_ga_stats',
126
-        'std' => '0',
127
-        'type' => 'radio',
128
-        'value' => '1',
129
-        'radiogroup' => 'start'
130
-    ),
131
-    array(
132
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
-        'desc' => __('No', 'geodirectory'),
134
-        'id' => 'geodir_ga_stats',
135
-        'std' => '1',
136
-        'type' => 'radio',
137
-        'value' => '0',
138
-        'radiogroup' => 'end'
139
-    ),
140
-
141
-    array(
142
-        'name' => __('Google analytics access', 'geodirectory'),
143
-        'desc' => '',
144
-        'id' => 'geodir_ga_token',
145
-        'type' => 'google_analytics',
146
-        'css' => 'min-width:300px;',
147
-        'std' => '' // Default value for the page title - changed in settings
148
-    ),
149
-
150
-    array(
151
-        'name' => __('Google analytics Auth Code', 'geodirectory'),
152
-        'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
-        'id' => 'geodir_ga_auth_code',
154
-        'type' => 'text',
155
-        'css' => 'min-width:300px;',
156
-        'std' => '' // Default value for the page title - changed in settings
157
-    ),
158
-
159
-    array(
160
-        'name' => __('Analytics Account', 'geodirectory'),
161
-        'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
-        'id' => 'geodir_ga_account_id',
163
-        'css' => 'min-width:300px;',
164
-        'std' => 'gridview_onehalf',
165
-        'type' => 'select',
166
-        'class' => 'chosen_select',
167
-        'options' => geodir_gd_accounts()
168
-    ),
169
-
170
-
171
-    array(
172
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
-        'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
-        'id' => 'geodir_ga_add_tracking_code',
175
-        'std' => '0',
176
-        'type' => 'radio',
177
-        'value' => '1',
178
-        'radiogroup' => 'start'
179
-    ),
180
-    array(
181
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
-        'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
-        'id' => 'geodir_ga_add_tracking_code',
184
-        'std' => '1',
185
-        'type' => 'radio',
186
-        'value' => '0',
187
-        'radiogroup' => 'end'
188
-    ),
189
-
190
-    array(
191
-        'name' => __('Anonymize user IP?', 'geodirectory'),
192
-        'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
-        'id' => 'geodir_ga_anonymize_ip',
194
-        'type' => 'checkbox',
195
-        'std' => '0'
196
-    ),
197
-
198
-    array(
199
-        'name' => __('Auto refresh active users?', 'geodirectory'),
200
-        'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
-        'id' => 'geodir_ga_auto_refresh',
202
-        'type' => 'checkbox',
203
-        'std' => '0'
204
-    ),
205
-    array(
206
-        'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
-        'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
-        'id' => 'geodir_ga_refresh_time',
209
-        'type' => 'text',
210
-        'std' => '5'
211
-    ),
212
-
213
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
116
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
+
118
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
+
120
+
121
+
122
+	array(
123
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
+		'desc' => __('Yes', 'geodirectory'),
125
+		'id' => 'geodir_ga_stats',
126
+		'std' => '0',
127
+		'type' => 'radio',
128
+		'value' => '1',
129
+		'radiogroup' => 'start'
130
+	),
131
+	array(
132
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
+		'desc' => __('No', 'geodirectory'),
134
+		'id' => 'geodir_ga_stats',
135
+		'std' => '1',
136
+		'type' => 'radio',
137
+		'value' => '0',
138
+		'radiogroup' => 'end'
139
+	),
140
+
141
+	array(
142
+		'name' => __('Google analytics access', 'geodirectory'),
143
+		'desc' => '',
144
+		'id' => 'geodir_ga_token',
145
+		'type' => 'google_analytics',
146
+		'css' => 'min-width:300px;',
147
+		'std' => '' // Default value for the page title - changed in settings
148
+	),
149
+
150
+	array(
151
+		'name' => __('Google analytics Auth Code', 'geodirectory'),
152
+		'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
+		'id' => 'geodir_ga_auth_code',
154
+		'type' => 'text',
155
+		'css' => 'min-width:300px;',
156
+		'std' => '' // Default value for the page title - changed in settings
157
+	),
158
+
159
+	array(
160
+		'name' => __('Analytics Account', 'geodirectory'),
161
+		'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
+		'id' => 'geodir_ga_account_id',
163
+		'css' => 'min-width:300px;',
164
+		'std' => 'gridview_onehalf',
165
+		'type' => 'select',
166
+		'class' => 'chosen_select',
167
+		'options' => geodir_gd_accounts()
168
+	),
169
+
170
+
171
+	array(
172
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
+		'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
+		'id' => 'geodir_ga_add_tracking_code',
175
+		'std' => '0',
176
+		'type' => 'radio',
177
+		'value' => '1',
178
+		'radiogroup' => 'start'
179
+	),
180
+	array(
181
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
+		'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
+		'id' => 'geodir_ga_add_tracking_code',
184
+		'std' => '1',
185
+		'type' => 'radio',
186
+		'value' => '0',
187
+		'radiogroup' => 'end'
188
+	),
189
+
190
+	array(
191
+		'name' => __('Anonymize user IP?', 'geodirectory'),
192
+		'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
+		'id' => 'geodir_ga_anonymize_ip',
194
+		'type' => 'checkbox',
195
+		'std' => '0'
196
+	),
197
+
198
+	array(
199
+		'name' => __('Auto refresh active users?', 'geodirectory'),
200
+		'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
+		'id' => 'geodir_ga_auto_refresh',
202
+		'type' => 'checkbox',
203
+		'std' => '0'
204
+	),
205
+	array(
206
+		'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
+		'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
+		'id' => 'geodir_ga_refresh_time',
209
+		'type' => 'text',
210
+		'std' => '5'
211
+	),
212
+
213
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
214 214
 
215 215
 )); // google_analytic_settings End
216 216
 
@@ -222,84 +222,84 @@  discard block
 block discarded – undo
222 222
  */
223 223
 $search_settings = apply_filters('geodir_search_settings', array(
224 224
 
225
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
-
227
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
-
229
-    array(
230
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
-        'id' => 'geodir_search_dist',
233
-        'type' => 'text',
234
-        'css' => 'min-width:300px;',
235
-        'std' => '40' // Default value for the page title - changed in settings
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
240
-        'desc' => __('Miles', 'geodirectory'),
241
-        'id' => 'geodir_search_dist_1',
242
-        'std' => 'miles',
243
-        'type' => 'radio',
244
-        'value' => 'miles',
245
-        'radiogroup' => 'start'
246
-    ),
247
-    array(
248
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
249
-        'desc' => __('Kilometers', 'geodirectory'),
250
-        'id' => 'geodir_search_dist_1',
251
-        'std' => 'miles',
252
-        'type' => 'radio',
253
-        'value' => 'km',
254
-        'radiogroup' => 'end'
255
-    ),
256
-
257
-    array(
258
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
-        'desc' => __('Meters', 'geodirectory'),
260
-        'id' => 'geodir_search_dist_2',
261
-        'std' => 'meters',
262
-        'type' => 'radio',
263
-        'value' => 'meters',
264
-        'radiogroup' => 'start'
265
-    ),
266
-
267
-    array(
268
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
-        'desc' => __('Feet', 'geodirectory'),
270
-        'id' => 'geodir_search_dist_2',
271
-        'std' => 'meters',
272
-        'type' => 'radio',
273
-        'value' => 'feet',
274
-        'radiogroup' => 'end'
275
-    ),
276
-
277
-    array(
278
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
-        'id' => 'geodir_search_near_addition',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => ''
284
-    ),
285
-    array(
286
-        'name' => __('Individual word search limit', 'geodirectory'),
287
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
-        'id' => 'geodir_search_word_limit',
289
-        'css' => 'min-width:300px;',
290
-        'std' => 'gridview_onehalf',
291
-        'type' => 'select',
292
-        'class' => 'chosen_select',
293
-        'options' => array_unique(array(
294
-            '0' => __('Disabled', 'geodirectory'),
295
-            '1' => __('1 Character words excluded', 'geodirectory'),
296
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
297
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
298
-        ))
299
-    ),
300
-
301
-
302
-    array('type' => 'sectionend', 'id' => 'search_settings'),
225
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
+
227
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
+
229
+	array(
230
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
+		'id' => 'geodir_search_dist',
233
+		'type' => 'text',
234
+		'css' => 'min-width:300px;',
235
+		'std' => '40' // Default value for the page title - changed in settings
236
+	),
237
+
238
+	array(
239
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
240
+		'desc' => __('Miles', 'geodirectory'),
241
+		'id' => 'geodir_search_dist_1',
242
+		'std' => 'miles',
243
+		'type' => 'radio',
244
+		'value' => 'miles',
245
+		'radiogroup' => 'start'
246
+	),
247
+	array(
248
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
249
+		'desc' => __('Kilometers', 'geodirectory'),
250
+		'id' => 'geodir_search_dist_1',
251
+		'std' => 'miles',
252
+		'type' => 'radio',
253
+		'value' => 'km',
254
+		'radiogroup' => 'end'
255
+	),
256
+
257
+	array(
258
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
+		'desc' => __('Meters', 'geodirectory'),
260
+		'id' => 'geodir_search_dist_2',
261
+		'std' => 'meters',
262
+		'type' => 'radio',
263
+		'value' => 'meters',
264
+		'radiogroup' => 'start'
265
+	),
266
+
267
+	array(
268
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
+		'desc' => __('Feet', 'geodirectory'),
270
+		'id' => 'geodir_search_dist_2',
271
+		'std' => 'meters',
272
+		'type' => 'radio',
273
+		'value' => 'feet',
274
+		'radiogroup' => 'end'
275
+	),
276
+
277
+	array(
278
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
+		'id' => 'geodir_search_near_addition',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => ''
284
+	),
285
+	array(
286
+		'name' => __('Individual word search limit', 'geodirectory'),
287
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
+		'id' => 'geodir_search_word_limit',
289
+		'css' => 'min-width:300px;',
290
+		'std' => 'gridview_onehalf',
291
+		'type' => 'select',
292
+		'class' => 'chosen_select',
293
+		'options' => array_unique(array(
294
+			'0' => __('Disabled', 'geodirectory'),
295
+			'1' => __('1 Character words excluded', 'geodirectory'),
296
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
297
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
298
+		))
299
+	),
300
+
301
+
302
+	array('type' => 'sectionend', 'id' => 'search_settings'),
303 303
 
304 304
 )); //search_settings End
305 305
 
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
  */
312 312
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
313 313
 
314
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
-
316
-    array(
317
-        'name' => '',
318
-        'desc' => '',
319
-        'id' => 'geodir_dummy_data_installer',
320
-        'type' => 'dummy_installer',
321
-        'css' => 'min-width:300px;',
322
-        'std' => '40' // Default value for the page title - changed in settings
323
-    ),
324
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
314
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
+
316
+	array(
317
+		'name' => '',
318
+		'desc' => '',
319
+		'id' => 'geodir_dummy_data_installer',
320
+		'type' => 'dummy_installer',
321
+		'css' => 'min-width:300px;',
322
+		'std' => '40' // Default value for the page title - changed in settings
323
+	),
324
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
325 325
 
326 326
 )); //dummy_data_settings End
327 327
 
Please login to merge, or discard this patch.