Test Failed
Pull Request — master (#274)
by Viruthagiri
10:39
created
geodirectory-functions/compatibility/Multi_News.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,10 @@
 block discarded – undo
126 126
     $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127 127
     if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128 128
         return $matches[0];
129
-    } else return '';
130
-}
129
+    } else {
130
+    	return '';
131
+    }
132
+    }
131 133
 
132 134
 
133 135
 /**
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -16,36 +16,36 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function multi_news_action_calls()
18 18
 {
19
-    // REMOVE BREADCRUMB
20
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
26
-
27
-    //ADD BREADCRUMS
28
-    add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20);
29
-    add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20);
30
-    add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20);
31
-    add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20);
32
-    //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20);
33
-    add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20);
34
-
35
-
36
-    // fix breadcrums
37
-    add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1);
38
-
39
-    // REMOVE PAGE TITLES
40
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
41
-    // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10);
42
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
43
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
44
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
45
-
46
-
47
-    add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1);
48
-    add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1);
19
+	// REMOVE BREADCRUMB
20
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
26
+
27
+	//ADD BREADCRUMS
28
+	add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20);
29
+	add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20);
30
+	add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20);
31
+	add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20);
32
+	//add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20);
33
+	add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20);
34
+
35
+
36
+	// fix breadcrums
37
+	add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1);
38
+
39
+	// REMOVE PAGE TITLES
40
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
41
+	// remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10);
42
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
43
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
44
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
45
+
46
+
47
+	add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1);
48
+	add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1);
49 49
 }
50 50
 
51 51
 /**
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function gd_mn_extra_wrap($page)
59 59
 {
60
-    if ($page == 'add-listing-page') {
61
-        echo '<div class="site-content page-wrap">';
62
-    } elseif ($page == 'signup-page') {
63
-        echo '</div><div class="section full-width-section" style="float: left;width:100%;">';
64
-    }
60
+	if ($page == 'add-listing-page') {
61
+		echo '<div class="site-content page-wrap">';
62
+	} elseif ($page == 'signup-page') {
63
+		echo '</div><div class="section full-width-section" style="float: left;width:100%;">';
64
+	}
65 65
 
66 66
 }
67 67
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function gd_mn_extra_wrap_end($page)
77 77
 {
78
-    if ($page == 'add-listing-page') {
79
-        echo '</div>';
80
-    }
78
+	if ($page == 'add-listing-page') {
79
+		echo '</div>';
80
+	}
81 81
 
82 82
 }
83 83
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 function gd_mn_replace_breadcrums()
92 92
 {
93 93
 
94
-    if (mom_option('breadcrumb') != 0) { ?>
94
+	if (mom_option('breadcrumb') != 0) { ?>
95 95
         <?php if (mom_option('cats_bread')) {
96
-            $cclass = '';
97
-            if (mom_option('cat_slider') == false) {
98
-                $cclass = 'post-crumbs ';
99
-            }
100
-            ?>
96
+			$cclass = '';
97
+			if (mom_option('cat_slider') == false) {
98
+				$cclass = 'post-crumbs ';
99
+			}
100
+			?>
101 101
             <div class="<?php echo $cclass; ?>entry-crumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
102 102
 
103 103
                 <?php mom_breadcrumb(); ?>
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function gd_get_breadcrum_links()
121 121
 {
122
-    ob_start();
123
-    geodir_breadcrumb();
124
-    $crums = ob_get_contents();
125
-    ob_get_clean();
126
-    $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127
-    if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128
-        return $matches[0];
129
-    } else return '';
122
+	ob_start();
123
+	geodir_breadcrumb();
124
+	$crums = ob_get_contents();
125
+	ob_get_clean();
126
+	$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
127
+	if (preg_match_all("/$regexp/siU", $crums, $matches)) {
128
+		return $matches[0];
129
+	} else return '';
130 130
 }
131 131
 
132 132
 
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function gd_breadcrumbs_plus_items($items)
142 142
 {   //print_r($items);exit;
143
-    $bits = array();
144
-    $pieces = gd_get_breadcrum_links();
145
-    //unset($pieces[0]);
146
-    $bits = $pieces;
143
+	$bits = array();
144
+	$pieces = gd_get_breadcrum_links();
145
+	//unset($pieces[0]);
146
+	$bits = $pieces;
147 147
 
148
-    $title = $items['last'];
149
-    if (is_page_geodir_home() || geodir_is_page('location')) {
148
+	$title = $items['last'];
149
+	if (is_page_geodir_home() || geodir_is_page('location')) {
150 150
 
151
-    } elseif (geodir_is_page('listing')) {
151
+	} elseif (geodir_is_page('listing')) {
152 152
 
153
-    } elseif (geodir_is_page('detail')) {
154
-        ob_start();
155
-        geodir_action_page_title();
156
-        $title = ob_get_contents();
157
-        ob_end_clean();
158
-    } elseif (geodir_is_page('search')) {
159
-    } elseif (geodir_is_page('author')) {
160
-    }
153
+	} elseif (geodir_is_page('detail')) {
154
+		ob_start();
155
+		geodir_action_page_title();
156
+		$title = ob_get_contents();
157
+		ob_end_clean();
158
+	} elseif (geodir_is_page('search')) {
159
+	} elseif (geodir_is_page('author')) {
160
+	}
161 161
 
162
-    $title = strip_tags($title);
163
-    $items = gd_breadcrumbs_plus_items_add($items, $bits, $title);
162
+	$title = strip_tags($title);
163
+	$items = gd_breadcrumbs_plus_items_add($items, $bits, $title);
164 164
 
165 165
 
166
-    return $items;
166
+	return $items;
167 167
 }
168 168
 
169 169
 
@@ -179,28 +179,28 @@  discard block
 block discarded – undo
179 179
  */
180 180
 function gd_breadcrumbs_plus_items_add($items, $bits, $last)
181 181
 {
182
-    //$pieces = explode("</div>", $items[0]);
183
-    if (is_array($bits)) {
184
-        $items = array();
185
-        $pieces = '';
186
-        foreach ($bits as $bit) {
187
-            $pieces .= $bit;
188
-        }
189
-        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
190
-        if (isset($last) && $last) {
191
-            $items['last'] = $last;
192
-        }
193
-    }
194
-
195
-    //print_r($items);
196
-    return $items;
182
+	//$pieces = explode("</div>", $items[0]);
183
+	if (is_array($bits)) {
184
+		$items = array();
185
+		$pieces = '';
186
+		foreach ($bits as $bit) {
187
+			$pieces .= $bit;
188
+		}
189
+		$items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
190
+		if (isset($last) && $last) {
191
+			$items['last'] = $last;
192
+		}
193
+	}
194
+
195
+	//print_r($items);
196
+	return $items;
197 197
 
198 198
 }
199 199
 
200 200
 add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
201 201
 add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
202 202
 function gd_multinews_mobile_menu_caret($html){
203
-    $html .= '<i class="responsive-caret"></i>';
204
-    return $html;
203
+	$html .= '<i class="responsive-caret"></i>';
204
+	return $html;
205 205
 
206 206
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         foreach ($bits as $bit) {
187 187
             $pieces .= $bit;
188 188
         }
189
-        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>";
189
+        $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">'.$pieces."</div>";
190 190
         if (isset($last) && $last) {
191 191
             $items['last'] = $last;
192 192
         }
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 
198 198
 }
199 199
 
200
-add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
201
-add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1);
202
-function gd_multinews_mobile_menu_caret($html){
200
+add_filter('geodir_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1);
201
+add_filter('geodir_location_switcher_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1);
202
+function gd_multinews_mobile_menu_caret($html) {
203 203
     $html .= '<i class="responsive-caret"></i>';
204 204
     return $html;
205 205
 
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 3 patches
Braces   +170 added lines, -121 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
     if (get_option('geodir_show_addlisting_nav')) {
154 157
 
155 158
         $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
159
+        if (geodir_is_page('add-listing')) {
160
+                    $menu_class = 'current-menu-item';
161
+        }
158 162
 
159 163
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160 164
         $post_types = geodir_get_posttypes('object');
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
                                 if (geodir_get_addlisting_link($post_type)) {
171 175
 
172 176
                                     $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
177
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
178
+                                                                            $menu_class = 'current-menu-item';
179
+                                    }
175 180
                                     /**
176 181
                                      * Filter the menu li class.
177 182
                                      *
@@ -255,8 +260,9 @@  discard block
 block discarded – undo
255 260
                                     if (geodir_get_addlisting_link($post_type)) {
256 261
 
257 262
                                         $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
263
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
264
+                                                                                    $menu_class = 'current-menu-item';
265
+                                        }
260 266
                                         /**
261 267
                                          * Filter the menu li class.
262 268
                                          *
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
     }
312 318
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 319
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
320
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
321
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+    }
316 323
 
317 324
     return $menu;
318 325
 
@@ -398,24 +405,28 @@  discard block
 block discarded – undo
398 405
     $geodir_post_type = get_query_var('post_type');
399 406
 
400 407
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
403
-        elseif (isset($_REQUEST['listing_type']))
404
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
408
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
409
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+        } elseif (isset($_REQUEST['listing_type'])) {
411
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
412
+        }
405 413
     }
406 414
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
416
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417
+    }
409 418
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+    if (is_tax()) {
420
+            $geodir_post_type = geodir_get_taxonomy_posttype();
421
+    }
412 422
 
413 423
 
414 424
     $all_postypes = geodir_get_posttypes();
415 425
     $all_postypes = stripslashes_deep($all_postypes);
416 426
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
427
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
428
+            $geodir_post_type = '';
429
+    }
419 430
 
420 431
 
421 432
     return $geodir_post_type;
@@ -462,11 +473,12 @@  discard block
 block discarded – undo
462 473
         endswitch;
463 474
     }
464 475
 
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
469
-}
476
+    if (!empty($post_types)) {
477
+            return $post_types;
478
+    } else {
479
+            return array();
480
+    }
481
+    }
470 482
 
471 483
 /**
472 484
  * Get Custom Post Type info.
@@ -483,9 +495,10 @@  discard block
 block discarded – undo
483 495
     $post_types = stripslashes_deep($post_types);
484 496
     if (!empty($post_types) && $post_type != '') {
485 497
         return $post_types[$post_type];
486
-    } else
487
-        return false;
488
-}
498
+    } else {
499
+            return false;
500
+    }
501
+    }
489 502
 
490 503
 if (!function_exists('geodir_get_taxonomies')) {
491 504
     /**
@@ -509,18 +522,21 @@  discard block
 block discarded – undo
509 522
             $gd_taxonomies = array_keys($taxonomies);
510 523
 
511 524
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
525
+            if ($post_type != '') {
526
+                            $gd_taxonomies = array();
527
+            }
514 528
 
515 529
             $i = 0;
516 530
             foreach ($taxonomies as $taxonomy => $args) {
517 531
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
532
+                if ($post_type != '' && $args['object_type'] == $post_type) {
533
+                                    $gd_taxonomies[] = $taxonomy;
534
+                }
520 535
 
521 536
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
522
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
523
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
537
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
538
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
539
+                    }
524 540
                 }
525 541
 
526 542
             }
@@ -575,10 +591,11 @@  discard block
 block discarded – undo
575 591
                 . ucfirst($category_obj->name) . '</option>';
576 592
         }
577 593
 
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
594
+        if ($echo) {
595
+                    echo $html;
596
+        } else {
597
+                    return $html;
598
+        }
582 599
     }
583 600
 }
584 601
 
@@ -612,11 +629,12 @@  discard block
 block discarded – undo
612 629
 
613 630
     }
614 631
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
619
-}
632
+    if (!empty($listing_slug)) {
633
+            return $listing_slug;
634
+    } else {
635
+            return false;
636
+    }
637
+    }
620 638
 
621 639
 
622 640
 /**
@@ -647,16 +665,18 @@  discard block
 block discarded – undo
647 665
     if (!empty($taxonomies)) {
648 666
         foreach (geodir_get_posttypes() as $pt) {
649 667
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
668
+            if (array_intersect($taxonomies, $object_taxonomies)) {
669
+                            $post_type[] = $pt;
670
+            }
652 671
         }
653 672
     }
654 673
 
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
659
-}
674
+    if (!empty($post_type)) {
675
+            return $post_type[0];
676
+    } else {
677
+            return false;
678
+    }
679
+    }
660 680
 
661 681
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662 682
     /**
@@ -712,18 +732,18 @@  discard block
 block discarded – undo
712 732
                 $checked = '';
713 733
 
714 734
                 if (in_array($cat_term->term_id, $search_terms)) {
715
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
716
-                        $checked = 'selected="selected"';
717
-                    else
718
-                        $checked = 'checked="checked"';
735
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
736
+                                            $checked = 'selected="selected"';
737
+                    } else {
738
+                                            $checked = 'checked="checked"';
739
+                    }
719 740
                 }
720 741
 
721
-                if ($cat_display == 'radio')
722
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
723
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
725
-
726
-                else {
742
+                if ($cat_display == 'radio') {
743
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
744
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
745
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
746
+                } else {
727 747
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
728 748
                 }
729 749
 
@@ -732,8 +752,9 @@  discard block
 block discarded – undo
732 752
 
733 753
             }
734 754
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
755
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
756
+                            $out .= '</div>';
757
+            }
737 758
 
738 759
             return $out;
739 760
         }
@@ -759,18 +780,21 @@  discard block
 block discarded – undo
759 780
         global $exclude_cats, $gd_session;
760 781
 
761 782
         $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
783
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
784
+                    $cat_exclude = serialize($exclude_cats);
785
+        }
764 786
 
765 787
         if (isset($_REQUEST['backandedit'])) {
766 788
             $post = (object)$gd_session->get('listing');
767 789
 
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
790
+            if (!is_array($post->post_category[$cat_taxonomy])) {
791
+                            $post_category = $post->post_category[$cat_taxonomy];
792
+            }
770 793
 
771 794
             $post_categories = $post->post_category_str;
772
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
773
-                $post_category_str = $post_categories[$cat_taxonomy];
795
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
796
+                            $post_category_str = $post_categories[$cat_taxonomy];
797
+            }
774 798
 
775 799
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776 800
             global $post;
@@ -961,8 +985,9 @@  discard block
 block discarded – undo
961 985
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962 986
             $post_cat_str = $post_categories[$cat_taxonomy];
963 987
             $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
988
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
989
+                            $style = "display:none;";
990
+            }
966 991
         }
967 992
         ?>
968 993
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -997,7 +1022,7 @@  discard block
 block discarded – undo
997 1022
         print_r($exclude_cats);
998 1023
         if(is_array( $exclude_cats)){
999 1024
             $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1025
+        } else{
1001 1026
             $exclude_cats = intval($exclude_cats);
1002 1027
         }
1003 1028
 
@@ -1027,7 +1052,10 @@  discard block
 block discarded – undo
1027 1052
 
1028 1053
             <div class="post_default_category">
1029 1054
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1030
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1055
+                       onchange="update_listing_cat()" <?php if ($default) {
1056
+	echo ' checked="checked" ';
1057
+}
1058
+?>   />
1031 1059
         <span> 
1032 1060
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1033 1061
         </span>
@@ -1127,8 +1155,9 @@  discard block
 block discarded – undo
1127 1155
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1156
 
1129 1157
         $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1158
+        if (!$selected) {
1159
+                    $option_slected = ' selected="selected" ';
1160
+        }
1132 1161
 
1133 1162
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1163
 
@@ -1136,8 +1165,9 @@  discard block
 block discarded – undo
1136 1165
 
1137 1166
         foreach ($cat_terms as $cat_term) {
1138 1167
             $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1168
+            if ($selected == $cat_term->term_id) {
1169
+                            $option_selected = ' selected="selected" ';
1170
+            }
1141 1171
 
1142 1172
             // Count child terms
1143 1173
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1202,8 +1232,9 @@  discard block
 block discarded – undo
1202 1232
 
1203 1233
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204 1234
 
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1235
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1236
+            $listing_slug = 'places';
1237
+    }
1207 1238
 
1208 1239
     /**
1209 1240
      * Taxonomies
@@ -1351,7 +1382,7 @@  discard block
 block discarded – undo
1351 1382
     //print_r( $segments);
1352 1383
     if($gd_wpml_get_languages){
1353 1384
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1385
+    } else{
1355 1386
         global $sitepress;
1356 1387
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1388
     }
@@ -1494,8 +1525,9 @@  discard block
 block discarded – undo
1494 1525
                             'city_slug' => $post->city_slug
1495 1526
                         );
1496 1527
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1528
+                    } else {
1529
+                                            $post_location = geodir_get_location();
1530
+                    }
1499 1531
 
1500 1532
 
1501 1533
                 } else {
@@ -1524,8 +1556,9 @@  discard block
 block discarded – undo
1524 1556
                             );
1525 1557
 
1526 1558
                         }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1559
+                    } else {
1560
+                                            $post_location = geodir_get_location();
1561
+                    }
1529 1562
                 }
1530 1563
 
1531 1564
 
@@ -1568,8 +1601,9 @@  discard block
 block discarded – undo
1568 1601
                         $post_terms = $post_terms[0];
1569 1602
                     }
1570 1603
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1604
+                    if (!$post_terms) {
1605
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1606
+                    }
1573 1607
 
1574 1608
                     if (!$post_terms) {
1575 1609
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1583,8 +1617,9 @@  discard block
 block discarded – undo
1583 1617
 
1584 1618
                 $term = get_term_by('id', $post_terms, $taxonomies);
1585 1619
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1620
+                if (!empty($term)) {
1621
+                                    $term_request = $term->slug;
1622
+                }
1588 1623
                 //$term_request = $term->slug.'/';
1589 1624
             }
1590 1625
 
@@ -1599,15 +1634,20 @@  discard block
 block discarded – undo
1599 1634
                 $request_term .= $term_request;
1600 1635
 
1601 1636
             } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1637
+                if (isset($location_request) && $location_request != '') {
1638
+                	$request_term = $location_request;
1639
+                }
1603 1640
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1641
+                if (isset($term_request) && $term_request != '') {
1642
+                	$request_term .= $term_request;
1643
+                }
1605 1644
             }
1606 1645
             $request_term = trim($request_term, '/');
1607
-            if (!empty($request_term))
1608
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1609
-            else
1610
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1646
+            if (!empty($request_term)) {
1647
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1648
+            } else {
1649
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1650
+            }
1611 1651
             //echo $post_link ;
1612 1652
         }
1613 1653
         // temp cache the permalink
@@ -1649,8 +1689,9 @@  discard block
 block discarded – undo
1649 1689
             if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650 1690
                 $include_location = true;
1651 1691
             }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1692
+        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1693
+                    $include_location = true;
1694
+        }
1654 1695
 
1655 1696
         if ($include_location) {
1656 1697
             global $post;
@@ -1800,10 +1841,11 @@  discard block
 block discarded – undo
1800 1841
     if (!is_object($obj_post_type)) {
1801 1842
         return;
1802 1843
     }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1844
+    if ($echo) {
1845
+            echo $obj_post_type->labels->singular_name;
1846
+    } else {
1847
+            return $obj_post_type->labels->singular_name;
1848
+    }
1807 1849
 
1808 1850
 }
1809 1851
 
@@ -1820,14 +1862,16 @@  discard block
 block discarded – undo
1820 1862
 {
1821 1863
     $all_postypes = geodir_get_posttypes();
1822 1864
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1865
+    if (!in_array($post_type, $all_postypes)) {
1866
+            return false;
1867
+    }
1825 1868
 
1826 1869
     $obj_post_type = get_post_type_object($post_type);
1827
-    if ($echo)
1828
-        echo $obj_post_type->labels->name;
1829
-    else
1830
-        return $obj_post_type->labels->name;
1870
+    if ($echo) {
1871
+            echo $obj_post_type->labels->name;
1872
+    } else {
1873
+            return $obj_post_type->labels->name;
1874
+    }
1831 1875
 
1832 1876
 }
1833 1877
 
@@ -1852,19 +1896,22 @@  discard block
 block discarded – undo
1852 1896
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1853 1897
 
1854 1898
     if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1899
+        if (0 == $term) {
1900
+                    return 0;
1901
+        }
1857 1902
         $where = 't.term_id = %d';
1858
-        if (!empty($taxonomy))
1859
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1860
-        else
1861
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1903
+        if (!empty($taxonomy)) {
1904
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1905
+        } else {
1906
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1907
+        }
1862 1908
     }
1863 1909
 
1864 1910
     $term = trim(wp_unslash($term));
1865 1911
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1912
+    if ('' === $slug = sanitize_title($term)) {
1913
+            return 0;
1914
+    }
1868 1915
 
1869 1916
     $where = 't.slug = %s';
1870 1917
 
@@ -1881,14 +1928,16 @@  discard block
 block discarded – undo
1881 1928
         $where_fields[] = $taxonomy;
1882 1929
 
1883 1930
 
1884
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1885
-            return $result;
1931
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1932
+                    return $result;
1933
+        }
1886 1934
 
1887 1935
         return false;
1888 1936
     }
1889 1937
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1938
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1939
+            return $result;
1940
+    }
1892 1941
 
1893 1942
     return false;
1894 1943
 }
Please login to merge, or discard this patch.
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
                              * @since 1.0.0
61 61
                              * @param string $menu_class The menu HTML class.
62 62
                              */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
63
+                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
64 64
                             /**
65 65
                              * Filter the menu a class.
66 66
                              *
67 67
                              * @since 1.0.0
68 68
                              */
69 69
                             $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
71
-									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72
-										' . __(ucfirst($args->labels->name)) . '
70
+                            $items .= '<li class="'.$li_class.'">
71
+									<a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'">
72
+										' . __(ucfirst($args->labels->name)).'
73 73
 									</a>
74 74
 								</li>';
75 75
                         }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
              * @since 1.0.0
89 89
              * @param string $menu_class The menu HTML class.
90 90
              */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
91
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
92 92
             /**
93 93
              * Filter the sub menu li class.
94 94
              *
95 95
              * @since 1.0.0
96 96
              * @param string $menu_class The menu HTML class.
97 97
              */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
98
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
99 99
             /**
100 100
              * Filter the sub menu ul class.
101 101
              *
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
              * @since 1.0.0
115 115
              */
116 116
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
118
-					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119
-					<ul class="' . $sub_ul_class . '">';
117
+            $items .= '<li class="'.$li_class.'">
118
+					<a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
119
+					<ul class="' . $sub_ul_class.'">';
120 120
             $post_types = geodir_get_posttypes('object');
121 121
 
122 122
             $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                                 if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134 134
                                     $menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
137
-														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(ucfirst($args->labels->name),'geodirectory') . '
136
+                                $items .= '<li class="'.$sub_li_class.'">
137
+														<a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'">
138
+															' . __(ucfirst($args->labels->name), 'geodirectory').'
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
              *
152 152
              * @since 1.5.9
153 153
              */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
154
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
155 155
             $items .= '</li>';
156 156
         }
157 157
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                      * @since 1.0.0
185 185
                                      * @param string $menu_class The menu HTML class.
186 186
                                      */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
187
+                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
188 188
                                     /**
189 189
                                      * Filter the menu a class.
190 190
                                      *
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
                                      */
193 193
                                     $a_class = apply_filters('geodir_menu_a_class', '');
194 194
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
196
-											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
195
+                                    $items .= '<li class="'.$li_class.'">
196
+											<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'">
197
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
198 198
 											</a>
199 199
 										</li>';
200 200
                                 }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
              * @since 1.0.0
219 219
              * @param string $menu_class The menu HTML class.
220 220
              */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
221
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
222 222
             /**
223 223
              * Filter the sub menu li class.
224 224
              *
225 225
              * @since 1.0.0
226 226
              * @param string $menu_class The menu HTML class.
227 227
              */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
228
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
229 229
             /**
230 230
              * Filter the sub menu ul class.
231 231
              *
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
              * @since 1.0.0
245 245
              */
246 246
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
248
-					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249
-					<ul class="' . $sub_ul_class . '">';
247
+            $items .= '<li  class="'.$li_class.'">
248
+					<a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
249
+					<ul class="' . $sub_ul_class.'">';
250 250
 
251 251
             $post_types = geodir_get_posttypes('object');
252 252
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
                                          * @since 1.0.0
270 270
                                          * @param string $menu_class The menu HTML class.
271 271
                                          */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
272
+                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
273 273
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
275
-														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
274
+                                        $items .= '<li class="'.$li_class.'">
275
+														<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'">
276
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
277 277
 														</a>
278 278
 													</li>';
279 279
                                     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
 
287 287
             $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
288
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
289 289
             $items .= '</li>';
290 290
 
291 291
         }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
     $geodir_theme_location = get_option('geodir_theme_location_nav');
314 314
     $geodir_theme_location_nav = array();
315 315
     if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
317 317
         $geodir_theme_location_nav[] = $args['theme_location'];
318 318
         update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319 319
     }
320 320
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322 322
     else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
323
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
324 324
 
325 325
     return $menu;
326 326
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
351
+        $items = $items.geodir_add_nav_menu_items();
352 352
         return $items;
353 353
 
354 354
     } else {
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 
374 374
     $taxonomies = geodir_get_taxonomies();
375 375
     $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
376
+    $taxonomies = "'".$taxonomies."'";
377 377
 
378 378
     $pn_categories = $wpdb->get_results(
379 379
         $wpdb->prepare(
380 380
             "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
381
+            array($wpdb->terms.term_id)
382 382
         )
383 383
     );
384 384
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409 409
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
411 411
         elseif (isset($_REQUEST['listing_type']))
412 412
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413 413
     }
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
         switch ($output):
448 448
             case 'object':
449 449
             case 'Object':
450
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
450
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
451 451
                 break;
452 452
             case 'array':
453 453
             case 'Array':
454
-                $post_types = (array)$post_types;
454
+                $post_types = (array) $post_types;
455 455
                 break;
456 456
 			case 'options':
457
-                $post_types = (array)$post_types;
457
+                $post_types = (array) $post_types;
458 458
 				
459 459
 				$options = array();
460 460
 				if (!empty($post_types)) {
@@ -572,15 +572,15 @@  discard block
 block discarded – undo
572 572
 
573 573
         $categories = get_terms($taxonomies);
574 574
 
575
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
575
+        $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
576 576
 
577 577
         foreach ($categories as $category_obj) {
578 578
             $select_opt = '';
579 579
             if ($selected == $category_obj->term_id) {
580 580
                 $select_opt = 'selected="selected"';
581 581
             }
582
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
583
-                . ucfirst($category_obj->name) . '</option>';
582
+            $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">'
583
+                . ucfirst($category_obj->name).'</option>';
584 584
         }
585 585
 
586 586
         if ($echo)
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
     } elseif (isset($wp_query->tax_query->queries)) {
649 649
         $tax_arr = $wp_query->tax_query->queries;
650 650
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
651
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
651
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
652 652
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
653 653
     }
654 654
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 
703 703
             if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
704 704
                 if ($cat_parent == 0) {
705
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
705
+                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display;
706 706
                     $main_list_class = 'class="main_list_selecter"';
707 707
                 } else {
708 708
                     //$display = 'display:none';
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
             if ($cat_display == 'checkbox' || $cat_display == 'radio') {
714 714
                 $p = 0;
715
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
715
+                $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">';
716 716
             }
717 717
 
718 718
             foreach ($cat_terms as $cat_term) {
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
                 }
728 728
 
729 729
                 if ($cat_display == 'radio')
730
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
730
+                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
731 731
                 elseif ($cat_display == 'select' || $cat_display == 'multiselect')
732
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
732
+                    $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>';
733 733
 
734 734
                 else {
735
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
735
+                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
736 736
                 }
737 737
 
738 738
                 // Call recurson to print sub cats
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
             $cat_exclude = serialize($exclude_cats);
772 772
 
773 773
         if (isset($_REQUEST['backandedit'])) {
774
-            $post = (object)$gd_session->get('listing');
774
+            $post = (object) $gd_session->get('listing');
775 775
 
776 776
             if (!is_array($post->post_category[$cat_taxonomy]))
777 777
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
             if (!empty($post_category)) {
805 805
                 $cat1 = array_filter(explode(',', $post_category));
806
-                $post_category = ',' . implode(',', $cat1) . ',';
806
+                $post_category = ','.implode(',', $cat1).',';
807 807
 
808 808
             }
809 809
 
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                 foreach ($post_category_upd as $cat) {
815 815
 
816 816
                     if (!in_array($cat, $exclude_cats) && $cat != '') {
817
-                        $post_category_change .= ',' . $cat;
817
+                        $post_category_change .= ','.$cat;
818 818
                     }
819 819
                 }
820 820
                 $post_category = $post_category_change;
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
             }
827 827
         }
828 828
 
829
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
829
+        echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']"  />';
830 830
 
831
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
831
+        echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']"  />';
832 832
 
833
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
833
+        echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']"  />';
834 834
 
835 835
 
836 836
         ?>
@@ -849,14 +849,14 @@  discard block
 block discarded – undo
849 849
 
850 850
             function show_subcatlist(main_cat, catObj) {
851 851
                 if (main_cat != '') {
852
-					var url = '<?php echo geodir_get_ajax_url();?>';
853
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
854
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
852
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
853
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
854
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
855 855
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
856
-					<?php if ((int)$cat_limit > 0) { ?>
856
+					<?php if ((int) $cat_limit > 0) { ?>
857 857
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
858 858
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
859
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
859
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
860 860
 						return false;
861 861
 					}
862 862
 					<?php } ?>
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
             }
896 896
 
897 897
             function update_listing_cat(el) {
898
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
898
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
899 899
                 var cat_ids = '';
900 900
                 var main_cat = '';
901 901
                 var sub_cat = '';
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         <div class="main_cat_list" style=" <?php if (isset($style)) {
977 977
             echo $style;
978 978
         }?> ">
979
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
979
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
980 980
             ?>
981 981
         </div>
982 982
     <?php
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
     if ($exclude != '') {
1004 1004
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
1005 1005
 
1006
-        if(is_array( $exclude_cats)){
1007
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1008
-        }else{
1006
+        if (is_array($exclude_cats)) {
1007
+            $exclude_cats = array_map('intval', $exclude_cats);
1008
+        } else {
1009 1009
             $exclude_cats = intval($exclude_cats);
1010 1010
         }
1011 1011
 
@@ -1019,25 +1019,25 @@  discard block
 block discarded – undo
1019 1019
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1020 1020
 
1021 1021
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1022
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1022
+            <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>"
1023 1023
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1024 1024
             <?php /* ?>
1025 1025
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1026 1026
 		<?php */ ?>
1027 1027
 
1028
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1028
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1029 1029
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1030 1030
                    checked="checked" disabled="disabled"/>
1031 1031
        <span> 
1032
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1032
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1033 1033
         </span>
1034 1034
             <br/>
1035 1035
 
1036 1036
             <div class="post_default_category">
1037
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1038
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1037
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1038
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1039 1039
         <span> 
1040
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1040
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1041 1041
         </span>
1042 1042
             </div>
1043 1043
 
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
         $post_cat_str = $post_categories[$request_taxonomy];
1071 1071
         $post_cat_array = explode("#", $post_cat_str);
1072 1072
         if (is_array($post_cat_array)) {
1073
-            $post_cat_array = array_unique( $post_cat_array );
1073
+            $post_cat_array = array_unique($post_cat_array);
1074 1074
 
1075 1075
 			foreach ($post_cat_array as $post_cat_html) {
1076 1076
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
                 }
1086 1086
                 $post_sub_catid = '';
1087 1087
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1088
-                    $post_sub_catid = (int)$post_cat_info[1];
1088
+                    $post_sub_catid = (int) $post_cat_info[1];
1089 1089
                 }
1090 1090
 
1091 1091
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             }
1107 1107
 
1108 1108
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1109
-                $post_sub_catid = (int)$post_cat_info[1];
1109
+                $post_sub_catid = (int) $post_cat_info[1];
1110 1110
             }
1111 1111
 
1112 1112
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1138,9 +1138,9 @@  discard block
 block discarded – undo
1138 1138
         if (!$selected)
1139 1139
             $option_slected = ' selected="selected" ';
1140 1140
 
1141
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1141
+        echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >';
1142 1142
 
1143
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1143
+        echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
1144 1144
 
1145 1145
         foreach ($cat_terms as $cat_term) {
1146 1146
             $option_selected = '';
@@ -1148,10 +1148,10 @@  discard block
 block discarded – undo
1148 1148
                 $option_selected = ' selected="selected" ';
1149 1149
 
1150 1150
             // Count child terms
1151
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1152
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1151
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1152
+            $has_child = !empty($child_terms) ? 't' : 'f';
1153 1153
 
1154
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1154
+            echo '<option  '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>';
1155 1155
         }
1156 1156
         echo '</select>';
1157 1157
     }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
             2 => __('Custom field updated.', 'geodirectory'),
1183 1183
             3 => __('Custom field deleted.', 'geodirectory'),
1184 1184
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1185
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1186 1186
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1187 1187
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188 1188
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
     global $wpdb;
1210 1210
 
1211
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1211
+    $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico';
1212 1212
 
1213 1213
     if (!$listing_slug = get_option('geodir_listing_prefix'))
1214 1214
         $listing_slug = 'places';
@@ -1221,11 +1221,11 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
         $gd_placetags = array();
1223 1223
         $gd_placetags['object_type'] = 'gd_place';
1224
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1224
+        $gd_placetags['listing_slug'] = $listing_slug.'/tags';
1225 1225
         $gd_placetags['args'] = array(
1226 1226
             'public' => true,
1227 1227
             'hierarchical' => false,
1228
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1228
+            'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
1229 1229
             'query_var' => true,
1230 1230
 
1231 1231
             'labels' => array(
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
             'menu_icon' => $menu_icon,
1320 1320
             'public' => true,
1321 1321
             'query_var' => true,
1322
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1322
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1323 1323
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324 1324
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325 1325
 
@@ -1341,25 +1341,25 @@  discard block
 block discarded – undo
1341 1341
 }
1342 1342
 
1343 1343
 $gd_wpml_get_languages = "";
1344
-function gd_wpml_get_lang_from_url($url){
1344
+function gd_wpml_get_lang_from_url($url) {
1345 1345
 
1346 1346
     global $gd_wpml_get_languages;
1347
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1347
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1348 1348
 
1349 1349
 
1350 1350
     //
1351
-    $url = str_replace(array("http://","https://"),"",$url);
1352
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1351
+    $url = str_replace(array("http://", "https://"), "", $url);
1352
+    $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url'));
1353 1353
 
1354
-    $url = str_replace($site_url,"",$url);
1354
+    $url = str_replace($site_url, "", $url);
1355 1355
 
1356 1356
 
1357 1357
     $segments = explode('/', trim($url, '/'));
1358 1358
 
1359 1359
     //print_r( $segments);
1360
-    if($gd_wpml_get_languages){
1360
+    if ($gd_wpml_get_languages) {
1361 1361
         $langs = $gd_wpml_get_languages;
1362
-    }else{
1362
+    } else {
1363 1363
         global $sitepress;
1364 1364
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1365 1365
     }
@@ -1424,17 +1424,17 @@  discard block
 block discarded – undo
1424 1424
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1425 1425
 
1426 1426
         // Alter the CPT slug if WPML is set to do so
1427
-        if(function_exists('icl_object_id')){
1428
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1427
+        if (function_exists('icl_object_id')) {
1428
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1429 1429
 
1430 1430
                 $org_slug = $slug;
1431
-                $slug = apply_filters( 'wpml_translate_single_string',
1431
+                $slug = apply_filters('wpml_translate_single_string',
1432 1432
                     $slug,
1433 1433
                     'WordPress',
1434
-                    'URL slug: ' . $slug,
1434
+                    'URL slug: '.$slug,
1435 1435
                     $language_code);
1436 1436
 
1437
-                if(!$slug){$slug = $org_slug;}
1437
+                if (!$slug) {$slug = $org_slug; }
1438 1438
 
1439 1439
             }
1440 1440
         }
@@ -1456,11 +1456,11 @@  discard block
 block discarded – undo
1456 1456
         }
1457 1457
         
1458 1458
         $post_link = trailingslashit(
1459
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1459
+            preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
1460 1460
         );
1461 1461
 
1462 1462
         if ($fix_url) {
1463
-            $post_link = $site_url . $post_link;
1463
+            $post_link = $site_url.$post_link;
1464 1464
         }
1465 1465
 
1466 1466
         if (isset($comment_post_cache[$post->ID])) {
@@ -1479,12 +1479,12 @@  discard block
 block discarded – undo
1479 1479
             $ID = $post->ID;
1480 1480
             $post2 = $wpdb->get_row(
1481 1481
                 $wpdb->prepare(
1482
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1482
+                    "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1483 1483
                     array($post->ID)
1484 1484
                 )
1485 1485
             );
1486 1486
 
1487
-            $post = (object)array_merge((array)$post, (array)$post2);
1487
+            $post = (object) array_merge((array) $post, (array) $post2);
1488 1488
 
1489 1489
             $comment_post_cache[$post->ID] = $post;
1490 1490
         }
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1495 1495
 
1496
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1496
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1497 1497
                 $location_request = '';
1498 1498
 
1499 1499
 
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1508 1508
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1509 1509
 
1510
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1510
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1511 1511
                             'region_slug' => $post->region_slug,
1512 1512
                             'city_slug' => $post->city_slug
1513 1513
                         );
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 
1521 1521
                     $post_location_sql = $wpdb->get_results(
1522 1522
                         $wpdb->prepare(
1523
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1523
+                            "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1524 1524
                             array($post->ID)
1525 1525
                         )
1526 1526
                     );
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1537 1537
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1538 1538
 
1539
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1539
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1540 1540
                                 'region_slug' => $post->region_slug,
1541 1541
                                 'city_slug' => $post->city_slug
1542 1542
                             );
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
 					}
1566 1566
 					$location_slug[] = $city_slug;
1567 1567
 					
1568
-					$location_request .= implode('/', $location_slug) . '/';
1568
+					$location_request .= implode('/', $location_slug).'/';
1569 1569
                 }
1570 1570
             }
1571 1571
 
@@ -1623,9 +1623,9 @@  discard block
 block discarded – undo
1623 1623
             }
1624 1624
             $request_term = trim($request_term, '/');
1625 1625
             if (!empty($request_term))
1626
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1626
+                $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1627 1627
             else
1628
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1628
+                $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1629 1629
             //echo $post_link ;
1630 1630
         }
1631 1631
         // temp cache the permalink
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1677 1677
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1678 1678
             
1679
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1679
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1680 1680
                 $location_terms = array(
1681 1681
                     'gd_country' => $post->country_slug,
1682 1682
                     'gd_region' => $post->region_slug,
@@ -1695,12 +1695,12 @@  discard block
 block discarded – undo
1695 1695
 
1696 1696
             if (!empty($location_terms)) {
1697 1697
 
1698
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1698
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1699 1699
 
1700 1700
                 if (get_option('permalink_structure') != '') {
1701
-                    $old_listing_slug = '/' . $listing_slug . '/';
1701
+                    $old_listing_slug = '/'.$listing_slug.'/';
1702 1702
                     $request_term = implode("/", $location_terms);
1703
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1703
+                    $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/';
1704 1704
 
1705 1705
                     $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1706 1706
                 } else {
@@ -1718,31 +1718,31 @@  discard block
 block discarded – undo
1718 1718
         }*/
1719 1719
 
1720 1720
         // Alter the CPT slug if WPML is set to do so
1721
-        if(function_exists('icl_object_id')){
1721
+        if (function_exists('icl_object_id')) {
1722 1722
             $post_types = get_option('geodir_post_types');
1723
-            $post_type = str_replace("category","",$taxonomy);
1724
-			$post_type = str_replace("_tags","",$post_type);
1723
+            $post_type = str_replace("category", "", $taxonomy);
1724
+			$post_type = str_replace("_tags", "", $post_type);
1725 1725
             $slug = $post_types[$post_type]['rewrite']['slug'];
1726
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1726
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1727 1727
 
1728 1728
                 global $sitepress;
1729 1729
                 $default_lang = $sitepress->get_default_language();
1730 1730
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1731
-                if(!$language_code ){$language_code  = $default_lang;}
1731
+                if (!$language_code) {$language_code = $default_lang; }
1732 1732
 
1733 1733
                 $org_slug = $slug;
1734
-                $slug = apply_filters( 'wpml_translate_single_string',
1734
+                $slug = apply_filters('wpml_translate_single_string',
1735 1735
                     $slug,
1736 1736
                     'WordPress',
1737
-                    'URL slug: ' . $slug,
1737
+                    'URL slug: '.$slug,
1738 1738
                     $language_code);
1739 1739
 
1740 1740
 
1741
-                if(!$slug){$slug = $org_slug;}
1741
+                if (!$slug) {$slug = $org_slug; }
1742 1742
 
1743 1743
                 $termlink = trailingslashit(
1744 1744
 
1745
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1745
+                    preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)
1746 1746
                 );
1747 1747
 
1748 1748
             }
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
 	
1776 1776
 	if (in_array($post_type, geodir_get_posttypes())) {
1777 1777
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1778
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1778
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1779 1779
                 $location_terms = array(
1780 1780
                     'gd_country' => $post->country_slug,
1781 1781
                     'gd_region' => $post->region_slug,
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 					$location_terms = implode("/", $location_terms);
1793 1793
 					$location_terms = rtrim($location_terms, '/');
1794 1794
 					
1795
-					$link .= urldecode($location_terms) . '/';
1795
+					$link .= urldecode($location_terms).'/';
1796 1796
 				} else {
1797 1797
 					$link = geodir_getlink($link, $location_terms);
1798 1798
 				}
@@ -1874,9 +1874,9 @@  discard block
 block discarded – undo
1874 1874
             return 0;
1875 1875
         $where = 't.term_id = %d';
1876 1876
         if (!empty($taxonomy))
1877
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1877
+            return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1878 1878
         else
1879
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1879
+            return $wpdb->get_var($wpdb->prepare($select.$where, $term));
1880 1880
     }
1881 1881
 
1882 1882
     $term = trim(wp_unslash($term));
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 
1889 1889
     $where_fields = array($slug);
1890 1890
     if (!empty($taxonomy)) {
1891
-        $parent = (int)$parent;
1891
+        $parent = (int) $parent;
1892 1892
         if ($parent > 0) {
1893 1893
             $where_fields[] = $parent;
1894 1894
             $else_where_fields[] = $parent;
@@ -1951,13 +1951,13 @@  discard block
 block discarded – undo
1951 1951
         $post_types = geodir_get_posttypes();
1952 1952
         $tax_arr = array();
1953 1953
         foreach ($post_types as $post_type) {
1954
-            $tax_arr[] = "'" . $post_type . "category'";
1954
+            $tax_arr[] = "'".$post_type."category'";
1955 1955
         }
1956 1956
         $tax_c = implode(',', $tax_arr);
1957 1957
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1958 1958
         //$terms = get_terms( $taxonomy );
1959 1959
 
1960
-        if($terms) {
1960
+        if ($terms) {
1961 1961
             foreach ($terms as $term) {
1962 1962
                 $post_type = str_replace("category", "", $term->taxonomy);
1963 1963
                 $a_terms[$post_type][] = $term;
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
             }
1966 1966
         }
1967 1967
 
1968
-        if($a_terms) {
1968
+        if ($a_terms) {
1969 1969
             foreach ($a_terms as $pt => $t2) {
1970 1970
 
1971 1971
                 foreach ($t2 as $term) {
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
     }
1991 1991
 
1992 1992
     if (is_ssl()) {
1993
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1993
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
1994 1994
     }
1995 1995
 
1996 1996
     return $terms_icons;
Please login to merge, or discard this patch.
Indentation   +1186 added lines, -1186 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name)) . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147
+
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
147 158
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -401,32 +401,32 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_get_current_posttype()
403 403
 {
404
-    global $wp_query, $geodir_post_type;
404
+	global $wp_query, $geodir_post_type;
405 405
 
406
-    $geodir_post_type = get_query_var('post_type');
406
+	$geodir_post_type = get_query_var('post_type');
407 407
 
408
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
-    }
408
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+		elseif (isset($_REQUEST['listing_type']))
412
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
+	}
414 414
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417 417
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
418
+	if (is_tax())
419
+		$geodir_post_type = geodir_get_taxonomy_posttype();
420 420
 
421 421
 
422
-    $all_postypes = geodir_get_posttypes();
423
-    $all_postypes = stripslashes_deep($all_postypes);
422
+	$all_postypes = geodir_get_posttypes();
423
+	$all_postypes = stripslashes_deep($all_postypes);
424 424
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
425
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
+		$geodir_post_type = '';
427 427
 
428 428
 
429
-    return $geodir_post_type;
429
+	return $geodir_post_type;
430 430
 }
431 431
 
432 432
 /**
@@ -440,21 +440,21 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function geodir_get_posttypes($output = 'names')
442 442
 {
443
-    $post_types = array();
444
-    $post_types = get_option('geodir_post_types');
445
-    $post_types = stripslashes_deep($post_types);
446
-    if (!empty($post_types)) {
447
-        switch ($output):
448
-            case 'object':
449
-            case 'Object':
450
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
451
-                break;
452
-            case 'array':
453
-            case 'Array':
454
-                $post_types = (array)$post_types;
455
-                break;
443
+	$post_types = array();
444
+	$post_types = get_option('geodir_post_types');
445
+	$post_types = stripslashes_deep($post_types);
446
+	if (!empty($post_types)) {
447
+		switch ($output):
448
+			case 'object':
449
+			case 'Object':
450
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
451
+				break;
452
+			case 'array':
453
+			case 'Array':
454
+				$post_types = (array)$post_types;
455
+				break;
456 456
 			case 'options':
457
-                $post_types = (array)$post_types;
457
+				$post_types = (array)$post_types;
458 458
 				
459 459
 				$options = array();
460 460
 				if (!empty($post_types)) {
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 					}
464 464
 				}
465 465
 				$post_types = $options;
466
-                break;
467
-            default:
468
-                $post_types = array_keys($post_types);
469
-                break;
470
-        endswitch;
471
-    }
472
-
473
-    if (!empty($post_types))
474
-        return $post_types;
475
-    else
476
-        return array();
466
+				break;
467
+			default:
468
+				$post_types = array_keys($post_types);
469
+				break;
470
+		endswitch;
471
+	}
472
+
473
+	if (!empty($post_types))
474
+		return $post_types;
475
+	else
476
+		return array();
477 477
 }
478 478
 
479 479
 /**
@@ -486,108 +486,108 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function geodir_get_posttype_info($post_type = '')
488 488
 {
489
-    $post_types = array();
490
-    $post_types = get_option('geodir_post_types');
491
-    $post_types = stripslashes_deep($post_types);
492
-    if (!empty($post_types) && $post_type != '') {
493
-        return $post_types[$post_type];
494
-    } else
495
-        return false;
489
+	$post_types = array();
490
+	$post_types = get_option('geodir_post_types');
491
+	$post_types = stripslashes_deep($post_types);
492
+	if (!empty($post_types) && $post_type != '') {
493
+		return $post_types[$post_type];
494
+	} else
495
+		return false;
496 496
 }
497 497
 
498 498
 if (!function_exists('geodir_get_taxonomies')) {
499
-    /**
500
-     * Get all custom taxonomies.
501
-     *
502
-     * @since 1.0.0
503
-     * @package GeoDirectory
504
-     * @param string $post_type The post type.
505
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
506
-     * @return array|bool Taxonomies on success. false on failure.
507
-     */
508
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
509
-    {
499
+	/**
500
+	 * Get all custom taxonomies.
501
+	 *
502
+	 * @since 1.0.0
503
+	 * @package GeoDirectory
504
+	 * @param string $post_type The post type.
505
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
506
+	 * @return array|bool Taxonomies on success. false on failure.
507
+	 */
508
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
509
+	{
510 510
 
511
-        $taxonomies = array();
512
-        $gd_taxonomies = array();
511
+		$taxonomies = array();
512
+		$gd_taxonomies = array();
513 513
 
514
-        if ($taxonomies = get_option('geodir_taxonomies')) {
514
+		if ($taxonomies = get_option('geodir_taxonomies')) {
515 515
 
516 516
 
517
-            $gd_taxonomies = array_keys($taxonomies);
517
+			$gd_taxonomies = array_keys($taxonomies);
518 518
 
519 519
 
520
-            if ($post_type != '')
521
-                $gd_taxonomies = array();
520
+			if ($post_type != '')
521
+				$gd_taxonomies = array();
522 522
 
523
-            $i = 0;
524
-            foreach ($taxonomies as $taxonomy => $args) {
523
+			$i = 0;
524
+			foreach ($taxonomies as $taxonomy => $args) {
525 525
 
526
-                if ($post_type != '' && $args['object_type'] == $post_type)
527
-                    $gd_taxonomies[] = $taxonomy;
526
+				if ($post_type != '' && $args['object_type'] == $post_type)
527
+					$gd_taxonomies[] = $taxonomy;
528 528
 
529
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
530
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
531
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
532
-                }
529
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
530
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
531
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
532
+				}
533 533
 
534
-            }
534
+			}
535
+
536
+			$gd_taxonomies = array_values($gd_taxonomies);
537
+		}
535 538
 
536
-            $gd_taxonomies = array_values($gd_taxonomies);
537
-        }
538
-
539
-        /**
540
-         * Filter the taxonomies.
541
-         *
542
-         * @since 1.0.0
543
-         * @param array $gd_taxonomies The taxonomy array.
544
-         */
545
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
546
-
547
-        if (!empty($taxonomies)) {
548
-            return $taxonomies;
549
-        } else {
550
-            return false;
551
-        }
552
-    }
539
+		/**
540
+		 * Filter the taxonomies.
541
+		 *
542
+		 * @since 1.0.0
543
+		 * @param array $gd_taxonomies The taxonomy array.
544
+		 */
545
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
546
+
547
+		if (!empty($taxonomies)) {
548
+			return $taxonomies;
549
+		} else {
550
+			return false;
551
+		}
552
+	}
553 553
 }
554 554
 
555 555
 if (!function_exists(' geodir_get_categories_dl')) {
556
-    /**
557
-     * Get categories dropdown HTML.
558
-     *
559
-     * @since 1.0.0
560
-     * @package GeoDirectory
561
-     * @param string $post_type The post type.
562
-     * @param string $selected The selected value.
563
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
564
-     * @param bool $echo Prints the HTML when set to true. Default: true.
565
-     * @return void|string Dropdown HTML.
566
-     */
567
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
568
-    {
569
-
570
-        $html = '';
571
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
572
-
573
-        $categories = get_terms($taxonomies);
574
-
575
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
576
-
577
-        foreach ($categories as $category_obj) {
578
-            $select_opt = '';
579
-            if ($selected == $category_obj->term_id) {
580
-                $select_opt = 'selected="selected"';
581
-            }
582
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
583
-                . ucfirst($category_obj->name) . '</option>';
584
-        }
585
-
586
-        if ($echo)
587
-            echo $html;
588
-        else
589
-            return $html;
590
-    }
556
+	/**
557
+	 * Get categories dropdown HTML.
558
+	 *
559
+	 * @since 1.0.0
560
+	 * @package GeoDirectory
561
+	 * @param string $post_type The post type.
562
+	 * @param string $selected The selected value.
563
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
564
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
565
+	 * @return void|string Dropdown HTML.
566
+	 */
567
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
568
+	{
569
+
570
+		$html = '';
571
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
572
+
573
+		$categories = get_terms($taxonomies);
574
+
575
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
576
+
577
+		foreach ($categories as $category_obj) {
578
+			$select_opt = '';
579
+			if ($selected == $category_obj->term_id) {
580
+				$select_opt = 'selected="selected"';
581
+			}
582
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
583
+				. ucfirst($category_obj->name) . '</option>';
584
+		}
585
+
586
+		if ($echo)
587
+			echo $html;
588
+		else
589
+			return $html;
590
+	}
591 591
 }
592 592
 
593 593
 
@@ -602,28 +602,28 @@  discard block
 block discarded – undo
602 602
 function geodir_get_listing_slug($object_type = '')
603 603
 {
604 604
 
605
-    $listing_slug = '';
605
+	$listing_slug = '';
606 606
 
607
-    $post_types = get_option('geodir_post_types');
608
-    $taxonomies = get_option('geodir_taxonomies');
607
+	$post_types = get_option('geodir_post_types');
608
+	$taxonomies = get_option('geodir_taxonomies');
609 609
 
610 610
 
611
-    if ($object_type != '') {
612
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
611
+	if ($object_type != '') {
612
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
613 613
 
614
-            $object_info = $post_types[$object_type];
615
-            $listing_slug = $object_info['listing_slug'];
616
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
617
-            $object_info = $taxonomies[$object_type];
618
-            $listing_slug = $object_info['listing_slug'];
619
-        }
614
+			$object_info = $post_types[$object_type];
615
+			$listing_slug = $object_info['listing_slug'];
616
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
617
+			$object_info = $taxonomies[$object_type];
618
+			$listing_slug = $object_info['listing_slug'];
619
+		}
620 620
 
621
-    }
621
+	}
622 622
 
623
-    if (!empty($listing_slug))
624
-        return $listing_slug;
625
-    else
626
-        return false;
623
+	if (!empty($listing_slug))
624
+		return $listing_slug;
625
+	else
626
+		return false;
627 627
 }
628 628
 
629 629
 
@@ -638,212 +638,212 @@  discard block
 block discarded – undo
638 638
  */
639 639
 function geodir_get_taxonomy_posttype($taxonomy = '')
640 640
 {
641
-    global $wp_query;
642
-
643
-    $post_type = array();
644
-    $taxonomies = array();
645
-
646
-    if (!empty($taxonomy)) {
647
-        $taxonomies[] = $taxonomy;
648
-    } elseif (isset($wp_query->tax_query->queries)) {
649
-        $tax_arr = $wp_query->tax_query->queries;
650
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
651
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
652
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
653
-    }
654
-
655
-    if (!empty($taxonomies)) {
656
-        foreach (geodir_get_posttypes() as $pt) {
657
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
658
-            if (array_intersect($taxonomies, $object_taxonomies))
659
-                $post_type[] = $pt;
660
-        }
661
-    }
662
-
663
-    if (!empty($post_type))
664
-        return $post_type[0];
665
-    else
666
-        return false;
641
+	global $wp_query;
642
+
643
+	$post_type = array();
644
+	$taxonomies = array();
645
+
646
+	if (!empty($taxonomy)) {
647
+		$taxonomies[] = $taxonomy;
648
+	} elseif (isset($wp_query->tax_query->queries)) {
649
+		$tax_arr = $wp_query->tax_query->queries;
650
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
651
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
652
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
653
+	}
654
+
655
+	if (!empty($taxonomies)) {
656
+		foreach (geodir_get_posttypes() as $pt) {
657
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
658
+			if (array_intersect($taxonomies, $object_taxonomies))
659
+				$post_type[] = $pt;
660
+		}
661
+	}
662
+
663
+	if (!empty($post_type))
664
+		return $post_type[0];
665
+	else
666
+		return false;
667 667
 }
668 668
 
669 669
 if (!function_exists('geodir_custom_taxonomy_walker')) {
670
-    /**
671
-     * Custom taxonomy walker function.
672
-     *
673
-     * @since 1.0.0
674
-     * @package GeoDirectory
675
-     * @param string $cat_taxonomy The taxonomy name.
676
-     * @param int $cat_parent The parent term ID.
677
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
678
-     * @param int $pading CSS padding in pixels.
679
-     * @return string|void taxonomy HTML.
680
-     */
681
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
682
-    {
683
-        global $cat_display, $post_cat, $exclude_cats;
684
-
685
-        $search_terms = trim($post_cat, ",");
686
-
687
-        $search_terms = explode(",", $search_terms);
688
-
689
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
690
-
691
-        $display = '';
692
-        $onchange = '';
693
-        $term_check = '';
694
-        $main_list_class = '';
695
-        $out = '';
696
-        //If there are terms, start displaying
697
-        if (count($cat_terms) > 0) {
698
-            //Displaying as a list
699
-            $p = $pading * 20;
700
-            $pading++;
701
-
702
-
703
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
704
-                if ($cat_parent == 0) {
705
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
706
-                    $main_list_class = 'class="main_list_selecter"';
707
-                } else {
708
-                    //$display = 'display:none';
709
-                    $list_class = 'sub_list gd-sub-cats-list';
710
-                }
711
-            }
670
+	/**
671
+	 * Custom taxonomy walker function.
672
+	 *
673
+	 * @since 1.0.0
674
+	 * @package GeoDirectory
675
+	 * @param string $cat_taxonomy The taxonomy name.
676
+	 * @param int $cat_parent The parent term ID.
677
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
678
+	 * @param int $pading CSS padding in pixels.
679
+	 * @return string|void taxonomy HTML.
680
+	 */
681
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
682
+	{
683
+		global $cat_display, $post_cat, $exclude_cats;
684
+
685
+		$search_terms = trim($post_cat, ",");
686
+
687
+		$search_terms = explode(",", $search_terms);
688
+
689
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
690
+
691
+		$display = '';
692
+		$onchange = '';
693
+		$term_check = '';
694
+		$main_list_class = '';
695
+		$out = '';
696
+		//If there are terms, start displaying
697
+		if (count($cat_terms) > 0) {
698
+			//Displaying as a list
699
+			$p = $pading * 20;
700
+			$pading++;
701
+
702
+
703
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
704
+				if ($cat_parent == 0) {
705
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
706
+					$main_list_class = 'class="main_list_selecter"';
707
+				} else {
708
+					//$display = 'display:none';
709
+					$list_class = 'sub_list gd-sub-cats-list';
710
+				}
711
+			}
712 712
 
713
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
714
-                $p = 0;
715
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
716
-            }
713
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
714
+				$p = 0;
715
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
716
+			}
717 717
 
718
-            foreach ($cat_terms as $cat_term) {
718
+			foreach ($cat_terms as $cat_term) {
719 719
 
720
-                $checked = '';
720
+				$checked = '';
721 721
 
722
-                if (in_array($cat_term->term_id, $search_terms)) {
723
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
724
-                        $checked = 'selected="selected"';
725
-                    else
726
-                        $checked = 'checked="checked"';
727
-                }
722
+				if (in_array($cat_term->term_id, $search_terms)) {
723
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
724
+						$checked = 'selected="selected"';
725
+					else
726
+						$checked = 'checked="checked"';
727
+				}
728 728
 
729
-                if ($cat_display == 'radio')
730
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
731
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
732
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
729
+				if ($cat_display == 'radio')
730
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
731
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
732
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
733 733
 
734
-                else {
735
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
736
-                }
734
+				else {
735
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
736
+				}
737 737
 
738
-                // Call recurson to print sub cats
739
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
738
+				// Call recurson to print sub cats
739
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
740 740
 
741
-            }
741
+			}
742 742
 
743
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
744
-                $out .= '</div>';
743
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
744
+				$out .= '</div>';
745 745
 
746
-            return $out;
747
-        }
748
-        return;
749
-    }
746
+			return $out;
747
+		}
748
+		return;
749
+	}
750 750
 }
751 751
 
752 752
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
753
-    /**
754
-     * Custom taxonomy walker function.
755
-     *
756
-     * @since 1.0.0
757
-     * @package GeoDirectory
758
-     * @global object $post WordPress Post object.
759
-     * @global object $gd_session GeoDirectory Session object.
760
-     * @param string $cat_taxonomy The taxonomy name.
761
-     * @param string $cat_limit Number of categories to display.
762
-     */
763
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
764
-    {
765
-        $post_category = '';
766
-        $post_category_str = '';
767
-        global $exclude_cats, $gd_session;
768
-
769
-        $cat_exclude = '';
770
-        if (is_array($exclude_cats) && !empty($exclude_cats))
771
-            $cat_exclude = serialize($exclude_cats);
772
-
773
-        if (isset($_REQUEST['backandedit'])) {
774
-            $post = (object)$gd_session->get('listing');
775
-
776
-            if (!is_array($post->post_category[$cat_taxonomy]))
777
-                $post_category = $post->post_category[$cat_taxonomy];
778
-
779
-            $post_categories = $post->post_category_str;
780
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
781
-                $post_category_str = $post_categories[$cat_taxonomy];
782
-
783
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
784
-            global $post;
785
-
786
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
787
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
788
-                $post_category = $post->{$cat_taxonomy};
789
-            }
753
+	/**
754
+	 * Custom taxonomy walker function.
755
+	 *
756
+	 * @since 1.0.0
757
+	 * @package GeoDirectory
758
+	 * @global object $post WordPress Post object.
759
+	 * @global object $gd_session GeoDirectory Session object.
760
+	 * @param string $cat_taxonomy The taxonomy name.
761
+	 * @param string $cat_limit Number of categories to display.
762
+	 */
763
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
764
+	{
765
+		$post_category = '';
766
+		$post_category_str = '';
767
+		global $exclude_cats, $gd_session;
768
+
769
+		$cat_exclude = '';
770
+		if (is_array($exclude_cats) && !empty($exclude_cats))
771
+			$cat_exclude = serialize($exclude_cats);
772
+
773
+		if (isset($_REQUEST['backandedit'])) {
774
+			$post = (object)$gd_session->get('listing');
775
+
776
+			if (!is_array($post->post_category[$cat_taxonomy]))
777
+				$post_category = $post->post_category[$cat_taxonomy];
778
+
779
+			$post_categories = $post->post_category_str;
780
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
781
+				$post_category_str = $post_categories[$cat_taxonomy];
782
+
783
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
784
+			global $post;
785
+
786
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
787
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
788
+				$post_category = $post->{$cat_taxonomy};
789
+			}
790 790
 
791
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
791
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
792 792
 
793
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
794
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
795
-                    if (is_numeric($cat_part)) {
796
-                        $cat_part_arr[] = $cat_part;
797
-                    }
798
-                }
799
-                if (is_array($cat_part_arr)) {
800
-                    $post_category = implode(',', $cat_part_arr);
801
-                }
802
-            }
793
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
794
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
795
+					if (is_numeric($cat_part)) {
796
+						$cat_part_arr[] = $cat_part;
797
+					}
798
+				}
799
+				if (is_array($cat_part_arr)) {
800
+					$post_category = implode(',', $cat_part_arr);
801
+				}
802
+			}
803 803
 
804
-            if (!empty($post_category)) {
805
-                $cat1 = array_filter(explode(',', $post_category));
806
-                $post_category = ',' . implode(',', $cat1) . ',';
804
+			if (!empty($post_category)) {
805
+				$cat1 = array_filter(explode(',', $post_category));
806
+				$post_category = ',' . implode(',', $cat1) . ',';
807 807
 
808
-            }
808
+			}
809 809
 
810
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
810
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
811 811
 
812
-                $post_category_upd = explode(',', $post_category);
813
-                $post_category_change = '';
814
-                foreach ($post_category_upd as $cat) {
812
+				$post_category_upd = explode(',', $post_category);
813
+				$post_category_change = '';
814
+				foreach ($post_category_upd as $cat) {
815 815
 
816
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
817
-                        $post_category_change .= ',' . $cat;
818
-                    }
819
-                }
820
-                $post_category = $post_category_change;
821
-            }
816
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
817
+						$post_category_change .= ',' . $cat;
818
+					}
819
+				}
820
+				$post_category = $post_category_change;
821
+			}
822 822
 
823 823
 
824
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
825
-                $post_category_str = $post_categories[$cat_taxonomy];
826
-            }
827
-        }
824
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
825
+				$post_category_str = $post_categories[$cat_taxonomy];
826
+			}
827
+		}
828 828
 
829
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
829
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
830 830
 
831
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
831
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
832 832
 
833
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
833
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
834 834
 
835 835
 
836
-        ?>
836
+		?>
837 837
         <div class="cat_sublist">
838 838
             <?php
839 839
 
840
-            $post_id = isset($post->ID) ? $post->ID : '';
840
+			$post_id = isset($post->ID) ? $post->ID : '';
841 841
 
842
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
842
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
843 843
 
844
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
845
-            }
846
-            ?>
844
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
845
+			}
846
+			?>
847 847
         </div>
848 848
         <script type="text/javascript">
849 849
 
@@ -966,22 +966,22 @@  discard block
 block discarded – undo
966 966
 
967 967
         </script>
968 968
         <?php
969
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
970
-            $post_cat_str = $post_categories[$cat_taxonomy];
971
-            $post_cat_array = explode("#", $post_cat_str);
972
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
973
-                $style = "display:none;";
974
-        }
975
-        ?>
969
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
970
+			$post_cat_str = $post_categories[$cat_taxonomy];
971
+			$post_cat_array = explode("#", $post_cat_str);
972
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
973
+				$style = "display:none;";
974
+		}
975
+		?>
976 976
         <div class="main_cat_list" style=" <?php if (isset($style)) {
977
-            echo $style;
978
-        }?> ">
977
+			echo $style;
978
+		}?> ">
979 979
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
980
-            ?>
980
+			?>
981 981
         </div>
982 982
     <?php
983 983
 
984
-    }
984
+	}
985 985
 }
986 986
 
987 987
 /**
@@ -998,23 +998,23 @@  discard block
 block discarded – undo
998 998
  */
999 999
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1000 1000
 {
1001
-    global $exclude_cats;
1001
+	global $exclude_cats;
1002 1002
 
1003
-    if ($exclude != '') {
1004
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1003
+	if ($exclude != '') {
1004
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1005 1005
 
1006
-        if(is_array( $exclude_cats)){
1007
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1008
-        }else{
1009
-            $exclude_cats = intval($exclude_cats);
1010
-        }
1006
+		if(is_array( $exclude_cats)){
1007
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1008
+		}else{
1009
+			$exclude_cats = intval($exclude_cats);
1010
+		}
1011 1011
 
1012
-    }
1012
+	}
1013 1013
 
1014
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1015
-        (!is_array($exclude_cats) || empty($exclude_cats))
1016
-    ) {
1017
-        ?>
1014
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1015
+		(!is_array($exclude_cats) || empty($exclude_cats))
1016
+	) {
1017
+		?>
1018 1018
 
1019 1019
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1020 1020
 
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
             <br/>
1045 1045
             <?php
1046
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1047
-            if (!empty($cat_terms)) { ?>
1046
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1047
+			if (!empty($cat_terms)) { ?>
1048 1048
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1049 1049
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1050 1050
             <?php } ?>
@@ -1066,53 +1066,53 @@  discard block
 block discarded – undo
1066 1066
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1067 1067
 {
1068 1068
 
1069
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1070
-        $post_cat_str = $post_categories[$request_taxonomy];
1071
-        $post_cat_array = explode("#", $post_cat_str);
1072
-        if (is_array($post_cat_array)) {
1073
-            $post_cat_array = array_unique( $post_cat_array );
1069
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1070
+		$post_cat_str = $post_categories[$request_taxonomy];
1071
+		$post_cat_array = explode("#", $post_cat_str);
1072
+		if (is_array($post_cat_array)) {
1073
+			$post_cat_array = array_unique( $post_cat_array );
1074 1074
 
1075 1075
 			foreach ($post_cat_array as $post_cat_html) {
1076 1076
 
1077
-                $post_cat_info = explode(":", $post_cat_html);
1078
-                $post_maincat_str = $post_cat_info[0];
1077
+				$post_cat_info = explode(":", $post_cat_html);
1078
+				$post_maincat_str = $post_cat_info[0];
1079 1079
 
1080
-                if (!empty($post_maincat_str)) {
1081
-                    $post_maincat_info = explode(",", $post_maincat_str);
1082
-                    $post_maincat_id = $post_maincat_info[0];
1083
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1084
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1085
-                }
1086
-                $post_sub_catid = '';
1087
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1088
-                    $post_sub_catid = (int)$post_cat_info[1];
1089
-                }
1080
+				if (!empty($post_maincat_str)) {
1081
+					$post_maincat_info = explode(",", $post_maincat_str);
1082
+					$post_maincat_id = $post_maincat_info[0];
1083
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1084
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1085
+				}
1086
+				$post_sub_catid = '';
1087
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1088
+					$post_sub_catid = (int)$post_cat_info[1];
1089
+				}
1090 1090
 
1091
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1091
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1092 1092
 
1093
-            }
1094
-        } else {
1093
+			}
1094
+		} else {
1095 1095
 
1096
-            $post_cat_info = explode(":", $post_cat_str);
1097
-            $post_maincat_str = $post_cat_info[0];
1096
+			$post_cat_info = explode(":", $post_cat_str);
1097
+			$post_maincat_str = $post_cat_info[0];
1098 1098
 
1099
-            $post_sub_catid = '';
1099
+			$post_sub_catid = '';
1100 1100
 
1101
-            if (!empty($post_maincat_str)) {
1102
-                $post_maincat_info = explode(",", $post_maincat_str);
1103
-                $post_maincat_id = $post_maincat_info[0];
1104
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1105
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1106
-            }
1101
+			if (!empty($post_maincat_str)) {
1102
+				$post_maincat_info = explode(",", $post_maincat_str);
1103
+				$post_maincat_id = $post_maincat_info[0];
1104
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1105
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1106
+			}
1107 1107
 
1108
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1109
-                $post_sub_catid = (int)$post_cat_info[1];
1110
-            }
1108
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1109
+				$post_sub_catid = (int)$post_cat_info[1];
1110
+			}
1111 1111
 
1112
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1112
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1113 1113
 
1114
-        }
1115
-    }
1114
+		}
1115
+	}
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1126,35 +1126,35 @@  discard block
 block discarded – undo
1126 1126
  */
1127 1127
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1128 1128
 {
1129
-    global $exclude_cats;
1129
+	global $exclude_cats;
1130 1130
 
1131
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1131
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1132 1132
 
1133
-    if (!empty($cat_terms)) {
1134
-        $onchange = '';
1135
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1133
+	if (!empty($cat_terms)) {
1134
+		$onchange = '';
1135
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1136 1136
 
1137
-        $option_selected = '';
1138
-        if (!$selected)
1139
-            $option_slected = ' selected="selected" ';
1137
+		$option_selected = '';
1138
+		if (!$selected)
1139
+			$option_slected = ' selected="selected" ';
1140 1140
 
1141
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1141
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1142 1142
 
1143
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1143
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1144 1144
 
1145
-        foreach ($cat_terms as $cat_term) {
1146
-            $option_selected = '';
1147
-            if ($selected == $cat_term->term_id)
1148
-                $option_selected = ' selected="selected" ';
1145
+		foreach ($cat_terms as $cat_term) {
1146
+			$option_selected = '';
1147
+			if ($selected == $cat_term->term_id)
1148
+				$option_selected = ' selected="selected" ';
1149 1149
 
1150
-            // Count child terms
1151
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1152
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1150
+			// Count child terms
1151
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1152
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1153 1153
 
1154
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1155
-        }
1156
-        echo '</select>';
1157
-    }
1154
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1155
+		}
1156
+		echo '</select>';
1157
+	}
1158 1158
 }
1159 1159
 
1160 1160
 /**
@@ -1170,28 +1170,28 @@  discard block
 block discarded – undo
1170 1170
  */
1171 1171
 function geodir_custom_update_messages($messages)
1172 1172
 {
1173
-    global $post, $post_ID;
1174
-
1175
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1176
-
1177
-    foreach ($post_types as $post_type => $post_object) {
1178
-
1179
-        $messages[$post_type] = array(
1180
-            0 => '', // Unused. Messages start at index 1.
1181
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1182
-            2 => __('Custom field updated.', 'geodirectory'),
1183
-            3 => __('Custom field deleted.', 'geodirectory'),
1184
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1186
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1187
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1189
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1190
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1191
-        );
1192
-    }
1193
-
1194
-    return $messages;
1173
+	global $post, $post_ID;
1174
+
1175
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1176
+
1177
+	foreach ($post_types as $post_type => $post_object) {
1178
+
1179
+		$messages[$post_type] = array(
1180
+			0 => '', // Unused. Messages start at index 1.
1181
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1182
+			2 => __('Custom field updated.', 'geodirectory'),
1183
+			3 => __('Custom field deleted.', 'geodirectory'),
1184
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1186
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1187
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1189
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1190
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1191
+		);
1192
+	}
1193
+
1194
+	return $messages;
1195 1195
 }
1196 1196
 
1197 1197
 
@@ -1206,181 +1206,181 @@  discard block
 block discarded – undo
1206 1206
 function geodir_register_defaults()
1207 1207
 {
1208 1208
 
1209
-    global $wpdb;
1210
-
1211
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1212
-
1213
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1214
-        $listing_slug = 'places';
1215
-
1216
-    /**
1217
-     * Taxonomies
1218
-     **/
1219
-    //if ( ! taxonomy_exists('gd_place_tags') )
1220
-    {
1221
-
1222
-        $gd_placetags = array();
1223
-        $gd_placetags['object_type'] = 'gd_place';
1224
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1225
-        $gd_placetags['args'] = array(
1226
-            'public' => true,
1227
-            'hierarchical' => false,
1228
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1229
-            'query_var' => true,
1230
-
1231
-            'labels' => array(
1232
-                'name' => __('Place Tags', 'geodirectory'),
1233
-                'singular_name' => __('Place Tag', 'geodirectory'),
1234
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1235
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1236
-                'all_items' => __('All Place Tags', 'geodirectory'),
1237
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1238
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1239
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1240
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1241
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1242
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1243
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1244
-            ),
1245
-        );
1246
-
1247
-
1248
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1249
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1250
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1251
-
1252
-
1253
-        // Update post types and delete tmp options
1254
-        flush_rewrite_rules();
1255
-
1256
-    }
1257
-
1258
-    //if ( ! taxonomy_exists('gd_placecategory') )
1259
-    {
1260
-
1261
-        $gd_placecategory = array();
1262
-        $gd_placecategory['object_type'] = 'gd_place';
1263
-        $gd_placecategory['listing_slug'] = $listing_slug;
1264
-        $gd_placecategory['args'] = array(
1265
-            'public' => true,
1266
-            'hierarchical' => true,
1267
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1268
-            'query_var' => true,
1269
-            'labels' => array(
1270
-                'name' => __('Place Categories', 'geodirectory'),
1271
-                'singular_name' => __('Place Category', 'geodirectory'),
1272
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1273
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1274
-                'all_items' => __('All Place Categories', 'geodirectory'),
1275
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1276
-                'update_item' => __('Update Place Category', 'geodirectory'),
1277
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1278
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1279
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1280
-            ),
1281
-        );
1282
-
1283
-
1284
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1285
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1286
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1287
-
1288
-
1289
-        flush_rewrite_rules();
1290
-    }
1291
-
1292
-    /**
1293
-     * Post Types
1294
-     **/
1295
-
1296
-    //if ( ! post_type_exists('gd_place') )
1297
-    {
1298
-
1299
-        $labels = array(
1300
-            'name' => __('Places', 'geodirectory'),
1301
-            'singular_name' => __('Place', 'geodirectory'),
1302
-            'add_new' => __('Add New', 'geodirectory'),
1303
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1304
-            'edit_item' => __('Edit Place', 'geodirectory'),
1305
-            'new_item' => __('New Place', 'geodirectory'),
1306
-            'view_item' => __('View Place', 'geodirectory'),
1307
-            'search_items' => __('Search Places', 'geodirectory'),
1308
-            'not_found' => __('No Place Found', 'geodirectory'),
1309
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1310
-
1311
-        $place_default = array(
1312
-            'labels' => $labels,
1313
-            'can_export' => true,
1314
-            'capability_type' => 'post',
1315
-            'description' => 'Place post type.',
1316
-            'has_archive' => $listing_slug,
1317
-            'hierarchical' => false,
1318
-            'map_meta_cap' => true,
1319
-            'menu_icon' => $menu_icon,
1320
-            'public' => true,
1321
-            'query_var' => true,
1322
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1323
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325
-
1326
-        //Update custom post types
1327
-        $geodir_post_types = get_option('geodir_post_types');
1328
-        $geodir_post_types['gd_place'] = $place_default;
1329
-        update_option('geodir_post_types', $geodir_post_types);
1330
-
1331
-        // Update post types and delete tmp options
1332
-        flush_rewrite_rules();
1333
-    }
1334
-
1335
-
1336
-    geodir_register_taxonomies();
1337
-    geodir_register_post_types();
1338
-
1339
-    //die;
1209
+	global $wpdb;
1210
+
1211
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1212
+
1213
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1214
+		$listing_slug = 'places';
1215
+
1216
+	/**
1217
+	 * Taxonomies
1218
+	 **/
1219
+	//if ( ! taxonomy_exists('gd_place_tags') )
1220
+	{
1221
+
1222
+		$gd_placetags = array();
1223
+		$gd_placetags['object_type'] = 'gd_place';
1224
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1225
+		$gd_placetags['args'] = array(
1226
+			'public' => true,
1227
+			'hierarchical' => false,
1228
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1229
+			'query_var' => true,
1230
+
1231
+			'labels' => array(
1232
+				'name' => __('Place Tags', 'geodirectory'),
1233
+				'singular_name' => __('Place Tag', 'geodirectory'),
1234
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1235
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1236
+				'all_items' => __('All Place Tags', 'geodirectory'),
1237
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1238
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1239
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1240
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1241
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1242
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1243
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1244
+			),
1245
+		);
1246
+
1247
+
1248
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1249
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1250
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1251
+
1252
+
1253
+		// Update post types and delete tmp options
1254
+		flush_rewrite_rules();
1255
+
1256
+	}
1257
+
1258
+	//if ( ! taxonomy_exists('gd_placecategory') )
1259
+	{
1260
+
1261
+		$gd_placecategory = array();
1262
+		$gd_placecategory['object_type'] = 'gd_place';
1263
+		$gd_placecategory['listing_slug'] = $listing_slug;
1264
+		$gd_placecategory['args'] = array(
1265
+			'public' => true,
1266
+			'hierarchical' => true,
1267
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1268
+			'query_var' => true,
1269
+			'labels' => array(
1270
+				'name' => __('Place Categories', 'geodirectory'),
1271
+				'singular_name' => __('Place Category', 'geodirectory'),
1272
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1273
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1274
+				'all_items' => __('All Place Categories', 'geodirectory'),
1275
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1276
+				'update_item' => __('Update Place Category', 'geodirectory'),
1277
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1278
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1279
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1280
+			),
1281
+		);
1282
+
1283
+
1284
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1285
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1286
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1287
+
1288
+
1289
+		flush_rewrite_rules();
1290
+	}
1291
+
1292
+	/**
1293
+	 * Post Types
1294
+	 **/
1295
+
1296
+	//if ( ! post_type_exists('gd_place') )
1297
+	{
1298
+
1299
+		$labels = array(
1300
+			'name' => __('Places', 'geodirectory'),
1301
+			'singular_name' => __('Place', 'geodirectory'),
1302
+			'add_new' => __('Add New', 'geodirectory'),
1303
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1304
+			'edit_item' => __('Edit Place', 'geodirectory'),
1305
+			'new_item' => __('New Place', 'geodirectory'),
1306
+			'view_item' => __('View Place', 'geodirectory'),
1307
+			'search_items' => __('Search Places', 'geodirectory'),
1308
+			'not_found' => __('No Place Found', 'geodirectory'),
1309
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1310
+
1311
+		$place_default = array(
1312
+			'labels' => $labels,
1313
+			'can_export' => true,
1314
+			'capability_type' => 'post',
1315
+			'description' => 'Place post type.',
1316
+			'has_archive' => $listing_slug,
1317
+			'hierarchical' => false,
1318
+			'map_meta_cap' => true,
1319
+			'menu_icon' => $menu_icon,
1320
+			'public' => true,
1321
+			'query_var' => true,
1322
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1323
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325
+
1326
+		//Update custom post types
1327
+		$geodir_post_types = get_option('geodir_post_types');
1328
+		$geodir_post_types['gd_place'] = $place_default;
1329
+		update_option('geodir_post_types', $geodir_post_types);
1330
+
1331
+		// Update post types and delete tmp options
1332
+		flush_rewrite_rules();
1333
+	}
1334
+
1335
+
1336
+	geodir_register_taxonomies();
1337
+	geodir_register_post_types();
1338
+
1339
+	//die;
1340 1340
 
1341 1341
 }
1342 1342
 
1343 1343
 $gd_wpml_get_languages = "";
1344 1344
 function gd_wpml_get_lang_from_url($url){
1345 1345
 
1346
-    global $gd_wpml_get_languages;
1347
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1346
+	global $gd_wpml_get_languages;
1347
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1348 1348
 
1349 1349
 
1350
-    //
1351
-    $url = str_replace(array("http://","https://"),"",$url);
1352
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1350
+	//
1351
+	$url = str_replace(array("http://","https://"),"",$url);
1352
+	$site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1353 1353
 
1354
-    $url = str_replace($site_url,"",$url);
1354
+	$url = str_replace($site_url,"",$url);
1355 1355
 
1356 1356
 
1357
-    $segments = explode('/', trim($url, '/'));
1357
+	$segments = explode('/', trim($url, '/'));
1358 1358
 
1359
-    //print_r( $segments);
1360
-    if($gd_wpml_get_languages){
1361
-        $langs = $gd_wpml_get_languages;
1362
-    }else{
1363
-        global $sitepress;
1364
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1365
-    }
1359
+	//print_r( $segments);
1360
+	if($gd_wpml_get_languages){
1361
+		$langs = $gd_wpml_get_languages;
1362
+	}else{
1363
+		global $sitepress;
1364
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1365
+	}
1366 1366
 
1367
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1368
-        return $segments[0];
1369
-    }
1367
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1368
+		return $segments[0];
1369
+	}
1370 1370
 
1371
-    return false;
1371
+	return false;
1372 1372
 
1373 1373
 
1374 1374
 }
1375 1375
 
1376 1376
 function gd_wpml_slug_translation_turned_on($post_type) {
1377 1377
 
1378
-    global $sitepress;
1379
-    $settings = $sitepress->get_settings();
1380
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1381
-    && $settings['posts_slug_translation']['types'][$post_type]
1382
-    && isset($settings['posts_slug_translation']['on'])
1383
-    && $settings['posts_slug_translation']['on'];
1378
+	global $sitepress;
1379
+	$settings = $sitepress->get_settings();
1380
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1381
+	&& $settings['posts_slug_translation']['types'][$post_type]
1382
+	&& isset($settings['posts_slug_translation']['on'])
1383
+	&& $settings['posts_slug_translation']['on'];
1384 1384
 }
1385 1385
 
1386 1386
 
@@ -1405,150 +1405,150 @@  discard block
 block discarded – undo
1405 1405
  */
1406 1406
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1407 1407
 {
1408
-    //echo $post_link."<br />".$sample ;
1408
+	//echo $post_link."<br />".$sample ;
1409 1409
 
1410 1410
 
1411
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1412
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1413
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1414
-        return $post_link;
1415
-    } else {
1416
-        $orig_post = $post;
1417
-        $post = $post_obj;
1418
-    }
1411
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1412
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1413
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1414
+		return $post_link;
1415
+	} else {
1416
+		$orig_post = $post;
1417
+		$post = $post_obj;
1418
+	}
1419 1419
 
1420
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1420
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1421 1421
 
1422 1422
 
1423
-        $post_types = get_option('geodir_post_types');
1424
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1423
+		$post_types = get_option('geodir_post_types');
1424
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1425 1425
 
1426
-        // Alter the CPT slug if WPML is set to do so
1427
-        if(function_exists('icl_object_id')){
1428
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1426
+		// Alter the CPT slug if WPML is set to do so
1427
+		if(function_exists('icl_object_id')){
1428
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1429 1429
 
1430
-                $org_slug = $slug;
1431
-                $slug = apply_filters( 'wpml_translate_single_string',
1432
-                    $slug,
1433
-                    'WordPress',
1434
-                    'URL slug: ' . $slug,
1435
-                    $language_code);
1430
+				$org_slug = $slug;
1431
+				$slug = apply_filters( 'wpml_translate_single_string',
1432
+					$slug,
1433
+					'WordPress',
1434
+					'URL slug: ' . $slug,
1435
+					$language_code);
1436 1436
 
1437
-                if(!$slug){$slug = $org_slug;}
1437
+				if(!$slug){$slug = $org_slug;}
1438 1438
 
1439
-            }
1440
-        }
1439
+			}
1440
+		}
1441 1441
 
1442
-        if (function_exists('geodir_location_geo_home_link')) {
1443
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1444
-        }
1442
+		if (function_exists('geodir_location_geo_home_link')) {
1443
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1444
+		}
1445 1445
         
1446
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1447
-        $site_url = trailingslashit(get_bloginfo('url'));
1446
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1447
+		$site_url = trailingslashit(get_bloginfo('url'));
1448 1448
         
1449
-        if (function_exists('geodir_location_geo_home_link')) {
1450
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1451
-        }
1452
-
1453
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1454
-        if ($fix_url) {
1455
-            $post_link = str_replace($site_url, '', $post_link);
1456
-        }
1449
+		if (function_exists('geodir_location_geo_home_link')) {
1450
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1451
+		}
1452
+
1453
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1454
+		if ($fix_url) {
1455
+			$post_link = str_replace($site_url, '', $post_link);
1456
+		}
1457 1457
         
1458
-        $post_link = trailingslashit(
1459
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1460
-        );
1461
-
1462
-        if ($fix_url) {
1463
-            $post_link = $site_url . $post_link;
1464
-        }
1465
-
1466
-        if (isset($comment_post_cache[$post->ID])) {
1467
-            $post = $comment_post_cache[$post->ID];
1468
-        }
1469
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1470
-            $post_id = $post->ID;
1471
-            if (isset($orig_post)) {
1472
-                $post = $orig_post;
1473
-            }
1474
-            return $gd_permalink_cache[$post_id];
1475
-        }
1458
+		$post_link = trailingslashit(
1459
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1460
+		);
1476 1461
 
1477
-        if (!isset($post->post_locations)) {
1478
-            $post_type = $post->post_type;
1479
-            $ID = $post->ID;
1480
-            $post2 = $wpdb->get_row(
1481
-                $wpdb->prepare(
1482
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1483
-                    array($post->ID)
1484
-                )
1485
-            );
1462
+		if ($fix_url) {
1463
+			$post_link = $site_url . $post_link;
1464
+		}
1486 1465
 
1487
-            $post = (object)array_merge((array)$post, (array)$post2);
1466
+		if (isset($comment_post_cache[$post->ID])) {
1467
+			$post = $comment_post_cache[$post->ID];
1468
+		}
1469
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1470
+			$post_id = $post->ID;
1471
+			if (isset($orig_post)) {
1472
+				$post = $orig_post;
1473
+			}
1474
+			return $gd_permalink_cache[$post_id];
1475
+		}
1488 1476
 
1489
-            $comment_post_cache[$post->ID] = $post;
1490
-        }
1477
+		if (!isset($post->post_locations)) {
1478
+			$post_type = $post->post_type;
1479
+			$ID = $post->ID;
1480
+			$post2 = $wpdb->get_row(
1481
+				$wpdb->prepare(
1482
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1483
+					array($post->ID)
1484
+				)
1485
+			);
1491 1486
 
1487
+			$post = (object)array_merge((array)$post, (array)$post2);
1492 1488
 
1489
+			$comment_post_cache[$post->ID] = $post;
1490
+		}
1493 1491
 
1494
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1495 1492
 
1496
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1497
-                $location_request = '';
1498 1493
 
1494
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1499 1495
 
1500
-                if (!empty($post->post_locations)) {
1501
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1502
-                    if (count($geodir_arr_locations) == 3) {
1503
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1504
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1505
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1506
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1507
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1508
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1496
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1497
+				$location_request = '';
1509 1498
 
1510
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1511
-                            'region_slug' => $post->region_slug,
1512
-                            'city_slug' => $post->city_slug
1513
-                        );
1514 1499
 
1515
-                    } else
1516
-                        $post_location = geodir_get_location();
1500
+				if (!empty($post->post_locations)) {
1501
+					$geodir_arr_locations = explode(',', $post->post_locations);
1502
+					if (count($geodir_arr_locations) == 3) {
1503
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1504
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1505
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1506
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1507
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1508
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1517 1509
 
1510
+						$post_location = (object)array('country_slug' => $post->country_slug,
1511
+							'region_slug' => $post->region_slug,
1512
+							'city_slug' => $post->city_slug
1513
+						);
1518 1514
 
1519
-                } else {
1515
+					} else
1516
+						$post_location = geodir_get_location();
1520 1517
 
1521
-                    $post_location_sql = $wpdb->get_results(
1522
-                        $wpdb->prepare(
1523
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1524
-                            array($post->ID)
1525
-                        )
1526
-                    );
1527
-
1528
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1529
-
1530
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1531
-                        if (count($geodir_arr_locations) == 3) {
1532
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1533
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1534
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1535
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1536
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1537
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1538
-
1539
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1540
-                                'region_slug' => $post->region_slug,
1541
-                                'city_slug' => $post->city_slug
1542
-                            );
1543 1518
 
1544
-                        }
1545
-                    } else
1546
-                        $post_location = geodir_get_location();
1547
-                }
1519
+				} else {
1548 1520
 
1521
+					$post_location_sql = $wpdb->get_results(
1522
+						$wpdb->prepare(
1523
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1524
+							array($post->ID)
1525
+						)
1526
+					);
1527
+
1528
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1529
+
1530
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1531
+						if (count($geodir_arr_locations) == 3) {
1532
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1533
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1534
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1535
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1536
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1537
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1538
+
1539
+							$post_location = (object)array('country_slug' => $post->country_slug,
1540
+								'region_slug' => $post->region_slug,
1541
+								'city_slug' => $post->city_slug
1542
+							);
1543
+
1544
+						}
1545
+					} else
1546
+						$post_location = geodir_get_location();
1547
+				}
1549 1548
 
1550
-                if (!empty($post_location)) {
1551
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1549
+
1550
+				if (!empty($post_location)) {
1551
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1552 1552
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1553 1553
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1554 1554
 					
@@ -1566,78 +1566,78 @@  discard block
 block discarded – undo
1566 1566
 					$location_slug[] = $city_slug;
1567 1567
 					
1568 1568
 					$location_request .= implode('/', $location_slug) . '/';
1569
-                }
1570
-            }
1569
+				}
1570
+			}
1571 1571
 
1572
-            if (get_option('geodir_add_categories_url')) {
1572
+			if (get_option('geodir_add_categories_url')) {
1573 1573
 
1574
-                $term_request = '';
1575
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1574
+				$term_request = '';
1575
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1576 1576
 
1577
-                $taxonomies = end($taxonomies);
1577
+				$taxonomies = end($taxonomies);
1578 1578
 
1579
-                if (!empty($post->default_category)) {
1580
-                    $post_terms = $post->default_category;
1581
-                } else {
1582
-                    $post_terms = '';
1579
+				if (!empty($post->default_category)) {
1580
+					$post_terms = $post->default_category;
1581
+				} else {
1582
+					$post_terms = '';
1583 1583
 
1584
-                    if (isset($post->{$taxonomies})) {
1585
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1586
-                        $post_terms = $post_terms[0];
1587
-                    }
1584
+					if (isset($post->{$taxonomies})) {
1585
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1586
+						$post_terms = $post_terms[0];
1587
+					}
1588 1588
 
1589
-                    if (!$post_terms)
1590
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1589
+					if (!$post_terms)
1590
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1591 1591
 
1592
-                    if (!$post_terms) {
1593
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1592
+					if (!$post_terms) {
1593
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1594 1594
 
1595
-                        if ($post_terms) {
1596
-                            $post_terms = explode(",", trim($post_terms, ","));
1597
-                            $post_terms = $post_terms[0];
1598
-                        }
1599
-                    }
1600
-                }
1595
+						if ($post_terms) {
1596
+							$post_terms = explode(",", trim($post_terms, ","));
1597
+							$post_terms = $post_terms[0];
1598
+						}
1599
+					}
1600
+				}
1601 1601
 
1602
-                $term = get_term_by('id', $post_terms, $taxonomies);
1602
+				$term = get_term_by('id', $post_terms, $taxonomies);
1603 1603
 
1604
-                if (!empty($term))
1605
-                    $term_request = $term->slug;
1606
-                //$term_request = $term->slug.'/';
1607
-            }
1604
+				if (!empty($term))
1605
+					$term_request = $term->slug;
1606
+				//$term_request = $term->slug.'/';
1607
+			}
1608 1608
 
1609
-            $request_term = '';
1610
-            $listingurl_separator = '';
1611
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1612
-            $detailurl_separator = '';
1613
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1614
-                $request_term = $location_request;
1615
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1616
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1617
-                $request_term .= $term_request;
1609
+			$request_term = '';
1610
+			$listingurl_separator = '';
1611
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1612
+			$detailurl_separator = '';
1613
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1614
+				$request_term = $location_request;
1615
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1616
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1617
+				$request_term .= $term_request;
1618 1618
 
1619
-            } else {
1620
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1619
+			} else {
1620
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1621 1621
 
1622
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1623
-            }
1624
-            $request_term = trim($request_term, '/');
1625
-            if (!empty($request_term))
1626
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1627
-            else
1628
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1629
-            //echo $post_link ;
1630
-        }
1631
-        // temp cache the permalink
1632
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1633
-            $gd_permalink_cache[$post->ID] = $post_link;
1634
-        }
1635
-    }
1636
-    if (isset($orig_post)) {
1637
-        $post = $orig_post;
1638
-    }
1639
-    //echo $post_link ;
1640
-    return $post_link;
1622
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1623
+			}
1624
+			$request_term = trim($request_term, '/');
1625
+			if (!empty($request_term))
1626
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1627
+			else
1628
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1629
+			//echo $post_link ;
1630
+		}
1631
+		// temp cache the permalink
1632
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1633
+			$gd_permalink_cache[$post->ID] = $post_link;
1634
+		}
1635
+	}
1636
+	if (isset($orig_post)) {
1637
+		$post = $orig_post;
1638
+	}
1639
+	//echo $post_link ;
1640
+	return $post_link;
1641 1641
 
1642 1642
 }
1643 1643
 
@@ -1654,103 +1654,103 @@  discard block
 block discarded – undo
1654 1654
  * @return string The term link.
1655 1655
  */
1656 1656
 function geodir_term_link($termlink, $term, $taxonomy) {
1657
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1657
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1658 1658
 
1659
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1660
-        global $geodir_add_location_url, $gd_session;
1661
-        $include_location = false;
1662
-        $request_term = array();
1659
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1660
+		global $geodir_add_location_url, $gd_session;
1661
+		$include_location = false;
1662
+		$request_term = array();
1663 1663
 
1664
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1664
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1665 1665
 
1666
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1667
-            if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1668
-                $include_location = true;
1669
-            }
1670
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1671
-            $include_location = true;
1666
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1667
+			if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1668
+				$include_location = true;
1669
+			}
1670
+		} elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1671
+			$include_location = true;
1672 1672
 
1673
-        if ($include_location) {
1674
-            global $post;
1673
+		if ($include_location) {
1674
+			global $post;
1675 1675
 			
1676 1676
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1677 1677
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1678 1678
             
1679 1679
 			if(geodir_is_page('detail') && isset($post->country_slug)){
1680
-                $location_terms = array(
1681
-                    'gd_country' => $post->country_slug,
1682
-                    'gd_region' => $post->region_slug,
1683
-                    'gd_city' => $post->city_slug
1684
-                );
1680
+				$location_terms = array(
1681
+					'gd_country' => $post->country_slug,
1682
+					'gd_region' => $post->region_slug,
1683
+					'gd_city' => $post->city_slug
1684
+				);
1685 1685
 				
1686 1686
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1687 1687
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1688 1688
 				}
1689
-            } else {
1690
-                $location_terms = geodir_get_current_location_terms('query_vars');
1691
-            }
1689
+			} else {
1690
+				$location_terms = geodir_get_current_location_terms('query_vars');
1691
+			}
1692 1692
 
1693
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1694
-            $location_terms = geodir_remove_location_terms($location_terms);
1693
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1694
+			$location_terms = geodir_remove_location_terms($location_terms);
1695 1695
 
1696
-            if (!empty($location_terms)) {
1696
+			if (!empty($location_terms)) {
1697 1697
 
1698
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1698
+				$url_separator = '';//get_option('geodir_listingurl_separator');
1699 1699
 
1700
-                if (get_option('permalink_structure') != '') {
1701
-                    $old_listing_slug = '/' . $listing_slug . '/';
1702
-                    $request_term = implode("/", $location_terms);
1703
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1700
+				if (get_option('permalink_structure') != '') {
1701
+					$old_listing_slug = '/' . $listing_slug . '/';
1702
+					$request_term = implode("/", $location_terms);
1703
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1704 1704
 
1705
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1706
-                } else {
1707
-                    $termlink = geodir_getlink($termlink, $request_term);
1708
-                }
1709
-            }
1710
-        }
1705
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1706
+				} else {
1707
+					$termlink = geodir_getlink($termlink, $request_term);
1708
+				}
1709
+			}
1710
+		}
1711 1711
 
1712
-        // Alter the CPT slug is WPML is set to do so
1713
-        /* we can replace this with the below function
1712
+		// Alter the CPT slug is WPML is set to do so
1713
+		/* we can replace this with the below function
1714 1714
         if(function_exists('icl_object_id')){
1715 1715
             global $sitepress;
1716 1716
             $post_type = str_replace("category","",$taxonomy);
1717 1717
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1718 1718
         }*/
1719 1719
 
1720
-        // Alter the CPT slug if WPML is set to do so
1721
-        if(function_exists('icl_object_id')){
1722
-            $post_types = get_option('geodir_post_types');
1723
-            $post_type = str_replace("category","",$taxonomy);
1720
+		// Alter the CPT slug if WPML is set to do so
1721
+		if(function_exists('icl_object_id')){
1722
+			$post_types = get_option('geodir_post_types');
1723
+			$post_type = str_replace("category","",$taxonomy);
1724 1724
 			$post_type = str_replace("_tags","",$post_type);
1725
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1726
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1725
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1726
+			if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1727 1727
 
1728
-                global $sitepress;
1729
-                $default_lang = $sitepress->get_default_language();
1730
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1731
-                if(!$language_code ){$language_code  = $default_lang;}
1728
+				global $sitepress;
1729
+				$default_lang = $sitepress->get_default_language();
1730
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1731
+				if(!$language_code ){$language_code  = $default_lang;}
1732 1732
 
1733
-                $org_slug = $slug;
1734
-                $slug = apply_filters( 'wpml_translate_single_string',
1735
-                    $slug,
1736
-                    'WordPress',
1737
-                    'URL slug: ' . $slug,
1738
-                    $language_code);
1733
+				$org_slug = $slug;
1734
+				$slug = apply_filters( 'wpml_translate_single_string',
1735
+					$slug,
1736
+					'WordPress',
1737
+					'URL slug: ' . $slug,
1738
+					$language_code);
1739 1739
 
1740 1740
 
1741
-                if(!$slug){$slug = $org_slug;}
1741
+				if(!$slug){$slug = $org_slug;}
1742 1742
 
1743
-                $termlink = trailingslashit(
1743
+				$termlink = trailingslashit(
1744 1744
 
1745
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1746
-                );
1745
+					preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1746
+				);
1747 1747
 
1748
-            }
1749
-        }
1748
+			}
1749
+		}
1750 1750
 
1751
-    }
1751
+	}
1752 1752
 	
1753
-    return $termlink;
1753
+	return $termlink;
1754 1754
 }
1755 1755
 
1756 1756
 /**
@@ -1776,14 +1776,14 @@  discard block
 block discarded – undo
1776 1776
 	if (in_array($post_type, geodir_get_posttypes())) {
1777 1777
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1778 1778
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1779
-                $location_terms = array(
1780
-                    'gd_country' => $post->country_slug,
1781
-                    'gd_region' => $post->region_slug,
1782
-                    'gd_city' => $post->city_slug
1783
-                );
1784
-            } else {
1785
-                $location_terms = geodir_get_current_location_terms('query_vars');
1786
-            }
1779
+				$location_terms = array(
1780
+					'gd_country' => $post->country_slug,
1781
+					'gd_region' => $post->region_slug,
1782
+					'gd_city' => $post->city_slug
1783
+				);
1784
+			} else {
1785
+				$location_terms = geodir_get_current_location_terms('query_vars');
1786
+			}
1787 1787
 			
1788 1788
 			$location_terms = geodir_remove_location_terms($location_terms);
1789 1789
 			
@@ -1814,14 +1814,14 @@  discard block
 block discarded – undo
1814 1814
  */
1815 1815
 function get_post_type_singular_label($post_type, $echo = false)
1816 1816
 {
1817
-    $obj_post_type = get_post_type_object($post_type);
1818
-    if (!is_object($obj_post_type)) {
1819
-        return;
1820
-    }
1821
-    if ($echo)
1822
-        echo $obj_post_type->labels->singular_name;
1823
-    else
1824
-        return $obj_post_type->labels->singular_name;
1817
+	$obj_post_type = get_post_type_object($post_type);
1818
+	if (!is_object($obj_post_type)) {
1819
+		return;
1820
+	}
1821
+	if ($echo)
1822
+		echo $obj_post_type->labels->singular_name;
1823
+	else
1824
+		return $obj_post_type->labels->singular_name;
1825 1825
 
1826 1826
 }
1827 1827
 
@@ -1836,16 +1836,16 @@  discard block
 block discarded – undo
1836 1836
  */
1837 1837
 function get_post_type_plural_label($post_type, $echo = false)
1838 1838
 {
1839
-    $all_postypes = geodir_get_posttypes();
1839
+	$all_postypes = geodir_get_posttypes();
1840 1840
 
1841
-    if (!in_array($post_type, $all_postypes))
1842
-        return false;
1841
+	if (!in_array($post_type, $all_postypes))
1842
+		return false;
1843 1843
 
1844
-    $obj_post_type = get_post_type_object($post_type);
1845
-    if ($echo)
1846
-        echo $obj_post_type->labels->name;
1847
-    else
1848
-        return $obj_post_type->labels->name;
1844
+	$obj_post_type = get_post_type_object($post_type);
1845
+	if ($echo)
1846
+		echo $obj_post_type->labels->name;
1847
+	else
1848
+		return $obj_post_type->labels->name;
1849 1849
 
1850 1850
 }
1851 1851
 
@@ -1864,51 +1864,51 @@  discard block
 block discarded – undo
1864 1864
  */
1865 1865
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1866 1866
 {
1867
-    global $wpdb;
1868
-
1869
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1870
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1871
-
1872
-    if (is_int($term)) {
1873
-        if (0 == $term)
1874
-            return 0;
1875
-        $where = 't.term_id = %d';
1876
-        if (!empty($taxonomy))
1877
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1878
-        else
1879
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1880
-    }
1867
+	global $wpdb;
1868
+
1869
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1870
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1871
+
1872
+	if (is_int($term)) {
1873
+		if (0 == $term)
1874
+			return 0;
1875
+		$where = 't.term_id = %d';
1876
+		if (!empty($taxonomy))
1877
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1878
+		else
1879
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1880
+	}
1881 1881
 
1882
-    $term = trim(wp_unslash($term));
1882
+	$term = trim(wp_unslash($term));
1883 1883
 
1884
-    if ('' === $slug = sanitize_title($term))
1885
-        return 0;
1884
+	if ('' === $slug = sanitize_title($term))
1885
+		return 0;
1886 1886
 
1887
-    $where = 't.slug = %s';
1887
+	$where = 't.slug = %s';
1888 1888
 
1889
-    $where_fields = array($slug);
1890
-    if (!empty($taxonomy)) {
1891
-        $parent = (int)$parent;
1892
-        if ($parent > 0) {
1893
-            $where_fields[] = $parent;
1894
-            $else_where_fields[] = $parent;
1895
-            $where .= ' AND tt.parent = %d';
1889
+	$where_fields = array($slug);
1890
+	if (!empty($taxonomy)) {
1891
+		$parent = (int)$parent;
1892
+		if ($parent > 0) {
1893
+			$where_fields[] = $parent;
1894
+			$else_where_fields[] = $parent;
1895
+			$where .= ' AND tt.parent = %d';
1896 1896
 
1897
-        }
1897
+		}
1898 1898
 
1899
-        $where_fields[] = $taxonomy;
1899
+		$where_fields[] = $taxonomy;
1900 1900
 
1901 1901
 
1902
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1903
-            return $result;
1902
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1903
+			return $result;
1904 1904
 
1905
-        return false;
1906
-    }
1905
+		return false;
1906
+	}
1907 1907
 
1908
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1909
-        return $result;
1908
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1909
+		return $result;
1910 1910
 
1911
-    return false;
1911
+	return false;
1912 1912
 }
1913 1913
 
1914 1914
 /**
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
 function geodir_get_term_icon_rebuild()
1921 1921
 {
1922 1922
 
1923
-    update_option('gd_term_icons', '');
1923
+	update_option('gd_term_icons', '');
1924 1924
 
1925 1925
 }
1926 1926
 
@@ -1938,60 +1938,60 @@  discard block
 block discarded – undo
1938 1938
  */
1939 1939
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1940 1940
 {
1941
-    global $wpdb;
1942
-    if (!$rebuild) {
1943
-        $terms_icons = get_option('gd_term_icons');
1944
-    } else {
1945
-        $terms_icons = '';
1946
-    }
1947
-
1948
-    if (empty($terms_icons)) {
1949
-        $default_icon_url = get_option('geodir_default_marker_icon');
1950
-        $taxonomy = geodir_get_taxonomies();
1951
-        $post_types = geodir_get_posttypes();
1952
-        $tax_arr = array();
1953
-        foreach ($post_types as $post_type) {
1954
-            $tax_arr[] = "'" . $post_type . "category'";
1955
-        }
1956
-        $tax_c = implode(',', $tax_arr);
1957
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1958
-        //$terms = get_terms( $taxonomy );
1959
-
1960
-        if($terms) {
1961
-            foreach ($terms as $term) {
1962
-                $post_type = str_replace("category", "", $term->taxonomy);
1963
-                $a_terms[$post_type][] = $term;
1941
+	global $wpdb;
1942
+	if (!$rebuild) {
1943
+		$terms_icons = get_option('gd_term_icons');
1944
+	} else {
1945
+		$terms_icons = '';
1946
+	}
1964 1947
 
1965
-            }
1966
-        }
1948
+	if (empty($terms_icons)) {
1949
+		$default_icon_url = get_option('geodir_default_marker_icon');
1950
+		$taxonomy = geodir_get_taxonomies();
1951
+		$post_types = geodir_get_posttypes();
1952
+		$tax_arr = array();
1953
+		foreach ($post_types as $post_type) {
1954
+			$tax_arr[] = "'" . $post_type . "category'";
1955
+		}
1956
+		$tax_c = implode(',', $tax_arr);
1957
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1958
+		//$terms = get_terms( $taxonomy );
1967 1959
 
1968
-        if($a_terms) {
1969
-            foreach ($a_terms as $pt => $t2) {
1960
+		if($terms) {
1961
+			foreach ($terms as $term) {
1962
+				$post_type = str_replace("category", "", $term->taxonomy);
1963
+				$a_terms[$post_type][] = $term;
1970 1964
 
1971
-                foreach ($t2 as $term) {
1972
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1973
-                    if ($term_icon) {
1974
-                        $term_icon_url = $term_icon["src"];
1975
-                    } else {
1976
-                        $term_icon_url = $default_icon_url;
1977
-                    }
1978
-                    $terms_icons[$term->term_id] = $term_icon_url;
1979
-                }
1980
-            }
1981
-        }
1965
+			}
1966
+		}
1982 1967
 
1983
-        update_option('gd_term_icons', $terms_icons);
1984
-    }
1968
+		if($a_terms) {
1969
+			foreach ($a_terms as $pt => $t2) {
1985 1970
 
1986
-    if ($term_id && isset($terms_icons[$term_id])) {
1987
-        return $terms_icons[$term_id];
1988
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
1989
-        return get_option('geodir_default_marker_icon');
1990
-    }
1971
+				foreach ($t2 as $term) {
1972
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1973
+					if ($term_icon) {
1974
+						$term_icon_url = $term_icon["src"];
1975
+					} else {
1976
+						$term_icon_url = $default_icon_url;
1977
+					}
1978
+					$terms_icons[$term->term_id] = $term_icon_url;
1979
+				}
1980
+			}
1981
+		}
1982
+
1983
+		update_option('gd_term_icons', $terms_icons);
1984
+	}
1991 1985
 
1992
-    if (is_ssl()) {
1993
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1994
-    }
1986
+	if ($term_id && isset($terms_icons[$term_id])) {
1987
+		return $terms_icons[$term_id];
1988
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
1989
+		return get_option('geodir_default_marker_icon');
1990
+	}
1991
+
1992
+	if (is_ssl()) {
1993
+		$terms_icons = str_replace("http:","https:",$terms_icons );
1994
+	}
1995 1995
 
1996
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
1996
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
1997 1997
 }
1998 1998
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-templates/geodir-signup.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
  * If user is not signed in, redirect home.
14 14
  */
15 15
 if (get_current_user_id()) {
16
-    wp_redirect(home_url(), 302);
17
-    exit;
16
+	wp_redirect(home_url(), 302);
17
+	exit;
18 18
 }
19 19
 
20 20
 // call header
Please login to merge, or discard this patch.
geodirectory-templates/preview-success.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
     <?php
16 16
 
17 17
 
18
-    global $wpdb;
18
+	global $wpdb;
19 19
 
20
-    $post_id = $_REQUEST['pid'];
21
-    $post_info = get_post($post_id);
20
+	$post_id = $_REQUEST['pid'];
21
+	$post_info = get_post($post_id);
22 22
 
23
-    $posted_date = $post_info->post_date;
24
-    $productlink = get_permalink($post_id);
25
-    $siteName = get_bloginfo('name');
26
-    $siteurl = home_url();
27
-    $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
23
+	$posted_date = $post_info->post_date;
24
+	$productlink = get_permalink($post_id);
25
+	$siteName = get_bloginfo('name');
26
+	$siteurl = home_url();
27
+	$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
28 28
 
29
-    $loginurl = geodir_login_url();
30
-    $loginurl_link = '<a href="' . $loginurl . '">login</a>';
29
+	$loginurl = geodir_login_url();
30
+	$loginurl_link = '<a href="' . $loginurl . '">login</a>';
31 31
 
32
-    $post_author = $post_info->post_author;
32
+	$post_author = $post_info->post_author;
33 33
 
34
-    $user_info = get_userdata($post_author);
35
-    $username = $user_info->user_login;
36
-    $user_email = $user_info->user_email;
34
+	$user_info = get_userdata($post_author);
35
+	$username = $user_info->user_login;
36
+	$user_email = $user_info->user_email;
37 37
 
38
-    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
38
+	$message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
39 39
 
40
-    /*
40
+	/*
41 41
      * Filter the success page message before variable replacements.
42 42
      *
43 43
      * @since 1.5.7
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      * @param object $post_info Post object.
46 46
      * @param object $user_info User object.
47 47
      */
48
-    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
48
+	$message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
49 49
 
50
-    $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51
-    $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
52
-    $message = str_replace($search_array, $replace_array, $message);
50
+	$search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51
+	$replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
52
+	$message = str_replace($search_array, $replace_array, $message);
53 53
 
54
-    /*
54
+	/*
55 55
      * Filter the success page message after variable replacements.
56 56
      *
57 57
      * @since 1.5.7
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
      * @param object $post_info Post object.
60 60
      * @param object $user_info User object.
61 61
      */
62
-    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
62
+	$message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
63 63
 
64 64
 
65 65
 
66
-    ?>
66
+	?>
67 67
 
68 68
     <?php
69 69
 
70
-    /*
70
+	/*
71 71
      * Action called before the success page message wrapper.
72 72
      *
73 73
      * @since 1.5.7
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
      * @param object $post_info Post object.
76 76
      * @param object $user_info User object.
77 77
      */
78
-    do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
79
-    echo '<h5 class="geodir_information">';
80
-    echo $message;
81
-    echo '</h5>';
82
-    /*
78
+	do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
79
+	echo '<h5 class="geodir_information">';
80
+	echo $message;
81
+	echo '</h5>';
82
+	/*
83 83
      * Action called after the success page message wrapper.
84 84
      *
85 85
      * @since 1.5.7
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
      * @param object $post_info Post object.
88 88
      * @param object $user_info User object.
89 89
      */
90
-    do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
90
+	do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
91 91
 
92
-    ?>
92
+	?>
93 93
 
94 94
 </div>
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
     $productlink = get_permalink($post_id);
25 25
     $siteName = get_bloginfo('name');
26 26
     $siteurl = home_url();
27
-    $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
27
+    $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
28 28
 
29 29
     $loginurl = geodir_login_url();
30
-    $loginurl_link = '<a href="' . $loginurl . '">login</a>';
30
+    $loginurl_link = '<a href="'.$loginurl.'">login</a>';
31 31
 
32 32
     $post_author = $post_info->post_author;
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $username = $user_info->user_login;
36 36
     $user_email = $user_info->user_email;
37 37
 
38
-    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
38
+    $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')), 'geodirectory'));
39 39
 
40 40
     /*
41 41
      * Filter the success page message before variable replacements.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param object $post_info Post object.
46 46
      * @param object $user_info User object.
47 47
      */
48
-    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
48
+    $message = apply_filters('geodir_success_page_msg_before_var_replace', $message, $post_info, $user_info);
49 49
 
50 50
     $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
51 51
     $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param object $post_info Post object.
60 60
      * @param object $user_info User object.
61 61
      */
62
-    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
62
+    $message = apply_filters('geodir_success_page_msg_after_var_replace', $message, $post_info, $user_info);
63 63
 
64 64
 
65 65
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param object $post_info Post object.
76 76
      * @param object $user_info User object.
77 77
      */
78
-    do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
78
+    do_action('geodir_before_success_page_msg_wrapper', $message, $post_info, $user_info);
79 79
     echo '<h5 class="geodir_information">';
80 80
     echo $message;
81 81
     echo '</h5>';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param object $post_info Post object.
88 88
      * @param object $user_info User object.
89 89
      */
90
-    do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
90
+    do_action('geodir_after_success_page_msg_wrapper', $message, $post_info, $user_info);
91 91
 
92 92
     ?>
93 93
 
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_reviews_widget.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -14,37 +14,37 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_recent_reviews_widget extends WP_Widget
16 16
 {
17
-    /**
17
+	/**
18 18
 	 * Register the recent reviews widget.
19 19
 	 *
20 20
 	 * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22 22
 	 */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
25
-        parent::__construct(
26
-            'geodir_recent_reviews', // Base ID
27
-            __('GD > Recent Reviews', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
25
+		parent::__construct(
26
+			'geodir_recent_reviews', // Base ID
27
+			__('GD > Recent Reviews', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31 31
 
32 32
 	/**
33 33
 	 * Front-end display content for recent reviews widget.
34 34
 	 *
35 35
 	 * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
36
+	 * @since 1.5.1 Declare function public.
37 37
 	 *
38 38
 	 * @param array $args     Widget arguments.
39 39
 	 * @param array $instance Saved values from database.
40 40
 	 */
41 41
 	public function widget($args, $instance)
42
-    {
43
-        // prints the widget
44
-        extract($args, EXTR_SKIP);
42
+	{
43
+		// prints the widget
44
+		extract($args, EXTR_SKIP);
45 45
 
46
-        /** This filter is documented in geodirectory_widgets.php */
47
-        $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
46
+		/** This filter is documented in geodirectory_widgets.php */
47
+		$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
48 48
 		
49 49
 		/**
50 50
 		 * Filter the number of reviews to display.
@@ -63,35 +63,35 @@  discard block
 block discarded – undo
63 63
 		 * @param int $g_size Height and width of the avatar image in pixels. Default 30.
64 64
 		 */
65 65
 		$g_size = apply_filters('geodir_recent_reviews_g_size', 30);
66
-        /**
67
-         * Filter the excerpt length
68
-         *
69
-         * @since 1.0.0
70
-         *
71
-         * @param int $excerpt_length Excerpt length. Default 100.
72
-         */
73
-        $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
74
-        $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false);
66
+		/**
67
+		 * Filter the excerpt length
68
+		 *
69
+		 * @since 1.0.0
70
+		 *
71
+		 * @param int $excerpt_length Excerpt length. Default 100.
72
+		 */
73
+		$excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
74
+		$comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false);
75 75
 
76
-        if ($comments_li) {
77
-            echo $before_widget;
78
-            ?>
76
+		if ($comments_li) {
77
+			echo $before_widget;
78
+			?>
79 79
             <div class="widget geodir_recent_reviews_section">
80 80
                 <?php if ($title) {
81
-                    echo $before_title . $title . $after_title;
82
-                } ?>
81
+					echo $before_title . $title . $after_title;
82
+				} ?>
83 83
                 <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul>
84 84
             </div>
85 85
             <?php
86
-            echo $after_widget;
87
-        }
88
-    }
86
+			echo $after_widget;
87
+		}
88
+	}
89 89
 
90 90
 	/**
91 91
 	 * Sanitize recent reviews widget form values as they are saved.
92 92
 	 *
93 93
 	 * @since 1.0.0
94
-     * @since 1.5.1 Declare function public.
94
+	 * @since 1.5.1 Declare function public.
95 95
 	 *
96 96
 	 * @param array $new_instance Values just sent to be saved.
97 97
 	 * @param array $old_instance Previously saved values from database.
@@ -99,29 +99,29 @@  discard block
 block discarded – undo
99 99
 	 * @return array Updated safe values to be saved.
100 100
 	 */
101 101
 	public function update($new_instance, $old_instance)
102
-    {
103
-        //save the widget
104
-        $instance = $old_instance;
105
-        $instance['title'] = strip_tags($new_instance['title']);
106
-        $instance['count'] = strip_tags($new_instance['count']);
107
-        return $instance;
108
-    }
102
+	{
103
+		//save the widget
104
+		$instance = $old_instance;
105
+		$instance['title'] = strip_tags($new_instance['title']);
106
+		$instance['count'] = strip_tags($new_instance['count']);
107
+		return $instance;
108
+	}
109 109
     
110 110
 	/**
111 111
 	 * Back-end recent reviews widget settings form.
112 112
 	 *
113 113
 	 * @since 1.0.0
114
-     * @since 1.5.1 Declare function public.
114
+	 * @since 1.5.1 Declare function public.
115 115
 	 *
116 116
 	 * @param array $instance Previously saved values from database.
117 117
 	 */
118 118
 	public function form($instance)
119
-    {
120
-        //widgetform in backend
121
-        $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122
-        $title = strip_tags($instance['title']);
123
-        $count = strip_tags($instance['count']);
124
-        ?>
119
+	{
120
+		//widgetform in backend
121
+		$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122
+		$title = strip_tags($instance['title']);
123
+		$count = strip_tags($instance['count']);
124
+		?>
125 125
         <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat"
126 126
                                                                                          id="<?php echo $this->get_field_id('title'); ?>"
127 127
                                                                                          name="<?php echo $this->get_field_name('title'); ?>"
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                                                                                              value="<?php echo esc_attr($count); ?>"/></label>
136 136
         </p>
137 137
     <?php
138
-    }
138
+	}
139 139
 } // class geodir_recent_reviews_widget
140 140
 
141 141
 register_widget('geodir_recent_reviews_widget');
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             ?>
79 79
             <div class="widget geodir_recent_reviews_section">
80 80
                 <?php if ($title) {
81
-                    echo $before_title . $title . $after_title;
81
+                    echo $before_title.$title.$after_title;
82 82
                 } ?>
83 83
                 <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul>
84 84
             </div>
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	public function form($instance)
119 119
     {
120 120
         //widgetform in backend
121
-        $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
121
+        $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
122 122
         $title = strip_tags($instance['title']);
123 123
         $count = strip_tags($instance['count']);
124 124
         ?>
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_bestof_widget.php 3 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,10 +118,11 @@  discard block
 block discarded – undo
118 118
         $instance['listing_width'] = strip_tags($new_instance['listing_width']);
119 119
         $instance['list_sort'] = strip_tags($new_instance['list_sort']);
120 120
         $instance['character_count'] = $new_instance['character_count'];
121
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
122
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
-        else
124
-            $instance['add_location_filter'] = '0';
121
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
122
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
+        } else {
124
+                    $instance['add_location_filter'] = '0';
125
+        }
125 126
 
126 127
         return $instance;
127 128
     }
@@ -279,7 +280,10 @@  discard block
 block discarded – undo
279 280
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
280 281
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
281 282
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
282
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
283
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
284
+	echo 'checked="checked"';
285
+}
286
+?>
283 287
                        value="1"/>
284 288
             </label>
285 289
         </p>
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
          * @param string $instance ['tab_layout'] Best of widget tab layout name.
52 52
          */
53 53
         $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
-        echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
54
+        echo '<div class="bestof-widget-tab-layout '.$tab_layout.'">';
55 55
         echo $before_widget;
56 56
         $loc_terms = geodir_get_current_location_terms();
57 57
         if (!empty($loc_terms)) {
58
-            $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
58
+            $cur_location = ' : '.geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59 59
         } else {
60 60
             $cur_location = '';
61 61
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
          *
77 77
          * @param string $instance ['title'] The widget title.
78 78
          */
79
-        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
79
+        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name').$cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80 80
 
81 81
         /**
82 82
          * Filter the post type.
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
 
205
-        echo $before_title . __($title,'geodirectory') . $after_title;
205
+        echo $before_title.__($title, 'geodirectory').$after_title;
206 206
 
207 207
         //term navigation - start
208 208
         echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214 214
 
215 215
             if ($is_dropdown) {
216
-                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
216
+                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="'.esc_attr(__('Select Category', 'geodirectory')).'">';
217 217
             } else {
218 218
                 $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219 219
                 $nav_html .= '<dt></dt>';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     }
231 231
                     if ($is_dropdown) {
232 232
                         $selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
-                        $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
233
+                        $nav_html .= '<option '.$selected.' value="'.$cat->term_id.'">'.geodir_ucwords($cat->name).'</option>';
234 234
                     } else {
235 235
                         if ($cat_count == 1) {
236 236
                             $nav_html .= '<dd class="geodir-tab-active">';
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
                             $nav_html .= '<dd class="">';
239 239
                         }
240 240
                         $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
-                        $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
-                        $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
241
+                        $nav_html .= '<a data-termid="'.$cat->term_id.'" href="'.get_term_link($cat, $cat->taxonomy).'">';
242
+                        $nav_html .= '<img alt="'.$cat->name.' icon" class="bestof-cat-icon" src="'.$term_icon_url.'"/>';
243 243
                         $nav_html .= '<span>';
244 244
                         $nav_html .= geodir_ucwords($cat->name);
245 245
                         $nav_html .= '<small>';
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                             if ($num_reviews == 0) {
249 249
                                 $reviews = __('No Reviews', 'geodirectory');
250 250
                             } elseif ($num_reviews > 1) {
251
-                                $reviews = $num_reviews . __(' Reviews', 'geodirectory');
251
+                                $reviews = $num_reviews.__(' Reviews', 'geodirectory');
252 252
                             } else {
253 253
                                 $reviews = __('1 Review', 'geodirectory');
254 254
                             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                  */
322 322
                 $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323 323
 
324
-                echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
324
+                echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>';
325 325
             }
326 326
             if ($excerpt_type == 'show-reviews') {
327 327
                 add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function form($instance)
380 380
     {
381
-        $instance = wp_parse_args((array)$instance,
381
+        $instance = wp_parse_args((array) $instance,
382 382
             array(
383 383
                 'title' => '',
384 384
                 'post_type' => '',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         ?>
405 405
         <p>
406
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
406
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
407 407
 
408 408
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
409 409
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         <p>
415 415
             <label
416
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
416
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
417 417
 
418 418
                 <?php $postypes = geodir_get_posttypes();
419 419
                 /**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         <p>
446 446
 
447 447
             <label
448
-                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
448
+                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
449 449
 
450 450
                 <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>"
451 451
                        name="<?php echo $this->get_field_name('post_limit'); ?>" type="text"
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         <p>
457 457
 
458 458
             <label
459
-                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?>
459
+                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?>
460 460
 
461 461
                 <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>"
462 462
                        name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text"
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
         <p>
468 468
             <label
469
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
469
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
470 470
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
471 471
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
472 472
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         </p>
475 475
         <p>
476 476
             <label
477
-                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?>
477
+                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?>
478 478
 
479 479
                 <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>"
480 480
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 
496 496
         <p>
497 497
             <label
498
-                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?>
498
+                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?>
499 499
 
500 500
                 <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>"
501 501
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 
513 513
         <p>
514 514
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
515
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
515
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
516 516
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
517
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
517
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
518 518
                        value="1"/>
519 519
             </label>
520 520
         </p>
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663 663
         $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664 664
 
665
-        echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
665
+        echo '<h3 class="bestof-cat-title">'.wp_sprintf(__('Best of %s', 'geodirectory'), $term->name).'<a href="'.esc_url($view_all_link).'">'.__("View all", 'geodirectory').'</a></h3>';
666 666
     }
667 667
     if ($excerpt_type == 'show-reviews') {
668 668
         add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
Please login to merge, or discard this patch.
Indentation   +517 added lines, -517 removed lines patch added patch discarded remove patch
@@ -14,280 +14,280 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_bestof_widget extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the best of widget with WordPress.
19
-     *
20
-     * @since 1.3.9
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
-        parent::__construct(
27
-            'bestof_widget', // Base ID
28
-            __('GD > Best of widget', 'geodirectory'), // Name
29
-            $widget_ops// Args
30
-        );
31
-    }
32
-
33
-    /**
34
-     * Front-end display content for best of widget.
35
-     *
36
-     * @since 1.3.9
37
-     * @since 1.5.1 Added filter to view all link.
38
-     * @since 1.5.1 Declare function public.
39
-     *
40
-     * @param array $args Widget arguments.
41
-     * @param array $instance Saved values from database.
42
-     */
43
-    public function widget($args, $instance)
44
-    {
45
-        extract($args);
46
-        /**
47
-         * Filter the best of widget tab layout.
48
-         *
49
-         * @since 1.3.9
50
-         *
51
-         * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
-         */
53
-        $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
-        echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
-        echo $before_widget;
56
-        $loc_terms = geodir_get_current_location_terms();
57
-        if (!empty($loc_terms)) {
58
-            $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
-        } else {
60
-            $cur_location = '';
61
-        }
62
-
63
-        /**
64
-         * Filter the current location name.
65
-         *
66
-         * @since 1.3.9
67
-         *
68
-         * @param string $cur_location Current location name.
69
-         */
70
-        $cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
-
72
-        /**
73
-         * Filter the widget title.
74
-         *
75
-         * @since 1.3.9
76
-         *
77
-         * @param string $instance ['title'] The widget title.
78
-         */
79
-        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
-
81
-        /**
82
-         * Filter the post type.
83
-         *
84
-         * @since 1.3.9
85
-         *
86
-         * @param string $instance ['post_type'] The post type.
87
-         */
88
-        $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
-
90
-        /**
91
-         * Filter the excerpt type.
92
-         *
93
-         * @since 1.5.4
94
-         *
95
-         * @param string $instance ['excerpt_type'] The excerpt type.
96
-         */
97
-        $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
-
99
-
100
-        /**
101
-         * Filter the listing limit.
102
-         *
103
-         * @since 1.3.9
104
-         *
105
-         * @param int $instance ['post_limit'] No. of posts to display.
106
-         */
107
-        $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
-
109
-        /**
110
-         * Filter the category limit.
111
-         *
112
-         * @since 1.3.9
113
-         *
114
-         * @param int $instance ['categ_limit'] No. of categories to display.
115
-         */
116
-        $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
-        $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
-
119
-        /**
120
-         * Filter the use of location filter.
121
-         *
122
-         * @since 1.3.9
123
-         *
124
-         * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
-         */
126
-        $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
-
128
-        // set post type to current viewing post type
129
-        if ($use_viewing_post_type) {
130
-            $current_post_type = geodir_get_current_posttype();
131
-            if ($current_post_type != '' && $current_post_type != $post_type) {
132
-                $post_type = $current_post_type;
133
-            }
134
-        }
135
-
136
-        if (isset($instance['character_count'])) {
137
-            /**
138
-             * Filter the widget's excerpt character count.
139
-             *
140
-             * @since 1.3.9
141
-             *
142
-             * @param int $instance ['character_count'] Excerpt character count.
143
-             */
144
-            $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
-        } else {
146
-            $character_count = '';
147
-        }
148
-
149
-        $category_taxonomy = geodir_get_taxonomies($post_type);
150
-
151
-        $term_args = array(
152
-            'hide_empty' => true,
153
-            'parent' => 0
154
-        );
155
-
156
-        if (is_tax()) {
157
-            $taxonomy = get_query_var('taxonomy');
158
-            $cur_term = get_query_var('term');
159
-            $term_data = get_term_by('name', $cur_term, $taxonomy);
160
-            $term_args['parent'] = $term_data->term_id;
161
-        }
162
-
163
-        $terms = get_terms($category_taxonomy[0], $term_args);
164
-
165
-        $term_reviews = geodir_count_reviews_by_terms();
166
-        $a_terms = array();
167
-        foreach ($terms as $term) {
168
-
169
-
170
-            if ($term->count > 0) {
171
-                if (isset($term_reviews[$term->term_id])) {
172
-                    $term->review_count = $term_reviews[$term->term_id];
173
-                } else {
174
-                    $term->review_count = '0';
175
-                }
176
-
177
-                $a_terms[] = $term;
178
-            }
179
-
180
-        }
181
-
182
-
183
-        $terms = geodir_sort_terms($a_terms, 'review_count');
184
-
185
-        $query_args = array(
186
-            'posts_per_page' => $post_limit,
187
-            'is_geodir_loop' => true,
188
-            'post_type' => $post_type,
189
-            'gd_location' => $add_location_filter ? true : false,
190
-            'order_by' => 'high_review'
191
-        );
192
-        if ($character_count >= 0) {
193
-            $query_args['excerpt_length'] = $character_count;
194
-        }
195
-
196
-        $layout = array();
197
-        if ($tab_layout == 'bestof-tabs-as-dropdown') {
198
-            $layout[] = $tab_layout;
199
-        } else {
200
-            $layout[] = 'bestof-tabs-as-dropdown';
201
-            $layout[] = $tab_layout;
202
-        }
203
-
204
-
205
-        echo $before_title . __($title,'geodirectory') . $after_title;
206
-
207
-        //term navigation - start
208
-        echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
209
-
210
-        $final_html = '';
211
-        foreach ($layout as $tab_layout) {
212
-            $nav_html = '';
213
-            $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214
-
215
-            if ($is_dropdown) {
216
-                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
217
-            } else {
218
-                $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219
-                $nav_html .= '<dt></dt>';
220
-            }
221
-
222
-
223
-            $term_icon = geodir_get_term_icon();
224
-            $cat_count = 0;
225
-            if (!empty($terms)) {
226
-                foreach ($terms as $cat) {
227
-                    $cat_count++;
228
-                    if ($cat_count > $categ_limit) {
229
-                        break;
230
-                    }
231
-                    if ($is_dropdown) {
232
-                        $selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
-                        $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
234
-                    } else {
235
-                        if ($cat_count == 1) {
236
-                            $nav_html .= '<dd class="geodir-tab-active">';
237
-                        } else {
238
-                            $nav_html .= '<dd class="">';
239
-                        }
240
-                        $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
-                        $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
-                        $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
243
-                        $nav_html .= '<span>';
244
-                        $nav_html .= geodir_ucwords($cat->name);
245
-                        $nav_html .= '<small>';
246
-                        if (isset($cat->review_count)) {
247
-                            $num_reviews = $cat->review_count;
248
-                            if ($num_reviews == 0) {
249
-                                $reviews = __('No Reviews', 'geodirectory');
250
-                            } elseif ($num_reviews > 1) {
251
-                                $reviews = $num_reviews . __(' Reviews', 'geodirectory');
252
-                            } else {
253
-                                $reviews = __('1 Review', 'geodirectory');
254
-                            }
255
-                            $nav_html .= $reviews;
256
-                        }
257
-                        $nav_html .= '</small>';
258
-                        $nav_html .= '</span>';
259
-                        $nav_html .= '</a>';
260
-                        $nav_html .= '</dd>';
261
-                    }
262
-                }
263
-            }
264
-
265
-            if ($is_dropdown) {
266
-                $nav_html .= '</select>';
267
-            } else {
268
-                $nav_html .= '</dl>';
269
-            }
270
-            $final_html .= $nav_html;
271
-        }
272
-        if ($terms) {
273
-            echo $final_html;
274
-        }
275
-        echo '</div>';
276
-        //term navigation - end
277
-
278
-        //first term listings by default - start
279
-        $first_term = '';
280
-        if ($terms) {
281
-            $first_term = $terms[0];
282
-            $tax_query = array(
283
-                'taxonomy' => $category_taxonomy[0],
284
-                'field' => 'id',
285
-                'terms' => $first_term->term_id
286
-            );
287
-            $query_args['tax_query'] = array($tax_query);
288
-        }
289
-
290
-        ?>
17
+	/**
18
+	 * Register the best of widget with WordPress.
19
+	 *
20
+	 * @since 1.3.9
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
+		parent::__construct(
27
+			'bestof_widget', // Base ID
28
+			__('GD > Best of widget', 'geodirectory'), // Name
29
+			$widget_ops// Args
30
+		);
31
+	}
32
+
33
+	/**
34
+	 * Front-end display content for best of widget.
35
+	 *
36
+	 * @since 1.3.9
37
+	 * @since 1.5.1 Added filter to view all link.
38
+	 * @since 1.5.1 Declare function public.
39
+	 *
40
+	 * @param array $args Widget arguments.
41
+	 * @param array $instance Saved values from database.
42
+	 */
43
+	public function widget($args, $instance)
44
+	{
45
+		extract($args);
46
+		/**
47
+		 * Filter the best of widget tab layout.
48
+		 *
49
+		 * @since 1.3.9
50
+		 *
51
+		 * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
+		 */
53
+		$tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
+		echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
+		echo $before_widget;
56
+		$loc_terms = geodir_get_current_location_terms();
57
+		if (!empty($loc_terms)) {
58
+			$cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
+		} else {
60
+			$cur_location = '';
61
+		}
62
+
63
+		/**
64
+		 * Filter the current location name.
65
+		 *
66
+		 * @since 1.3.9
67
+		 *
68
+		 * @param string $cur_location Current location name.
69
+		 */
70
+		$cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
+
72
+		/**
73
+		 * Filter the widget title.
74
+		 *
75
+		 * @since 1.3.9
76
+		 *
77
+		 * @param string $instance ['title'] The widget title.
78
+		 */
79
+		$title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
+
81
+		/**
82
+		 * Filter the post type.
83
+		 *
84
+		 * @since 1.3.9
85
+		 *
86
+		 * @param string $instance ['post_type'] The post type.
87
+		 */
88
+		$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
+
90
+		/**
91
+		 * Filter the excerpt type.
92
+		 *
93
+		 * @since 1.5.4
94
+		 *
95
+		 * @param string $instance ['excerpt_type'] The excerpt type.
96
+		 */
97
+		$excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
+
99
+
100
+		/**
101
+		 * Filter the listing limit.
102
+		 *
103
+		 * @since 1.3.9
104
+		 *
105
+		 * @param int $instance ['post_limit'] No. of posts to display.
106
+		 */
107
+		$post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
+
109
+		/**
110
+		 * Filter the category limit.
111
+		 *
112
+		 * @since 1.3.9
113
+		 *
114
+		 * @param int $instance ['categ_limit'] No. of categories to display.
115
+		 */
116
+		$categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
+		$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
+
119
+		/**
120
+		 * Filter the use of location filter.
121
+		 *
122
+		 * @since 1.3.9
123
+		 *
124
+		 * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
+		 */
126
+		$add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
+
128
+		// set post type to current viewing post type
129
+		if ($use_viewing_post_type) {
130
+			$current_post_type = geodir_get_current_posttype();
131
+			if ($current_post_type != '' && $current_post_type != $post_type) {
132
+				$post_type = $current_post_type;
133
+			}
134
+		}
135
+
136
+		if (isset($instance['character_count'])) {
137
+			/**
138
+			 * Filter the widget's excerpt character count.
139
+			 *
140
+			 * @since 1.3.9
141
+			 *
142
+			 * @param int $instance ['character_count'] Excerpt character count.
143
+			 */
144
+			$character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
+		} else {
146
+			$character_count = '';
147
+		}
148
+
149
+		$category_taxonomy = geodir_get_taxonomies($post_type);
150
+
151
+		$term_args = array(
152
+			'hide_empty' => true,
153
+			'parent' => 0
154
+		);
155
+
156
+		if (is_tax()) {
157
+			$taxonomy = get_query_var('taxonomy');
158
+			$cur_term = get_query_var('term');
159
+			$term_data = get_term_by('name', $cur_term, $taxonomy);
160
+			$term_args['parent'] = $term_data->term_id;
161
+		}
162
+
163
+		$terms = get_terms($category_taxonomy[0], $term_args);
164
+
165
+		$term_reviews = geodir_count_reviews_by_terms();
166
+		$a_terms = array();
167
+		foreach ($terms as $term) {
168
+
169
+
170
+			if ($term->count > 0) {
171
+				if (isset($term_reviews[$term->term_id])) {
172
+					$term->review_count = $term_reviews[$term->term_id];
173
+				} else {
174
+					$term->review_count = '0';
175
+				}
176
+
177
+				$a_terms[] = $term;
178
+			}
179
+
180
+		}
181
+
182
+
183
+		$terms = geodir_sort_terms($a_terms, 'review_count');
184
+
185
+		$query_args = array(
186
+			'posts_per_page' => $post_limit,
187
+			'is_geodir_loop' => true,
188
+			'post_type' => $post_type,
189
+			'gd_location' => $add_location_filter ? true : false,
190
+			'order_by' => 'high_review'
191
+		);
192
+		if ($character_count >= 0) {
193
+			$query_args['excerpt_length'] = $character_count;
194
+		}
195
+
196
+		$layout = array();
197
+		if ($tab_layout == 'bestof-tabs-as-dropdown') {
198
+			$layout[] = $tab_layout;
199
+		} else {
200
+			$layout[] = 'bestof-tabs-as-dropdown';
201
+			$layout[] = $tab_layout;
202
+		}
203
+
204
+
205
+		echo $before_title . __($title,'geodirectory') . $after_title;
206
+
207
+		//term navigation - start
208
+		echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
209
+
210
+		$final_html = '';
211
+		foreach ($layout as $tab_layout) {
212
+			$nav_html = '';
213
+			$is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214
+
215
+			if ($is_dropdown) {
216
+				$nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
217
+			} else {
218
+				$nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219
+				$nav_html .= '<dt></dt>';
220
+			}
221
+
222
+
223
+			$term_icon = geodir_get_term_icon();
224
+			$cat_count = 0;
225
+			if (!empty($terms)) {
226
+				foreach ($terms as $cat) {
227
+					$cat_count++;
228
+					if ($cat_count > $categ_limit) {
229
+						break;
230
+					}
231
+					if ($is_dropdown) {
232
+						$selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
+						$nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
234
+					} else {
235
+						if ($cat_count == 1) {
236
+							$nav_html .= '<dd class="geodir-tab-active">';
237
+						} else {
238
+							$nav_html .= '<dd class="">';
239
+						}
240
+						$term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
+						$nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
+						$nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
243
+						$nav_html .= '<span>';
244
+						$nav_html .= geodir_ucwords($cat->name);
245
+						$nav_html .= '<small>';
246
+						if (isset($cat->review_count)) {
247
+							$num_reviews = $cat->review_count;
248
+							if ($num_reviews == 0) {
249
+								$reviews = __('No Reviews', 'geodirectory');
250
+							} elseif ($num_reviews > 1) {
251
+								$reviews = $num_reviews . __(' Reviews', 'geodirectory');
252
+							} else {
253
+								$reviews = __('1 Review', 'geodirectory');
254
+							}
255
+							$nav_html .= $reviews;
256
+						}
257
+						$nav_html .= '</small>';
258
+						$nav_html .= '</span>';
259
+						$nav_html .= '</a>';
260
+						$nav_html .= '</dd>';
261
+					}
262
+				}
263
+			}
264
+
265
+			if ($is_dropdown) {
266
+				$nav_html .= '</select>';
267
+			} else {
268
+				$nav_html .= '</dl>';
269
+			}
270
+			$final_html .= $nav_html;
271
+		}
272
+		if ($terms) {
273
+			echo $final_html;
274
+		}
275
+		echo '</div>';
276
+		//term navigation - end
277
+
278
+		//first term listings by default - start
279
+		$first_term = '';
280
+		if ($terms) {
281
+			$first_term = $terms[0];
282
+			$tax_query = array(
283
+				'taxonomy' => $category_taxonomy[0],
284
+				'field' => 'id',
285
+				'terms' => $first_term->term_id
286
+			);
287
+			$query_args['tax_query'] = array($tax_query);
288
+		}
289
+
290
+		?>
291 291
         <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type"
292 292
                value="<?php echo $post_type; ?>">
293 293
         <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type"
@@ -298,110 +298,110 @@  discard block
 block discarded – undo
298 298
                value="<?php echo $category_taxonomy[0]; ?>">
299 299
         <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter"
300 300
                value="<?php if ($add_location_filter) {
301
-                   echo 1;
302
-               } else {
303
-                   echo 0;
304
-               } ?>">
301
+				   echo 1;
302
+			   } else {
303
+				   echo 0;
304
+			   } ?>">
305 305
         <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count"
306 306
                value="<?php echo $character_count; ?>">
307 307
         <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;">
308 308
             <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fa fa-cog fa-spin"></i></p>
309 309
             <?php
310
-            echo '<div id="geodir-bestof-places">';
311
-            if ($terms) {
312
-                $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
313
-                /**
314
-                 * Filter the page link to view all lisitngs.
315
-                 *
316
-                 * @since 1.5.1
317
-                 *
318
-                 * @param array $view_all_link View all listings page link.
319
-                 * @param array $post_type The Post type.
320
-                 * @param array $first_term The category term object.
321
-                 */
322
-                $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323
-
324
-                echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
325
-            }
326
-            if ($excerpt_type == 'show-reviews') {
327
-                add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
328
-            }
329
-            geodir_bestof_places_by_term($query_args);
330
-            if ($excerpt_type == 'show-reviews') {
331
-                remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
332
-            }
333
-            echo "</div>";
334
-            ?>
310
+			echo '<div id="geodir-bestof-places">';
311
+			if ($terms) {
312
+				$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
313
+				/**
314
+				 * Filter the page link to view all lisitngs.
315
+				 *
316
+				 * @since 1.5.1
317
+				 *
318
+				 * @param array $view_all_link View all listings page link.
319
+				 * @param array $post_type The Post type.
320
+				 * @param array $first_term The category term object.
321
+				 */
322
+				$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323
+
324
+				echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
325
+			}
326
+			if ($excerpt_type == 'show-reviews') {
327
+				add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
328
+			}
329
+			geodir_bestof_places_by_term($query_args);
330
+			if ($excerpt_type == 'show-reviews') {
331
+				remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
332
+			}
333
+			echo "</div>";
334
+			?>
335 335
         </div>
336 336
         <?php //first term listings by default - end
337
-        ?>
337
+		?>
338 338
         <?php echo $after_widget;
339
-        echo "</div>";
340
-    }
341
-
342
-    /**
343
-     * Sanitize best of widget form values as they are saved.
344
-     *
345
-     * @since 1.3.9
346
-     * @since 1.5.1 Declare function public.
347
-     *
348
-     * @param array $new_instance Values just sent to be saved.
349
-     * @param array $old_instance Previously saved values from database.
350
-     *
351
-     * @return array Updated safe values to be saved.
352
-     */
353
-    public function update($new_instance, $old_instance)
354
-    {
355
-        $instance = $old_instance;
356
-        $instance['title'] = strip_tags($new_instance['title']);
357
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
358
-        $instance['post_limit'] = strip_tags($new_instance['post_limit']);
359
-        $instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
360
-        $instance['character_count'] = $new_instance['character_count'];
361
-        $instance['tab_layout'] = $new_instance['tab_layout'];
362
-        $instance['excerpt_type'] = $new_instance['excerpt_type'];
363
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
364
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
365
-        else
366
-            $instance['add_location_filter'] = '0';
367
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
368
-        return $instance;
369
-    }
370
-
371
-    /**
372
-     * Back-end best of widget settings form.
373
-     *
374
-     * @since 1.3.9
375
-     * @since 1.5.1 Declare function public.
376
-     *
377
-     * @param array $instance Previously saved values from database.
378
-     */
379
-    public function form($instance)
380
-    {
381
-        $instance = wp_parse_args((array)$instance,
382
-            array(
383
-                'title' => '',
384
-                'post_type' => '',
385
-                'post_limit' => '5',
386
-                'categ_limit' => '3',
387
-                'character_count' => '20',
388
-                'add_location_filter' => '1',
389
-                'tab_layout' => 'bestof-tabs-on-top',
390
-                'excerpt_type' => 'show-desc',
391
-                'use_viewing_post_type' => ''
392
-            )
393
-        );
394
-        $title = strip_tags($instance['title']);
395
-        $post_type = strip_tags($instance['post_type']);
396
-        $post_limit = strip_tags($instance['post_limit']);
397
-        $categ_limit = strip_tags($instance['categ_limit']);
398
-        $character_count = strip_tags($instance['character_count']);
399
-        $tab_layout = strip_tags($instance['tab_layout']);
400
-        $excerpt_type = strip_tags($instance['excerpt_type']);
401
-        $add_location_filter = strip_tags($instance['add_location_filter']);
402
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
403
-
404
-        ?>
339
+		echo "</div>";
340
+	}
341
+
342
+	/**
343
+	 * Sanitize best of widget form values as they are saved.
344
+	 *
345
+	 * @since 1.3.9
346
+	 * @since 1.5.1 Declare function public.
347
+	 *
348
+	 * @param array $new_instance Values just sent to be saved.
349
+	 * @param array $old_instance Previously saved values from database.
350
+	 *
351
+	 * @return array Updated safe values to be saved.
352
+	 */
353
+	public function update($new_instance, $old_instance)
354
+	{
355
+		$instance = $old_instance;
356
+		$instance['title'] = strip_tags($new_instance['title']);
357
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
358
+		$instance['post_limit'] = strip_tags($new_instance['post_limit']);
359
+		$instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
360
+		$instance['character_count'] = $new_instance['character_count'];
361
+		$instance['tab_layout'] = $new_instance['tab_layout'];
362
+		$instance['excerpt_type'] = $new_instance['excerpt_type'];
363
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
364
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
365
+		else
366
+			$instance['add_location_filter'] = '0';
367
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
368
+		return $instance;
369
+	}
370
+
371
+	/**
372
+	 * Back-end best of widget settings form.
373
+	 *
374
+	 * @since 1.3.9
375
+	 * @since 1.5.1 Declare function public.
376
+	 *
377
+	 * @param array $instance Previously saved values from database.
378
+	 */
379
+	public function form($instance)
380
+	{
381
+		$instance = wp_parse_args((array)$instance,
382
+			array(
383
+				'title' => '',
384
+				'post_type' => '',
385
+				'post_limit' => '5',
386
+				'categ_limit' => '3',
387
+				'character_count' => '20',
388
+				'add_location_filter' => '1',
389
+				'tab_layout' => 'bestof-tabs-on-top',
390
+				'excerpt_type' => 'show-desc',
391
+				'use_viewing_post_type' => ''
392
+			)
393
+		);
394
+		$title = strip_tags($instance['title']);
395
+		$post_type = strip_tags($instance['post_type']);
396
+		$post_limit = strip_tags($instance['post_limit']);
397
+		$categ_limit = strip_tags($instance['categ_limit']);
398
+		$character_count = strip_tags($instance['character_count']);
399
+		$tab_layout = strip_tags($instance['tab_layout']);
400
+		$excerpt_type = strip_tags($instance['excerpt_type']);
401
+		$add_location_filter = strip_tags($instance['add_location_filter']);
402
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
403
+
404
+		?>
405 405
         <p>
406 406
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
407 407
 
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
                 for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
417 417
 
418 418
                 <?php $postypes = geodir_get_posttypes();
419
-                /**
420
-                 * Filter the post types to display in widget.
421
-                 *
422
-                 * @since 1.3.9
423
-                 *
424
-                 * @param array $postypes Post types array.
425
-                 */
426
-                $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
419
+				/**
420
+				 * Filter the post types to display in widget.
421
+				 *
422
+				 * @since 1.3.9
423
+				 *
424
+				 * @param array $postypes Post types array.
425
+				 */
426
+				$postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
427 427
 
428 428
                 <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>"
429 429
                         name="<?php echo $this->get_field_name('post_type'); ?>"
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
                     <?php foreach ($postypes as $postypes_obj) { ?>
433 433
 
434 434
                         <option <?php if ($post_type == $postypes_obj) {
435
-                            echo 'selected="selected"';
436
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
437
-                            echo ucfirst($extvalue[1]); ?></option>
435
+							echo 'selected="selected"';
436
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
437
+							echo ucfirst($extvalue[1]); ?></option>
438 438
 
439 439
                     <?php } ?>
440 440
 
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
481 481
 
482 482
                     <option <?php if ($tab_layout == 'bestof-tabs-on-top') {
483
-                        echo 'selected="selected"';
484
-                    } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
483
+						echo 'selected="selected"';
484
+					} ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
485 485
                     <option <?php if ($tab_layout == 'bestof-tabs-on-left') {
486
-                        echo 'selected="selected"';
487
-                    } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
486
+						echo 'selected="selected"';
487
+					} ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
488 488
                     <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') {
489
-                        echo 'selected="selected"';
490
-                    } ?>
489
+						echo 'selected="selected"';
490
+					} ?>
491 491
                         value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option>
492 492
                 </select>
493 493
             </label>
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
502 502
 
503 503
                     <option <?php if ($excerpt_type == 'show-desc') {
504
-                        echo 'selected="selected"';
505
-                    } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
504
+						echo 'selected="selected"';
505
+					} ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
506 506
                     <option <?php if ($excerpt_type == 'show-reviews') {
507
-                        echo 'selected="selected"';
508
-                    } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
507
+						echo 'selected="selected"';
508
+					} ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
509 509
                 </select>
510 510
             </label>
511 511
         </p>
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
525 525
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
526 526
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
527
-                    echo 'checked="checked"';
528
-                } ?>  value="1"/>
527
+					echo 'checked="checked"';
528
+				} ?>  value="1"/>
529 529
             </label>
530 530
         </p>
531 531
     <?php
532
-    }
532
+	}
533 533
 } // class geodir_bestof_widget
534 534
 
535 535
 register_widget('geodir_bestof_widget');
@@ -549,68 +549,68 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_bestof_places_by_term($query_args)
551 551
 {
552
-    global $gd_session;
553
-
554
-    /**
555
-     * This action called before querying widget listings.
556
-     *
557
-     * @since 1.0.0
558
-     */
559
-    do_action('geodir_bestof_get_widget_listings_before');
560
-
561
-    $widget_listings = geodir_get_widget_listings($query_args);
562
-
563
-    /**
564
-     * This action called after querying widget listings.
565
-     *
566
-     * @since 1.0.0
567
-     */
568
-    do_action('geodir_bestof_get_widget_listings_after');
569
-
570
-    $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
571
-
572
-    if (!isset($character_count)) {
573
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
574
-        $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
575
-    }
576
-
577
-    /** This filter is documented in geodirectory-functions/general_functions.php */
578
-    $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
579
-
580
-    global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
581
-    $current_post = $post;
582
-    $current_map_jason = $map_jason;
583
-    $current_map_canvas_arr = $map_canvas_arr;
584
-    $current_grid_view = $gridview_columns_widget;
585
-    $gridview_columns_widget = null;
586
-
587
-    $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
588
-    $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
589
-
590
-    $gd_session->set('gd_listing_view', '1');
591
-    $geodir_is_widget_listing = true;
592
-
593
-    /**
594
-     * Includes the template for the listing listview.
595
-     *
596
-     * @since 1.3.9
597
-     */
598
-    include($template);
599
-
600
-    $geodir_is_widget_listing = false;
601
-
602
-    $GLOBALS['post'] = $current_post;
603
-    if (!empty($current_post)) {
604
-        setup_postdata($current_post);
605
-    }
606
-    if ($gd_listing_view_set) { // Set back previous value
607
-        $gd_session->set('gd_listing_view', $gd_listing_view_old);
608
-    } else {
609
-        $gd_session->un_set('gd_listing_view');
610
-    }
611
-    $map_jason = $current_map_jason;
612
-    $map_canvas_arr = $current_map_canvas_arr;
613
-    $gridview_columns_widget = $current_grid_view;
552
+	global $gd_session;
553
+
554
+	/**
555
+	 * This action called before querying widget listings.
556
+	 *
557
+	 * @since 1.0.0
558
+	 */
559
+	do_action('geodir_bestof_get_widget_listings_before');
560
+
561
+	$widget_listings = geodir_get_widget_listings($query_args);
562
+
563
+	/**
564
+	 * This action called after querying widget listings.
565
+	 *
566
+	 * @since 1.0.0
567
+	 */
568
+	do_action('geodir_bestof_get_widget_listings_after');
569
+
570
+	$character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
571
+
572
+	if (!isset($character_count)) {
573
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
574
+		$character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
575
+	}
576
+
577
+	/** This filter is documented in geodirectory-functions/general_functions.php */
578
+	$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
579
+
580
+	global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
581
+	$current_post = $post;
582
+	$current_map_jason = $map_jason;
583
+	$current_map_canvas_arr = $map_canvas_arr;
584
+	$current_grid_view = $gridview_columns_widget;
585
+	$gridview_columns_widget = null;
586
+
587
+	$gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
588
+	$gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
589
+
590
+	$gd_session->set('gd_listing_view', '1');
591
+	$geodir_is_widget_listing = true;
592
+
593
+	/**
594
+	 * Includes the template for the listing listview.
595
+	 *
596
+	 * @since 1.3.9
597
+	 */
598
+	include($template);
599
+
600
+	$geodir_is_widget_listing = false;
601
+
602
+	$GLOBALS['post'] = $current_post;
603
+	if (!empty($current_post)) {
604
+		setup_postdata($current_post);
605
+	}
606
+	if ($gd_listing_view_set) { // Set back previous value
607
+		$gd_session->set('gd_listing_view', $gd_listing_view_old);
608
+	} else {
609
+		$gd_session->un_set('gd_listing_view');
610
+	}
611
+	$map_jason = $current_map_jason;
612
+	$map_canvas_arr = $current_map_canvas_arr;
613
+	$gridview_columns_widget = $current_grid_view;
614 614
 }
615 615
 
616 616
 //Ajax functions
@@ -627,51 +627,51 @@  discard block
 block discarded – undo
627 627
  */
628 628
 function geodir_bestof_callback()
629 629
 {
630
-    check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
631
-    //set variables
632
-    $post_type = strip_tags(esc_sql($_POST['post_type']));
633
-    $post_limit = strip_tags(esc_sql($_POST['post_limit']));
634
-    $character_count = strip_tags(esc_sql($_POST['char_count']));
635
-    $taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
636
-    $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
637
-    $term_id = strip_tags(esc_sql($_POST['term_id']));
638
-    $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
639
-
640
-    $query_args = array(
641
-        'posts_per_page' => $post_limit,
642
-        'is_geodir_loop' => true,
643
-        'post_type' => $post_type,
644
-        'gd_location' => $add_location_filter ? true : false,
645
-        'order_by' => 'high_review'
646
-    );
647
-
648
-    if ($character_count >= 0) {
649
-        $query_args['excerpt_length'] = $character_count;
650
-    }
651
-
652
-    $tax_query = array(
653
-        'taxonomy' => $taxonomy,
654
-        'field' => 'id',
655
-        'terms' => $term_id
656
-    );
657
-
658
-    $query_args['tax_query'] = array($tax_query);
659
-    if ($term_id && $taxonomy) {
660
-        $term = get_term_by('id', $term_id, $taxonomy);
661
-        $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
662
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663
-        $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664
-
665
-        echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
666
-    }
667
-    if ($excerpt_type == 'show-reviews') {
668
-        add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
669
-    }
670
-    geodir_bestof_places_by_term($query_args);
671
-    if ($excerpt_type == 'show-reviews') {
672
-        remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
673
-    }
674
-    gd_die();
630
+	check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
631
+	//set variables
632
+	$post_type = strip_tags(esc_sql($_POST['post_type']));
633
+	$post_limit = strip_tags(esc_sql($_POST['post_limit']));
634
+	$character_count = strip_tags(esc_sql($_POST['char_count']));
635
+	$taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
636
+	$add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
637
+	$term_id = strip_tags(esc_sql($_POST['term_id']));
638
+	$excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
639
+
640
+	$query_args = array(
641
+		'posts_per_page' => $post_limit,
642
+		'is_geodir_loop' => true,
643
+		'post_type' => $post_type,
644
+		'gd_location' => $add_location_filter ? true : false,
645
+		'order_by' => 'high_review'
646
+	);
647
+
648
+	if ($character_count >= 0) {
649
+		$query_args['excerpt_length'] = $character_count;
650
+	}
651
+
652
+	$tax_query = array(
653
+		'taxonomy' => $taxonomy,
654
+		'field' => 'id',
655
+		'terms' => $term_id
656
+	);
657
+
658
+	$query_args['tax_query'] = array($tax_query);
659
+	if ($term_id && $taxonomy) {
660
+		$term = get_term_by('id', $term_id, $taxonomy);
661
+		$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
662
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663
+		$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664
+
665
+		echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
666
+	}
667
+	if ($excerpt_type == 'show-reviews') {
668
+		add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
669
+	}
670
+	geodir_bestof_places_by_term($query_args);
671
+	if ($excerpt_type == 'show-reviews') {
672
+		remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
673
+	}
674
+	gd_die();
675 675
 }
676 676
 
677 677
 //Javascript
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function geodir_bestof_js()
686 686
 {
687
-    $ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
688
-    ?>
687
+	$ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
688
+	?>
689 689
     <script type="text/javascript">
690 690
         jQuery(document).ready(function () {
691 691
             jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) {
@@ -758,18 +758,18 @@  discard block
 block discarded – undo
758 758
 
759 759
 function best_of_show_review_in_excerpt($excerpt)
760 760
 {
761
-    global $wpdb, $post;
762
-    $review_table = GEODIR_REVIEW_TABLE;
763
-    $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
764
-    $comments = $wpdb->get_results($request);
765
-
766
-    if ($comments) {
767
-        foreach ($comments as $comment) {
768
-            // Set the extra comment info needed.
769
-            $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
770
-            $comment_content = $comment_extra->comment_content;
771
-            $excerpt = strip_tags($comment_content);
772
-        }
773
-    }
774
-    return $excerpt;
761
+	global $wpdb, $post;
762
+	$review_table = GEODIR_REVIEW_TABLE;
763
+	$request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
764
+	$comments = $wpdb->get_results($request);
765
+
766
+	if ($comments) {
767
+		foreach ($comments as $comment) {
768
+			// Set the extra comment info needed.
769
+			$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
770
+			$comment_content = $comment_extra->comment_content;
771
+			$excerpt = strip_tags($comment_content);
772
+		}
773
+	}
774
+	return $excerpt;
775 775
 }
776 776
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 3 patches
Indentation   +515 added lines, -515 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if (!function_exists('geodir_admin_panel')) {
10
-    /**
11
-     * GeoDirectory Backend Admin Panel.
12
-     *
13
-     * Handles the display of the main GeoDirectory admin panel.
14
-     *
15
-     * @since 1.0.0
16
-     * @package GeoDirectory
17
-     * @global string $current_tab Current tab in geodirectory settings.
18
-     * @global object $geodirectory GeoDirectory plugin object.
19
-     */
20
-    function geodir_admin_panel()
21
-    {
22
-        global $geodirectory;
23
-        global $current_tab;
24
-
25
-
26
-        ?>
10
+	/**
11
+	 * GeoDirectory Backend Admin Panel.
12
+	 *
13
+	 * Handles the display of the main GeoDirectory admin panel.
14
+	 *
15
+	 * @since 1.0.0
16
+	 * @package GeoDirectory
17
+	 * @global string $current_tab Current tab in geodirectory settings.
18
+	 * @global object $geodirectory GeoDirectory plugin object.
19
+	 */
20
+	function geodir_admin_panel()
21
+	{
22
+		global $geodirectory;
23
+		global $current_tab;
24
+
25
+
26
+		?>
27 27
 
28 28
         <div id="gd-wrapper-main" class="wrap geodirectory">
29 29
             <?php
30
-            /**
31
-             * Called just after the opening wrapper div for the GD settings page in the admin area.
32
-             *
33
-             * @since 1.0.0
34
-             */
35
-            do_action('geodir_before_admin_panel');
36
-            ?>
30
+			/**
31
+			 * Called just after the opening wrapper div for the GD settings page in the admin area.
32
+			 *
33
+			 * @since 1.0.0
34
+			 */
35
+			do_action('geodir_before_admin_panel');
36
+			?>
37 37
 
38 38
             <div class="gd-wrapper gd-wrapper-vr clearfix">
39 39
 
@@ -44,75 +44,75 @@  discard block
 block discarded – undo
44 44
                          alt="geo-logo" class="geo-logoalter"/>
45 45
                     <ul>
46 46
                         <?php
47
-                        $tabs = array();
48
-                        /**
49
-                         * Filter the GD admin settings tabs on the left of the admin menu.
50
-                         *
51
-                         * @since 1.0.0
52
-                         * @param array $tabs The array of tabs to display.
53
-                         */
54
-                        $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
-
57
-                        foreach ($tabs as $name => $args) :
58
-                            $label = $args['label'];
59
-
60
-
61
-                            $query_string = '';
62
-                            if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
-
64
-                                $subtabs = $args['subtabs'];
65
-
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
67
-
68
-                            endif;
69
-
70
-
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
-
73
-                            if (isset($args['url']) && $args['url'] != '') {
74
-                                $tab_link = $args['url'];
75
-                            }
76
-
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
79
-
80
-                            if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
84
-
85
-                            $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
-                            /**
89
-                             * Called before the individual settings tabs are output.
90
-                             *
91
-                             * @since 1.0.0
92
-                             * @param string $name The name of the settings tab.
93
-                             * @see 'geodir_after_settings_tabs'
94
-                             */
95
-                            do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
-                            /**
98
-                             * Called after the individual settings tabs are output.
99
-                             *
100
-                             * @since 1.0.0
101
-                             * @param string $name The name of the settings tab.
102
-                             * @see 'geodir_before_settings_tabs'
103
-                             */
104
-                            do_action('geodir_after_settings_tabs', $name);
105
-                        endforeach;
106
-
107
-                        /**
108
-                         * Called after the GD settings tabs have been output.
109
-                         *
110
-                         * Called before the closing `ul` so can be used to add new settings tab links.
111
-                         *
112
-                         * @since 1.0.0
113
-                         */
114
-                        do_action('geodir_settings_tabs');
115
-                        ?>
47
+						$tabs = array();
48
+						/**
49
+						 * Filter the GD admin settings tabs on the left of the admin menu.
50
+						 *
51
+						 * @since 1.0.0
52
+						 * @param array $tabs The array of tabs to display.
53
+						 */
54
+						$tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
+						update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
56
+
57
+						foreach ($tabs as $name => $args) :
58
+							$label = $args['label'];
59
+
60
+
61
+							$query_string = '';
62
+							if (isset($args['subtabs']) && !empty($args['subtabs'])):
63
+
64
+								$subtabs = $args['subtabs'];
65
+
66
+								$query_string = '&subtab=' . $subtabs[0]['subtab'];
67
+
68
+							endif;
69
+
70
+
71
+							$tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
72
+
73
+							if (isset($args['url']) && $args['url'] != '') {
74
+								$tab_link = $args['url'];
75
+							}
76
+
77
+							if (!empty($args['request']))
78
+								$tab_link = geodir_getlink($tab_link, $args['request']);
79
+
80
+							if (isset($args['target']) && $args['target'] != '') {
81
+								$tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
+							} else
83
+								$tab_target = '';
84
+
85
+							$tab_active = '';
86
+							if ($current_tab == $name)
87
+								$tab_active = ' class="tab-active" ';
88
+							/**
89
+							 * Called before the individual settings tabs are output.
90
+							 *
91
+							 * @since 1.0.0
92
+							 * @param string $name The name of the settings tab.
93
+							 * @see 'geodir_after_settings_tabs'
94
+							 */
95
+							do_action('geodir_before_settings_tabs', $name);
96
+							echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
97
+							/**
98
+							 * Called after the individual settings tabs are output.
99
+							 *
100
+							 * @since 1.0.0
101
+							 * @param string $name The name of the settings tab.
102
+							 * @see 'geodir_before_settings_tabs'
103
+							 */
104
+							do_action('geodir_after_settings_tabs', $name);
105
+						endforeach;
106
+
107
+						/**
108
+						 * Called after the GD settings tabs have been output.
109
+						 *
110
+						 * Called before the closing `ul` so can be used to add new settings tab links.
111
+						 *
112
+						 * @since 1.0.0
113
+						 */
114
+						do_action('geodir_settings_tabs');
115
+						?>
116 116
                     </ul>
117 117
                 </div>
118 118
                 <!--gd-left-nav ends here-->
@@ -121,52 +121,52 @@  discard block
 block discarded – undo
121 121
                     <div class="gd-tabs-main">
122 122
 
123 123
                         <?php
124
-                        unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
127
-                        $form_action = '';
124
+						unset($subtabs);
125
+						if (isset($tabs[$current_tab]['subtabs']))
126
+							$subtabs = $tabs[$current_tab]['subtabs'];
127
+						$form_action = '';
128 128
 
129
-                        if (!empty($subtabs)):
130
-                        ?>
129
+						if (!empty($subtabs)):
130
+						?>
131 131
                             <dl class="gd-tab-head">
132 132
                                 <?php
133
-                                foreach ($subtabs as $sub) {
134
-                                    $subtab_active = '';
135
-                                    if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
-                                        $subtab_active = 'class="gd-tab-active"';
137
-                                        $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
-                                    }
139
-
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
-                                    if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
-                                        $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
-                                    }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
-                                }
146
-                                ?>
133
+								foreach ($subtabs as $sub) {
134
+									$subtab_active = '';
135
+									if (isset($_REQUEST['subtab']) && $sub['subtab'] == $_REQUEST['subtab']) {
136
+										$subtab_active = 'class="gd-tab-active"';
137
+										$form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138
+									}
139
+
140
+									$sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
141
+									if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142
+										$sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143
+									}
144
+									echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
145
+								}
146
+								?>
147 147
                             </dl>
148 148
 
149 149
                         <?php endif; ?>
150 150
                         <div class="gd-tab-content <?php if (empty($subtabs)) {
151
-                            echo "inner_contet_tabs";
152
-                        } ?>">
151
+							echo "inner_contet_tabs";
152
+						} ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+									  echo sanitize_text_field($sub['subtab']);
156
+								  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+										   echo sanitize_text_field($_REQUEST['active_tab']);
160
+									   } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
164
-                                /**
165
-                                 * Used to call the content of each GD settings tab page.
166
-                                 *
167
-                                 * @since 1.0.0
168
-                                 */
169
-                                do_action('geodir_admin_option_form', $current_tab); ?>
164
+								/**
165
+								 * Used to call the content of each GD settings tab page.
166
+								 *
167
+								 * @since 1.0.0
168
+								 */
169
+								do_action('geodir_admin_option_form', $current_tab); ?>
170 170
                             </form>
171 171
                         </div>
172 172
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </script>
268 268
     <?php
269 269
 
270
-    }
270
+	}
271 271
 }
272 272
 
273 273
 
@@ -283,48 +283,48 @@  discard block
 block discarded – undo
283 283
 function geodir_admin_option_form($tab_name)
284 284
 {
285 285
 
286
-    //echo $tab_name.'_array.php' ;
287
-    global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
-        /**
290
-         * Contains settings array for given tab.
291
-         *
292
-         * @since 1.0.0
293
-         * @package GeoDirectory
294
-         */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
296
-    }
297
-
298
-    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
-
300
-    switch ($tab_name) {
301
-
302
-        case 'general_settings':
303
-
304
-            geodir_admin_fields($geodir_settings['general_settings']);
305
-            /**
306
-             *
307
-             * Update Taxonomy Options *
308
-             *
309
-             **/
310
-            /*add_action('updated_option_place_prefix','update_listing_prefix');
286
+	//echo $tab_name.'_array.php' ;
287
+	global $geodir_settings, $is_default, $mapzoom;
288
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
289
+		/**
290
+		 * Contains settings array for given tab.
291
+		 *
292
+		 * @since 1.0.0
293
+		 * @package GeoDirectory
294
+		 */
295
+		include_once('option-pages/' . $tab_name . '_array.php');
296
+	}
297
+
298
+	$listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
299
+
300
+	switch ($tab_name) {
301
+
302
+		case 'general_settings':
303
+
304
+			geodir_admin_fields($geodir_settings['general_settings']);
305
+			/**
306
+			 *
307
+			 * Update Taxonomy Options *
308
+			 *
309
+			 **/
310
+			/*add_action('updated_option_place_prefix','update_listing_prefix');
311 311
             function update_listing_prefix(){
312 312
                 geodir_register_defaults();
313 313
             }*/
314 314
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
315
+			if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
+				$hide_save_button = "style='display:none;'";
317
+			else
318
+				$hide_save_button = '';
319 319
 
320
-            /**
321
-             * Filter weather the default save button in the GD admin settings pages should be shown.
322
-             *
323
-             * @since 1.0.0
324
-             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
-             */
326
-            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
-            ?>
320
+			/**
321
+			 * Filter weather the default save button in the GD admin settings pages should be shown.
322
+			 *
323
+			 * @since 1.0.0
324
+			 * @param string $hide_save_button The style element, either blank or: style='display:none;'.
325
+			 */
326
+			$hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
327
+			?>
328 328
 
329 329
             <p class="submit">
330 330
             <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
@@ -334,36 +334,36 @@  discard block
 block discarded – undo
334 334
             </div>
335 335
             
336 336
 		<?php break;
337
-        case 'design_settings' :
338
-            geodir_admin_fields($geodir_settings['design_settings']);
337
+		case 'design_settings' :
338
+			geodir_admin_fields($geodir_settings['design_settings']);
339 339
 
340 340
 
341 341
 
342
-            ?>
342
+			?>
343 343
 			<p class="submit">
344 344
 			<input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
345 345
 			<input type="hidden" name="subtab" id="last_tab" />
346 346
 			</p>
347 347
 			</div>
348 348
         <?php break;
349
-        case 'permalink_settings' :
350
-            geodir_admin_fields($geodir_settings['permalink_settings']); ?>
349
+		case 'permalink_settings' :
350
+			geodir_admin_fields($geodir_settings['permalink_settings']); ?>
351 351
             <p class="submit">
352 352
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
353 353
             <input type="hidden" name="subtab" id="last_tab" />
354 354
             </p>
355 355
             </div>	
356 356
 		<?php break;
357
-        case 'title_meta_settings' :
358
-            geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
357
+		case 'title_meta_settings' :
358
+			geodir_admin_fields($geodir_settings['title_meta_settings']); ?>
359 359
             <p class="submit">
360 360
             <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
361 361
             <input type="hidden" name="subtab" id="last_tab" />
362 362
             </p>
363 363
             </div>
364 364
 		<?php break;
365
-        case 'notifications_settings' :
366
-            geodir_admin_fields($geodir_settings['notifications_settings']); ?>
365
+		case 'notifications_settings' :
366
+			geodir_admin_fields($geodir_settings['notifications_settings']); ?>
367 367
 			
368 368
 			<p class="submit">
369 369
 				
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
 			</div>
374 374
 			
375 375
 		<?php break;
376
-        case 'default_location_settings' :
377
-            ?>
376
+		case 'default_location_settings' :
377
+			?>
378 378
             <div class="inner_content_tab_main">
379 379
                 <div class="gd-content-heading">
380 380
                     <?php global $wpdb;
381 381
 
382 382
 
383
-                    $location_result = geodir_get_default_location();
383
+					$location_result = geodir_get_default_location();
384 384
 
385
-                    $prefix = '';
385
+					$prefix = '';
386 386
 
387 387
 
388
-                    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
-                    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
-                    $city = isset($location_result->city) ? $location_result->city : '';
391
-                    $region = isset($location_result->region) ? $location_result->region : '';
392
-                    $country = isset($location_result->country) ? $location_result->country : '';
388
+					$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
389
+					$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
390
+					$city = isset($location_result->city) ? $location_result->city : '';
391
+					$region = isset($location_result->region) ? $location_result->region : '';
392
+					$country = isset($location_result->country) ? $location_result->country : '';
393 393
 
394 394
 
395
-                    $map_title = __("Set Address On Map", 'geodirectory');
395
+					$map_title = __("Set Address On Map", 'geodirectory');
396 396
 
397
-                    ?>
397
+					?>
398 398
 
399 399
                     <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
403 403
                     <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) {
404
-                        echo $location_result->location_id;
405
-                    } ?>">
404
+						echo $location_result->location_id;
405
+					} ?>">
406 406
 
407 407
                     <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
408 408
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+											   echo $location_result->city;
419
+										   } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+											   echo $location_result->region;
435
+										   } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
448 448
 
449
-                                    $country_result = isset($location_result->country) ? $location_result->country : '';
450
-                                    ?>
449
+									$country_result = isset($location_result->country) ? $location_result->country : '';
450
+									?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453 453
                                             data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
                                 scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473
-                                /**
474
-                                 * Contains add listing page map functions.
475
-                                 *
476
-                                 * @since 1.0.0
477
-                                 */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
473
+								/**
474
+								 * Contains add listing page map functions.
475
+								 *
476
+								 * @since 1.0.0
477
+								 */
478
+								include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+											   echo $location_result->city_latitude;
489
+										   } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+											   echo $location_result->city_longitude;
506
+										   } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+		case $listing_type . '_fields_settings' :
539 539
 
540
-            geodir_custom_post_type_form();
540
+			geodir_custom_post_type_form();
541 541
 
542
-            break;
543
-        case 'tools_settings' :
544
-            geodir_diagnostic_tools_setting_page();
545
-            break;
546
-        case 'compatibility_settings' :
547
-            geodir_theme_compatibility_setting_page();
548
-            break;		
542
+			break;
543
+		case 'tools_settings' :
544
+			geodir_diagnostic_tools_setting_page();
545
+			break;
546
+		case 'compatibility_settings' :
547
+			geodir_theme_compatibility_setting_page();
548
+			break;		
549 549
 		case 'import_export' :
550
-            geodir_import_export_page();
551
-            break;
550
+			geodir_import_export_page();
551
+			break;
552 552
 
553
-    }// end of switch
553
+	}// end of switch
554 554
 }
555 555
 
556 556
 
@@ -590,170 +590,170 @@  discard block
 block discarded – undo
590 590
 function geodir_update_options_compatibility_settings()
591 591
 {
592 592
 
593
-    global $wpdb;
593
+	global $wpdb;
594 594
 
595 595
 
596
-    $theme_settings = array();
596
+	$theme_settings = array();
597 597
 
598
-    $theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
-    $theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
-    $theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
598
+	$theme_settings['geodir_wrapper_open_id'] = $_POST['geodir_wrapper_open_id'];
599
+	$theme_settings['geodir_wrapper_open_class'] = $_POST['geodir_wrapper_open_class'];
600
+	$theme_settings['geodir_wrapper_open_replace'] = stripslashes($_POST['geodir_wrapper_open_replace']);
601 601
 
602
-    $theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
602
+	$theme_settings['geodir_wrapper_close_replace'] = stripslashes($_POST['geodir_wrapper_close_replace']);
603 603
 
604
-    $theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
-    $theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
-    $theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
604
+	$theme_settings['geodir_wrapper_content_open_id'] = $_POST['geodir_wrapper_content_open_id'];
605
+	$theme_settings['geodir_wrapper_content_open_class'] = $_POST['geodir_wrapper_content_open_class'];
606
+	$theme_settings['geodir_wrapper_content_open_replace'] = stripslashes($_POST['geodir_wrapper_content_open_replace']);
607 607
 
608
-    $theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
608
+	$theme_settings['geodir_wrapper_content_close_replace'] = stripslashes($_POST['geodir_wrapper_content_close_replace']);
609 609
 
610
-    $theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
-    $theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
-    $theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
610
+	$theme_settings['geodir_article_open_id'] = $_POST['geodir_article_open_id'];
611
+	$theme_settings['geodir_article_open_class'] = $_POST['geodir_article_open_class'];
612
+	$theme_settings['geodir_article_open_replace'] = stripslashes($_POST['geodir_article_open_replace']);
613 613
 
614
-    $theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
614
+	$theme_settings['geodir_article_close_replace'] = stripslashes($_POST['geodir_article_close_replace']);
615 615
 
616
-    $theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
-    $theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
-    $theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
616
+	$theme_settings['geodir_sidebar_right_open_id'] = $_POST['geodir_sidebar_right_open_id'];
617
+	$theme_settings['geodir_sidebar_right_open_class'] = $_POST['geodir_sidebar_right_open_class'];
618
+	$theme_settings['geodir_sidebar_right_open_replace'] = stripslashes($_POST['geodir_sidebar_right_open_replace']);
619 619
 
620
-    $theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
620
+	$theme_settings['geodir_sidebar_right_close_replace'] = stripslashes($_POST['geodir_sidebar_right_close_replace']);
621 621
 
622
-    $theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
-    $theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
-    $theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
622
+	$theme_settings['geodir_sidebar_left_open_id'] = $_POST['geodir_sidebar_left_open_id'];
623
+	$theme_settings['geodir_sidebar_left_open_class'] = $_POST['geodir_sidebar_left_open_class'];
624
+	$theme_settings['geodir_sidebar_left_open_replace'] = stripslashes($_POST['geodir_sidebar_left_open_replace']);
625 625
 
626
-    $theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
626
+	$theme_settings['geodir_sidebar_left_close_replace'] = stripslashes($_POST['geodir_sidebar_left_close_replace']);
627 627
 
628
-    $theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
-    $theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
-    $theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
628
+	$theme_settings['geodir_main_content_open_id'] = $_POST['geodir_main_content_open_id'];
629
+	$theme_settings['geodir_main_content_open_class'] = $_POST['geodir_main_content_open_class'];
630
+	$theme_settings['geodir_main_content_open_replace'] = stripslashes($_POST['geodir_main_content_open_replace']);
631 631
 
632
-    $theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
632
+	$theme_settings['geodir_main_content_close_replace'] = stripslashes($_POST['geodir_main_content_close_replace']);
633 633
 
634 634
 // Other Actions
635
-    $theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
-    $theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
635
+	$theme_settings['geodir_top_content_add'] = stripslashes($_POST['geodir_top_content_add']);
636
+	$theme_settings['geodir_before_main_content_add'] = stripslashes($_POST['geodir_before_main_content_add']);
637 637
 
638 638
 // Filters
639
-    $theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
-    $theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
-    $theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
-    $theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
-    $theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
-    $theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
-    $theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
-    $theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
-    $theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
-    $theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
639
+	$theme_settings['geodir_full_page_class_filter'] = stripslashes($_POST['geodir_full_page_class_filter']);
640
+	$theme_settings['geodir_before_widget_filter'] = stripslashes($_POST['geodir_before_widget_filter']);
641
+	$theme_settings['geodir_after_widget_filter'] = stripslashes($_POST['geodir_after_widget_filter']);
642
+	$theme_settings['geodir_before_title_filter'] = stripslashes($_POST['geodir_before_title_filter']);
643
+	$theme_settings['geodir_after_title_filter'] = stripslashes($_POST['geodir_after_title_filter']);
644
+	$theme_settings['geodir_menu_li_class_filter'] = stripslashes($_POST['geodir_menu_li_class_filter']);
645
+	$theme_settings['geodir_sub_menu_ul_class_filter'] = stripslashes($_POST['geodir_sub_menu_ul_class_filter']);
646
+	$theme_settings['geodir_sub_menu_li_class_filter'] = stripslashes($_POST['geodir_sub_menu_li_class_filter']);
647
+	$theme_settings['geodir_menu_a_class_filter'] = stripslashes($_POST['geodir_menu_a_class_filter']);
648
+	$theme_settings['geodir_sub_menu_a_class_filter'] = stripslashes($_POST['geodir_sub_menu_a_class_filter']);
649 649
 //location manager filters
650
-    $theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
-    $theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
-    $theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
-    $theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
650
+	$theme_settings['geodir_location_switcher_menu_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_li_class_filter']);
651
+	$theme_settings['geodir_location_switcher_menu_a_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_a_class_filter']);
652
+	$theme_settings['geodir_location_switcher_menu_sub_ul_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_ul_class_filter']);
653
+	$theme_settings['geodir_location_switcher_menu_sub_li_class_filter'] = stripslashes($_POST['geodir_location_switcher_menu_sub_li_class_filter']);
654 654
 
655 655
 
656 656
 // theme required css
657
-    $theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
657
+	$theme_settings['geodir_theme_compat_css'] = stripslashes($_POST['geodir_theme_compat_css']);
658 658
 
659 659
 // theme required js
660
-    $theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
660
+	$theme_settings['geodir_theme_compat_js'] = stripslashes($_POST['geodir_theme_compat_js']);
661 661
 
662 662
 // theme compat name
663
-    $theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
-    if ($theme_settings['gd_theme_compat'] == '') {
665
-        update_option('gd_theme_compat', '');
666
-        update_option('theme_compatibility_setting', '');
667
-        return;
668
-    }
663
+	$theme_settings['gd_theme_compat'] = $_POST['gd_theme_compat'];
664
+	if ($theme_settings['gd_theme_compat'] == '') {
665
+		update_option('gd_theme_compat', '');
666
+		update_option('theme_compatibility_setting', '');
667
+		return;
668
+	}
669 669
 
670 670
 // theme default options
671
-    $theme_settings['geodir_theme_compat_default_options'] = '';
671
+	$theme_settings['geodir_theme_compat_default_options'] = '';
672 672
 
673 673
 
674 674
 //suported theme code
675
-    $theme_settings['geodir_theme_compat_code'] = false;
676
-
677
-    $theme = wp_get_theme();
678
-
679
-    if ($theme->parent()) {
680
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
-    } else {
682
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
683
-    }
684
-
685
-    if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
-        $theme_settings['geodir_theme_compat_code'] = $theme_name;
687
-    }
688
-
689
-
690
-    $theme_name = $theme_name . "_custom";
691
-    $theme_arr = get_option('gd_theme_compats');
692
-    update_option('gd_theme_compat', $theme_name);
693
-    /**
694
-     * Called before the theme compatibility settings are saved to the DB.
695
-     *
696
-     * @since 1.4.0
697
-     * @param array $theme_settings {
698
-     *    Attributes of the theme compatibility settings array.
699
-     *
700
-     *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
-     *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
-     *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
-     *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
-     *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
-     *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
-     *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
-     *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
-     *    @type string $geodir_article_open_id Geodir article open html id.
709
-     *    @type string $geodir_article_open_class Geodir article open html class.
710
-     *    @type string $geodir_article_open_replace Geodir article open content replace.
711
-     *    @type string $geodir_article_close_replace Geodir article close content replace.
712
-     *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
-     *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
-     *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
-     *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
-     *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
-     *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
-     *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
-     *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
-     *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
-     *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
-     *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
-     *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
-     *    @type string $geodir_top_content_add Geodir top content add.
725
-     *    @type string $geodir_before_main_content_add Geodir before main content add.
726
-     *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
-     *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
-     *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
-     *    @type string $geodir_before_title_filter Geodir before title filter.
730
-     *    @type string $geodir_after_title_filter Geodir after title filter.
731
-     *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
-     *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
-     *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
-     *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
-     *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
-     *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
-     *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
-     *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
-     *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
-     *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
-     *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
-     *    @type string $gd_theme_compat Gd theme compatibility.
743
-     *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
-     *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
-     *
746
-     * }
747
-     */
748
-    do_action('gd_compat_save_settings', $theme_settings);
675
+	$theme_settings['geodir_theme_compat_code'] = false;
676
+
677
+	$theme = wp_get_theme();
678
+
679
+	if ($theme->parent()) {
680
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
681
+	} else {
682
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
683
+	}
684
+
685
+	if (in_array($theme_name, array('Avada', 'Enfold', 'X', 'Divi', 'Genesis', 'Jupiter', 'Multi_News'))) {// list of themes that have php files
686
+		$theme_settings['geodir_theme_compat_code'] = $theme_name;
687
+	}
688
+
689
+
690
+	$theme_name = $theme_name . "_custom";
691
+	$theme_arr = get_option('gd_theme_compats');
692
+	update_option('gd_theme_compat', $theme_name);
693
+	/**
694
+	 * Called before the theme compatibility settings are saved to the DB.
695
+	 *
696
+	 * @since 1.4.0
697
+	 * @param array $theme_settings {
698
+	 *    Attributes of the theme compatibility settings array.
699
+	 *
700
+	 *    @type string $geodir_wrapper_open_id Geodir wrapper open html id.
701
+	 *    @type string $geodir_wrapper_open_class Geodir wrapper open html class.
702
+	 *    @type string $geodir_wrapper_open_replace Geodir wrapper open content replace.
703
+	 *    @type string $geodir_wrapper_close_replace Geodir wrapper close content replace.
704
+	 *    @type string $geodir_wrapper_content_open_id Geodir wrapper content open html id.
705
+	 *    @type string $geodir_wrapper_content_open_class Geodir wrapper content open html class.
706
+	 *    @type string $geodir_wrapper_content_open_replace Geodir wrapper content open content replace.
707
+	 *    @type string $geodir_wrapper_content_close_replace Geodir wrapper content close content replace.
708
+	 *    @type string $geodir_article_open_id Geodir article open html id.
709
+	 *    @type string $geodir_article_open_class Geodir article open html class.
710
+	 *    @type string $geodir_article_open_replace Geodir article open content replace.
711
+	 *    @type string $geodir_article_close_replace Geodir article close content replace.
712
+	 *    @type string $geodir_sidebar_right_open_id Geodir sidebar right open html id.
713
+	 *    @type string $geodir_sidebar_right_open_class Geodir sidebar right open html class.
714
+	 *    @type string $geodir_sidebar_right_open_replace Geodir sidebar right open content replace.
715
+	 *    @type string $geodir_sidebar_right_close_replace Geodir sidebar right close content replace.
716
+	 *    @type string $geodir_sidebar_left_open_id Geodir sidebar left open html id.
717
+	 *    @type string $geodir_sidebar_left_open_class Geodir sidebar left open html class.
718
+	 *    @type string $geodir_sidebar_left_open_replace Geodir sidebar left open content replace.
719
+	 *    @type string $geodir_sidebar_left_close_replace Geodir sidebar left close content replace.
720
+	 *    @type string $geodir_main_content_open_id Geodir main content open html id.
721
+	 *    @type string $geodir_main_content_open_class Geodir main content open html class.
722
+	 *    @type string $geodir_main_content_open_replace Geodir main content open content replace.
723
+	 *    @type string $geodir_main_content_close_replace Geodir main content close content replace.
724
+	 *    @type string $geodir_top_content_add Geodir top content add.
725
+	 *    @type string $geodir_before_main_content_add Geodir before main content add.
726
+	 *    @type string $geodir_full_page_class_filter Geodir full page class filter.
727
+	 *    @type string $geodir_before_widget_filter Geodir before widget filter.
728
+	 *    @type string $geodir_after_widget_filter Geodir after widget filter.
729
+	 *    @type string $geodir_before_title_filter Geodir before title filter.
730
+	 *    @type string $geodir_after_title_filter Geodir after title filter.
731
+	 *    @type string $geodir_menu_li_class_filter Geodir menu li class filter.
732
+	 *    @type string $geodir_sub_menu_ul_class_filter Geodir sub menu ul class filter.
733
+	 *    @type string $geodir_sub_menu_li_class_filter Geodir sub menu li class filter.
734
+	 *    @type string $geodir_menu_a_class_filter Geodir menu a class filter.
735
+	 *    @type string $geodir_sub_menu_a_class_filter Geodir sub menu a class filter.
736
+	 *    @type string $geodir_location_switcher_menu_li_class_filter Geodir location switcher menu li class filter.
737
+	 *    @type string $geodir_location_switcher_menu_a_class_filter Geodir location switcher menu a class filter.
738
+	 *    @type string $geodir_location_switcher_menu_sub_ul_class_filter Geodir location switcher menu sub ul class filter.
739
+	 *    @type string $geodir_location_switcher_menu_sub_li_class_filter Geodir location switcher menu sub li class filter.
740
+	 *    @type string $geodir_theme_compat_css Geodir theme compatibility css.
741
+	 *    @type string $geodir_theme_compat_js Geodir theme compatibility js.
742
+	 *    @type string $gd_theme_compat Gd theme compatibility.
743
+	 *    @type string $geodir_theme_compat_default_options Geodir theme compatibility default options.
744
+	 *    @type bool $geodir_theme_compat_code Geodir theme compatibility code Ex: 'Avada.
745
+	 *
746
+	 * }
747
+	 */
748
+	do_action('gd_compat_save_settings', $theme_settings);
749 749
 
750 750
 //if($_POST['gd_theme_compat'])==
751
-    $theme_arr[$theme_name] = $theme_settings;
752
-    update_option('gd_theme_compats', $theme_arr);
751
+	$theme_arr[$theme_name] = $theme_settings;
752
+	update_option('gd_theme_compats', $theme_arr);
753 753
 
754 754
 
755 755
 //print_r($theme_settings);exit;
756
-    update_option('theme_compatibility_setting', $theme_settings);
756
+	update_option('theme_compatibility_setting', $theme_settings);
757 757
 
758 758
 }
759 759
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_theme_compatibility_setting_page()
768 768
 {
769
-    global $wpdb;
770
-    $tc = get_option('theme_compatibility_setting');
771
-    //print_r($tc);
772
-    //print_r(wp_get_theme());
769
+	global $wpdb;
770
+	$tc = get_option('theme_compatibility_setting');
771
+	//print_r($tc);
772
+	//print_r(wp_get_theme());
773 773
 
774
-    ?>
774
+	?>
775 775
     <div class="inner_content_tab_main">
776 776
         <div class="gd-content-heading">
777 777
 
@@ -813,21 +813,21 @@  discard block
 block discarded – undo
813 813
                 <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814 814
                 <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
815 815
                 <?php
816
-                $theme_arr = get_option('gd_theme_compats');
817
-                $theme_active = get_option('gd_theme_compat');
818
-                if (is_array($theme_arr)) {
819
-                    foreach ($theme_arr as $key => $theme) {
820
-                        $sel = '';
821
-                        if ($theme_active == $key) {
822
-                            $sel = "selected";
823
-                        }
824
-                        echo "<option $sel>$key</option>";
825
-                    }
816
+				$theme_arr = get_option('gd_theme_compats');
817
+				$theme_active = get_option('gd_theme_compat');
818
+				if (is_array($theme_arr)) {
819
+					foreach ($theme_arr as $key => $theme) {
820
+						$sel = '';
821
+						if ($theme_active == $key) {
822
+							$sel = "selected";
823
+						}
824
+						echo "<option $sel>$key</option>";
825
+					}
826 826
 
827 827
 
828
-                }
828
+				}
829 829
 
830
-                ?>
830
+				?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833 833
                     class="button-primary"><?php _e('Export', 'geodirectory');?></button>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
                         <small>geodir_wrapper_open</small>
937 937
                     </td>
938 938
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_id'])) {
939
-                            echo $tc['geodir_wrapper_open_id'];
940
-                        }?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
939
+							echo $tc['geodir_wrapper_open_id'];
940
+						}?>" type="text" name="geodir_wrapper_open_id" placeholder="geodir-wrapper"/></td>
941 941
                     <td><input value="<?php if (isset($tc['geodir_wrapper_open_class'])) {
942
-                            echo $tc['geodir_wrapper_open_class'];
943
-                        }?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
942
+							echo $tc['geodir_wrapper_open_class'];
943
+						}?>" type="text" name="geodir_wrapper_open_class" placeholder=""/></td>
944 944
                 </tr>
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
                         <span><?php _e('Output:', 'geodirectory');?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951
-                                echo $tc['geodir_wrapper_open_replace'];
952
-                            }?></textarea>
951
+								echo $tc['geodir_wrapper_open_replace'];
952
+							}?></textarea>
953 953
                     </td>
954 954
                 </tr>
955 955
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                         <span><?php _e('Output:', 'geodirectory');?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972
-                                echo $tc['geodir_wrapper_close_replace'];
973
-                            }?></textarea>
972
+								echo $tc['geodir_wrapper_close_replace'];
973
+							}?></textarea>
974 974
                     </td>
975 975
                 </tr>
976 976
 
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
                         <small>geodir_wrapper_content_open</small>
981 981
                     </td>
982 982
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_id'])) {
983
-                            echo $tc['geodir_wrapper_content_open_id'];
984
-                        }?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
983
+							echo $tc['geodir_wrapper_content_open_id'];
984
+						}?>" type="text" name="geodir_wrapper_content_open_id" placeholder="geodir-wrapper-content"/>
985 985
                     </td>
986 986
                     <td><input value="<?php if (isset($tc['geodir_wrapper_content_open_class'])) {
987
-                            echo $tc['geodir_wrapper_content_open_class'];
988
-                        }?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
987
+							echo $tc['geodir_wrapper_content_open_class'];
988
+						}?>" type="text" name="geodir_wrapper_content_open_class" placeholder=""/></td>
989 989
                 </tr>
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
                         <span><?php _e('Output:', 'geodirectory');?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996
-                                echo $tc['geodir_wrapper_content_open_replace'];
997
-                            }?></textarea>
996
+								echo $tc['geodir_wrapper_content_open_replace'];
997
+							}?></textarea>
998 998
                     </td>
999 999
                 </tr>
1000 1000
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
                         <span><?php _e('Output:', 'geodirectory');?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017
-                                echo $tc['geodir_wrapper_content_close_replace'];
1018
-                            }?></textarea>
1017
+								echo $tc['geodir_wrapper_content_close_replace'];
1018
+							}?></textarea>
1019 1019
                     </td>
1020 1020
                 </tr>
1021 1021
 
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
                         <small>geodir_article_open</small>
1025 1025
                     </td>
1026 1026
                     <td><input value="<?php if (isset($tc['geodir_article_open_id'])) {
1027
-                            echo $tc['geodir_article_open_id'];
1028
-                        }?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1027
+							echo $tc['geodir_article_open_id'];
1028
+						}?>" type="text" name="geodir_article_open_id" placeholder="geodir-wrapper-content"/></td>
1029 1029
                     <td><input value="<?php if (isset($tc['geodir_article_open_class'])) {
1030
-                            echo $tc['geodir_article_open_class'];
1031
-                        }?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1030
+							echo $tc['geodir_article_open_class'];
1031
+						}?>" type="text" name="geodir_article_open_class" placeholder=""/></td>
1032 1032
                 </tr>
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
                         <span><?php _e('Output:', 'geodirectory');?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039
-                                echo $tc['geodir_article_open_replace'];
1040
-                            }?></textarea>
1039
+								echo $tc['geodir_article_open_replace'];
1040
+							}?></textarea>
1041 1041
                     </td>
1042 1042
                 </tr>
1043 1043
 
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                         <span><?php _e('Output:', 'geodirectory');?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059
-                                echo $tc['geodir_article_close_replace'];
1060
-                            }?></textarea>
1059
+								echo $tc['geodir_article_close_replace'];
1060
+							}?></textarea>
1061 1061
                     </td>
1062 1062
                 </tr>
1063 1063
 
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
                         <small>geodir_sidebar_right_open</small>
1067 1067
                     </td>
1068 1068
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_id'])) {
1069
-                            echo $tc['geodir_sidebar_right_open_id'];
1070
-                        }?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1069
+							echo $tc['geodir_sidebar_right_open_id'];
1070
+						}?>" type="text" name="geodir_sidebar_right_open_id" placeholder="geodir-sidebar-right"/></td>
1071 1071
                     <td><input value="<?php if (isset($tc['geodir_sidebar_right_open_class'])) {
1072
-                            echo $tc['geodir_sidebar_right_open_class'];
1073
-                        }?>" type="text" name="geodir_sidebar_right_open_class"
1072
+							echo $tc['geodir_sidebar_right_open_class'];
1073
+						}?>" type="text" name="geodir_sidebar_right_open_class"
1074 1074
                                placeholder="geodir-sidebar-right geodir-listings-sidebar-right"/></td>
1075 1075
                 </tr>
1076 1076
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
                         <span><?php _e('Output:', 'geodirectory');?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082
-                                echo $tc['geodir_sidebar_right_open_replace'];
1083
-                            }?></textarea>
1082
+								echo $tc['geodir_sidebar_right_open_replace'];
1083
+							}?></textarea>
1084 1084
                     </td>
1085 1085
                 </tr>
1086 1086
 
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
                         <span><?php _e('Output:', 'geodirectory');?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102
-                                echo $tc['geodir_sidebar_right_close_replace'];
1103
-                            }?></textarea>
1102
+								echo $tc['geodir_sidebar_right_close_replace'];
1103
+							}?></textarea>
1104 1104
                     </td>
1105 1105
                 </tr>
1106 1106
 
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
                         <small>geodir_sidebar_left_open</small>
1111 1111
                     </td>
1112 1112
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_id'])) {
1113
-                            echo $tc['geodir_sidebar_left_open_id'];
1114
-                        }?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1113
+							echo $tc['geodir_sidebar_left_open_id'];
1114
+						}?>" type="text" name="geodir_sidebar_left_open_id" placeholder="geodir-sidebar-left"/></td>
1115 1115
                     <td><input value="<?php if (isset($tc['geodir_sidebar_left_open_class'])) {
1116
-                            echo $tc['geodir_sidebar_left_open_class'];
1117
-                        }?>" type="text" name="geodir_sidebar_left_open_class"
1116
+							echo $tc['geodir_sidebar_left_open_class'];
1117
+						}?>" type="text" name="geodir_sidebar_left_open_class"
1118 1118
                                placeholder="geodir-sidebar-left geodir-listings-sidebar-left"/></td>
1119 1119
                 </tr>
1120 1120
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
                         <span><?php _e('Output:', 'geodirectory');?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126
-                                echo $tc['geodir_sidebar_left_open_replace'];
1127
-                            }?></textarea>
1126
+								echo $tc['geodir_sidebar_left_open_replace'];
1127
+							}?></textarea>
1128 1128
                     </td>
1129 1129
                 </tr>
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
                         <span><?php _e('Output:', 'geodirectory');?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146
-                                echo $tc['geodir_sidebar_left_close_replace'];
1147
-                            }?></textarea>
1146
+								echo $tc['geodir_sidebar_left_close_replace'];
1147
+							}?></textarea>
1148 1148
                     </td>
1149 1149
                 </tr>
1150 1150
 
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
                         <small>geodir_main_content_open</small>
1154 1154
                     </td>
1155 1155
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_id'])) {
1156
-                            echo $tc['geodir_main_content_open_id'];
1157
-                        }?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1156
+							echo $tc['geodir_main_content_open_id'];
1157
+						}?>" type="text" name="geodir_main_content_open_id" placeholder="geodir-main-content"/></td>
1158 1158
                     <td><input value="<?php if (isset($tc['geodir_main_content_open_class'])) {
1159
-                            echo $tc['geodir_main_content_open_class'];
1160
-                        }?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1159
+							echo $tc['geodir_main_content_open_class'];
1160
+						}?>" type="text" name="geodir_main_content_open_class" placeholder="CURRENT-PAGE-page"/></td>
1161 1161
                 </tr>
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                         <span><?php _e('Output:', 'geodirectory');?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168
-                                echo $tc['geodir_main_content_open_replace'];
1169
-                            }?></textarea>
1168
+								echo $tc['geodir_main_content_open_replace'];
1169
+							}?></textarea>
1170 1170
                     </td>
1171 1171
                 </tr>
1172 1172
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
                         <span><?php _e('Output:', 'geodirectory');?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188
-                                echo $tc['geodir_main_content_close_replace'];
1189
-                            }?></textarea>
1188
+								echo $tc['geodir_main_content_close_replace'];
1189
+							}?></textarea>
1190 1190
                     </td>
1191 1191
                 </tr>
1192 1192
 
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
                     </td>
1211 1211
                     <td><textarea name="geodir_top_content_add"
1212 1212
                                   placeholder=''><?php if (isset($tc['geodir_top_content_add'])) {
1213
-                                echo $tc['geodir_top_content_add'];
1214
-                            }?></textarea></td>
1213
+								echo $tc['geodir_top_content_add'];
1214
+							}?></textarea></td>
1215 1215
                 </tr>
1216 1216
 
1217 1217
                 <tr>
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     </td>
1221 1221
                     <td><textarea name="geodir_before_main_content_add"
1222 1222
                                   placeholder=''><?php if (isset($tc['geodir_before_main_content_add'])) {
1223
-                                echo $tc['geodir_before_main_content_add'];
1224
-                            }?></textarea></td>
1223
+								echo $tc['geodir_before_main_content_add'];
1224
+							}?></textarea></td>
1225 1225
                 </tr>
1226 1226
 
1227 1227
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
                     </td>
1245 1245
                     <td><textarea name="geodir_full_page_class_filter"
1246 1246
                                   placeholder='geodir_full_page clearfix'><?php if (isset($tc['geodir_full_page_class_filter'])) {
1247
-                                echo $tc['geodir_full_page_class_filter'];
1248
-                            }?></textarea></td>
1247
+								echo $tc['geodir_full_page_class_filter'];
1248
+							}?></textarea></td>
1249 1249
                 </tr>
1250 1250
 
1251 1251
                 <tr>
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
                     </td>
1255 1255
                     <td><textarea name="geodir_before_widget_filter"
1256 1256
                                   placeholder='<section id="%1$s" class="widget geodir-widget %2$s">'><?php if (isset($tc['geodir_before_widget_filter'])) {
1257
-                                echo $tc['geodir_before_widget_filter'];
1258
-                            }?></textarea></td>
1257
+								echo $tc['geodir_before_widget_filter'];
1258
+							}?></textarea></td>
1259 1259
                 </tr>
1260 1260
 
1261 1261
                 <tr>
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
                     </td>
1265 1265
                     <td><textarea name="geodir_after_widget_filter"
1266 1266
                                   placeholder='</section>'><?php if (isset($tc['geodir_after_widget_filter'])) {
1267
-                                echo $tc['geodir_after_widget_filter'];
1268
-                            }?></textarea></td>
1267
+								echo $tc['geodir_after_widget_filter'];
1268
+							}?></textarea></td>
1269 1269
                 </tr>
1270 1270
 
1271 1271
                 <tr>
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
                     </td>
1275 1275
                     <td><textarea name="geodir_before_title_filter"
1276 1276
                                   placeholder='<h3 class="widget-title">'><?php if (isset($tc['geodir_before_title_filter'])) {
1277
-                                echo $tc['geodir_before_title_filter'];
1278
-                            }?></textarea></td>
1277
+								echo $tc['geodir_before_title_filter'];
1278
+							}?></textarea></td>
1279 1279
                 </tr>
1280 1280
 
1281 1281
                 <tr>
@@ -1284,8 +1284,8 @@  discard block
 block discarded – undo
1284 1284
                     </td>
1285 1285
                     <td><textarea name="geodir_after_title_filter"
1286 1286
                                   placeholder='</h3>'><?php if (isset($tc['geodir_after_title_filter'])) {
1287
-                                echo $tc['geodir_after_title_filter'];
1288
-                            }?></textarea></td>
1287
+								echo $tc['geodir_after_title_filter'];
1288
+							}?></textarea></td>
1289 1289
                 </tr>
1290 1290
 
1291 1291
                 <tr>
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
                     </td>
1295 1295
                     <td><textarea name="geodir_menu_li_class_filter"
1296 1296
                                   placeholder='menu-item'><?php if (isset($tc['geodir_menu_li_class_filter'])) {
1297
-                                echo $tc['geodir_menu_li_class_filter'];
1298
-                            }?></textarea></td>
1297
+								echo $tc['geodir_menu_li_class_filter'];
1298
+							}?></textarea></td>
1299 1299
                 </tr>
1300 1300
 
1301 1301
                 <tr>
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
                     </td>
1305 1305
                     <td><textarea name="geodir_sub_menu_ul_class_filter"
1306 1306
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_sub_menu_ul_class_filter'])) {
1307
-                                echo $tc['geodir_sub_menu_ul_class_filter'];
1308
-                            }?></textarea></td>
1307
+								echo $tc['geodir_sub_menu_ul_class_filter'];
1308
+							}?></textarea></td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <tr>
@@ -1314,8 +1314,8 @@  discard block
 block discarded – undo
1314 1314
                     </td>
1315 1315
                     <td><textarea name="geodir_sub_menu_li_class_filter"
1316 1316
                                   placeholder='menu-item'><?php if (isset($tc['geodir_sub_menu_li_class_filter'])) {
1317
-                                echo $tc['geodir_sub_menu_li_class_filter'];
1318
-                            }?></textarea></td>
1317
+								echo $tc['geodir_sub_menu_li_class_filter'];
1318
+							}?></textarea></td>
1319 1319
                 </tr>
1320 1320
 
1321 1321
                 <tr>
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
                     </td>
1325 1325
                     <td><textarea name="geodir_menu_a_class_filter"
1326 1326
                                   placeholder=''><?php if (isset($tc['geodir_menu_a_class_filter'])) {
1327
-                                echo $tc['geodir_menu_a_class_filter'];
1328
-                            }?></textarea></td>
1327
+								echo $tc['geodir_menu_a_class_filter'];
1328
+							}?></textarea></td>
1329 1329
                 </tr>
1330 1330
 
1331 1331
                 <tr>
@@ -1334,8 +1334,8 @@  discard block
 block discarded – undo
1334 1334
                     </td>
1335 1335
                     <td><textarea name="geodir_sub_menu_a_class_filter"
1336 1336
                                   placeholder=''><?php if (isset($tc['geodir_sub_menu_a_class_filter'])) {
1337
-                                echo $tc['geodir_sub_menu_a_class_filter'];
1338
-                            }?></textarea></td>
1337
+								echo $tc['geodir_sub_menu_a_class_filter'];
1338
+							}?></textarea></td>
1339 1339
                 </tr>
1340 1340
 
1341 1341
 
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
                     </td>
1346 1346
                     <td><textarea name="geodir_location_switcher_menu_li_class_filter"
1347 1347
                                   placeholder='menu-item menu-item-type-social menu-item-type-social gd-location-switcher'><?php if (isset($tc['geodir_location_switcher_menu_li_class_filter'])) {
1348
-                                echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
-                            }?></textarea></td>
1348
+								echo $tc['geodir_location_switcher_menu_li_class_filter'];
1349
+							}?></textarea></td>
1350 1350
                 </tr>
1351 1351
 
1352 1352
                 <tr>
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
                     </td>
1356 1356
                     <td><textarea name="geodir_location_switcher_menu_a_class_filter"
1357 1357
                                   placeholder=''><?php if (isset($tc['geodir_location_switcher_menu_a_class_filter'])) {
1358
-                                echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
-                            }?></textarea></td>
1358
+								echo $tc['geodir_location_switcher_menu_a_class_filter'];
1359
+							}?></textarea></td>
1360 1360
                 </tr>
1361 1361
 
1362 1362
                 <tr>
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
                     </td>
1366 1366
                     <td><textarea name="geodir_location_switcher_menu_sub_ul_class_filter"
1367 1367
                                   placeholder='sub-menu'><?php if (isset($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
1368
-                                echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
-                            }?></textarea></td>
1368
+								echo $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
1369
+							}?></textarea></td>
1370 1370
                 </tr>
1371 1371
 
1372 1372
                 <tr>
@@ -1375,21 +1375,21 @@  discard block
 block discarded – undo
1375 1375
                     </td>
1376 1376
                     <td><textarea name="geodir_location_switcher_menu_sub_li_class_filter"
1377 1377
                                   placeholder='menu-item gd-location-switcher-menu-item'><?php if (isset($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
1378
-                                echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
-                            }?></textarea></td>
1378
+								echo $tc['geodir_location_switcher_menu_sub_li_class_filter'];
1379
+							}?></textarea></td>
1380 1380
                 </tr>
1381 1381
 
1382 1382
 
1383 1383
 
1384 1384
                 <?php
1385
-                /**
1386
-                 * Allows more filter setting to be added to theme compatibility settings page.
1387
-                 *
1388
-                 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
-                 *
1390
-                 * @since 1.4.0
1391
-                 */
1392
-                do_action('gd_compat_other_filters');?>
1385
+				/**
1386
+				 * Allows more filter setting to be added to theme compatibility settings page.
1387
+				 *
1388
+				 * Called after the last setting in "Other filters" section of theme compatibility settings.
1389
+				 *
1390
+				 * @since 1.4.0
1391
+				 */
1392
+				do_action('gd_compat_other_filters');?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
                 <tr>
1403 1403
                     <td><textarea name="geodir_theme_compat_css"
1404 1404
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_css'])) {
1405
-                                echo $tc['geodir_theme_compat_css'];
1406
-                            }?></textarea></td>
1405
+								echo $tc['geodir_theme_compat_css'];
1406
+							}?></textarea></td>
1407 1407
                 </tr>
1408 1408
 
1409 1409
 
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
                 <tr>
1418 1418
                     <td><textarea name="geodir_theme_compat_js"
1419 1419
                                   placeholder=''><?php if (isset($tc['geodir_theme_compat_js'])) {
1420
-                                echo $tc['geodir_theme_compat_js'];
1421
-                            }?></textarea></td>
1420
+								echo $tc['geodir_theme_compat_js'];
1421
+							}?></textarea></td>
1422 1422
                 </tr>
1423 1423
 
1424 1424
 
@@ -1445,23 +1445,23 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_custom_post_type_form()
1447 1447
 {
1448
-    $listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1448
+	$listing_type = ($_REQUEST['listing_type'] != '') ? $_REQUEST['listing_type'] : 'gd_place';
1449 1449
 
1450
-    $sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1450
+	$sub_tab = ($_REQUEST['subtab'] != '') ? $_REQUEST['subtab'] : '';
1451 1451
 
1452 1452
 
1453
-    ?>
1453
+	?>
1454 1454
 
1455 1455
     <div class="gd-content-heading">
1456 1456
         <?php
1457
-        /**
1458
-         * Filter custom fields panel heading.
1459
-         *
1460
-         * @since 1.0.0
1461
-         * @param string $sub_tab Sub tab name.
1462
-         * @param string $listing_type Post type.
1463
-         */
1464
-        ?>
1457
+		/**
1458
+		 * Filter custom fields panel heading.
1459
+		 *
1460
+		 * @since 1.0.0
1461
+		 * @param string $sub_tab Sub tab name.
1462
+		 * @param string $listing_type Post type.
1463
+		 */
1464
+		?>
1465 1465
         <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
@@ -1469,25 +1469,25 @@  discard block
 block discarded – undo
1469 1469
 
1470 1470
             <div class="side-sortables" id="geodir-available-fields">
1471 1471
                 <?php
1472
-                /**
1473
-                 * Filter custom field available fields heading.
1474
-                 *
1475
-                 * @since 1.0.0
1476
-                 * @param string $sub_tab Sub tab name.
1477
-                 * @param string $listing_type Post type.
1478
-                 */
1479
-                ?>
1472
+				/**
1473
+				 * Filter custom field available fields heading.
1474
+				 *
1475
+				 * @since 1.0.0
1476
+				 * @param string $sub_tab Sub tab name.
1477
+				 * @param string $listing_type Post type.
1478
+				 */
1479
+				?>
1480 1480
                 <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483
-                /**
1484
-                 * Filter custom field available fields note text.
1485
-                 *
1486
-                 * @since 1.0.0
1487
-                 * @param string $sub_tab Sub tab name.
1488
-                 * @param string $listing_type Post type.
1489
-                 */
1490
-                ?>
1483
+				/**
1484
+				 * Filter custom field available fields note text.
1485
+				 *
1486
+				 * @since 1.0.0
1487
+				 * @param string $sub_tab Sub tab name.
1488
+				 * @param string $listing_type Post type.
1489
+				 */
1490
+				?>
1491 1491
                 <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1492 1492
 
1493 1493
                 <div class="inside">
@@ -1495,13 +1495,13 @@  discard block
 block discarded – undo
1495 1495
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1496 1496
 
1497 1497
                         <?php
1498
-                        /**
1499
-                         * Adds the available fields to the custom fields settings page per post type.
1500
-                         *
1501
-                         * @since 1.0.0
1502
-                         * @param string $sub_tab The current settings tab name.
1503
-                         */
1504
-                        do_action('geodir_manage_available_fields', $sub_tab); ?>
1498
+						/**
1499
+						 * Adds the available fields to the custom fields settings page per post type.
1500
+						 *
1501
+						 * @since 1.0.0
1502
+						 * @param string $sub_tab The current settings tab name.
1503
+						 */
1504
+						do_action('geodir_manage_available_fields', $sub_tab); ?>
1505 1505
 
1506 1506
                         <div style="clear:both"></div>
1507 1507
                     </div>
@@ -1514,25 +1514,25 @@  discard block
 block discarded – undo
1514 1514
             <div class="side-sortables" id="geodir-selected-fields">
1515 1515
                 <h3 class="hndle">
1516 1516
                     <?php
1517
-                    /**
1518
-                     * Filter custom field selected fields heading.
1519
-                     *
1520
-                     * @since 1.0.0
1521
-                     * @param string $sub_tab Sub tab name.
1522
-                     * @param string $listing_type Post type.
1523
-                     */
1524
-                    ?>
1517
+					/**
1518
+					 * Filter custom field selected fields heading.
1519
+					 *
1520
+					 * @since 1.0.0
1521
+					 * @param string $sub_tab Sub tab name.
1522
+					 * @param string $listing_type Post type.
1523
+					 */
1524
+					?>
1525 1525
                     <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528
-                /**
1529
-                 * Filter custom field selected fields note text.
1530
-                 *
1531
-                 * @since 1.0.0
1532
-                 * @param string $sub_tab Sub tab name.
1533
-                 * @param string $listing_type Post type.
1534
-                 */
1535
-                ?>
1528
+				/**
1529
+				 * Filter custom field selected fields note text.
1530
+				 *
1531
+				 * @since 1.0.0
1532
+				 * @param string $sub_tab Sub tab name.
1533
+				 * @param string $listing_type Post type.
1534
+				 */
1535
+				?>
1536 1536
                 <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1537 1537
 
1538 1538
                 <div class="inside">
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
                     <div id="gt-form-builder-tab" class="gt-tabs-panel">
1541 1541
                         <div class="field_row_main">
1542 1542
                             <?php
1543
-                            /**
1544
-                             * Adds the selected fields and setting to the custom fields settings page per post type.
1545
-                             *
1546
-                             * @since 1.0.0
1547
-                             * @param string $sub_tab The current settings tab name.
1548
-                             */
1549
-                            do_action('geodir_manage_selected_fields', $sub_tab); ?>
1543
+							/**
1544
+							 * Adds the selected fields and setting to the custom fields settings page per post type.
1545
+							 *
1546
+							 * @since 1.0.0
1547
+							 * @param string $sub_tab The current settings tab name.
1548
+							 */
1549
+							do_action('geodir_manage_selected_fields', $sub_tab); ?>
1550 1550
                         </div>
1551 1551
                         <div style="clear:both"></div>
1552 1552
                     </div>
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
  */
1570 1570
 function geodir_diagnostic_tools_setting_page()
1571 1571
 {
1572
-    ?>
1572
+	?>
1573 1573
     <div class="inner_content_tab_main">
1574 1574
         <div class="gd-content-heading">
1575 1575
 
@@ -1671,13 +1671,13 @@  discard block
 block discarded – undo
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
1674
-                /**
1675
-                 * Allows you to add more setting to the GD>Tools settings page.
1676
-                 *
1677
-                 * Called after the last setting on the GD>Tools page.
1678
-                 * @since 1.0.0
1679
-                 */
1680
-                do_action('geodir_diagnostic_tool');?>
1674
+				/**
1675
+				 * Allows you to add more setting to the GD>Tools settings page.
1676
+				 *
1677
+				 * Called after the last setting on the GD>Tools page.
1678
+				 * @since 1.0.0
1679
+				 */
1680
+				do_action('geodir_diagnostic_tool');?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,17 +74,20 @@  discard block
 block discarded – undo
74 74
                                 $tab_link = $args['url'];
75 75
                             }
76 76
 
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
77
+                            if (!empty($args['request'])) {
78
+                                                            $tab_link = geodir_getlink($tab_link, $args['request']);
79
+                            }
79 80
 
80 81
                             if (isset($args['target']) && $args['target'] != '') {
81 82
                                 $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
83
+                            } else {
84
+                                                            $tab_target = '';
85
+                            }
84 86
 
85 87
                             $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
+                            if ($current_tab == $name) {
89
+                                                            $tab_active = ' class="tab-active" ';
90
+                            }
88 91
                             /**
89 92
                              * Called before the individual settings tabs are output.
90 93
                              *
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 
123 126
                         <?php
124 127
                         unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
128
+                        if (isset($tabs[$current_tab]['subtabs'])) {
129
+                                                    $subtabs = $tabs[$current_tab]['subtabs'];
130
+                        }
127 131
                         $form_action = '';
128 132
 
129 133
                         if (!empty($subtabs)):
@@ -189,7 +193,10 @@  discard block
 block discarded – undo
189 193
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 194
                      return false;*/
191 195
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery(\'ul.subsubsub li a[href="#' . sanitize_text_field($_GET['subtab']) . '"]\').click();'; ?>
196
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) {
197
+	echo 'jQuery(\'ul.subsubsub li a[href="#' . sanitize_text_field($_GET['subtab']) . '"]\').click();';
198
+}
199
+?>
193 200
                 // Countries
194 201
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 202
                     if (jQuery(this).val() == "specific") {
@@ -312,10 +319,11 @@  discard block
 block discarded – undo
312 319
                 geodir_register_defaults();
313 320
             }*/
314 321
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
322
+            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
323
+                            $hide_save_button = "style='display:none;'";
324
+            } else {
325
+                            $hide_save_button = '';
326
+            }
319 327
 
320 328
             /**
321 329
              * Filter weather the default save button in the GD admin settings pages should be shown.
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                          * @param array $tabs The array of tabs to display.
53 53
                          */
54 54
                         $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
55
+                        update_option('geodir_tabs', $tabs); // Important to show settings menu dropdown
56 56
 
57 57
                         foreach ($tabs as $name => $args) :
58 58
                             $label = $args['label'];
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 
64 64
                                 $subtabs = $args['subtabs'];
65 65
 
66
-                                $query_string = '&subtab=' . $subtabs[0]['subtab'];
66
+                                $query_string = '&subtab='.$subtabs[0]['subtab'];
67 67
 
68 68
                             endif;
69 69
 
70 70
 
71
-                            $tab_link = admin_url('admin.php?page=geodirectory&tab=' . $name . $query_string);
71
+                            $tab_link = admin_url('admin.php?page=geodirectory&tab='.$name.$query_string);
72 72
 
73 73
                             if (isset($args['url']) && $args['url'] != '') {
74 74
                                 $tab_link = $args['url'];
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                                 $tab_link = geodir_getlink($tab_link, $args['request']);
79 79
 
80 80
                             if (isset($args['target']) && $args['target'] != '') {
81
-                                $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
81
+                                $tab_target = " target='".sanitize_text_field($args['target'])."' ";
82 82
                             } else
83 83
                                 $tab_target = '';
84 84
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                              * @see 'geodir_after_settings_tabs'
94 94
                              */
95 95
                             do_action('geodir_before_settings_tabs', $name);
96
-                            echo '<li ' . $tab_active . ' ><a href="' . esc_url($tab_link) . '"  ' . $tab_target . ' >' . $label . '</a></li>';
96
+                            echo '<li '.$tab_active.' ><a href="'.esc_url($tab_link).'"  '.$tab_target.' >'.$label.'</a></li>';
97 97
                             /**
98 98
                              * Called after the individual settings tabs are output.
99 99
                              *
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
                                         $form_action = isset($sub['form_action']) ? $sub['form_action'] : '';
138 138
                                     }
139 139
 
140
-                                    $sub_tabs_link = admin_url() . 'admin.php?page=geodirectory&tab=' . $current_tab . '&subtab=' . $sub['subtab'];
140
+                                    $sub_tabs_link = admin_url().'admin.php?page=geodirectory&tab='.$current_tab.'&subtab='.$sub['subtab'];
141 141
                                     if (isset($sub['request']) && is_array($sub['request']) && !empty($sub['request'])) {
142 142
                                         $sub_tabs_link = geodir_getlink($sub_tabs_link, $sub['request']);
143 143
                                     }
144
-                                    echo '<dd ' . $subtab_active . ' id="claim_listing"><a href="' . esc_url($sub_tabs_link) . '" >' . sanitize_text_field($sub['label']) . '</a></dd>';
144
+                                    echo '<dd '.$subtab_active.' id="claim_listing"><a href="'.esc_url($sub_tabs_link).'" >'.sanitize_text_field($sub['label']).'</a></dd>';
145 145
                                 }
146 146
                                 ?>
147 147
                             </dl>
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                             echo "inner_contet_tabs";
152 152
                         } ?>">
153 153
                             <form method="post" id="mainform"
154
-                                  class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
154
+                                  class="geodir_optionform <?php echo $current_tab.' '; ?><?php if (isset($sub['subtab'])) {
155 155
                                       echo sanitize_text_field($sub['subtab']);
156 156
                                   } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                                            echo sanitize_text_field($_REQUEST['active_tab']);
160 160
                                        } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162
-                                <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
162
+                                <?php wp_nonce_field('geodir-settings-'.$current_tab, '_wpnonce-'.$current_tab, true, true); ?>
163 163
                                 <?php
164 164
                                 /**
165 165
                                  * Used to call the content of each GD settings tab page.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 190
                      return false;*/
191 191
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery(\'ul.subsubsub li a[href="#' . sanitize_text_field($_GET['subtab']) . '"]\').click();'; ?>
192
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery(\'ul.subsubsub li a[href="#'.sanitize_text_field($_GET['subtab']).'"]\').click();'; ?>
193 193
                 // Countries
194 194
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 195
                     if (jQuery(this).val() == "specific") {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
223 223
                         if (changed) {
224 224
                             window.onbeforeunload = function () {
225
-                                return '<?php echo __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
225
+                                return '<?php echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
226 226
                             }
227 227
                         } else {
228 228
                             window.onbeforeunload = '';
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 
286 286
     //echo $tab_name.'_array.php' ;
287 287
     global $geodir_settings, $is_default, $mapzoom;
288
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
288
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$tab_name.'_array.php')) {
289 289
         /**
290 290
          * Contains settings array for given tab.
291 291
          *
292 292
          * @since 1.0.0
293 293
          * @package GeoDirectory
294 294
          */
295
-        include_once('option-pages/' . $tab_name . '_array.php');
295
+        include_once('option-pages/'.$tab_name.'_array.php');
296 296
     }
297 297
 
298 298
     $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ?>
328 328
 
329 329
             <p class="submit">
330
-            <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
330
+            <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
331 331
             <input type="hidden" name="subtab" id="last_tab" />
332 332
             </p>
333 333
             
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
                     ?>
398 398
 
399
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
399
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
                         echo $location_result->location_id;
405 405
                     } ?>">
406 406
 
407
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
407
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
408 408
 
409 409
                     <table class="form-table default_location_form">
410 410
                         <tbody>
411 411
                         <tr valign="top" class="single_select_page">
412
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
412
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
413 413
                             <td class="forminp">
414 414
                                 <div class="gtd-formfeild required">
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416
-                                           id="<?php echo $prefix;?>city" name="city"
416
+                                           id="<?php echo $prefix; ?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418 418
                                                echo $location_result->city;
419 419
                                            } ?>"/>
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
                             </td>
426 426
                         </tr>
427 427
                         <tr valign="top" class="single_select_page">
428
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
428
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
429 429
                             <td class="forminp">
430 430
                                 <div class="gtd-formfeild required">
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432
-                                           id="<?php echo $prefix;?>region" name="region"
432
+                                           id="<?php echo $prefix; ?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434 434
                                                echo $location_result->region;
435 435
                                            } ?>"/>
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                             </td>
442 442
                         </tr>
443 443
                         <tr valign="top" class="single_select_page">
444
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
444
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
445 445
                             <td class="forminp">
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                                     ?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
453
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
454 454
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
455 455
                                             data-showeverywhere="0">
456 456
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         </tr>
468 468
                         <tr valign="top" class="single_select_page gd-add-location-map">
469 469
                             <th class="titledesc"
470
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
470
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473 473
                                 /**
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
                                  *
476 476
                                  * @since 1.0.0
477 477
                                  */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
478
+                                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
482
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
482
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
483 483
                             <td class="forminp">
484 484
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
486
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488 488
                                                echo $location_result->city_latitude;
489 489
                                            } ?>"/>
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                         </tr>
497 497
                         <tr valign="top" class="single_select_page">
498 498
                             <th class="titledesc"
499
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
499
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
500 500
                             <td class="forminp">
501 501
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
503
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505 505
                                                echo $location_result->city_longitude;
506 506
                                            } ?>"/>
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
                 </div>
536 536
             </div>
537 537
             <?php break;
538
-        case $listing_type . '_fields_settings' :
538
+        case $listing_type.'_fields_settings' :
539 539
 
540 540
             geodir_custom_post_type_form();
541 541
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
     }
688 688
 
689 689
 
690
-    $theme_name = $theme_name . "_custom";
690
+    $theme_name = $theme_name."_custom";
691 691
     $theme_arr = get_option('gd_theme_compats');
692 692
     update_option('gd_theme_compat', $theme_name);
693 693
     /**
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
         <div class="gd-content-heading">
777 777
 
778 778
 
779
-            <h3><?php _e('Theme Compatibility Settings', 'geodirectory');?></h3>
779
+            <h3><?php _e('Theme Compatibility Settings', 'geodirectory'); ?></h3>
780 780
             <style>
781 781
                 .gd-theme-compat-table {
782 782
                     width: 100%;
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
                 </div>
808 808
             <?php }?>
809 809
 
810
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
810
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
811 811
 
812 812
             <select name="gd_theme_compat" id="gd_theme_compat">
813
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
813
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
814
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
815 815
                 <?php
816 816
                 $theme_arr = get_option('gd_theme_compats');
817 817
                 $theme_active = get_option('gd_theme_compat');
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
                 ?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
833
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
834 834
             <button onclick="gd_comp_import();" type="button"
835
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
836 836
 
837 837
             <div class="gd-comp-import-export">
838 838
                 <textarea id="gd-import-export-theme-comp"
839
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
839
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
840 840
             </div>
841 841
             <script>
842 842
 
843 843
                 function gd_comp_export() {
844 844
                     theme = jQuery('#gd_theme_compat').val();
845 845
                     if (theme == '' || theme == 'custom') {
846
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
846
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
847 847
                         return false;
848 848
                     }
849 849
                     jQuery('.gd-comp-import-export').show();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 
878 878
                     jQuery.post(ajaxurl, data, function (response) {
879 879
                         if (response == '0') {
880
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
880
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
881 881
                         } else {
882
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
882
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
883 883
                             jQuery('#gd-import-export-theme-comp').val('');
884 884
                             jQuery('.gd-comp-import-export').hide();
885 885
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 
921 921
             </script>
922 922
 
923
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
923
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
924 924
 
925 925
             <table class="form-table gd-theme-compat-table">
926 926
                 <tbody>
927 927
                 <tr>
928
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
929
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
930
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
928
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
929
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
930
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
931 931
                 </tr>
932 932
 
933 933
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
947 947
                     <td colspan="3">
948
-                        <span><?php _e('Output:', 'geodirectory');?></span>
948
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951 951
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
                         <small>geodir_wrapper_close</small>
960 960
                     </td>
961 961
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
962
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
962
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                 </tr>
966 966
 
967 967
                 <tr class="gd-theme-comp-out">
968 968
                     <td colspan="3">
969
-                        <span><?php _e('Output:', 'geodirectory');?></span>
969
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972 972
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
992 992
                     <td colspan="3">
993
-                        <span><?php _e('Output:', 'geodirectory');?></span>
993
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996 996
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                         <small>geodir_wrapper_content_close</small>
1005 1005
                     </td>
1006 1006
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1007
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1007
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                 </tr>
1011 1011
 
1012 1012
                 <tr class="gd-theme-comp-out">
1013 1013
                     <td colspan="3">
1014
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1014
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017 1017
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
1035 1035
                     <td colspan="3">
1036
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1036
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039 1039
                                 echo $tc['geodir_article_open_replace'];
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                         <small>geodir_article_close</small>
1047 1047
                     </td>
1048 1048
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1049
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1049
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                 </tr>
1053 1053
 
1054 1054
                 <tr class="gd-theme-comp-out">
1055 1055
                     <td colspan="3">
1056
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1056
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059 1059
                                 echo $tc['geodir_article_close_replace'];
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 <tr class="gd-theme-comp-out">
1078 1078
                     <td colspan="3">
1079
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1079
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082 1082
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
                         <small>geodir_sidebar_right_close</small>
1090 1090
                     </td>
1091 1091
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1092
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1092
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                 </tr>
1096 1096
 
1097 1097
                 <tr class="gd-theme-comp-out">
1098 1098
                     <td colspan="3">
1099
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1099
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102 1102
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
                 <tr class="gd-theme-comp-out">
1122 1122
                     <td colspan="3">
1123
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1123
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126 1126
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                         <small>geodir_sidebar_left_close</small>
1134 1134
                     </td>
1135 1135
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1136
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1136
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                 </tr>
1140 1140
 
1141 1141
                 <tr class="gd-theme-comp-out">
1142 1142
                     <td colspan="3">
1143
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1143
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146 1146
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
1164 1164
                     <td colspan="3">
1165
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1165
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168 1168
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                         <small>geodir_main_content_close</small>
1176 1176
                     </td>
1177 1177
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1178
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1178
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                 </tr>
1182 1182
 
1183 1183
                 <tr class="gd-theme-comp-out">
1184 1184
                     <td colspan="3">
1185
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1185
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188 1188
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1194,13 +1194,13 @@  discard block
 block discarded – undo
1194 1194
                 </tbody>
1195 1195
             </table>
1196 1196
 
1197
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1197
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1198 1198
 
1199 1199
             <table class="form-table gd-theme-compat-table">
1200 1200
                 <tbody>
1201 1201
                 <tr>
1202
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1203
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1202
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1203
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1204 1204
                 </tr>
1205 1205
 
1206 1206
 
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
             </table>
1230 1230
 
1231 1231
 
1232
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1232
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1233 1233
 
1234 1234
             <table class="form-table gd-theme-compat-table">
1235 1235
                 <tbody>
1236 1236
                 <tr>
1237
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1238
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1237
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1238
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1239 1239
                 </tr>
1240 1240
 
1241 1241
                 <tr>
@@ -1389,13 +1389,13 @@  discard block
 block discarded – undo
1389 1389
                  *
1390 1390
                  * @since 1.4.0
1391 1391
                  */
1392
-                do_action('gd_compat_other_filters');?>
1392
+                do_action('gd_compat_other_filters'); ?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
1396 1396
 
1397 1397
 
1398
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1398
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1399 1399
 
1400 1400
             <table class="form-table gd-theme-compat-table">
1401 1401
                 <tbody>
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 </tbody>
1411 1411
             </table>
1412 1412
 
1413
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1413
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1414 1414
 
1415 1415
             <table class="form-table gd-theme-compat-table">
1416 1416
                 <tbody>
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
             <p class="submit">
1430 1430
                 <input name="save" class="button-primary" type="submit"
1431
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1431
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1432 1432
             </p>
1433 1433
 
1434 1434
         </div>
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
          * @param string $listing_type Post type.
1463 1463
          */
1464 1464
         ?>
1465
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1465
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
1468 1468
         <div class="general-form-builder-frame">
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
                  * @param string $listing_type Post type.
1478 1478
                  */
1479 1479
                 ?>
1480
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1480
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483 1483
                 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                  * @param string $listing_type Post type.
1489 1489
                  */
1490 1490
                 ?>
1491
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1491
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1492 1492
 
1493 1493
                 <div class="inside">
1494 1494
 
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
                      * @param string $listing_type Post type.
1523 1523
                      */
1524 1524
                     ?>
1525
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1525
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528 1528
                 /**
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
                  * @param string $listing_type Post type.
1534 1534
                  */
1535 1535
                 ?>
1536
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1536
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1537 1537
 
1538 1538
                 <div class="inside">
1539 1539
 
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
         <div class="gd-content-heading">
1575 1575
 
1576 1576
 
1577
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1577
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1578 1578
             <style>
1579 1579
                 .gd-tools-table {
1580 1580
                     width: 100%;
@@ -1593,81 +1593,81 @@  discard block
 block discarded – undo
1593 1593
             <table class="form-table gd-tools-table">
1594 1594
                 <tbody>
1595 1595
                 <tr>
1596
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1597
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1598
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1596
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1597
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1598
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1599 1599
                 </tr>
1600 1600
 
1601 1601
 
1602 1602
                 <tr>
1603
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1603
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1604 1604
                     <td>
1605
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1605
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1606 1606
                     </td>
1607 1607
                     <td>
1608
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1608
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1609 1609
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1610 1610
                     </td>
1611 1611
                 </tr>
1612 1612
 
1613 1613
 
1614 1614
                 <tr>
1615
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1615
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1616 1616
                     <td>
1617
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1617
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1618 1618
                     </td>
1619
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1619
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1620 1620
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1621 1621
                     </td>
1622 1622
                 </tr>
1623 1623
 
1624 1624
                 <tr>
1625
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1625
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1626 1626
                     <td>
1627
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1627
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1628 1628
                     </td>
1629
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1629
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1630 1630
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1631 1631
                     </td>
1632 1632
                 </tr>
1633 1633
 
1634 1634
                 <tr>
1635
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1635
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1636 1636
                     <td>
1637
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1637
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1638 1638
                     </td>
1639
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1639
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1640 1640
                                class="button-primary geodir_diagnosis_button" data-diagnose="tags_sync"/>
1641 1641
                     </td>
1642 1642
                 </tr>
1643 1643
 
1644 1644
                 <tr>
1645
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1645
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1646 1646
                     <td>
1647
-                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory');?></small>
1647
+                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory'); ?></small>
1648 1648
                     </td>
1649
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1649
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1650 1650
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1651 1651
                     </td>
1652 1652
                 </tr>
1653 1653
 
1654 1654
 
1655 1655
                 <tr>
1656
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1656
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1657 1657
                     <td>
1658
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1658
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1659 1659
                     </td>
1660
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1660
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1661 1661
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1662 1662
                     </td>
1663 1663
                 </tr>
1664 1664
 				<tr>
1665
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1665
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1666 1666
 					<td>
1667
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1667
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1668 1668
 					</td>
1669 1669
 					<td>
1670
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1670
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
                  * Called after the last setting on the GD>Tools page.
1678 1678
                  * @since 1.0.0
1679 1679
                  */
1680
-                do_action('geodir_diagnostic_tool');?>
1680
+                do_action('geodir_diagnostic_tool'); ?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -714,8 +714,9 @@  discard block
 block discarded – undo
714 714
 
715 715
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716 716
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
717
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
718
+                                                                    $term_icon = $term_icon_url['src'];
719
+                                }
719 720
                                 break;
720 721
                             }
721 722
                         }
@@ -1246,8 +1247,9 @@  discard block
 block discarded – undo
1246 1247
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247 1248
     }
1248 1249
 
1249
-    if (isset($taxonomies[$post_type . '_tags']))
1250
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1250
+    if (isset($taxonomies[$post_type . '_tags'])) {
1251
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1252
+    }
1251 1253
 
1252 1254
     ?>
1253 1255
     </p><?php
@@ -1598,23 +1600,21 @@  discard block
 block discarded – undo
1598 1600
     if(geodir_is_page('pt')){
1599 1601
         $gd_page = 'pt';
1600 1602
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
-    }
1602
-    elseif(geodir_is_page('listing')){
1603
+    } elseif(geodir_is_page('listing')){
1603 1604
         $gd_page = 'listing';
1604 1605
         global $wp_query;
1605 1606
         $current_term = $wp_query->get_queried_object();
1606 1607
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1607 1608
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1609
+        } else{
1609 1610
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1611
         }
1611 1612
 
1612
-    }
1613
-    elseif(geodir_is_page('author')){
1613
+    } elseif(geodir_is_page('author')){
1614 1614
         $gd_page = 'author';
1615 1615
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616 1616
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1617
+        } else{
1618 1618
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619 1619
         }
1620 1620
 
@@ -2025,8 +2025,9 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_action_add_listing_page_title()
2027 2027
 {
2028
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2029
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2028
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2029
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2030
+    }
2030 2031
     /** This action is documented in geodirectory_template_actions.php */
2031 2032
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032 2033
     /** This action is documented in geodirectory_template_actions.php */
@@ -2038,7 +2039,7 @@  discard block
 block discarded – undo
2038 2039
         $gd_page = 'add-listing';
2039 2040
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040 2041
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2042
+        } elseif(isset($listing_type)){
2042 2043
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2044
         }
2044 2045
 
@@ -2321,8 +2322,9 @@  discard block
 block discarded – undo
2321 2322
         $totImg = 0;
2322 2323
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2323 2324
             $post = (object)$gd_session->get('listing');
2324
-            if (isset($post->post_images))
2325
-                $curImages = trim($post->post_images, ",");
2325
+            if (isset($post->post_images)) {
2326
+                            $curImages = trim($post->post_images, ",");
2327
+            }
2326 2328
 
2327 2329
 
2328 2330
             if ($curImages != '') {
@@ -2350,10 +2352,13 @@  discard block
 block discarded – undo
2350 2352
             $totImg = count((array)$thumb_img_arr);
2351 2353
         }
2352 2354
 
2353
-        if ($curImages != '')
2354
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2355
-        else
2356
-            $svalue = '';
2355
+        if ($curImages != '') {
2356
+                    $svalue = $curImages;
2357
+        }
2358
+        // this will be initial value of the above form field. Image urls.
2359
+        else {
2360
+                    $svalue = '';
2361
+        }
2357 2362
 
2358 2363
         $image_limit = $package_info->image_limit;
2359 2364
         $show_image_input_box = ($image_limit != '0');
@@ -2563,8 +2568,9 @@  discard block
 block discarded – undo
2563 2568
     </script><?php
2564 2569
 
2565 2570
     global $errors;
2566
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2567
-        $errors->add('claim_login', LOGIN_CLAIM);
2571
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2572
+            $errors->add('claim_login', LOGIN_CLAIM);
2573
+    }
2568 2574
 
2569 2575
     if (!empty($errors)) {
2570 2576
         foreach ($errors as $errorsObj) {
@@ -2668,8 +2674,9 @@  discard block
 block discarded – undo
2668 2674
 
2669 2675
     if (!empty($term)) {
2670 2676
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2671
-        if (!empty($current_term))
2672
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2677
+        if (!empty($current_term)) {
2678
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2679
+        }
2673 2680
     }
2674 2681
 
2675 2682
 
@@ -2687,7 +2694,7 @@  discard block
 block discarded – undo
2687 2694
         $gd_page = 'author';
2688 2695
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2689 2696
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2690
-        }else{
2697
+        } else{
2691 2698
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2692 2699
         }
2693 2700
 
Please login to merge, or discard this patch.
Indentation   +1748 added lines, -1748 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,106 +275,106 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
279
-    if (empty($tc)) {
280
-        return;
281
-    }
278
+	$tc = get_option('theme_compatibility_setting');
279
+	if (empty($tc)) {
280
+		return;
281
+	}
282 282
 
283
-    //php
284
-    if (!empty($tc['geodir_theme_compat_code'])) {
285
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
-    }
283
+	//php
284
+	if (!empty($tc['geodir_theme_compat_code'])) {
285
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+	}
287 287
 
288
-    //geodir_full_page_class
289
-    if (!empty($tc['geodir_full_page_class_filter'])) {
290
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
-    }
288
+	//geodir_full_page_class
289
+	if (!empty($tc['geodir_full_page_class_filter'])) {
290
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
+	}
292 292
 
293
-    //widget before filter
294
-    if (!empty($tc['geodir_before_widget_filter'])) {
295
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
-    }
293
+	//widget before filter
294
+	if (!empty($tc['geodir_before_widget_filter'])) {
295
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
+	}
297 297
 
298
-    //widget after filter
299
-    if (!empty($tc['geodir_after_widget_filter'])) {
300
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
-    }
298
+	//widget after filter
299
+	if (!empty($tc['geodir_after_widget_filter'])) {
300
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
+	}
302 302
 
303
-    //widget before title filter
304
-    if (!empty($tc['geodir_before_title_filter'])) {
305
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
-    }
303
+	//widget before title filter
304
+	if (!empty($tc['geodir_before_title_filter'])) {
305
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
+	}
307 307
 
308
-    //widget before title filter
309
-    if (!empty($tc['geodir_after_title_filter'])) {
310
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
-    }
308
+	//widget before title filter
309
+	if (!empty($tc['geodir_after_title_filter'])) {
310
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
+	}
312 312
 
313
-    //menu li class
314
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
315
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
-    }
313
+	//menu li class
314
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
315
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
+	}
317 317
 
318
-    //menu ul class
319
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
-    }
318
+	//menu ul class
319
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
+	}
322 322
 
323
-    //menu sub li class
324
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
-    }
323
+	//menu sub li class
324
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
+	}
327 327
 
328
-    //menu a class
329
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
330
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
-    }
328
+	//menu a class
329
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
330
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
+	}
332 332
 
333
-    //menu sub a class
334
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
-    }
333
+	//menu sub a class
334
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
+	}
337 337
 
338
-    //location menu li class
339
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
-    }
338
+	//location menu li class
339
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
+	}
342 342
 
343
-    //location menu sub ul class
344
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
-    }
343
+	//location menu sub ul class
344
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
+	}
347 347
 
348
-    //location menu sub li class
349
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
-    }
348
+	//location menu sub li class
349
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
+	}
352 352
 
353
-    //location menu a class
354
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
-    }
353
+	//location menu a class
354
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
+	}
357 357
 
358
-    // compat styles
359
-    if (!empty($tc['geodir_theme_compat_css'])) {
360
-        add_action('wp_head', 'gd_compat_styles');
361
-    }
358
+	// compat styles
359
+	if (!empty($tc['geodir_theme_compat_css'])) {
360
+		add_action('wp_head', 'gd_compat_styles');
361
+	}
362 362
 
363
-    // compat js
364
-    if (!empty($tc['geodir_theme_compat_js'])) {
365
-        add_action('wp_footer', 'gd_compat_script');
366
-    }
363
+	// compat js
364
+	if (!empty($tc['geodir_theme_compat_js'])) {
365
+		add_action('wp_footer', 'gd_compat_script');
366
+	}
367 367
 
368 368
 
369
-    // geodir_top_content_add
370
-    if (!empty($tc['geodir_top_content_add'])) {
371
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
-    }
369
+	// geodir_top_content_add
370
+	if (!empty($tc['geodir_top_content_add'])) {
371
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
+	}
373 373
 
374
-    // geodir_before_main_content_add
375
-    if (!empty($tc['geodir_before_main_content_add'])) {
376
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
-    }
374
+	// geodir_before_main_content_add
375
+	if (!empty($tc['geodir_before_main_content_add'])) {
376
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
+	}
378 378
 
379 379
 
380 380
 }
@@ -397,23 +397,23 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
399 399
 {
400
-    $tc = get_option('theme_compatibility_setting');
401
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
402
-        $text = $tc['geodir_wrapper_open_replace'];
403
-    } else {
404
-        $text = '<div id="[id]" class="[class]">';
405
-    }
400
+	$tc = get_option('theme_compatibility_setting');
401
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
402
+		$text = $tc['geodir_wrapper_open_replace'];
403
+	} else {
404
+		$text = '<div id="[id]" class="[class]">';
405
+	}
406 406
 
407
-    if (!empty($tc['geodir_wrapper_open_id'])) {
408
-        $id = $tc['geodir_wrapper_open_id'];
409
-    }
410
-    if (!empty($tc['geodir_wrapper_open_class'])) {
411
-        $class = $tc['geodir_wrapper_open_class'];
412
-    }
407
+	if (!empty($tc['geodir_wrapper_open_id'])) {
408
+		$id = $tc['geodir_wrapper_open_id'];
409
+	}
410
+	if (!empty($tc['geodir_wrapper_open_class'])) {
411
+		$class = $tc['geodir_wrapper_open_class'];
412
+	}
413 413
 
414
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
414
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415 415
 
416
-    echo $text;
416
+	echo $text;
417 417
 }
418 418
 
419 419
 // action for adding the wrapperdiv closing tag
@@ -428,14 +428,14 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_action_wrapper_close($type = '')
430 430
 {
431
-    $tc = get_option('theme_compatibility_setting');
432
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
433
-        $text = $tc['geodir_wrapper_close_replace'];
434
-    } else {
435
-        $text = '</div><!-- wrapper ends here-->';
436
-    }
431
+	$tc = get_option('theme_compatibility_setting');
432
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
433
+		$text = $tc['geodir_wrapper_close_replace'];
434
+	} else {
435
+		$text = '</div><!-- wrapper ends here-->';
436
+	}
437 437
 
438
-    echo $text;
438
+	echo $text;
439 439
 }
440 440
 
441 441
 // action for adding the content div opening tag
@@ -451,35 +451,35 @@  discard block
 block discarded – undo
451 451
  */
452 452
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
453 453
 {
454
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
-        $width_css = 'style="width:' . $width . '%;"';
456
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
-        $width_css = 'style="width:' . $width . '%;"';
458
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
-        $width_css = 'style="width:' . $width . '%;"';
460
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
-        $width_css = 'style="width:' . $width . '%;"';
462
-    } else {
463
-        $width_css = '';
464
-    }
465
-
466
-    $tc = get_option('theme_compatibility_setting');
467
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
-        $text = $tc['geodir_wrapper_content_open_replace'];
469
-    } else {
470
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
-    }
472
-
473
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
-        $id = $tc['geodir_wrapper_content_open_id'];
475
-    }
476
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
-        $class = $tc['geodir_wrapper_content_open_class'];
478
-    }
479
-
480
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
-
482
-    echo $text;
454
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
+		$width_css = 'style="width:' . $width . '%;"';
456
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
+		$width_css = 'style="width:' . $width . '%;"';
458
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
+		$width_css = 'style="width:' . $width . '%;"';
460
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
+		$width_css = 'style="width:' . $width . '%;"';
462
+	} else {
463
+		$width_css = '';
464
+	}
465
+
466
+	$tc = get_option('theme_compatibility_setting');
467
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
+		$text = $tc['geodir_wrapper_content_open_replace'];
469
+	} else {
470
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
+	}
472
+
473
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
+		$id = $tc['geodir_wrapper_content_open_id'];
475
+	}
476
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
+		$class = $tc['geodir_wrapper_content_open_class'];
478
+	}
479
+
480
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
+
482
+	echo $text;
483 483
 }
484 484
 
485 485
 // action for adding the primary div closing tag
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_action_wrapper_content_close($type = '')
495 495
 {
496
-    $tc = get_option('theme_compatibility_setting');
497
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
-        $text = $tc['geodir_wrapper_content_close_replace'];
499
-    } else {
500
-        $text = '</div><!-- content ends here-->';
501
-    }
502
-    echo $text;
496
+	$tc = get_option('theme_compatibility_setting');
497
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
+		$text = $tc['geodir_wrapper_content_close_replace'];
499
+	} else {
500
+		$text = '</div><!-- content ends here-->';
501
+	}
502
+	echo $text;
503 503
 }
504 504
 
505 505
 // action for adding the <article> opening tag
@@ -517,24 +517,24 @@  discard block
 block discarded – undo
517 517
  */
518 518
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
519 519
 {
520
-    $class = implode(" ", $class);
521
-    $tc = get_option('theme_compatibility_setting');
522
-    if (!empty($tc['geodir_article_open_replace'])) {
523
-        $text = $tc['geodir_article_open_replace'];
524
-    } else {
525
-        $text = '<article  id="[id]" class="[class]" >';
526
-    }
520
+	$class = implode(" ", $class);
521
+	$tc = get_option('theme_compatibility_setting');
522
+	if (!empty($tc['geodir_article_open_replace'])) {
523
+		$text = $tc['geodir_article_open_replace'];
524
+	} else {
525
+		$text = '<article  id="[id]" class="[class]" >';
526
+	}
527 527
 
528
-    if (!empty($tc['geodir_article_open_id'])) {
529
-        $id = $tc['geodir_article_open_id'];
530
-    }
531
-    if (!empty($tc['geodir_article_open_class'])) {
532
-        $class = $tc['geodir_article_open_class'];
533
-    }
528
+	if (!empty($tc['geodir_article_open_id'])) {
529
+		$id = $tc['geodir_article_open_id'];
530
+	}
531
+	if (!empty($tc['geodir_article_open_class'])) {
532
+		$class = $tc['geodir_article_open_class'];
533
+	}
534 534
 
535
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
535
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536 536
 
537
-    echo $text;
537
+	echo $text;
538 538
 }
539 539
 
540 540
 // action for adding the primary div closing tag
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
  */
549 549
 function geodir_action_article_close($type = '')
550 550
 {
551
-    $tc = get_option('theme_compatibility_setting');
552
-    if (!empty($tc['geodir_article_close_replace'])) {
553
-        $text = $tc['geodir_article_close_replace'];
554
-    } else {
555
-        $text = '</article><!-- article ends here-->';
556
-    }
557
-    echo $text;
551
+	$tc = get_option('theme_compatibility_setting');
552
+	if (!empty($tc['geodir_article_close_replace'])) {
553
+		$text = $tc['geodir_article_close_replace'];
554
+	} else {
555
+		$text = '</article><!-- article ends here-->';
556
+	}
557
+	echo $text;
558 558
 }
559 559
 
560 560
 // action for adding the sidebar opening tag
@@ -571,35 +571,35 @@  discard block
 block discarded – undo
571 571
  */
572 572
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
573 573
 {
574
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
-        $width_css = 'style="width:' . $width . '%;"';
576
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
-        $width_css = 'style="width:' . $width . '%;"';
578
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
-        $width_css = 'style="width:' . $width . '%;"';
580
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
-        $width_css = 'style="width:' . $width . '%;"';
582
-    } else {
583
-        $width_css = '';
584
-    }
585
-
586
-    $tc = get_option('theme_compatibility_setting');
587
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
-        $text = $tc['geodir_sidebar_right_open_replace'];
589
-    } else {
590
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
-    }
592
-
593
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
-        $id = $tc['geodir_sidebar_right_open_id'];
595
-    }
596
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
-        $class = $tc['geodir_sidebar_right_open_class'];
598
-    }
599
-
600
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
-
602
-    echo $text;
574
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
+		$width_css = 'style="width:' . $width . '%;"';
576
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
+		$width_css = 'style="width:' . $width . '%;"';
578
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
+		$width_css = 'style="width:' . $width . '%;"';
580
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
+		$width_css = 'style="width:' . $width . '%;"';
582
+	} else {
583
+		$width_css = '';
584
+	}
585
+
586
+	$tc = get_option('theme_compatibility_setting');
587
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
+		$text = $tc['geodir_sidebar_right_open_replace'];
589
+	} else {
590
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
+	}
592
+
593
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
+		$id = $tc['geodir_sidebar_right_open_id'];
595
+	}
596
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
+		$class = $tc['geodir_sidebar_right_open_class'];
598
+	}
599
+
600
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
+
602
+	echo $text;
603 603
 }
604 604
 
605 605
 // action for adding the primary div closing tag
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_action_sidebar_right_close($type = '')
615 615
 {
616
-    $tc = get_option('theme_compatibility_setting');
617
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
-        $text = $tc['geodir_sidebar_right_close_replace'];
619
-    } else {
620
-        $text = '</aside><!-- sidebar ends here-->';
621
-    }
622
-    echo $text;
616
+	$tc = get_option('theme_compatibility_setting');
617
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
+		$text = $tc['geodir_sidebar_right_close_replace'];
619
+	} else {
620
+		$text = '</aside><!-- sidebar ends here-->';
621
+	}
622
+	echo $text;
623 623
 }
624 624
 
625 625
 
@@ -640,121 +640,121 @@  discard block
 block discarded – undo
640 640
  */
641 641
 function geodir_action_geodir_set_preview_post()
642 642
 {
643
-    global $post, $preview, $gd_session;
644
-    $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
645
-    if (!$preview || $is_backend_preview) {
646
-        return;
647
-    }// bail if not previewing
648
-
649
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
-
651
-    $fields_info = geodir_get_custom_fields_type($listing_type);
652
-
653
-    foreach ($_REQUEST as $pkey => $pval) {
654
-        if ($pkey == 'geodir_video') {
655
-            $tags = '<iframe>';
656
-        } else if ($pkey == 'post_desc') {
657
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
-        } else if (is_array($_REQUEST[$pkey])) {
661
-            $tags = 'skip_field';
662
-        } else {
663
-            $tags = '';
664
-        }
665
-        /**
666
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
-         *
668
-         * @since 1.0.0
669
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
-         */
672
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
-
674
-        if ($tags != 'skip_field') {
675
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
-        }
677
-    }
678
-
679
-    $post = (object)$_REQUEST;
680
-
681
-
682
-    if (isset($post->video)) {
683
-        $post->video = stripslashes($post->video);
684
-    }
685
-
686
-    if (isset($post->Video2)) {
687
-        $post->Video2 = stripslashes($post->Video2);
688
-    }
689
-
690
-    $post_type = $post->listing_type;
691
-    $post_type_info = get_post_type_object($post_type);
692
-
693
-    $listing_label = $post_type_info->labels->singular_name;
694
-
695
-    $term_icon = '';
696
-
697
-    if (!empty($post->post_category)) {
698
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
699
-
700
-            if ($post_term != '' && !is_array($post_term)) {
701
-                $post_term = explode(',', trim($post_term, ','));
702
-            }
643
+	global $post, $preview, $gd_session;
644
+	$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
645
+	if (!$preview || $is_backend_preview) {
646
+		return;
647
+	}// bail if not previewing
648
+
649
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
+
651
+	$fields_info = geodir_get_custom_fields_type($listing_type);
652
+
653
+	foreach ($_REQUEST as $pkey => $pval) {
654
+		if ($pkey == 'geodir_video') {
655
+			$tags = '<iframe>';
656
+		} else if ($pkey == 'post_desc') {
657
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
+		} else if (is_array($_REQUEST[$pkey])) {
661
+			$tags = 'skip_field';
662
+		} else {
663
+			$tags = '';
664
+		}
665
+		/**
666
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
+		 *
668
+		 * @since 1.0.0
669
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
+		 */
672
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
+
674
+		if ($tags != 'skip_field') {
675
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
+		}
677
+	}
678
+
679
+	$post = (object)$_REQUEST;
680
+
681
+
682
+	if (isset($post->video)) {
683
+		$post->video = stripslashes($post->video);
684
+	}
685
+
686
+	if (isset($post->Video2)) {
687
+		$post->Video2 = stripslashes($post->Video2);
688
+	}
689
+
690
+	$post_type = $post->listing_type;
691
+	$post_type_info = get_post_type_object($post_type);
692
+
693
+	$listing_label = $post_type_info->labels->singular_name;
694
+
695
+	$term_icon = '';
696
+
697
+	if (!empty($post->post_category)) {
698
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
699
+
700
+			if ($post_term != '' && !is_array($post_term)) {
701
+				$post_term = explode(',', trim($post_term, ','));
702
+			}
703 703
 
704
-            if (is_array($post_term)) {
705
-                $post_term = array_unique($post_term);
706
-            }
704
+			if (is_array($post_term)) {
705
+				$post_term = array_unique($post_term);
706
+			}
707 707
 
708
-            if (!empty($post_term)) {
709
-                foreach ($post_term as $cat_id) {
710
-                    $cat_id = trim($cat_id);
711
-
712
-                    if ($cat_id != '') {
713
-                        $term_icon = get_option('geodir_default_marker_icon');
714
-
715
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
-                            if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
719
-                                break;
720
-                            }
721
-                        }
722
-                    }
723
-                }
724
-            }
725
-        }
726
-    }
708
+			if (!empty($post_term)) {
709
+				foreach ($post_term as $cat_id) {
710
+					$cat_id = trim($cat_id);
711
+
712
+					if ($cat_id != '') {
713
+						$term_icon = get_option('geodir_default_marker_icon');
714
+
715
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
+							if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
+									$term_icon = $term_icon_url['src'];
719
+								break;
720
+							}
721
+						}
722
+					}
723
+				}
724
+			}
725
+		}
726
+	}
727 727
 
728
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
728
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
730 730
 
731
-    $srcharr = array("'", "/", "-", '"', '\\');
732
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
731
+	$srcharr = array("'", "/", "-", '"', '\\');
732
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
733 733
 
734
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
734
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
735 735
 
736
-    $json = '{';
737
-    $json .= '"post_preview": "1",';
738
-    $json .= '"t": "' . $json_title . '",';
739
-    $json .= '"lt": "' . $post_latitude . '",';
740
-    $json .= '"ln": "' . $post_longitude . '",';
741
-    $json .= '"i":"' . $term_icon . '"';
742
-    $json .= '}';
736
+	$json = '{';
737
+	$json .= '"post_preview": "1",';
738
+	$json .= '"t": "' . $json_title . '",';
739
+	$json .= '"lt": "' . $post_latitude . '",';
740
+	$json .= '"ln": "' . $post_longitude . '",';
741
+	$json .= '"i":"' . $term_icon . '"';
742
+	$json .= '}';
743 743
 
744
-    $post->marker_json = $json;
744
+	$post->marker_json = $json;
745 745
 
746
-    $gd_session->set('listing', $_REQUEST);
746
+	$gd_session->set('listing', $_REQUEST);
747 747
 
748
-    // we need to define a few things to trick the setup_postdata
749
-    if (!isset($post->ID)) {
750
-        $post->ID = '';
751
-        $post->post_author = '';
752
-        $post->post_date = '';
753
-        $post->post_content = '';
754
-        $post->default_category = '';
755
-        $post->post_type = '';
756
-    }
757
-    setup_postdata($post);
748
+	// we need to define a few things to trick the setup_postdata
749
+	if (!isset($post->ID)) {
750
+		$post->ID = '';
751
+		$post->post_author = '';
752
+		$post->post_date = '';
753
+		$post->post_content = '';
754
+		$post->default_category = '';
755
+		$post->post_type = '';
756
+	}
757
+	setup_postdata($post);
758 758
 }
759 759
 
760 760
 /**
@@ -766,15 +766,15 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_action_geodir_preview_code()
768 768
 {
769
-    global $preview;
769
+	global $preview;
770 770
 
771
-    $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
771
+	$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
772 772
 
773
-    if (!$preview || $is_backend_preview) {
774
-        return;
775
-    }// bail if not previewing
773
+	if (!$preview || $is_backend_preview) {
774
+		return;
775
+	}// bail if not previewing
776 776
 
777
-    geodir_get_template_part('preview', 'buttons');
777
+	geodir_get_template_part('preview', 'buttons');
778 778
 }
779 779
 
780 780
 // action for adding the details page top widget area
@@ -790,20 +790,20 @@  discard block
 block discarded – undo
790 790
  */
791 791
 function geodir_action_geodir_sidebar_detail_top($class = '')
792 792
 {
793
-    if (get_option('geodir_show_detail_top_section')) { ?>
793
+	if (get_option('geodir_show_detail_top_section')) { ?>
794 794
         <div
795 795
             class="<?php
796
-            /**
797
-             * Filter the div class for the wrapper of the full width widget areas.
798
-             *
799
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
-             *
801
-             * @since 1.0.0
802
-             * @param string $class The class of the div.
803
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
-             */
806
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
796
+			/**
797
+			 * Filter the div class for the wrapper of the full width widget areas.
798
+			 *
799
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
+			 *
801
+			 * @since 1.0.0
802
+			 * @param string $class The class of the div.
803
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
+			 */
806
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
807 807
             <?php dynamic_sidebar('geodir_detail_top'); ?>
808 808
         </div>
809 809
     <?php }
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
  */
828 828
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
829 829
 {
830
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
830
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
831 831
         <div
832 832
             class="<?php
833
-            /** This action is documented in geodirectory_template_actions.php */
834
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
833
+			/** This action is documented in geodirectory_template_actions.php */
834
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
835 835
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
836 836
         </div><!-- clearfix ends here-->
837 837
     <?php }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
  */
846 846
 function geodir_details_sidebar_widget_area()
847 847
 {
848
-    dynamic_sidebar('geodir_detail_sidebar');
848
+	dynamic_sidebar('geodir_detail_sidebar');
849 849
 }
850 850
 
851 851
 /**
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
  */
857 857
 function geodir_details_sidebar_place_details()
858 858
 {
859
-    /**
860
-     * Used to add items to the details page sidebar.
861
-     *
862
-     * @since 1.0.0
863
-     */
864
-    do_action('geodir_detail_page_sidebar');
859
+	/**
860
+	 * Used to add items to the details page sidebar.
861
+	 *
862
+	 * @since 1.0.0
863
+	 */
864
+	do_action('geodir_detail_page_sidebar');
865 865
 }
866 866
 
867 867
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -876,68 +876,68 @@  discard block
 block discarded – undo
876 876
  */
877 877
 function geodir_action_details_sidebar()
878 878
 {
879
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
-    if (get_option('geodir_detail_sidebar_left_section')) {
881
-        /**
882
-         * Called before the details page left sidebar is opened.
883
-         *
884
-         * This is used to add opening wrapper HTML to the details page left sidebar.
885
-         *
886
-         * @since 1.0.0
887
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
-         */
892
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
-        ?>
879
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
+	if (get_option('geodir_detail_sidebar_left_section')) {
881
+		/**
882
+		 * Called before the details page left sidebar is opened.
883
+		 *
884
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
885
+		 *
886
+		 * @since 1.0.0
887
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
+		 */
892
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
+		?>
894 894
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
895
-        /**
896
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
-         *
898
-         * This is used to add all info to the details page sidebars.
899
-         *
900
-         * @since 1.0.0
901
-         */
902
-        do_action('geodir_detail_sidebar_inside');
903
-        ?></div><!-- end geodir-content-left --><?php
904
-        /**
905
-         * Called after the details page left sidebar.
906
-         *
907
-         * This is used to add closing wrapper HTML to the details page left sidebar.
908
-         *
909
-         * @since 1.0.0
910
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
-         */
912
-        do_action('geodir_sidebar_left_close', 'details-page');
913
-    } else {
914
-        /**
915
-         * Called before the details page right sidebar is opened.
916
-         *
917
-         * This is used to add opening wrapper HTML to the details page right sidebar.
918
-         *
919
-         * @since 1.0.0
920
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
-         */
925
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
-        ?>
895
+		/**
896
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
+		 *
898
+		 * This is used to add all info to the details page sidebars.
899
+		 *
900
+		 * @since 1.0.0
901
+		 */
902
+		do_action('geodir_detail_sidebar_inside');
903
+		?></div><!-- end geodir-content-left --><?php
904
+		/**
905
+		 * Called after the details page left sidebar.
906
+		 *
907
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
908
+		 *
909
+		 * @since 1.0.0
910
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
+		 */
912
+		do_action('geodir_sidebar_left_close', 'details-page');
913
+	} else {
914
+		/**
915
+		 * Called before the details page right sidebar is opened.
916
+		 *
917
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
918
+		 *
919
+		 * @since 1.0.0
920
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
+		 */
925
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
+		?>
927 927
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
928
-        /** This action is documented in geodirectory_template_actions.php */
929
-        do_action('geodir_detail_sidebar_inside');
930
-        ?></div><!-- end geodir-content-right --><?php
931
-        /**
932
-         * Called after the details page right sidebar.
933
-         *
934
-         * This is used to add closing wrapper HTML to the details page right sidebar.
935
-         *
936
-         * @since 1.0.0
937
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
-         */
939
-        do_action('geodir_sidebar_right_close', 'details-page');
940
-    }
928
+		/** This action is documented in geodirectory_template_actions.php */
929
+		do_action('geodir_detail_sidebar_inside');
930
+		?></div><!-- end geodir-content-right --><?php
931
+		/**
932
+		 * Called after the details page right sidebar.
933
+		 *
934
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
935
+		 *
936
+		 * @since 1.0.0
937
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
+		 */
939
+		do_action('geodir_sidebar_right_close', 'details-page');
940
+	}
941 941
 }
942 942
 
943 943
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -951,21 +951,21 @@  discard block
 block discarded – undo
951 951
  */
952 952
 function geodir_action_page_title()
953 953
 {
954
-    /**
955
-     * Filter the page title HTML h1 class.
956
-     *
957
-     * @since 1.0.0
958
-     * @param string $class The class to use. Default is 'entry-title fn'.
959
-     */
960
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
-    /**
962
-     * Filter the page title HTML header wrapper class.
963
-     *
964
-     * @since 1.0.0
965
-     * @param string $class The class to use. Default is 'entry-header'.
966
-     */
967
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
954
+	/**
955
+	 * Filter the page title HTML h1 class.
956
+	 *
957
+	 * @since 1.0.0
958
+	 * @param string $class The class to use. Default is 'entry-title fn'.
959
+	 */
960
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
+	/**
962
+	 * Filter the page title HTML header wrapper class.
963
+	 *
964
+	 * @since 1.0.0
965
+	 * @param string $class The class to use. Default is 'entry-header'.
966
+	 */
967
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969 969
 }
970 970
 
971 971
 
@@ -982,87 +982,87 @@  discard block
 block discarded – undo
982 982
  */
983 983
 function geodir_action_details_slider()
984 984
 {
985
-    global $preview, $post;
985
+	global $preview, $post;
986 986
 
987
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
987
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988 988
 
989
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
989
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
991 991
 
992
-        $preview_post_images = array();
993
-        if ($preview_get_images) {
994
-            foreach ($preview_get_images as $row) {
995
-                $preview_post_images[] = $row->src;
996
-            }
997
-        }
998
-        if (!empty($preview_post_images)) {
999
-            $post->post_images = implode(',', $preview_post_images);
1000
-        }
1001
-    }
1002
-
1003
-    if ($preview) {
1004
-        $post_images = array();
1005
-        if (isset($post->post_images) && !empty($post->post_images)) {
1006
-            $post->post_images = trim($post->post_images, ",");
1007
-            $post_images = explode(",", $post->post_images);
1008
-        }
1009
-
1010
-        $main_slides = '';
1011
-        $nav_slides = '';
1012
-        $slides = 0;
1013
-
1014
-        if (!empty($post_images)) {
1015
-            foreach ($post_images as $image) {
1016
-                if (!empty($image)) {
1017
-                    $sizes = getimagesize(trim($image));
1018
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
-
1021
-                    if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
-                    }
1024
-
1025
-                    if (isset($image->src)) {
1026
-                        if ($image->height >= 400) {
1027
-                            $spacer_height = 0;
1028
-                        } else {
1029
-                            $spacer_height = ((400 - $image->height) / 2);
1030
-                        }
1031
-
1032
-                        $image_title = isset($image->title) ? $image->title : '';
1033
-
1034
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
-                        $slides++;
1038
-                    }
1039
-                }
1040
-            }// endfore
1041
-        } //end if
1042
-    } else {
1043
-        $main_slides = '';
1044
-        $nav_slides = '';
1045
-        $post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
-        $slides = 0;
1047
-
1048
-        if (!empty($post_images)) {
1049
-            foreach ($post_images as $image) {
1050
-                if ($image->height >= 400) {
1051
-                    $spacer_height = 0;
1052
-                } else {
1053
-                    $spacer_height = ((400 - $image->height) / 2);
1054
-                }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
-                $slides++;
1060
-            }
1061
-        }// endfore
1062
-    }
992
+		$preview_post_images = array();
993
+		if ($preview_get_images) {
994
+			foreach ($preview_get_images as $row) {
995
+				$preview_post_images[] = $row->src;
996
+			}
997
+		}
998
+		if (!empty($preview_post_images)) {
999
+			$post->post_images = implode(',', $preview_post_images);
1000
+		}
1001
+	}
1002
+
1003
+	if ($preview) {
1004
+		$post_images = array();
1005
+		if (isset($post->post_images) && !empty($post->post_images)) {
1006
+			$post->post_images = trim($post->post_images, ",");
1007
+			$post_images = explode(",", $post->post_images);
1008
+		}
1009
+
1010
+		$main_slides = '';
1011
+		$nav_slides = '';
1012
+		$slides = 0;
1013
+
1014
+		if (!empty($post_images)) {
1015
+			foreach ($post_images as $image) {
1016
+				if (!empty($image)) {
1017
+					$sizes = getimagesize(trim($image));
1018
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
+
1021
+					if ($image && $width && $height) {
1022
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+					}
1024
+
1025
+					if (isset($image->src)) {
1026
+						if ($image->height >= 400) {
1027
+							$spacer_height = 0;
1028
+						} else {
1029
+							$spacer_height = ((400 - $image->height) / 2);
1030
+						}
1031
+
1032
+						$image_title = isset($image->title) ? $image->title : '';
1033
+
1034
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
+						$slides++;
1038
+					}
1039
+				}
1040
+			}// endfore
1041
+		} //end if
1042
+	} else {
1043
+		$main_slides = '';
1044
+		$nav_slides = '';
1045
+		$post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
+		$slides = 0;
1047
+
1048
+		if (!empty($post_images)) {
1049
+			foreach ($post_images as $image) {
1050
+				if ($image->height >= 400) {
1051
+					$spacer_height = 0;
1052
+				} else {
1053
+					$spacer_height = ((400 - $image->height) / 2);
1054
+				}
1055
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
+				$slides++;
1060
+			}
1061
+		}// endfore
1062
+	}
1063 1063
 
1064
-    if (!empty($post_images)) {
1065
-        ?>
1064
+	if (!empty($post_images)) {
1065
+		?>
1066 1066
         <div class="geodir_flex-container">
1067 1067
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1068 1068
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
             <?php } ?>
1076 1076
         </div>
1077 1077
     <?php
1078
-    }
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1090,177 +1090,177 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+	global $preview, $post;?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096
-    $taxonomies = array();
1097
-
1098
-    $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
1099
-
1100
-    if ($preview && !$is_backend_preview) {
1101
-        $post_type = $post->listing_type;
1102
-        $post_taxonomy = $post_type . 'category';
1103
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
-    } else {
1105
-        $post_type = $post->post_type;
1106
-        $post_taxonomy = $post_type . 'category';
1107
-    }
1096
+	$taxonomies = array();
1097
+
1098
+	$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
1099
+
1100
+	if ($preview && !$is_backend_preview) {
1101
+		$post_type = $post->listing_type;
1102
+		$post_taxonomy = $post_type . 'category';
1103
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
+	} else {
1105
+		$post_type = $post->post_type;
1106
+		$post_taxonomy = $post_type . 'category';
1107
+	}
1108 1108
 //{	
1109
-    $post_type_info = get_post_type_object($post_type);
1110
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
-
1112
-    if (!empty($post->post_tags)) {
1113
-
1114
-        if (taxonomy_exists($post_type . '_tags')):
1115
-            $links = array();
1116
-            $terms = array();
1117
-            // to limit post tags
1118
-            $post_tags = trim($post->post_tags, ",");
1119
-            $post_id = isset($post->ID) ? $post->ID : '';
1120
-            /**
1121
-             * Filter the post tags.
1122
-             *
1123
-             * Allows you to filter the post tags output on the details page of a post.
1124
-             *
1125
-             * @since 1.0.0
1126
-             * @param string $post_tags A comma seperated list of tags.
1127
-             * @param int $post_id The current post id.
1128
-             */
1129
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
-
1131
-            $post->post_tags = $post_tags;
1132
-            $post_tags = explode(",", trim($post->post_tags, ","));
1133
-
1134
-
1135
-            foreach ($post_tags as $post_term) {
1136
-
1137
-                // fix slug creation order for tags & location
1138
-                $post_term = trim($post_term);
1139
-
1140
-                $priority_location = false;
1141
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1143
-                } else {
1144
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1146
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1147
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1148
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1149
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150
-                    if ($match_country || $match_region || $match_city) {
1151
-                        $priority_location = true;
1152
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1153
-                    } else {
1154
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1156
-                    }
1157
-                }
1158
-
1159
-                if (!is_wp_error($term) && is_object($term)) {
1160
-
1161
-                    // fix tag link on detail page
1162
-                    if ($priority_location) {
1163
-
1164
-                        $tag_link = "<a href=''>$post_term</a>";
1165
-                        /**
1166
-                         * Filter the tag name on the details page.
1167
-                         *
1168
-                         * @since 1.5.6
1169
-                         * @param string $tag_link The tag link html.
1170
-                         * @param object $term The tag term object.
1171
-                         */
1172
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1173
-                        $links[] = $tag_link;
1174
-                    } else {
1175
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1176
-                        /** This action is documented in geodirectory-template_actions.php */
1177
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1178
-                        $links[] = $tag_link;
1179
-                    }
1180
-                    $terms[] = $term;
1181
-                }
1182
-                //
1183
-            }
1184
-            if (!isset($listing_label)) {
1185
-                $listing_label = '';
1186
-            }
1187
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1188
-        endif;
1189
-
1190
-    }
1191
-
1192
-    if (!empty($post->{$post_taxonomy})) {
1193
-        $links = array();
1194
-        $terms = array();
1195
-        $termsOrdered = array();
1196
-        if (!is_array($post->{$post_taxonomy})) {
1197
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1198
-        } else {
1199
-            $post_term = $post->{$post_taxonomy};
1109
+	$post_type_info = get_post_type_object($post_type);
1110
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
+
1112
+	if (!empty($post->post_tags)) {
1113
+
1114
+		if (taxonomy_exists($post_type . '_tags')):
1115
+			$links = array();
1116
+			$terms = array();
1117
+			// to limit post tags
1118
+			$post_tags = trim($post->post_tags, ",");
1119
+			$post_id = isset($post->ID) ? $post->ID : '';
1120
+			/**
1121
+			 * Filter the post tags.
1122
+			 *
1123
+			 * Allows you to filter the post tags output on the details page of a post.
1124
+			 *
1125
+			 * @since 1.0.0
1126
+			 * @param string $post_tags A comma seperated list of tags.
1127
+			 * @param int $post_id The current post id.
1128
+			 */
1129
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
+
1131
+			$post->post_tags = $post_tags;
1132
+			$post_tags = explode(",", trim($post->post_tags, ","));
1133
+
1134
+
1135
+			foreach ($post_tags as $post_term) {
1136
+
1137
+				// fix slug creation order for tags & location
1138
+				$post_term = trim($post_term);
1139
+
1140
+				$priority_location = false;
1141
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1143
+				} else {
1144
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1146
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1147
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1148
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1149
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150
+					if ($match_country || $match_region || $match_city) {
1151
+						$priority_location = true;
1152
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1153
+					} else {
1154
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1156
+					}
1157
+				}
1158
+
1159
+				if (!is_wp_error($term) && is_object($term)) {
1160
+
1161
+					// fix tag link on detail page
1162
+					if ($priority_location) {
1163
+
1164
+						$tag_link = "<a href=''>$post_term</a>";
1165
+						/**
1166
+						 * Filter the tag name on the details page.
1167
+						 *
1168
+						 * @since 1.5.6
1169
+						 * @param string $tag_link The tag link html.
1170
+						 * @param object $term The tag term object.
1171
+						 */
1172
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1173
+						$links[] = $tag_link;
1174
+					} else {
1175
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1176
+						/** This action is documented in geodirectory-template_actions.php */
1177
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1178
+						$links[] = $tag_link;
1179
+					}
1180
+					$terms[] = $term;
1181
+				}
1182
+				//
1183
+			}
1184
+			if (!isset($listing_label)) {
1185
+				$listing_label = '';
1186
+			}
1187
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1188
+		endif;
1189
+
1190
+	}
1191
+
1192
+	if (!empty($post->{$post_taxonomy})) {
1193
+		$links = array();
1194
+		$terms = array();
1195
+		$termsOrdered = array();
1196
+		if (!is_array($post->{$post_taxonomy})) {
1197
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1198
+		} else {
1199
+			$post_term = $post->{$post_taxonomy};
1200 1200
 			
1201 1201
 			if ($preview && !$is_backend_preview) {
1202 1202
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1203 1203
 			}
1204
-        }
1205
-
1206
-        $post_term = array_unique($post_term);
1207
-        if (!empty($post_term)) {
1208
-            foreach ($post_term as $post_term) {
1209
-                $post_term = trim($post_term);
1210
-
1211
-                if ($post_term != ''):
1212
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1213
-
1214
-                    if (is_object($term)) {
1215
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1216
-                        /**
1217
-                         * Filter the category name on the details page.
1218
-                         *
1219
-                         * @since 1.5.6
1220
-                         * @param string $term_link The link html to the category.
1221
-                         * @param object $term The category term object.
1222
-                         */
1223
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1224
-                        $links[] = $term_link;
1225
-                        $terms[] = $term;
1226
-                    }
1227
-                endif;
1228
-            }
1229
-            // order alphabetically
1230
-            asort($links);
1231
-            foreach (array_keys($links) as $key) {
1232
-                $termsOrdered[$key] = $terms[$key];
1233
-            }
1234
-            $terms = $termsOrdered;
1204
+		}
1205
+
1206
+		$post_term = array_unique($post_term);
1207
+		if (!empty($post_term)) {
1208
+			foreach ($post_term as $post_term) {
1209
+				$post_term = trim($post_term);
1210
+
1211
+				if ($post_term != ''):
1212
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1213
+
1214
+					if (is_object($term)) {
1215
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1216
+						/**
1217
+						 * Filter the category name on the details page.
1218
+						 *
1219
+						 * @since 1.5.6
1220
+						 * @param string $term_link The link html to the category.
1221
+						 * @param object $term The category term object.
1222
+						 */
1223
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1224
+						$links[] = $term_link;
1225
+						$terms[] = $term;
1226
+					}
1227
+				endif;
1228
+			}
1229
+			// order alphabetically
1230
+			asort($links);
1231
+			foreach (array_keys($links) as $key) {
1232
+				$termsOrdered[$key] = $terms[$key];
1233
+			}
1234
+			$terms = $termsOrdered;
1235 1235
 
1236
-        }
1236
+		}
1237 1237
 
1238
-        if (!isset($listing_label)) {
1239
-            $listing_label = '';
1240
-        }
1241
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1238
+		if (!isset($listing_label)) {
1239
+			$listing_label = '';
1240
+		}
1241
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1242 1242
 
1243
-    }
1243
+	}
1244 1244
 
1245
-    /**
1246
-     * Filter the taxonomies array before output.
1247
-     *
1248
-     * @since 1.5.9
1249
-     * @param array $taxonomies The array of cats and tags.
1250
-     * @param string $post_type The post type being output.
1251
-     * @param string $listing_label The post type label.
1252
-     * @param string $listing_label The post type label with ucwords function.
1253
-     */
1254
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1245
+	/**
1246
+	 * Filter the taxonomies array before output.
1247
+	 *
1248
+	 * @since 1.5.9
1249
+	 * @param array $taxonomies The array of cats and tags.
1250
+	 * @param string $post_type The post type being output.
1251
+	 * @param string $listing_label The post type label.
1252
+	 * @param string $listing_label The post type label with ucwords function.
1253
+	 */
1254
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1255 1255
 
1256
-    if (isset($taxonomies[$post_taxonomy])) {
1257
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1258
-    }
1256
+	if (isset($taxonomies[$post_taxonomy])) {
1257
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1258
+	}
1259 1259
 
1260
-    if (isset($taxonomies[$post_type . '_tags']))
1261
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1260
+	if (isset($taxonomies[$post_type . '_tags']))
1261
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1262 1262
 
1263
-    ?>
1263
+	?>
1264 1264
     </p><?php
1265 1265
 }
1266 1266
 
@@ -1282,140 +1282,140 @@  discard block
 block discarded – undo
1282 1282
 function geodir_action_details_micordata($post='')
1283 1283
 {
1284 1284
 
1285
-    global $preview;
1286
-    if(empty($post)){global $post;}
1287
-    if ($preview || !geodir_is_page('detail')) {
1288
-        return;
1289
-    }
1290
-
1291
-    // url
1292
-    $c_url = geodir_curPageURL();
1293
-
1294
-    // post reviews
1295
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1296
-    if (empty($post_reviews)) {
1297
-        $reviews = '';
1298
-    } else {
1299
-        foreach ($post_reviews as $review) {
1300
-            $reviews[] = array(
1301
-                "@type" => "Review",
1302
-                "author" => $review->comment_author,
1303
-                "datePublished" => $review->comment_date,
1304
-                "description" => $review->comment_content,
1305
-                "reviewRating" => array(
1306
-                    "@type" => "Rating",
1307
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1308
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309
-                    "worstRating" => "1"
1310
-                )
1311
-            );
1312
-        }
1313
-
1314
-    }
1315
-
1316
-    // post images
1317
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1318
-    if (empty($post_images)) {
1319
-        $images = '';
1320
-    } else {
1321
-        $i_arr = array();
1322
-        foreach ($post_images as $img) {
1323
-            $i_arr[] = $img->src;
1324
-        }
1325
-
1326
-        if (count($i_arr) == 1) {
1327
-            $images = $i_arr[0];
1328
-        } else {
1329
-            $images = $i_arr;
1330
-        }
1331
-
1332
-    }
1333
-    //print_r($post);
1334
-    // external links
1335
-    $external_links =  array();
1336
-    $external_links[] = $post->geodir_website;
1337
-    $external_links[] = $post->geodir_twitter;
1338
-    $external_links[] = $post->geodir_facebook;
1339
-    $external_links = array_filter($external_links);
1340
-
1341
-    if(!empty($external_links)){
1342
-        $external_links = array_values($external_links);
1343
-    }
1344
-
1345
-    // reviews
1346
-    $comment_count = geodir_get_review_count_total($post->ID);
1347
-    $post_avgratings = geodir_get_post_rating($post->ID);
1348
-
1349
-    // schema type
1350
-    $schema_type = 'LocalBusiness';
1351
-    if(isset($post->default_category) && $post->default_category){
1352
-        $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
-        if($cat_schema){$schema_type = $cat_schema;}
1354
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1355
-    }
1356
-
1357
-    $schema = array();
1358
-    $schema['@context'] = "http://schema.org";
1359
-    $schema['@type'] = $schema_type;
1360
-    $schema['name'] = $post->post_name;
1361
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1362
-    $schema['telephone'] = $post->geodir_contact;
1363
-    $schema['url'] = $c_url;
1364
-    $schema['sameAs'] = $external_links;
1365
-    $schema['image'] = $images;
1366
-    $schema['address'] = array(
1367
-        "@type" => "PostalAddress",
1368
-        "streetAddress" => $post->post_address,
1369
-        "addressLocality" => $post->post_city,
1370
-        "addressRegion" => $post->post_region,
1371
-        "addressCountry" => $post->post_country,
1372
-        "postalCode" => $post->post_zip
1373
-    );
1374
-
1375
-    if($post->post_latitude && $post->post_longitude) {
1376
-        $schema['geo'] = array(
1377
-            "@type" => "GeoCoordinates",
1378
-            "latitude" => $post->post_latitude,
1379
-            "longitude" => $post->post_longitude
1380
-        );
1381
-    }
1382
-
1383
-    if($post_avgratings) {
1384
-        $schema['aggregateRating'] = array(
1385
-            "@type" => "AggregateRating",
1386
-            "ratingValue" => $post_avgratings,
1387
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1388
-            "worstRating" => "1",
1389
-            "ratingCount" => $comment_count
1390
-        );
1391
-    }
1392
-    $schema['review'] = $reviews;
1393
-
1394
-    /**
1395
-     * Allow the schema JSON-LD info to be filtered.
1396
-     *
1397
-     * @since 1.5.4
1398
-     * @since 1.5.7 Added $post variable.
1399
-     * @param array $schema The array of schema data to be filtered.
1400
-     * @param object $post The post object.
1401
-     */
1402
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1403
-
1404
-
1405
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1406
-
1407
-
1408
-    $uploads = wp_upload_dir();
1409
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1410
-
1411
-    /**
1412
-     * Show facebook open graph meta info
1413
-     *
1414
-     * @since 1.6.6
1415
-     * @param string $facebook_og The open graph html to be filtered.
1416
-     * @param object $post The post object.
1417
-     */
1418
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1285
+	global $preview;
1286
+	if(empty($post)){global $post;}
1287
+	if ($preview || !geodir_is_page('detail')) {
1288
+		return;
1289
+	}
1290
+
1291
+	// url
1292
+	$c_url = geodir_curPageURL();
1293
+
1294
+	// post reviews
1295
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1296
+	if (empty($post_reviews)) {
1297
+		$reviews = '';
1298
+	} else {
1299
+		foreach ($post_reviews as $review) {
1300
+			$reviews[] = array(
1301
+				"@type" => "Review",
1302
+				"author" => $review->comment_author,
1303
+				"datePublished" => $review->comment_date,
1304
+				"description" => $review->comment_content,
1305
+				"reviewRating" => array(
1306
+					"@type" => "Rating",
1307
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1308
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309
+					"worstRating" => "1"
1310
+				)
1311
+			);
1312
+		}
1313
+
1314
+	}
1315
+
1316
+	// post images
1317
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1318
+	if (empty($post_images)) {
1319
+		$images = '';
1320
+	} else {
1321
+		$i_arr = array();
1322
+		foreach ($post_images as $img) {
1323
+			$i_arr[] = $img->src;
1324
+		}
1325
+
1326
+		if (count($i_arr) == 1) {
1327
+			$images = $i_arr[0];
1328
+		} else {
1329
+			$images = $i_arr;
1330
+		}
1331
+
1332
+	}
1333
+	//print_r($post);
1334
+	// external links
1335
+	$external_links =  array();
1336
+	$external_links[] = $post->geodir_website;
1337
+	$external_links[] = $post->geodir_twitter;
1338
+	$external_links[] = $post->geodir_facebook;
1339
+	$external_links = array_filter($external_links);
1340
+
1341
+	if(!empty($external_links)){
1342
+		$external_links = array_values($external_links);
1343
+	}
1344
+
1345
+	// reviews
1346
+	$comment_count = geodir_get_review_count_total($post->ID);
1347
+	$post_avgratings = geodir_get_post_rating($post->ID);
1348
+
1349
+	// schema type
1350
+	$schema_type = 'LocalBusiness';
1351
+	if(isset($post->default_category) && $post->default_category){
1352
+		$cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
+		if($cat_schema){$schema_type = $cat_schema;}
1354
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1355
+	}
1356
+
1357
+	$schema = array();
1358
+	$schema['@context'] = "http://schema.org";
1359
+	$schema['@type'] = $schema_type;
1360
+	$schema['name'] = $post->post_name;
1361
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1362
+	$schema['telephone'] = $post->geodir_contact;
1363
+	$schema['url'] = $c_url;
1364
+	$schema['sameAs'] = $external_links;
1365
+	$schema['image'] = $images;
1366
+	$schema['address'] = array(
1367
+		"@type" => "PostalAddress",
1368
+		"streetAddress" => $post->post_address,
1369
+		"addressLocality" => $post->post_city,
1370
+		"addressRegion" => $post->post_region,
1371
+		"addressCountry" => $post->post_country,
1372
+		"postalCode" => $post->post_zip
1373
+	);
1374
+
1375
+	if($post->post_latitude && $post->post_longitude) {
1376
+		$schema['geo'] = array(
1377
+			"@type" => "GeoCoordinates",
1378
+			"latitude" => $post->post_latitude,
1379
+			"longitude" => $post->post_longitude
1380
+		);
1381
+	}
1382
+
1383
+	if($post_avgratings) {
1384
+		$schema['aggregateRating'] = array(
1385
+			"@type" => "AggregateRating",
1386
+			"ratingValue" => $post_avgratings,
1387
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1388
+			"worstRating" => "1",
1389
+			"ratingCount" => $comment_count
1390
+		);
1391
+	}
1392
+	$schema['review'] = $reviews;
1393
+
1394
+	/**
1395
+	 * Allow the schema JSON-LD info to be filtered.
1396
+	 *
1397
+	 * @since 1.5.4
1398
+	 * @since 1.5.7 Added $post variable.
1399
+	 * @param array $schema The array of schema data to be filtered.
1400
+	 * @param object $post The post object.
1401
+	 */
1402
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1403
+
1404
+
1405
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1406
+
1407
+
1408
+	$uploads = wp_upload_dir();
1409
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1410
+
1411
+	/**
1412
+	 * Show facebook open graph meta info
1413
+	 *
1414
+	 * @since 1.6.6
1415
+	 * @param string $facebook_og The open graph html to be filtered.
1416
+	 * @param object $post The post object.
1417
+	 */
1418
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1419 1419
 
1420 1420
 
1421 1421
 
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
  */
1436 1436
 function geodir_action_details_next_prev()
1437 1437
 {
1438
-    ?>
1438
+	?>
1439 1439
     <div class="geodir-pos_navigation clearfix">
1440 1440
     <div
1441 1441
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1453,15 +1453,15 @@  discard block
 block discarded – undo
1453 1453
  */
1454 1454
 function geodir_action_before_single_post()
1455 1455
 {
1456
-    global $post;
1457
-    /**
1458
-     * Called at the very start of the details page output, before the title section.
1459
-     *
1460
-     * @since 1.0.0
1461
-     * @param object $post The current post object.
1462
-     * @global WP_Post|null $post The current post, if available.
1463
-     */
1464
-    do_action('geodir_before_single_post', $post); // extra action	
1456
+	global $post;
1457
+	/**
1458
+	 * Called at the very start of the details page output, before the title section.
1459
+	 *
1460
+	 * @since 1.0.0
1461
+	 * @param object $post The current post object.
1462
+	 * @global WP_Post|null $post The current post, if available.
1463
+	 */
1464
+	do_action('geodir_before_single_post', $post); // extra action	
1465 1465
 }
1466 1466
 
1467 1467
 /**
@@ -1472,13 +1472,13 @@  discard block
 block discarded – undo
1472 1472
  */
1473 1473
 function geodir_action_after_single_post($post)
1474 1474
 {
1475
-    /**
1476
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1477
-     *
1478
-     * @since 1.0.0
1479
-     * @param object $post The current post object.
1480
-     */
1481
-    do_action('geodir_after_single_post', $post); // extra action	
1475
+	/**
1476
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1477
+	 *
1478
+	 * @since 1.0.0
1479
+	 * @param object $post The current post object.
1480
+	 */
1481
+	do_action('geodir_after_single_post', $post); // extra action	
1482 1482
 }
1483 1483
 
1484 1484
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1504,167 +1504,167 @@  discard block
 block discarded – undo
1504 1504
  */
1505 1505
 function geodir_action_listings_title()
1506 1506
 {
1507
-    global $wp, $term;
1507
+	global $wp, $term;
1508 1508
 
1509
-    $gd_post_type = geodir_get_current_posttype();
1510
-    $post_type_info = get_post_type_object($gd_post_type);
1509
+	$gd_post_type = geodir_get_current_posttype();
1510
+	$post_type_info = get_post_type_object($gd_post_type);
1511 1511
 
1512
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1513
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1514
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1515
-    }
1512
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1513
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1514
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1515
+	}
1516 1516
 
1517
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1518
-    $single_name = $post_type_info->labels->singular_name;
1517
+	$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1518
+	$single_name = $post_type_info->labels->singular_name;
1519 1519
 
1520
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1520
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1521 1521
 
1522
-    $gd_country = get_query_var('gd_country');
1523
-    $gd_region = get_query_var('gd_region');
1524
-    $gd_city = get_query_var('gd_city');
1522
+	$gd_country = get_query_var('gd_country');
1523
+	$gd_region = get_query_var('gd_region');
1524
+	$gd_city = get_query_var('gd_city');
1525 1525
 
1526
-    if (!empty($term)) {
1527
-        $location_name = '';
1528
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1529
-            if ($gd_country != '') {
1530
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1531
-            }
1532
-
1533
-            if ($gd_region != '') {
1534
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1535
-            }
1536
-
1537
-            if ($gd_city != '') {
1538
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1539
-            }
1540
-        }
1541
-
1542
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1543
-        if (!empty($current_term)) {
1544
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1545
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1546
-                $location_last_char = substr($location_name, -1);
1547
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1548
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1549
-            } else {
1550
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1551
-            }
1552
-        } else {
1553
-            if (count($taxonomy) > 1) {
1554
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1555
-
1556
-                if (!empty($current_term)) {
1557
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1558
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1559
-                        $location_last_char = substr($location_name, -1);
1560
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1561
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1562
-                    } else {
1563
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1564
-                    }
1565
-                }
1566
-            }
1567
-        }
1568
-
1569
-    } else {
1570
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1571
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1572
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1573
-
1574
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1575
-
1576
-        if (function_exists('get_actual_location_name')) {
1577
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1578
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1579
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1580
-        }
1581
-
1582
-        if ($gd_city != '') {
1583
-            if ($gd_city_actual != '') {
1584
-                $gd_city = $gd_city_actual;
1585
-            } else {
1586
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1587
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1588
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1589
-            }
1590
-
1591
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1592
-        } else if ($gd_region != '') {
1593
-            if ($gd_region_actual != '') {
1594
-                $gd_region = $gd_region_actual;
1595
-            } else {
1596
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1597
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1598
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1599
-            }
1600
-
1601
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1602
-        } else if ($gd_country != '') {
1603
-            if ($gd_country_actual != '') {
1604
-                $gd_country = $gd_country_actual;
1605
-            } else {
1606
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1607
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1608
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1609
-            }
1610
-
1611
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1612
-        }
1613
-    }
1614
-
1615
-    if (is_search()) {
1616
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1617
-    }
1618
-    /** This action is documented in geodirectory_template_actions.php */
1619
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1620
-    /** This action is documented in geodirectory_template_actions.php */
1621
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1622
-
1623
-
1624
-    $title = $list_title;
1625
-    if(geodir_is_page('pt')){
1626
-        $gd_page = 'pt';
1627
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1628
-    }
1629
-    elseif(geodir_is_page('listing')){
1630
-        $gd_page = 'listing';
1631
-        global $wp_query;
1632
-        $current_term = $wp_query->get_queried_object();
1633
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1634
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1635
-        }else{
1636
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1637
-        }
1526
+	if (!empty($term)) {
1527
+		$location_name = '';
1528
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1529
+			if ($gd_country != '') {
1530
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1531
+			}
1638 1532
 
1639
-    }
1640
-    elseif(geodir_is_page('author')){
1641
-        $gd_page = 'author';
1642
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1643
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1644
-        }else{
1645
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1646
-        }
1533
+			if ($gd_region != '') {
1534
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1535
+			}
1647 1536
 
1648
-    }
1537
+			if ($gd_city != '') {
1538
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1539
+			}
1540
+		}
1541
+
1542
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1543
+		if (!empty($current_term)) {
1544
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1545
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1546
+				$location_last_char = substr($location_name, -1);
1547
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1548
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1549
+			} else {
1550
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1551
+			}
1552
+		} else {
1553
+			if (count($taxonomy) > 1) {
1554
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1555
+
1556
+				if (!empty($current_term)) {
1557
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1558
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1559
+						$location_last_char = substr($location_name, -1);
1560
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1561
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1562
+					} else {
1563
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1564
+					}
1565
+				}
1566
+			}
1567
+		}
1568
+
1569
+	} else {
1570
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1571
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1572
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1573
+
1574
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1575
+
1576
+		if (function_exists('get_actual_location_name')) {
1577
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1578
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1579
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1580
+		}
1581
+
1582
+		if ($gd_city != '') {
1583
+			if ($gd_city_actual != '') {
1584
+				$gd_city = $gd_city_actual;
1585
+			} else {
1586
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1587
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1588
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1589
+			}
1649 1590
 
1591
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1592
+		} else if ($gd_region != '') {
1593
+			if ($gd_region_actual != '') {
1594
+				$gd_region = $gd_region_actual;
1595
+			} else {
1596
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1597
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1598
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1599
+			}
1650 1600
 
1651
-    /**
1652
-     * Filter page title to replace variables.
1653
-     *
1654
-     * @since 1.5.4
1655
-     * @param string $title The page title including variables.
1656
-     * @param string $gd_page The GeoDirectory page type if any.
1657
-     */
1658
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1601
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1602
+		} else if ($gd_country != '') {
1603
+			if ($gd_country_actual != '') {
1604
+				$gd_country = $gd_country_actual;
1605
+			} else {
1606
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1607
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1608
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1609
+			}
1659 1610
 
1660
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1661
-        /**
1662
-         * Filter the listing page title.
1663
-         *
1664
-         * @since 1.0.0
1665
-         * @param string $list_title The title for the category page.
1666
-         */
1667
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1611
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1612
+		}
1613
+	}
1614
+
1615
+	if (is_search()) {
1616
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1617
+	}
1618
+	/** This action is documented in geodirectory_template_actions.php */
1619
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1620
+	/** This action is documented in geodirectory_template_actions.php */
1621
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1622
+
1623
+
1624
+	$title = $list_title;
1625
+	if(geodir_is_page('pt')){
1626
+		$gd_page = 'pt';
1627
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1628
+	}
1629
+	elseif(geodir_is_page('listing')){
1630
+		$gd_page = 'listing';
1631
+		global $wp_query;
1632
+		$current_term = $wp_query->get_queried_object();
1633
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1634
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1635
+		}else{
1636
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1637
+		}
1638
+
1639
+	}
1640
+	elseif(geodir_is_page('author')){
1641
+		$gd_page = 'author';
1642
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1643
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1644
+		}else{
1645
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1646
+		}
1647
+
1648
+	}
1649
+
1650
+
1651
+	/**
1652
+	 * Filter page title to replace variables.
1653
+	 *
1654
+	 * @since 1.5.4
1655
+	 * @param string $title The page title including variables.
1656
+	 * @param string $gd_page The GeoDirectory page type if any.
1657
+	 */
1658
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1659
+
1660
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1661
+		/**
1662
+		 * Filter the listing page title.
1663
+		 *
1664
+		 * @since 1.0.0
1665
+		 * @param string $list_title The title for the category page.
1666
+		 */
1667
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1668 1668
 }
1669 1669
 
1670 1670
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1677,46 +1677,46 @@  discard block
 block discarded – undo
1677 1677
  */
1678 1678
 function geodir_action_listings_description()
1679 1679
 {
1680
-    global $wp_query;
1681
-    $current_term = $wp_query->get_queried_object();
1680
+	global $wp_query;
1681
+	$current_term = $wp_query->get_queried_object();
1682 1682
 
1683
-    $gd_post_type = geodir_get_current_posttype();
1684
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1683
+	$gd_post_type = geodir_get_current_posttype();
1684
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1685 1685
 
1686
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1687
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1688
-        if ($term_desc && !$saved_data) {
1689
-            $saved_data = $term_desc;
1690
-        }
1686
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1687
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1688
+		if ($term_desc && !$saved_data) {
1689
+			$saved_data = $term_desc;
1690
+		}
1691 1691
 
1692
-        // stop payment manager filtering content length
1693
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1694
-        if ( false !== $filter_priority ) {
1695
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1696
-        }
1692
+		// stop payment manager filtering content length
1693
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1694
+		if ( false !== $filter_priority ) {
1695
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1696
+		}
1697 1697
 
1698
-        /**
1699
-         * Apply the core filter `the_content` filter to the variable string.
1700
-         *
1701
-         * This is a WordPress core filter that does many things.
1702
-         *
1703
-         * @since 1.0.0
1704
-         * @param string $var The string to apply the filter to.
1705
-         */
1706
-        $cat_description = apply_filters('the_content', $saved_data);
1698
+		/**
1699
+		 * Apply the core filter `the_content` filter to the variable string.
1700
+		 *
1701
+		 * This is a WordPress core filter that does many things.
1702
+		 *
1703
+		 * @since 1.0.0
1704
+		 * @param string $var The string to apply the filter to.
1705
+		 */
1706
+		$cat_description = apply_filters('the_content', $saved_data);
1707 1707
 
1708 1708
 
1709
-        if ( false !== $filter_priority ) {
1710
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1711
-        }
1709
+		if ( false !== $filter_priority ) {
1710
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1711
+		}
1712 1712
 
1713
-        if ($cat_description) {
1714
-            ?>
1713
+		if ($cat_description) {
1714
+			?>
1715 1715
 
1716 1716
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1717
-        }
1717
+		}
1718 1718
 
1719
-    }
1719
+	}
1720 1720
 }
1721 1721
 
1722 1722
 // action for adding the listings page top widget area
@@ -1735,11 +1735,11 @@  discard block
 block discarded – undo
1735 1735
  */
1736 1736
 function geodir_action_geodir_sidebar_listings_top()
1737 1737
 {
1738
-    if (get_option('geodir_show_listing_top_section')) { ?>
1738
+	if (get_option('geodir_show_listing_top_section')) { ?>
1739 1739
         <div
1740 1740
             class="<?php
1741
-            /** This action is documented in geodirectory_template_actions.php */
1742
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1741
+			/** This action is documented in geodirectory_template_actions.php */
1742
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1743 1743
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1744 1744
         </div><!-- clearfix ends here-->
1745 1745
     <?php }
@@ -1762,35 +1762,35 @@  discard block
 block discarded – undo
1762 1762
  */
1763 1763
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1764 1764
 {
1765
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1766
-        $width_css = 'style="width:' . $width . '%;"';
1767
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1768
-        $width_css = 'style="width:' . $width . '%;"';
1769
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1770
-        $width_css = 'style="width:' . $width . '%;"';
1771
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1772
-        $width_css = 'style="width:' . $width . '%;"';
1773
-    } else {
1774
-        $width_css = '';
1775
-    }
1776
-
1777
-    $tc = get_option('theme_compatibility_setting');
1778
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1779
-        $text = $tc['geodir_sidebar_left_open_replace'];
1780
-    } else {
1781
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1782
-    }
1783
-
1784
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1785
-        $id = $tc['geodir_sidebar_left_open_id'];
1786
-    }
1787
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1788
-        $class = $tc['geodir_sidebar_left_open_class'];
1789
-    }
1790
-
1791
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1792
-
1793
-    echo $text;
1765
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1766
+		$width_css = 'style="width:' . $width . '%;"';
1767
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1768
+		$width_css = 'style="width:' . $width . '%;"';
1769
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1770
+		$width_css = 'style="width:' . $width . '%;"';
1771
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1772
+		$width_css = 'style="width:' . $width . '%;"';
1773
+	} else {
1774
+		$width_css = '';
1775
+	}
1776
+
1777
+	$tc = get_option('theme_compatibility_setting');
1778
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1779
+		$text = $tc['geodir_sidebar_left_open_replace'];
1780
+	} else {
1781
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1782
+	}
1783
+
1784
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1785
+		$id = $tc['geodir_sidebar_left_open_id'];
1786
+	}
1787
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1788
+		$class = $tc['geodir_sidebar_left_open_class'];
1789
+	}
1790
+
1791
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1792
+
1793
+	echo $text;
1794 1794
 }
1795 1795
 
1796 1796
 // action for adding the primary div closing tag
@@ -1806,13 +1806,13 @@  discard block
 block discarded – undo
1806 1806
  */
1807 1807
 function geodir_action_sidebar_left_close($type = '')
1808 1808
 {
1809
-    $tc = get_option('theme_compatibility_setting');
1810
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1811
-        $text = $tc['geodir_sidebar_left_close_replace'];
1812
-    } else {
1813
-        $text = '</aside><!-- sidebar ends here-->';
1814
-    }
1815
-    echo $text;
1809
+	$tc = get_option('theme_compatibility_setting');
1810
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1811
+		$text = $tc['geodir_sidebar_left_close_replace'];
1812
+	} else {
1813
+		$text = '</aside><!-- sidebar ends here-->';
1814
+	}
1815
+	echo $text;
1816 1816
 }
1817 1817
 
1818 1818
 /**
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
  */
1826 1826
 function geodir_listing_left_section()
1827 1827
 {
1828
-    if (get_option('geodir_show_listing_left_section')) { ?>
1828
+	if (get_option('geodir_show_listing_left_section')) { ?>
1829 1829
         <div class="geodir-content-left geodir-sidebar-wrap">
1830 1830
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1831 1831
         </div><!-- end geodir-content-left -->
@@ -1843,20 +1843,20 @@  discard block
 block discarded – undo
1843 1843
  */
1844 1844
 function geodir_action_listings_sidebar_left()
1845 1845
 {
1846
-    if (get_option('geodir_show_listing_left_section')) {
1847
-        /** This action is documented in geodirectory_template_actions.php */
1848
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1849
-        /**
1850
-         * Calls the listings page (category) left sidebar content.
1851
-         *
1852
-         * All the content for the listings page left sidebar is added via this hook.
1853
-         *
1854
-         * @since 1.0.0
1855
-         */
1856
-        do_action('geodir_listings_sidebar_left_inside');
1857
-        /** This action is documented in geodirectory_template_actions.php */
1858
-        do_action('geodir_sidebar_left_close', 'listings-page');
1859
-    }
1846
+	if (get_option('geodir_show_listing_left_section')) {
1847
+		/** This action is documented in geodirectory_template_actions.php */
1848
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1849
+		/**
1850
+		 * Calls the listings page (category) left sidebar content.
1851
+		 *
1852
+		 * All the content for the listings page left sidebar is added via this hook.
1853
+		 *
1854
+		 * @since 1.0.0
1855
+		 */
1856
+		do_action('geodir_listings_sidebar_left_inside');
1857
+		/** This action is documented in geodirectory_template_actions.php */
1858
+		do_action('geodir_sidebar_left_close', 'listings-page');
1859
+	}
1860 1860
 }
1861 1861
 
1862 1862
 /**
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
  */
1870 1870
 function geodir_listing_right_section()
1871 1871
 {
1872
-    if (get_option('geodir_show_listing_right_section')) { ?>
1872
+	if (get_option('geodir_show_listing_right_section')) { ?>
1873 1873
         <div class="geodir-content-right geodir-sidebar-wrap">
1874 1874
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1875 1875
         </div><!-- end geodir-content-right -->
@@ -1887,20 +1887,20 @@  discard block
 block discarded – undo
1887 1887
  */
1888 1888
 function geodir_action_listings_sidebar_right()
1889 1889
 {
1890
-    if (get_option('geodir_show_listing_right_section')) {
1891
-        /** This action is documented in geodirectory_template_actions.php */
1892
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1893
-        /**
1894
-         * Calls the listings page (category) right sidebar content.
1895
-         *
1896
-         * All the content for the listings page right sidebar is added via this hook.
1897
-         *
1898
-         * @since 1.0.0
1899
-         */
1900
-        do_action('geodir_listings_sidebar_right_inside');
1901
-        /** This action is documented in geodirectory_template_actions.php */
1902
-        do_action('geodir_sidebar_right_close', 'listings-page');
1903
-    }
1890
+	if (get_option('geodir_show_listing_right_section')) {
1891
+		/** This action is documented in geodirectory_template_actions.php */
1892
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1893
+		/**
1894
+		 * Calls the listings page (category) right sidebar content.
1895
+		 *
1896
+		 * All the content for the listings page right sidebar is added via this hook.
1897
+		 *
1898
+		 * @since 1.0.0
1899
+		 */
1900
+		do_action('geodir_listings_sidebar_right_inside');
1901
+		/** This action is documented in geodirectory_template_actions.php */
1902
+		do_action('geodir_sidebar_right_close', 'listings-page');
1903
+	}
1904 1904
 }
1905 1905
 
1906 1906
 
@@ -1917,23 +1917,23 @@  discard block
 block discarded – undo
1917 1917
  */
1918 1918
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1919 1919
 {
1920
-    $tc = get_option('theme_compatibility_setting');
1921
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1922
-        $text = $tc['geodir_main_content_open_replace'];
1923
-    } else {
1924
-        $text = '<main id="[id]" class="[class]" role="main">';
1925
-    }
1920
+	$tc = get_option('theme_compatibility_setting');
1921
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1922
+		$text = $tc['geodir_main_content_open_replace'];
1923
+	} else {
1924
+		$text = '<main id="[id]" class="[class]" role="main">';
1925
+	}
1926 1926
 
1927
-    if (!empty($tc['geodir_main_content_open_id'])) {
1928
-        $id = $tc['geodir_main_content_open_id'];
1929
-    }
1930
-    if (!empty($tc['geodir_main_content_open_class'])) {
1931
-        $class = $tc['geodir_main_content_open_class'];
1932
-    }
1927
+	if (!empty($tc['geodir_main_content_open_id'])) {
1928
+		$id = $tc['geodir_main_content_open_id'];
1929
+	}
1930
+	if (!empty($tc['geodir_main_content_open_class'])) {
1931
+		$class = $tc['geodir_main_content_open_class'];
1932
+	}
1933 1933
 
1934
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1934
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1935 1935
 
1936
-    echo $text;
1936
+	echo $text;
1937 1937
 }
1938 1938
 
1939 1939
 // action for adding the primary div closing tag
@@ -1946,13 +1946,13 @@  discard block
 block discarded – undo
1946 1946
  */
1947 1947
 function geodir_action_main_content_close()
1948 1948
 {
1949
-    $tc = get_option('theme_compatibility_setting');
1950
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1951
-        $text = $tc['geodir_main_content_close_replace'];
1952
-    } else {
1953
-        $text = '</main><!-- main ends here-->';
1954
-    }
1955
-    echo $text;
1949
+	$tc = get_option('theme_compatibility_setting');
1950
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1951
+		$text = $tc['geodir_main_content_close_replace'];
1952
+	} else {
1953
+		$text = '</main><!-- main ends here-->';
1954
+	}
1955
+	echo $text;
1956 1956
 }
1957 1957
 
1958 1958
 /**
@@ -1964,14 +1964,14 @@  discard block
 block discarded – undo
1964 1964
  */
1965 1965
 function geodir_action_listings_content_inside()
1966 1966
 {
1967
-    global $gridview_columns;
1968
-    $listing_view = get_option('geodir_listing_view');
1969
-    if (strstr($listing_view, 'gridview')) {
1970
-        $gridview_columns = $listing_view;
1971
-        $listing_view_exp = explode('_', $listing_view);
1972
-        $listing_view = $listing_view_exp[0];
1973
-    }
1974
-    geodir_get_template_part('listing', 'listview');
1967
+	global $gridview_columns;
1968
+	$listing_view = get_option('geodir_listing_view');
1969
+	if (strstr($listing_view, 'gridview')) {
1970
+		$gridview_columns = $listing_view;
1971
+		$listing_view_exp = explode('_', $listing_view);
1972
+		$listing_view = $listing_view_exp[0];
1973
+	}
1974
+	geodir_get_template_part('listing', 'listview');
1975 1975
 }
1976 1976
 
1977 1977
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1987,47 +1987,47 @@  discard block
 block discarded – undo
1987 1987
  */
1988 1988
 function geodir_action_listings_content()
1989 1989
 {
1990
-    /**
1991
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1992
-     *
1993
-     * @since 1.0.0
1994
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1995
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
1996
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1997
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1998
-     */
1999
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2000
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2001
-    echo '<div class="clearfix '.$extra_class.'">';
2002
-    /**
2003
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2004
-     *
2005
-     * @since 1.0.0
2006
-     */
2007
-    do_action('geodir_before_listing');
2008
-    echo '</div>';
2009
-
2010
-    /**
2011
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2012
-     *
2013
-     * @since 1.0.0
2014
-     */
2015
-    do_action('geodir_listings_content_inside');
2016
-
2017
-    /**
2018
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2019
-     *
2020
-     * @since 1.0.0
2021
-     */
2022
-    do_action('geodir_after_listing');
2023
-
2024
-    /**
2025
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2026
-     *
2027
-     * @since 1.0.0
2028
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2029
-     */
2030
-    do_action('geodir_main_content_close', 'listings-page');
1990
+	/**
1991
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1992
+	 *
1993
+	 * @since 1.0.0
1994
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1995
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
1996
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1997
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1998
+	 */
1999
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2000
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2001
+	echo '<div class="clearfix '.$extra_class.'">';
2002
+	/**
2003
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2004
+	 *
2005
+	 * @since 1.0.0
2006
+	 */
2007
+	do_action('geodir_before_listing');
2008
+	echo '</div>';
2009
+
2010
+	/**
2011
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2012
+	 *
2013
+	 * @since 1.0.0
2014
+	 */
2015
+	do_action('geodir_listings_content_inside');
2016
+
2017
+	/**
2018
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2019
+	 *
2020
+	 * @since 1.0.0
2021
+	 */
2022
+	do_action('geodir_after_listing');
2023
+
2024
+	/**
2025
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2026
+	 *
2027
+	 * @since 1.0.0
2028
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2029
+	 */
2030
+	do_action('geodir_main_content_close', 'listings-page');
2031 2031
 }
2032 2032
 
2033 2033
 
@@ -2042,10 +2042,10 @@  discard block
 block discarded – undo
2042 2042
  */
2043 2043
 function geodir_action_sidebar_listings_bottom_section()
2044 2044
 {
2045
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2045
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2046 2046
         <div class="<?php
2047
-            /** This action is documented in geodirectory_template_actions.php */
2048
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2047
+			/** This action is documented in geodirectory_template_actions.php */
2048
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2049 2049
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2050 2050
         </div><!-- clearfix ends here-->
2051 2051
     <?php }
@@ -2065,38 +2065,38 @@  discard block
 block discarded – undo
2065 2065
  */
2066 2066
 function geodir_action_add_listing_page_title()
2067 2067
 {
2068
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2069
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2070
-    /** This action is documented in geodirectory_template_actions.php */
2071
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2072
-    /** This action is documented in geodirectory_template_actions.php */
2073
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2074
-
2075
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2076
-
2077
-    if(geodir_is_page('add-listing')){
2078
-        $gd_page = 'add-listing';
2079
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2080
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2081
-        }elseif(isset($listing_type)){
2082
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2083
-        }
2068
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2069
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2070
+	/** This action is documented in geodirectory_template_actions.php */
2071
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2072
+	/** This action is documented in geodirectory_template_actions.php */
2073
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2074
+
2075
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2076
+
2077
+	if(geodir_is_page('add-listing')){
2078
+		$gd_page = 'add-listing';
2079
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2080
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2081
+		}elseif(isset($listing_type)){
2082
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2083
+		}
2084 2084
 
2085
-    }
2085
+	}
2086 2086
 
2087 2087
 
2088
-    /**
2089
-     * Filter page title to replace variables.
2090
-     *
2091
-     * @since 1.5.4
2092
-     * @param string $title The page title including variables.
2093
-     * @param string $gd_page The GeoDirectory page type if any.
2094
-     */
2095
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2088
+	/**
2089
+	 * Filter page title to replace variables.
2090
+	 *
2091
+	 * @since 1.5.4
2092
+	 * @param string $title The page title including variables.
2093
+	 * @param string $gd_page The GeoDirectory page type if any.
2094
+	 */
2095
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2096 2096
 
2097
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2098
-    echo $title;
2099
-    echo '</h1></header>';
2097
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2098
+	echo $title;
2099
+	echo '</h1></header>';
2100 2100
 }
2101 2101
 
2102 2102
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2127,59 +2127,59 @@  discard block
 block discarded – undo
2127 2127
  */
2128 2128
 function geodir_action_add_listing_form()
2129 2129
 {
2130
-    global $cat_display, $post_cat, $current_user, $gd_session;
2131
-    $page_id = get_the_ID();
2132
-    $post = '';
2133
-    $title = '';
2134
-    $desc = '';
2135
-    $kw_tags = '';
2136
-    $required_msg = '';
2137
-    $submit_button = '';
2138
-
2139
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2140
-
2141
-    $thumb_img_arr = array();
2142
-    $curImages = '';
2143
-
2144
-    if (isset($_REQUEST['backandedit'])) {
2145
-        global $post;
2146
-        $post = (object)$gd_session->get('listing');
2147
-        $listing_type = $post->listing_type;
2148
-        $title = $post->post_title;
2149
-        $desc = $post->post_desc;
2150
-        $post_cat = $post->post_category;
2151
-
2152
-        $kw_tags = $post->post_tags;
2153
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2154
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2155
-        global $post, $post_images;
2156
-
2157
-        $post = geodir_get_post_info($_REQUEST['pid']);
2158
-        $thumb_img_arr = geodir_get_images($post->ID);
2159
-        if ($thumb_img_arr) {
2160
-            foreach ($thumb_img_arr as $post_img) {
2161
-                $curImages .= $post_img->src . ',';
2162
-            }
2163
-        }
2130
+	global $cat_display, $post_cat, $current_user, $gd_session;
2131
+	$page_id = get_the_ID();
2132
+	$post = '';
2133
+	$title = '';
2134
+	$desc = '';
2135
+	$kw_tags = '';
2136
+	$required_msg = '';
2137
+	$submit_button = '';
2138
+
2139
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2140
+
2141
+	$thumb_img_arr = array();
2142
+	$curImages = '';
2143
+
2144
+	if (isset($_REQUEST['backandedit'])) {
2145
+		global $post;
2146
+		$post = (object)$gd_session->get('listing');
2147
+		$listing_type = $post->listing_type;
2148
+		$title = $post->post_title;
2149
+		$desc = $post->post_desc;
2150
+		$post_cat = $post->post_category;
2151
+
2152
+		$kw_tags = $post->post_tags;
2153
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2154
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2155
+		global $post, $post_images;
2156
+
2157
+		$post = geodir_get_post_info($_REQUEST['pid']);
2158
+		$thumb_img_arr = geodir_get_images($post->ID);
2159
+		if ($thumb_img_arr) {
2160
+			foreach ($thumb_img_arr as $post_img) {
2161
+				$curImages .= $post_img->src . ',';
2162
+			}
2163
+		}
2164 2164
 
2165
-        $listing_type = $post->post_type;
2166
-        $title = $post->post_title;
2167
-        $desc = $post->post_content;
2168
-        $kw_tags = $post->post_tags;
2169
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2170
-    } else {
2171
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2172
-    }
2165
+		$listing_type = $post->post_type;
2166
+		$title = $post->post_title;
2167
+		$desc = $post->post_content;
2168
+		$kw_tags = $post->post_tags;
2169
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2170
+	} else {
2171
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2172
+	}
2173 2173
 
2174
-    if ($current_user->ID != '0') {
2175
-        $user_login = true;
2176
-    }
2174
+	if ($current_user->ID != '0') {
2175
+		$user_login = true;
2176
+	}
2177 2177
 
2178
-    $post_type_info = geodir_get_posttype_info($listing_type);
2178
+	$post_type_info = geodir_get_posttype_info($listing_type);
2179 2179
 
2180
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2180
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2181 2181
 
2182
-    ?>
2182
+	?>
2183 2183
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2184 2184
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2185 2185
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2190,27 +2190,27 @@  discard block
 block discarded – undo
2190 2190
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2191 2191
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2192 2192
         <?php
2193
-        } 
2194
-        /**
2195
-         * Called at the very top of the add listing page form for frontend.
2196
-         *
2197
-         * This is called just before the "Enter Listing Details" text.
2198
-         *
2199
-         * @since 1.0.0
2200
-         */
2201
-        do_action('geodir_before_detail_fields');
2202
-        ?>
2193
+		} 
2194
+		/**
2195
+		 * Called at the very top of the add listing page form for frontend.
2196
+		 *
2197
+		 * This is called just before the "Enter Listing Details" text.
2198
+		 *
2199
+		 * @since 1.0.0
2200
+		 */
2201
+		do_action('geodir_before_detail_fields');
2202
+		?>
2203 2203
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2204 2204
         <?php
2205
-        /**
2206
-         * Called at the top of the add listing page form for frontend.
2207
-         *
2208
-         * This is called after the "Enter Listing Details" text.
2209
-         *
2210
-         * @since 1.0.0
2211
-         */
2212
-        do_action('geodir_before_main_form_fields');
2213
-        ?>
2205
+		/**
2206
+		 * Called at the top of the add listing page form for frontend.
2207
+		 *
2208
+		 * This is called after the "Enter Listing Details" text.
2209
+		 *
2210
+		 * @since 1.0.0
2211
+		 */
2212
+		do_action('geodir_before_main_form_fields');
2213
+		?>
2214 2214
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2215 2215
             <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
2216 2216
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
@@ -2218,57 +2218,57 @@  discard block
 block discarded – undo
2218 2218
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2219 2219
         </div>
2220 2220
         <?php
2221
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2222
-
2223
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2224
-        $desc_limit = '';
2225
-        /**
2226
-         * Filter the add listing description field character limit number.
2227
-         *
2228
-         * @since 1.0.0
2229
-         * @param int $desc_limit The amount of characters to limit the description to.
2230
-         */
2231
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2232
-        /**
2233
-         * Filter the add listing description field text.
2234
-         *
2235
-         * @since 1.0.0
2236
-         * @param string $desc The text for the description field.
2237
-         * @param int $desc_limit The character limit number if any.
2238
-         */
2239
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2240
-        $desc_limit_msg = '';
2241
-        /**
2242
-         * Filter the add listing description limit message.
2243
-         *
2244
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2245
-         *
2246
-         * @since 1.0.0
2247
-         * @param string $desc_limit_msg The limit message string if any.
2248
-         * @param int $desc_limit The character limit numer if any.
2249
-         */
2250
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2221
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2222
+
2223
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2224
+		$desc_limit = '';
2225
+		/**
2226
+		 * Filter the add listing description field character limit number.
2227
+		 *
2228
+		 * @since 1.0.0
2229
+		 * @param int $desc_limit The amount of characters to limit the description to.
2230
+		 */
2231
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2232
+		/**
2233
+		 * Filter the add listing description field text.
2234
+		 *
2235
+		 * @since 1.0.0
2236
+		 * @param string $desc The text for the description field.
2237
+		 * @param int $desc_limit The character limit number if any.
2238
+		 */
2239
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2240
+		$desc_limit_msg = '';
2241
+		/**
2242
+		 * Filter the add listing description limit message.
2243
+		 *
2244
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2245
+		 *
2246
+		 * @since 1.0.0
2247
+		 * @param string $desc_limit_msg The limit message string if any.
2248
+		 * @param int $desc_limit The character limit numer if any.
2249
+		 */
2250
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2251 2251
         
2252
-        $desc_class = '';
2253
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2254
-            /**
2255
-             * Called on the add listing page form for frontend just before the description field.
2256
-             *
2257
-             * @since 1.0.0
2258
-             */
2259
-            do_action('geodir_before_description_field');
2252
+		$desc_class = '';
2253
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2254
+			/**
2255
+			 * Called on the add listing page form for frontend just before the description field.
2256
+			 *
2257
+			 * @since 1.0.0
2258
+			 */
2259
+			do_action('geodir_before_description_field');
2260 2260
             
2261
-            $desc_class = ' required_field';
2262
-        } else {
2263
-            $desc_class = ' hidden';
2264
-        }
2265
-        ?>
2261
+			$desc_class = ' required_field';
2262
+		} else {
2263
+			$desc_class = ' hidden';
2264
+		}
2265
+		?>
2266 2266
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2267 2267
             <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2268 2268
             <?php
2269
-            if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2270
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2271
-            ?>
2269
+			if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2270
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2271
+			?>
2272 2272
                 <div class="editor" field_id="post_desc" field_type="editor">
2273 2273
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2274 2274
                 </div>
@@ -2282,56 +2282,56 @@  discard block
 block discarded – undo
2282 2282
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2283 2283
         </div>
2284 2284
         <?php
2285
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2286
-            /**
2287
-             * Called on the add listing page form for frontend just after the description field.
2288
-             *
2289
-             * @since 1.0.0
2290
-             */
2291
-            do_action('geodir_after_description_field');
2292
-        }
2285
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2286
+			/**
2287
+			 * Called on the add listing page form for frontend just after the description field.
2288
+			 *
2289
+			 * @since 1.0.0
2290
+			 */
2291
+			do_action('geodir_after_description_field');
2292
+		}
2293 2293
         
2294
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2295
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2296
-        $kw_tags_msg = TAGKW_MSG;
2297
-        /**
2298
-         * Filter the add listing tags character limit.
2299
-         *
2300
-         * @since 1.0.0
2301
-         * @param int $kw_tags_count The character count limit if any.
2302
-         */
2303
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2304
-        /**
2305
-         * Filter the add listing tags field value.
2306
-         *
2307
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2308
-         *
2309
-         * @since 1.0.0
2310
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2311
-         * @param int $kw_tags_count The character count limit if any.
2312
-         */
2313
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2314
-        /**
2315
-         * Filter the add listing tags field message text.
2316
-         *
2317
-         * @since 1.0.0
2318
-         * @param string $kw_tags_msg The message shown under the field.
2319
-         * @param int $kw_tags_count The character count limit if any.
2320
-         */
2321
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2294
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2295
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2296
+		$kw_tags_msg = TAGKW_MSG;
2297
+		/**
2298
+		 * Filter the add listing tags character limit.
2299
+		 *
2300
+		 * @since 1.0.0
2301
+		 * @param int $kw_tags_count The character count limit if any.
2302
+		 */
2303
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2304
+		/**
2305
+		 * Filter the add listing tags field value.
2306
+		 *
2307
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2308
+		 *
2309
+		 * @since 1.0.0
2310
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2311
+		 * @param int $kw_tags_count The character count limit if any.
2312
+		 */
2313
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2314
+		/**
2315
+		 * Filter the add listing tags field message text.
2316
+		 *
2317
+		 * @since 1.0.0
2318
+		 * @param string $kw_tags_msg The message shown under the field.
2319
+		 * @param int $kw_tags_count The character count limit if any.
2320
+		 */
2321
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2322 2322
         
2323
-        $tags_class = '';
2324
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2325
-            /**
2326
-             * Called on the add listing page form for frontend just before the tags field.
2327
-             *
2328
-             * @since 1.0.0
2329
-             */
2330
-            do_action('geodir_before_listing_tags_field');
2331
-        } else {
2332
-            $tags_class = ' hidden';
2333
-        }
2334
-        ?>
2323
+		$tags_class = '';
2324
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2325
+			/**
2326
+			 * Called on the add listing page form for frontend just before the tags field.
2327
+			 *
2328
+			 * @since 1.0.0
2329
+			 */
2330
+			do_action('geodir_before_listing_tags_field');
2331
+		} else {
2332
+			$tags_class = ' hidden';
2333
+		}
2334
+		?>
2335 2335
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2336 2336
             <label><?php echo TAGKW_TEXT; ?></label>
2337 2337
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2339,90 +2339,90 @@  discard block
 block discarded – undo
2339 2339
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2340 2340
         </div>
2341 2341
         <?php
2342
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2343
-            /**
2344
-             * Called on the add listing page form for frontend just after the tags field.
2345
-             *
2346
-             * @since 1.0.0
2347
-             */
2348
-            do_action('geodir_after_listing_tags_field');
2349
-        }
2342
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2343
+			/**
2344
+			 * Called on the add listing page form for frontend just after the tags field.
2345
+			 *
2346
+			 * @since 1.0.0
2347
+			 */
2348
+			do_action('geodir_after_listing_tags_field');
2349
+		}
2350 2350
         
2351
-        $package_info = array();
2352
-        $package_info = geodir_post_package_info($package_info, $post);
2351
+		$package_info = array();
2352
+		$package_info = geodir_post_package_info($package_info, $post);
2353 2353
         
2354
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2354
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2355 2355
         
2356
-        // adjust values here
2357
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2358
-
2359
-        $multiple = true; // allow multiple files upload
2356
+		// adjust values here
2357
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2360 2358
 
2361
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2359
+		$multiple = true; // allow multiple files upload
2362 2360
 
2363
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2361
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2364 2362
 
2365
-        $thumb_img_arr = array();
2366
-        $totImg = 0;
2367
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2368
-            $post = (object)$gd_session->get('listing');
2369
-            if (isset($post->post_images))
2370
-                $curImages = trim($post->post_images, ",");
2363
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2371 2364
 
2365
+		$thumb_img_arr = array();
2366
+		$totImg = 0;
2367
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2368
+			$post = (object)$gd_session->get('listing');
2369
+			if (isset($post->post_images))
2370
+				$curImages = trim($post->post_images, ",");
2372 2371
 
2373
-            if ($curImages != '') {
2374
-                $curImages_array = explode(',', $curImages);
2375
-                $totImg = count($curImages_array);
2376
-            }
2377 2372
 
2378
-            $listing_type = $post->listing_type;
2373
+			if ($curImages != '') {
2374
+				$curImages_array = explode(',', $curImages);
2375
+				$totImg = count($curImages_array);
2376
+			}
2379 2377
 
2380
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2381
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2382
-            $listing_type = $post->post_type;
2383
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2378
+			$listing_type = $post->listing_type;
2384 2379
 
2385
-        } else {
2386
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2387
-        }
2380
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2381
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2382
+			$listing_type = $post->post_type;
2383
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2388 2384
 
2385
+		} else {
2386
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2387
+		}
2389 2388
 
2390
-        if (!empty($thumb_img_arr)) {
2391
-            foreach ($thumb_img_arr as $img) {
2392
-                //$curImages = $img->src.",";
2393
-            }
2394 2389
 
2395
-            $totImg = count((array)$thumb_img_arr);
2396
-        }
2390
+		if (!empty($thumb_img_arr)) {
2391
+			foreach ($thumb_img_arr as $img) {
2392
+				//$curImages = $img->src.",";
2393
+			}
2397 2394
 
2398
-        if ($curImages != '')
2399
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2400
-        else
2401
-            $svalue = '';
2402
-
2403
-        $image_limit = $package_info->image_limit;
2404
-        $show_image_input_box = ($image_limit != '0');
2405
-        /**
2406
-         * Filter to be able to show/hide the image upload section of the add listing form.
2407
-         *
2408
-         * @since 1.0.0
2409
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2410
-         * @param string $listing_type The custom post type slug.
2411
-         */
2412
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2413
-        if ($show_image_input_box) {
2414
-            ?>
2395
+			$totImg = count((array)$thumb_img_arr);
2396
+		}
2397
+
2398
+		if ($curImages != '')
2399
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2400
+		else
2401
+			$svalue = '';
2402
+
2403
+		$image_limit = $package_info->image_limit;
2404
+		$show_image_input_box = ($image_limit != '0');
2405
+		/**
2406
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2407
+		 *
2408
+		 * @since 1.0.0
2409
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2410
+		 * @param string $listing_type The custom post type slug.
2411
+		 */
2412
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2413
+		if ($show_image_input_box) {
2414
+			?>
2415 2415
 
2416 2416
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2417 2417
                 <?php if ($image_limit == 1) {
2418
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2419
-                } ?>
2418
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2419
+				} ?>
2420 2420
                 <?php if ($image_limit > 1) {
2421
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2422
-                } ?>
2421
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2422
+				} ?>
2423 2423
                 <?php if ($image_limit == '') {
2424
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2425
-                } ?>
2424
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2425
+				} ?>
2426 2426
             </h5>
2427 2427
 
2428 2428
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2460,12 +2460,12 @@  discard block
 block discarded – undo
2460 2460
         <?php } ?>
2461 2461
 
2462 2462
         <?php
2463
-        /**
2464
-         * Called on the add listing page form for frontend just after the image upload field.
2465
-         *
2466
-         * @since 1.0.0
2467
-         */
2468
-        do_action('geodir_after_main_form_fields');?>
2463
+		/**
2464
+		 * Called on the add listing page form for frontend just after the image upload field.
2465
+		 *
2466
+		 * @since 1.0.0
2467
+		 */
2468
+		do_action('geodir_after_main_form_fields');?>
2469 2469
 
2470 2470
 
2471 2471
         <!-- add captcha code -->
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
 
2495 2495
     </form>
2496 2496
     <?php
2497
-    wp_reset_query();
2497
+	wp_reset_query();
2498 2498
 }
2499 2499
 
2500 2500
 /**
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
  */
2506 2506
 function geodir_add_listing_sidebar_widget_area()
2507 2507
 {
2508
-    dynamic_sidebar('geodir_add_listing_sidebar');
2508
+	dynamic_sidebar('geodir_add_listing_sidebar');
2509 2509
 }
2510 2510
 
2511 2511
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2520,16 +2520,16 @@  discard block
 block discarded – undo
2520 2520
  */
2521 2521
 function geodir_action_add_listing_sidebar()
2522 2522
 {
2523
-    /** This action is documented in geodirectory_template_actions.php */
2524
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2525
-    /**
2526
-     * This is used to add the content to the add listing page sidebar.
2527
-     *
2528
-     * @since 1.0.0
2529
-     */
2530
-    do_action('geodir_add_listing_sidebar_inside');
2531
-    /** This action is documented in geodirectory_template_actions.php */
2532
-    do_action('geodir_sidebar_right_close', 'details-page');
2523
+	/** This action is documented in geodirectory_template_actions.php */
2524
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2525
+	/**
2526
+	 * This is used to add the content to the add listing page sidebar.
2527
+	 *
2528
+	 * @since 1.0.0
2529
+	 */
2530
+	do_action('geodir_add_listing_sidebar_inside');
2531
+	/** This action is documented in geodirectory_template_actions.php */
2532
+	do_action('geodir_sidebar_right_close', 'details-page');
2533 2533
 }
2534 2534
 
2535 2535
 ###############################################
@@ -2546,11 +2546,11 @@  discard block
 block discarded – undo
2546 2546
  */
2547 2547
 function geodir_action_geodir_sidebar_signup_top()
2548 2548
 {
2549
-    ?>
2549
+	?>
2550 2550
     <div
2551 2551
         class="<?php
2552
-        /** This action is documented in geodirectory_template_actions.php */
2553
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2552
+		/** This action is documented in geodirectory_template_actions.php */
2553
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2554 2554
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2555 2555
     </div><!-- clearfix ends here-->
2556 2556
 <?php
@@ -2569,9 +2569,9 @@  discard block
 block discarded – undo
2569 2569
 function geodir_action_signup_forms()
2570 2570
 {
2571 2571
 
2572
-    global $user_login;
2572
+	global $user_login;
2573 2573
 
2574
-    ?>
2574
+	?>
2575 2575
     <script type="text/javascript">
2576 2576
         <?php if ( $user_login ) { ?>
2577 2577
         setTimeout(function () {
@@ -2607,65 +2607,65 @@  discard block
 block discarded – undo
2607 2607
         <?php } ?>
2608 2608
     </script><?php
2609 2609
 
2610
-    global $errors;
2611
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2612
-        $errors->add('claim_login', LOGIN_CLAIM);
2613
-
2614
-    if (!empty($errors)) {
2615
-        foreach ($errors as $errorsObj) {
2616
-            foreach ($errorsObj as $key => $val) {
2617
-                for ($i = 0; $i < count($val); $i++) {
2618
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2619
-                    $registration_error_msg = 1;
2620
-                }
2621
-            }
2622
-        }
2623
-    }
2610
+	global $errors;
2611
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2612
+		$errors->add('claim_login', LOGIN_CLAIM);
2613
+
2614
+	if (!empty($errors)) {
2615
+		foreach ($errors as $errorsObj) {
2616
+			foreach ($errorsObj as $key => $val) {
2617
+				for ($i = 0; $i < count($val); $i++) {
2618
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2619
+					$registration_error_msg = 1;
2620
+				}
2621
+			}
2622
+		}
2623
+	}
2624 2624
 
2625
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2626
-        ?>
2625
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2626
+		?>
2627 2627
 
2628 2628
         <div class="login_form">
2629 2629
             <?php
2630
-            /**
2631
-             * Contains login form template.
2632
-             *
2633
-             * @since 1.0.0
2634
-             */
2635
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2630
+			/**
2631
+			 * Contains login form template.
2632
+			 *
2633
+			 * @since 1.0.0
2634
+			 */
2635
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2636 2636
         </div>
2637 2637
 
2638 2638
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
2639 2639
 
2640 2640
         <div class="registration_form">
2641 2641
             <?php
2642
-            /**
2643
-             * Contains registration form template.
2644
-             *
2645
-             * @since 1.0.0
2646
-             */
2647
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2642
+			/**
2643
+			 * Contains registration form template.
2644
+			 *
2645
+			 * @since 1.0.0
2646
+			 */
2647
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2648 2648
         </div>
2649 2649
 
2650 2650
     <?php } else { ?>
2651 2651
 
2652 2652
         <div class="login_form_l">
2653 2653
             <?php
2654
-            /**
2655
-             * Contains login form template.
2656
-             *
2657
-             * @since 1.0.0
2658
-             */
2659
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2654
+			/**
2655
+			 * Contains login form template.
2656
+			 *
2657
+			 * @since 1.0.0
2658
+			 */
2659
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2660 2660
         </div>
2661 2661
         <div class="registration_form_r">
2662 2662
             <?php
2663
-            /**
2664
-             * Contains registration form template.
2665
-             *
2666
-             * @since 1.0.0
2667
-             */
2668
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2663
+			/**
2664
+			 * Contains registration form template.
2665
+			 *
2666
+			 * @since 1.0.0
2667
+			 */
2668
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2669 2669
         </div>
2670 2670
 
2671 2671
     <?php }?>
@@ -2696,66 +2696,66 @@  discard block
 block discarded – undo
2696 2696
  */
2697 2697
 function geodir_action_author_page_title()
2698 2698
 {
2699
-    global $term;
2699
+	global $term;
2700 2700
 
2701
-    $gd_post_type = geodir_get_current_posttype();
2702
-    $post_type_info = get_post_type_object($gd_post_type);
2701
+	$gd_post_type = geodir_get_current_posttype();
2702
+	$post_type_info = get_post_type_object($gd_post_type);
2703 2703
 
2704
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2705
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2706
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2707
-    }
2704
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2705
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2706
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2707
+	}
2708 2708
 
2709
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2710
-    $single_name = $post_type_info->labels->singular_name;
2709
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2710
+	$single_name = $post_type_info->labels->singular_name;
2711 2711
 
2712
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2712
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2713 2713
 
2714
-    if (!empty($term)) {
2715
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2716
-        if (!empty($current_term))
2717
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2718
-    }
2714
+	if (!empty($term)) {
2715
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2716
+		if (!empty($current_term))
2717
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2718
+	}
2719 2719
 
2720 2720
 
2721
-    if (is_search()) {
2722
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2721
+	if (is_search()) {
2722
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2723 2723
 
2724
-    }
2725
-    /** This action is documented in geodirectory_template_actions.php */
2726
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2727
-    /** This action is documented in geodirectory_template_actions.php */
2728
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2724
+	}
2725
+	/** This action is documented in geodirectory_template_actions.php */
2726
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2727
+	/** This action is documented in geodirectory_template_actions.php */
2728
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2729 2729
 
2730
-    $title = $list_title;
2731
-    if(geodir_is_page('author')){
2732
-        $gd_page = 'author';
2733
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2734
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2735
-        }else{
2736
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2737
-        }
2730
+	$title = $list_title;
2731
+	if(geodir_is_page('author')){
2732
+		$gd_page = 'author';
2733
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2734
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2735
+		}else{
2736
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2737
+		}
2738 2738
 
2739
-    }
2739
+	}
2740 2740
 
2741 2741
 
2742
-    /**
2743
-     * Filter page title to replace variables.
2744
-     *
2745
-     * @since 1.5.4
2746
-     * @param string $title The page title including variables.
2747
-     * @param string $gd_page The GeoDirectory page type if any.
2748
-     */
2749
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2742
+	/**
2743
+	 * Filter page title to replace variables.
2744
+	 *
2745
+	 * @since 1.5.4
2746
+	 * @param string $title The page title including variables.
2747
+	 * @param string $gd_page The GeoDirectory page type if any.
2748
+	 */
2749
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2750 2750
 
2751
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2752
-        /**
2753
-         * Filter the author page title text.
2754
-         *
2755
-         * @since 1.0.0
2756
-         * @param string $list_title The title for the page.
2757
-         */
2758
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2751
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2752
+		/**
2753
+		 * Filter the author page title text.
2754
+		 *
2755
+		 * @since 1.0.0
2756
+		 * @param string $list_title The title for the page.
2757
+		 */
2758
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2759 2759
 }
2760 2760
 
2761 2761
 
@@ -2773,11 +2773,11 @@  discard block
 block discarded – undo
2773 2773
  */
2774 2774
 function geodir_action_geodir_sidebar_author_top()
2775 2775
 {
2776
-    if (get_option('geodir_show_author_top_section')) { ?>
2776
+	if (get_option('geodir_show_author_top_section')) { ?>
2777 2777
         <div
2778 2778
             class="<?php
2779
-            /** This action is documented in geodirectory_template_actions.php */
2780
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2779
+			/** This action is documented in geodirectory_template_actions.php */
2780
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2781 2781
             <?php dynamic_sidebar('geodir_author_top'); ?>
2782 2782
         </div><!-- clearfix ends here-->
2783 2783
     <?php }
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
  */
2794 2794
 function geodir_author_left_section()
2795 2795
 {
2796
-    if (get_option('geodir_show_author_left_section')) { ?>
2796
+	if (get_option('geodir_show_author_left_section')) { ?>
2797 2797
         <div class="geodir-content-left geodir-sidebar-wrap">
2798 2798
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2799 2799
         </div><!-- end geodir-content-left -->
@@ -2814,19 +2814,19 @@  discard block
 block discarded – undo
2814 2814
  */
2815 2815
 function geodir_action_author_sidebar_left()
2816 2816
 {
2817
-    if (get_option('geodir_show_author_left_section')) {
2817
+	if (get_option('geodir_show_author_left_section')) {
2818 2818
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2819
-        /** This action is documented in geodirectory_template_actions.php */
2820
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2821
-        /**
2822
-         * This is used to add the content to the author page left sidebar (if active).
2823
-         *
2824
-         * @since 1.0.0
2825
-         */
2826
-        do_action('geodir_author_sidebar_left_inside');
2827
-        /** This action is documented in geodirectory_template_actions.php */
2828
-        do_action('geodir_sidebar_left_close', 'author-page');
2829
-    }
2819
+		/** This action is documented in geodirectory_template_actions.php */
2820
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2821
+		/**
2822
+		 * This is used to add the content to the author page left sidebar (if active).
2823
+		 *
2824
+		 * @since 1.0.0
2825
+		 */
2826
+		do_action('geodir_author_sidebar_left_inside');
2827
+		/** This action is documented in geodirectory_template_actions.php */
2828
+		do_action('geodir_sidebar_left_close', 'author-page');
2829
+	}
2830 2830
 }
2831 2831
 
2832 2832
 /**
@@ -2839,7 +2839,7 @@  discard block
 block discarded – undo
2839 2839
  */
2840 2840
 function geodir_author_right_section()
2841 2841
 {
2842
-    if (get_option('geodir_show_author_right_section')) { ?>
2842
+	if (get_option('geodir_show_author_right_section')) { ?>
2843 2843
         <div class="geodir-content-right geodir-sidebar-wrap">
2844 2844
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2845 2845
         </div><!-- end geodir-content-right -->
@@ -2859,18 +2859,18 @@  discard block
 block discarded – undo
2859 2859
  */
2860 2860
 function geodir_action_author_sidebar_right()
2861 2861
 {
2862
-    if (get_option('geodir_show_author_right_section')) {
2863
-        /** This action is documented in geodirectory_template_actions.php */
2864
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2865
-        /**
2866
-         * This is used to add the content to the author page right sidebar (if active).
2867
-         *
2868
-         * @since 1.0.0
2869
-         */
2870
-        do_action('geodir_author_sidebar_right_inside');
2871
-        /** This action is documented in geodirectory_template_actions.php */
2872
-        do_action('geodir_sidebar_right_close', 'author-page');
2873
-    }
2862
+	if (get_option('geodir_show_author_right_section')) {
2863
+		/** This action is documented in geodirectory_template_actions.php */
2864
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2865
+		/**
2866
+		 * This is used to add the content to the author page right sidebar (if active).
2867
+		 *
2868
+		 * @since 1.0.0
2869
+		 */
2870
+		do_action('geodir_author_sidebar_right_inside');
2871
+		/** This action is documented in geodirectory_template_actions.php */
2872
+		do_action('geodir_sidebar_right_close', 'author-page');
2873
+	}
2874 2874
 }
2875 2875
 
2876 2876
 /**
@@ -2882,14 +2882,14 @@  discard block
 block discarded – undo
2882 2882
  */
2883 2883
 function geodir_action_author_content_inside()
2884 2884
 {
2885
-    global $gridview_columns;
2886
-    $listing_view = get_option('geodir_author_view');
2887
-    if (strstr($listing_view, 'gridview')) {
2888
-        $gridview_columns = $listing_view;
2889
-        $listing_view_exp = explode('_', $listing_view);
2890
-        $listing_view = $listing_view_exp[0];
2891
-    }
2892
-    geodir_get_template_part('listing', 'listview');
2885
+	global $gridview_columns;
2886
+	$listing_view = get_option('geodir_author_view');
2887
+	if (strstr($listing_view, 'gridview')) {
2888
+		$gridview_columns = $listing_view;
2889
+		$listing_view_exp = explode('_', $listing_view);
2890
+		$listing_view = $listing_view_exp[0];
2891
+	}
2892
+	geodir_get_template_part('listing', 'listview');
2893 2893
 }
2894 2894
 
2895 2895
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2904,22 +2904,22 @@  discard block
 block discarded – undo
2904 2904
  */
2905 2905
 function geodir_action_author_content()
2906 2906
 {
2907
-    /** This action is documented in geodirectory_template_actions.php */
2908
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2909
-    echo '<div class="clearfix">';
2910
-    /** This action is documented in geodirectory_template_actions.php */
2911
-    do_action('geodir_before_listing');
2912
-    echo '</div>';
2913
-    /**
2914
-     * This is used to add the content to the author page main content.
2915
-     *
2916
-     * @since 1.0.0
2917
-     */
2918
-    do_action('geodir_author_content_inside');
2919
-    /** This action is documented in geodirectory_template_actions.php */
2920
-    do_action('geodir_after_listing');
2921
-    /** This action is documented in geodirectory_template_actions.php */
2922
-    do_action('geodir_main_content_close', 'author-page');
2907
+	/** This action is documented in geodirectory_template_actions.php */
2908
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2909
+	echo '<div class="clearfix">';
2910
+	/** This action is documented in geodirectory_template_actions.php */
2911
+	do_action('geodir_before_listing');
2912
+	echo '</div>';
2913
+	/**
2914
+	 * This is used to add the content to the author page main content.
2915
+	 *
2916
+	 * @since 1.0.0
2917
+	 */
2918
+	do_action('geodir_author_content_inside');
2919
+	/** This action is documented in geodirectory_template_actions.php */
2920
+	do_action('geodir_after_listing');
2921
+	/** This action is documented in geodirectory_template_actions.php */
2922
+	do_action('geodir_main_content_close', 'author-page');
2923 2923
 }
2924 2924
 
2925 2925
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2933,11 +2933,11 @@  discard block
 block discarded – undo
2933 2933
  */
2934 2934
 function geodir_action_sidebar_author_bottom_section()
2935 2935
 {
2936
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2936
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2937 2937
         <div
2938 2938
             class="<?php
2939
-            /** This action is documented in geodirectory_template_actions.php */
2940
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2939
+			/** This action is documented in geodirectory_template_actions.php */
2940
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2941 2941
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2942 2942
         </div><!-- clearfix ends here-->
2943 2943
     <?php }
@@ -2956,23 +2956,23 @@  discard block
 block discarded – undo
2956 2956
  */
2957 2957
 function geodir_action_search_page_title()
2958 2958
 {
2959
-    $gd_post_type = geodir_get_current_posttype();
2960
-    $post_type_info = get_post_type_object($gd_post_type);
2959
+	$gd_post_type = geodir_get_current_posttype();
2960
+	$post_type_info = get_post_type_object($gd_post_type);
2961 2961
 
2962
-    $pt_name = '';
2963
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2962
+	$pt_name = '';
2963
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2964 2964
 
2965
-    if (is_search()) {
2966
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2965
+	if (is_search()) {
2966
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2967 2967
 
2968
-    }
2969
-    /** This action is documented in geodirectory_template_actions.php */
2970
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2971
-    /** This action is documented in geodirectory_template_actions.php */
2972
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2973
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2974
-        /** This action is documented in geodirectory_template_actions.php */
2975
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2968
+	}
2969
+	/** This action is documented in geodirectory_template_actions.php */
2970
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2971
+	/** This action is documented in geodirectory_template_actions.php */
2972
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2973
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2974
+		/** This action is documented in geodirectory_template_actions.php */
2975
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2976 2976
 }
2977 2977
 
2978 2978
 // action for adding the listings page top widget area
@@ -2988,11 +2988,11 @@  discard block
 block discarded – undo
2988 2988
  */
2989 2989
 function geodir_action_geodir_sidebar_search_top()
2990 2990
 {
2991
-    if (get_option('geodir_show_search_top_section')) { ?>
2991
+	if (get_option('geodir_show_search_top_section')) { ?>
2992 2992
         <div
2993 2993
             class="<?php
2994
-            /** This action is documented in geodirectory_template_actions.php */
2995
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2994
+			/** This action is documented in geodirectory_template_actions.php */
2995
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2996 2996
             <?php dynamic_sidebar('geodir_search_top'); ?>
2997 2997
         </div><!-- clearfix ends here-->
2998 2998
     <?php }
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
  */
3009 3009
 function geodir_search_left_section()
3010 3010
 {
3011
-    if (get_option('geodir_show_search_left_section')) { ?>
3011
+	if (get_option('geodir_show_search_left_section')) { ?>
3012 3012
         <div class="geodir-content-left geodir-sidebar-wrap">
3013 3013
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3014 3014
         </div><!-- end geodir-content-left -->
@@ -3028,19 +3028,19 @@  discard block
 block discarded – undo
3028 3028
  */
3029 3029
 function geodir_action_search_sidebar_left()
3030 3030
 {
3031
-    if (get_option('geodir_show_search_left_section')) {
3031
+	if (get_option('geodir_show_search_left_section')) {
3032 3032
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3033
-        /** This action is documented in geodirectory_template_actions.php */
3034
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3035
-        /**
3036
-         * This is used to add the content to the search page left sidebar (if active).
3037
-         *
3038
-         * @since 1.0.0
3039
-         */
3040
-        do_action('geodir_search_sidebar_left_inside');
3041
-        /** This action is documented in geodirectory_template_actions.php */
3042
-        do_action('geodir_sidebar_left_close', 'search-page');
3043
-    }
3033
+		/** This action is documented in geodirectory_template_actions.php */
3034
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3035
+		/**
3036
+		 * This is used to add the content to the search page left sidebar (if active).
3037
+		 *
3038
+		 * @since 1.0.0
3039
+		 */
3040
+		do_action('geodir_search_sidebar_left_inside');
3041
+		/** This action is documented in geodirectory_template_actions.php */
3042
+		do_action('geodir_sidebar_left_close', 'search-page');
3043
+	}
3044 3044
 }
3045 3045
 
3046 3046
 /**
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
  */
3054 3054
 function geodir_search_right_section()
3055 3055
 {
3056
-    if (get_option('geodir_show_search_right_section')) { ?>
3056
+	if (get_option('geodir_show_search_right_section')) { ?>
3057 3057
         <div class="geodir-content-right geodir-sidebar-wrap">
3058 3058
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3059 3059
         </div><!-- end geodir-content-right -->
@@ -3073,18 +3073,18 @@  discard block
 block discarded – undo
3073 3073
  */
3074 3074
 function geodir_action_search_sidebar_right()
3075 3075
 {
3076
-    if (get_option('geodir_show_search_right_section')) {
3077
-        /** This action is documented in geodirectory_template_actions.php */
3078
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3079
-        /**
3080
-         * This is used to add the content to the search page right sidebar (if active).
3081
-         *
3082
-         * @since 1.0.0
3083
-         */
3084
-        do_action('geodir_search_sidebar_right_inside');
3085
-        /** This action is documented in geodirectory_template_actions.php */
3086
-        do_action('geodir_sidebar_right_close', 'search-page');
3087
-    }
3076
+	if (get_option('geodir_show_search_right_section')) {
3077
+		/** This action is documented in geodirectory_template_actions.php */
3078
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3079
+		/**
3080
+		 * This is used to add the content to the search page right sidebar (if active).
3081
+		 *
3082
+		 * @since 1.0.0
3083
+		 */
3084
+		do_action('geodir_search_sidebar_right_inside');
3085
+		/** This action is documented in geodirectory_template_actions.php */
3086
+		do_action('geodir_sidebar_right_close', 'search-page');
3087
+	}
3088 3088
 }
3089 3089
 
3090 3090
 
@@ -3099,11 +3099,11 @@  discard block
 block discarded – undo
3099 3099
  */
3100 3100
 function geodir_action_sidebar_search_bottom_section()
3101 3101
 {
3102
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3102
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3103 3103
         <div
3104 3104
             class="<?php
3105
-            /** This action is documented in geodirectory_template_actions.php */
3106
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3105
+			/** This action is documented in geodirectory_template_actions.php */
3106
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3107 3107
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3108 3108
         </div><!-- clearfix ends here-->
3109 3109
     <?php }
@@ -3118,14 +3118,14 @@  discard block
 block discarded – undo
3118 3118
  */
3119 3119
 function geodir_action_search_content_inside()
3120 3120
 {
3121
-    global $gridview_columns;
3122
-    $listing_view = get_option('geodir_search_view');
3123
-    if (strstr($listing_view, 'gridview')) {
3124
-        $gridview_columns = $listing_view;
3125
-        $listing_view_exp = explode('_', $listing_view);
3126
-        $listing_view = $listing_view_exp[0];
3127
-    }
3128
-    geodir_get_template_part('listing', 'listview');
3121
+	global $gridview_columns;
3122
+	$listing_view = get_option('geodir_search_view');
3123
+	if (strstr($listing_view, 'gridview')) {
3124
+		$gridview_columns = $listing_view;
3125
+		$listing_view_exp = explode('_', $listing_view);
3126
+		$listing_view = $listing_view_exp[0];
3127
+	}
3128
+	geodir_get_template_part('listing', 'listview');
3129 3129
 }
3130 3130
 
3131 3131
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3141,22 +3141,22 @@  discard block
 block discarded – undo
3141 3141
  */
3142 3142
 function geodir_action_search_content()
3143 3143
 {
3144
-    /** This action is documented in geodirectory_template_actions.php */
3145
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3146
-    echo '<div class="clearfix">';
3147
-    /** This action is documented in geodirectory_template_actions.php */
3148
-    do_action('geodir_before_listing');
3149
-    echo '</div>';
3150
-    /**
3151
-     * This is used to add the content to the search page main content.
3152
-     *
3153
-     * @since 1.0.0
3154
-     */
3155
-    do_action('geodir_search_content_inside');
3156
-    /** This action is documented in geodirectory_template_actions.php */
3157
-    do_action('geodir_after_listing');
3158
-    /** This action is documented in geodirectory_template_actions.php */
3159
-    do_action('geodir_main_content_close', 'search-page');
3144
+	/** This action is documented in geodirectory_template_actions.php */
3145
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3146
+	echo '<div class="clearfix">';
3147
+	/** This action is documented in geodirectory_template_actions.php */
3148
+	do_action('geodir_before_listing');
3149
+	echo '</div>';
3150
+	/**
3151
+	 * This is used to add the content to the search page main content.
3152
+	 *
3153
+	 * @since 1.0.0
3154
+	 */
3155
+	do_action('geodir_search_content_inside');
3156
+	/** This action is documented in geodirectory_template_actions.php */
3157
+	do_action('geodir_after_listing');
3158
+	/** This action is documented in geodirectory_template_actions.php */
3159
+	do_action('geodir_main_content_close', 'search-page');
3160 3160
 }
3161 3161
 
3162 3162
 ###############################################
@@ -3179,11 +3179,11 @@  discard block
 block discarded – undo
3179 3179
  */
3180 3180
 function geodir_action_geodir_sidebar_home_top()
3181 3181
 {
3182
-    if (get_option('geodir_show_home_top_section')) { ?>
3182
+	if (get_option('geodir_show_home_top_section')) { ?>
3183 3183
         <div
3184 3184
             class="<?php
3185
-            /** This action is documented in geodirectory_template_actions.php */
3186
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3185
+			/** This action is documented in geodirectory_template_actions.php */
3186
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3187 3187
             <?php dynamic_sidebar('geodir_home_top'); ?>
3188 3188
         </div><!-- clearfix ends here-->
3189 3189
     <?php }
@@ -3199,7 +3199,7 @@  discard block
 block discarded – undo
3199 3199
  */
3200 3200
 function geodir_home_left_section()
3201 3201
 {
3202
-    if (get_option('geodir_show_home_left_section')) { ?>
3202
+	if (get_option('geodir_show_home_left_section')) { ?>
3203 3203
         <div class="geodir-content-left geodir-sidebar-wrap">
3204 3204
             <?php dynamic_sidebar('geodir_home_left'); ?>
3205 3205
         </div><!-- end geodir-content-left -->
@@ -3221,19 +3221,19 @@  discard block
 block discarded – undo
3221 3221
  */
3222 3222
 function geodir_action_home_sidebar_left()
3223 3223
 {
3224
-    if (get_option('geodir_show_home_left_section')) {
3224
+	if (get_option('geodir_show_home_left_section')) {
3225 3225
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3226
-        /** This action is documented in geodirectory_template_actions.php */
3227
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3228
-        /**
3229
-         * This is used to add the content to the home page left sidebar (if active).
3230
-         *
3231
-         * @since 1.0.0
3232
-         */
3233
-        do_action('geodir_home_sidebar_left_inside');
3234
-        /** This action is documented in geodirectory_template_actions.php */
3235
-        do_action('geodir_sidebar_left_close', 'home-page');
3236
-    }
3226
+		/** This action is documented in geodirectory_template_actions.php */
3227
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3228
+		/**
3229
+		 * This is used to add the content to the home page left sidebar (if active).
3230
+		 *
3231
+		 * @since 1.0.0
3232
+		 */
3233
+		do_action('geodir_home_sidebar_left_inside');
3234
+		/** This action is documented in geodirectory_template_actions.php */
3235
+		do_action('geodir_sidebar_left_close', 'home-page');
3236
+	}
3237 3237
 }
3238 3238
 
3239 3239
 /**
@@ -3246,7 +3246,7 @@  discard block
 block discarded – undo
3246 3246
  */
3247 3247
 function geodir_home_right_section()
3248 3248
 {
3249
-    if (get_option('geodir_show_home_right_section')) { ?>
3249
+	if (get_option('geodir_show_home_right_section')) { ?>
3250 3250
         <div class="geodir-content-right geodir-sidebar-wrap">
3251 3251
             <?php dynamic_sidebar('geodir_home_right'); ?>
3252 3252
         </div><!-- end geodir-content-right -->
@@ -3267,18 +3267,18 @@  discard block
 block discarded – undo
3267 3267
  */
3268 3268
 function geodir_action_home_sidebar_right()
3269 3269
 {
3270
-    if (get_option('geodir_show_home_right_section')) {
3271
-        /** This action is documented in geodirectory_template_actions.php */
3272
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3273
-        /**
3274
-         * This is used to add the content to the home page right sidebar (if active).
3275
-         *
3276
-         * @since 1.0.0
3277
-         */
3278
-        do_action('geodir_home_sidebar_right_inside');
3279
-        /** This action is documented in geodirectory_template_actions.php */
3280
-        do_action('geodir_sidebar_right_close', 'home-page');
3281
-    }
3270
+	if (get_option('geodir_show_home_right_section')) {
3271
+		/** This action is documented in geodirectory_template_actions.php */
3272
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3273
+		/**
3274
+		 * This is used to add the content to the home page right sidebar (if active).
3275
+		 *
3276
+		 * @since 1.0.0
3277
+		 */
3278
+		do_action('geodir_home_sidebar_right_inside');
3279
+		/** This action is documented in geodirectory_template_actions.php */
3280
+		do_action('geodir_sidebar_right_close', 'home-page');
3281
+	}
3282 3282
 }
3283 3283
 
3284 3284
 /**
@@ -3289,7 +3289,7 @@  discard block
 block discarded – undo
3289 3289
  */
3290 3290
 function geodir_action_home_content_inside()
3291 3291
 {
3292
-    dynamic_sidebar('geodir_home_content');
3292
+	dynamic_sidebar('geodir_home_content');
3293 3293
 }
3294 3294
 
3295 3295
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3304,28 +3304,28 @@  discard block
 block discarded – undo
3304 3304
  */
3305 3305
 function geodir_action_home_content()
3306 3306
 {
3307
-    /** This action is documented in geodirectory_template_actions.php */
3308
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3309
-    /**
3310
-     * This called before the home page main content.
3311
-     *
3312
-     * @since 1.0.0
3313
-     */
3314
-    do_action('geodir_before_home_content');
3315
-    /**
3316
-     * This is used to add the content to the home page main content.
3317
-     *
3318
-     * @since 1.0.0
3319
-     */
3320
-    do_action('geodir_home_content_inside');
3321
-    /**
3322
-     * This is called after the homepage main content.
3323
-     *
3324
-     * @since 1.0.0
3325
-     */
3326
-    do_action('geodir_after_home_content');
3327
-    /** This action is documented in geodirectory_template_actions.php */
3328
-    do_action('geodir_main_content_close', 'home-page');
3307
+	/** This action is documented in geodirectory_template_actions.php */
3308
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3309
+	/**
3310
+	 * This called before the home page main content.
3311
+	 *
3312
+	 * @since 1.0.0
3313
+	 */
3314
+	do_action('geodir_before_home_content');
3315
+	/**
3316
+	 * This is used to add the content to the home page main content.
3317
+	 *
3318
+	 * @since 1.0.0
3319
+	 */
3320
+	do_action('geodir_home_content_inside');
3321
+	/**
3322
+	 * This is called after the homepage main content.
3323
+	 *
3324
+	 * @since 1.0.0
3325
+	 */
3326
+	do_action('geodir_after_home_content');
3327
+	/** This action is documented in geodirectory_template_actions.php */
3328
+	do_action('geodir_main_content_close', 'home-page');
3329 3329
 }
3330 3330
 
3331 3331
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3340,11 +3340,11 @@  discard block
 block discarded – undo
3340 3340
  */
3341 3341
 function geodir_action_sidebar_home_bottom_section()
3342 3342
 {
3343
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3343
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3344 3344
         <div
3345 3345
             class="<?php
3346
-            /** This action is documented in geodirectory_template_actions.php */
3347
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3346
+			/** This action is documented in geodirectory_template_actions.php */
3347
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3348 3348
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3349 3349
         </div><!-- clearfix ends here-->
3350 3350
     <?php }
@@ -3372,13 +3372,13 @@  discard block
 block discarded – undo
3372 3372
  */
3373 3373
 function geodir_filter_listing_page_title($list_title)
3374 3374
 {
3375
-    if (is_search() && trim(get_search_query()) == '') {
3376
-        $gd_post_type = geodir_get_current_posttype();
3377
-        $post_type_info = get_post_type_object($gd_post_type);
3375
+	if (is_search() && trim(get_search_query()) == '') {
3376
+		$gd_post_type = geodir_get_current_posttype();
3377
+		$post_type_info = get_post_type_object($gd_post_type);
3378 3378
 
3379
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3380
-    }
3381
-    return $list_title;
3379
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3380
+	}
3381
+	return $list_title;
3382 3382
 }
3383 3383
 
3384 3384
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3393,61 +3393,61 @@  discard block
 block discarded – undo
3393 3393
  * @param string $gd_page The geodirectory page type. Default null.
3394 3394
  */
3395 3395
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3396
-    global $post;
3396
+	global $post;
3397 3397
         
3398
-    $gd_page_id = NULL;
3399
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3400
-        $gd_page_id = geodir_home_page_id();
3401
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3402
-        $gd_page_id = geodir_preview_page_id();
3403
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3404
-        $gd_page_id = geodir_add_listing_page_id();
3405
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3406
-        $gd_page_id = geodir_success_page_id();
3407
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3408
-        $gd_page_id = geodir_location_page_id();
3409
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3410
-        $gd_page_id = geodir_info_page_id();
3411
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3412
-        $gd_page_id = geodir_login_page_id();
3413
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3414
-        $gd_page_id = geodir_payment_checkout_page_id();
3415
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3416
-        $gd_page_id = geodir_payment_invoices_page_id();
3417
-    }
3398
+	$gd_page_id = NULL;
3399
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3400
+		$gd_page_id = geodir_home_page_id();
3401
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3402
+		$gd_page_id = geodir_preview_page_id();
3403
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3404
+		$gd_page_id = geodir_add_listing_page_id();
3405
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3406
+		$gd_page_id = geodir_success_page_id();
3407
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3408
+		$gd_page_id = geodir_location_page_id();
3409
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3410
+		$gd_page_id = geodir_info_page_id();
3411
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3412
+		$gd_page_id = geodir_login_page_id();
3413
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3414
+		$gd_page_id = geodir_payment_checkout_page_id();
3415
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3416
+		$gd_page_id = geodir_payment_invoices_page_id();
3417
+	}
3418 3418
     
3419
-    if (!$gd_page_id > 0) {
3420
-        return;
3421
-    }
3419
+	if (!$gd_page_id > 0) {
3420
+		return;
3421
+	}
3422 3422
     
3423
-    $display = 'before';
3424
-    /**
3425
-     * Filter the position to display the page content.
3426
-     *
3427
-     * @since 1.6.3
3428
-     *
3429
-     * @param string $display Position to add the post content.
3430
-     * @param string $gd_page The geodirectory page type.
3431
-     */
3432
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3423
+	$display = 'before';
3424
+	/**
3425
+	 * Filter the position to display the page content.
3426
+	 *
3427
+	 * @since 1.6.3
3428
+	 *
3429
+	 * @param string $display Position to add the post content.
3430
+	 * @param string $gd_page The geodirectory page type.
3431
+	 */
3432
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3433 3433
     
3434
-    if ($position !== $display) {
3435
-        return;
3436
-    }
3434
+	if ($position !== $display) {
3435
+		return;
3436
+	}
3437 3437
         
3438
-    $gd_post = $post;
3438
+	$gd_post = $post;
3439 3439
     
3440
-    setup_postdata(get_post($gd_page_id));
3440
+	setup_postdata(get_post($gd_page_id));
3441 3441
     
3442
-    if (get_the_content()) {
3443
-        ?>
3442
+	if (get_the_content()) {
3443
+		?>
3444 3444
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3445 3445
         <?php
3446
-    }
3446
+	}
3447 3447
     
3448
-    $post = $gd_post;
3449
-    if (!empty($gd_post) && is_object($gd_post)) {
3450
-        setup_postdata($gd_post);
3451
-    }
3448
+	$post = $gd_post;
3449
+	if (!empty($gd_post) && is_object($gd_post)) {
3450
+		setup_postdata($gd_post);
3451
+	}
3452 3452
 }
3453 3453
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
3454 3454
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
     //php
284 284
     if (!empty($tc['geodir_theme_compat_code'])) {
285
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
285
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
286 286
     }
287 287
 
288 288
     //geodir_full_page_class
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
453 453
 {
454 454
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
-        $width_css = 'style="width:' . $width . '%;"';
455
+        $width_css = 'style="width:'.$width.'%;"';
456 456
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
-        $width_css = 'style="width:' . $width . '%;"';
457
+        $width_css = 'style="width:'.$width.'%;"';
458 458
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
-        $width_css = 'style="width:' . $width . '%;"';
459
+        $width_css = 'style="width:'.$width.'%;"';
460 460
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
-        $width_css = 'style="width:' . $width . '%;"';
461
+        $width_css = 'style="width:'.$width.'%;"';
462 462
     } else {
463 463
         $width_css = '';
464 464
     }
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
573 573
 {
574 574
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
-        $width_css = 'style="width:' . $width . '%;"';
575
+        $width_css = 'style="width:'.$width.'%;"';
576 576
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
-        $width_css = 'style="width:' . $width . '%;"';
577
+        $width_css = 'style="width:'.$width.'%;"';
578 578
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
-        $width_css = 'style="width:' . $width . '%;"';
579
+        $width_css = 'style="width:'.$width.'%;"';
580 580
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
-        $width_css = 'style="width:' . $width . '%;"';
581
+        $width_css = 'style="width:'.$width.'%;"';
582 582
     } else {
583 583
         $width_css = '';
584 584
     }
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         }
677 677
     }
678 678
 
679
-    $post = (object)$_REQUEST;
679
+    $post = (object) $_REQUEST;
680 680
 
681 681
 
682 682
     if (isset($post->video)) {
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 
736 736
     $json = '{';
737 737
     $json .= '"post_preview": "1",';
738
-    $json .= '"t": "' . $json_title . '",';
739
-    $json .= '"lt": "' . $post_latitude . '",';
740
-    $json .= '"ln": "' . $post_longitude . '",';
741
-    $json .= '"i":"' . $term_icon . '"';
738
+    $json .= '"t": "'.$json_title.'",';
739
+    $json .= '"lt": "'.$post_latitude.'",';
740
+    $json .= '"ln": "'.$post_longitude.'",';
741
+    $json .= '"i":"'.$term_icon.'"';
742 742
     $json .= '}';
743 743
 
744 744
     $post->marker_json = $json;
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
      * @param string $class The class to use. Default is 'entry-header'.
966 966
      */
967 967
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
968
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
969 969
 }
970 970
 
971 971
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020 1020
 
1021 1021
                     if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1022
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1023 1023
                     }
1024 1024
 
1025 1025
                     if (isset($image->src)) {
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
                         $image_title = isset($image->title) ? $image->title : '';
1033 1033
 
1034
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1034
+                        $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1035
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1036
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1037 1037
                         $slides++;
1038 1038
                     }
1039 1039
                 }
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
                 } else {
1053 1053
                     $spacer_height = ((400 - $image->height) / 2);
1054 1054
                 }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1055
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
+                $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1057
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1059 1059
                 $slides++;
1060 1060
             }
1061 1061
         }// endfore
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+    global $preview, $post; ?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096 1096
     $taxonomies = array();
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
     if ($preview && !$is_backend_preview) {
1101 1101
         $post_type = $post->listing_type;
1102
-        $post_taxonomy = $post_type . 'category';
1102
+        $post_taxonomy = $post_type.'category';
1103 1103
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104 1104
     } else {
1105 1105
         $post_type = $post->post_type;
1106
-        $post_taxonomy = $post_type . 'category';
1106
+        $post_taxonomy = $post_type.'category';
1107 1107
     }
1108 1108
 //{	
1109 1109
     $post_type_info = get_post_type_object($post_type);
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
     if (!empty($post->post_tags)) {
1113 1113
 
1114
-        if (taxonomy_exists($post_type . '_tags')):
1114
+        if (taxonomy_exists($post_type.'_tags')):
1115 1115
             $links = array();
1116 1116
             $terms = array();
1117 1117
             // to limit post tags
@@ -1138,8 +1138,8 @@  discard block
 block discarded – undo
1138 1138
                 $post_term = trim($post_term);
1139 1139
 
1140 1140
                 $priority_location = false;
1141
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1142
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1141
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1142
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1143 1143
                 } else {
1144 1144
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1145 1145
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1150 1150
                     if ($match_country || $match_region || $match_city) {
1151 1151
                         $priority_location = true;
1152
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1152
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1153 1153
                     } else {
1154
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1155
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1154
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1155
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1156 1156
                     }
1157 1157
                 }
1158 1158
 
@@ -1169,12 +1169,12 @@  discard block
 block discarded – undo
1169 1169
                          * @param string $tag_link The tag link html.
1170 1170
                          * @param object $term The tag term object.
1171 1171
                          */
1172
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1173 1173
                         $links[] = $tag_link;
1174 1174
                     } else {
1175
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1176 1176
                         /** This action is documented in geodirectory-template_actions.php */
1177
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1178 1178
                         $links[] = $tag_link;
1179 1179
                     }
1180 1180
                     $terms[] = $term;
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
             if (!isset($listing_label)) {
1185 1185
                 $listing_label = '';
1186 1186
             }
1187
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1188 1188
         endif;
1189 1189
 
1190 1190
     }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1213 1213
 
1214 1214
                     if (is_object($term)) {
1215
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1216 1216
                         /**
1217 1217
                          * Filter the category name on the details page.
1218 1218
                          *
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
                          * @param string $term_link The link html to the category.
1221 1221
                          * @param object $term The category term object.
1222 1222
                          */
1223
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1224 1224
                         $links[] = $term_link;
1225 1225
                         $terms[] = $term;
1226 1226
                     }
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
         if (!isset($listing_label)) {
1239 1239
             $listing_label = '';
1240 1240
         }
1241
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1241
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1242 1242
 
1243 1243
     }
1244 1244
 
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
      * @param string $listing_label The post type label.
1252 1252
      * @param string $listing_label The post type label with ucwords function.
1253 1253
      */
1254
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1254
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1255 1255
 
1256 1256
     if (isset($taxonomies[$post_taxonomy])) {
1257
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1258 1258
     }
1259 1259
 
1260
-    if (isset($taxonomies[$post_type . '_tags']))
1261
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1260
+    if (isset($taxonomies[$post_type.'_tags']))
1261
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1262 1262
 
1263 1263
     ?>
1264 1264
     </p><?php
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
  * @param object $post Optional. The post object or blank.
1280 1280
  * @package GeoDirectory
1281 1281
  */
1282
-function geodir_action_details_micordata($post='')
1282
+function geodir_action_details_micordata($post = '')
1283 1283
 {
1284 1284
 
1285 1285
     global $preview;
1286
-    if(empty($post)){global $post;}
1286
+    if (empty($post)) {global $post; }
1287 1287
     if ($preview || !geodir_is_page('detail')) {
1288 1288
         return;
1289 1289
     }
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
                 "description" => $review->comment_content,
1305 1305
                 "reviewRating" => array(
1306 1306
                     "@type" => "Rating",
1307
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1308 1308
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1309 1309
                     "worstRating" => "1"
1310 1310
                 )
@@ -1332,13 +1332,13 @@  discard block
 block discarded – undo
1332 1332
     }
1333 1333
     //print_r($post);
1334 1334
     // external links
1335
-    $external_links =  array();
1335
+    $external_links = array();
1336 1336
     $external_links[] = $post->geodir_website;
1337 1337
     $external_links[] = $post->geodir_twitter;
1338 1338
     $external_links[] = $post->geodir_facebook;
1339 1339
     $external_links = array_filter($external_links);
1340 1340
 
1341
-    if(!empty($external_links)){
1341
+    if (!empty($external_links)) {
1342 1342
         $external_links = array_values($external_links);
1343 1343
     }
1344 1344
 
@@ -1348,17 +1348,17 @@  discard block
 block discarded – undo
1348 1348
 
1349 1349
     // schema type
1350 1350
     $schema_type = 'LocalBusiness';
1351
-    if(isset($post->default_category) && $post->default_category){
1351
+    if (isset($post->default_category) && $post->default_category) {
1352 1352
         $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1353
-        if($cat_schema){$schema_type = $cat_schema;}
1354
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1353
+        if ($cat_schema) {$schema_type = $cat_schema; }
1354
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1355 1355
     }
1356 1356
 
1357 1357
     $schema = array();
1358 1358
     $schema['@context'] = "http://schema.org";
1359 1359
     $schema['@type'] = $schema_type;
1360 1360
     $schema['name'] = $post->post_name;
1361
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1361
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1362 1362
     $schema['telephone'] = $post->geodir_contact;
1363 1363
     $schema['url'] = $c_url;
1364 1364
     $schema['sameAs'] = $external_links;
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
         "postalCode" => $post->post_zip
1373 1373
     );
1374 1374
 
1375
-    if($post->post_latitude && $post->post_longitude) {
1375
+    if ($post->post_latitude && $post->post_longitude) {
1376 1376
         $schema['geo'] = array(
1377 1377
             "@type" => "GeoCoordinates",
1378 1378
             "latitude" => $post->post_latitude,
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
         );
1381 1381
     }
1382 1382
 
1383
-    if($post_avgratings) {
1383
+    if ($post_avgratings) {
1384 1384
         $schema['aggregateRating'] = array(
1385 1385
             "@type" => "AggregateRating",
1386 1386
             "ratingValue" => $post_avgratings,
@@ -1399,10 +1399,10 @@  discard block
 block discarded – undo
1399 1399
      * @param array $schema The array of schema data to be filtered.
1400 1400
      * @param object $post The post object.
1401 1401
      */
1402
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1402
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1403 1403
 
1404 1404
 
1405
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1405
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1406 1406
 
1407 1407
 
1408 1408
     $uploads = wp_upload_dir();
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
      * @param string $facebook_og The open graph html to be filtered.
1416 1416
      * @param object $post The post object.
1417 1417
      */
1418
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1418
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1419 1419
 
1420 1420
 
1421 1421
 
@@ -1438,9 +1438,9 @@  discard block
 block discarded – undo
1438 1438
     ?>
1439 1439
     <div class="geodir-pos_navigation clearfix">
1440 1440
     <div
1441
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1441
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1442 1442
     <div
1443
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1443
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1444 1444
     </div><?php
1445 1445
 }
1446 1446
 
@@ -1509,12 +1509,12 @@  discard block
 block discarded – undo
1509 1509
     $gd_post_type = geodir_get_current_posttype();
1510 1510
     $post_type_info = get_post_type_object($gd_post_type);
1511 1511
 
1512
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1512
+    $add_string_in_title = __('All', 'geodirectory').' ';
1513 1513
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1514
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1514
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1515 1515
     }
1516 1516
 
1517
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1517
+    $list_title = $add_string_in_title.__(ucfirst($post_type_info->labels->name), 'geodirectory');
1518 1518
     $single_name = $post_type_info->labels->singular_name;
1519 1519
 
1520 1520
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1542,12 +1542,12 @@  discard block
 block discarded – undo
1542 1542
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1543 1543
         if (!empty($current_term)) {
1544 1544
             $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1545
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1545
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1546 1546
                 $location_last_char = substr($location_name, -1);
1547 1547
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1548
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1548
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1549 1549
             } else {
1550
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1550
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1551 1551
             }
1552 1552
         } else {
1553 1553
             if (count($taxonomy) > 1) {
@@ -1555,12 +1555,12 @@  discard block
 block discarded – undo
1555 1555
 
1556 1556
                 if (!empty($current_term)) {
1557 1557
                     $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1558
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1558
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1559 1559
                         $location_last_char = substr($location_name, -1);
1560 1560
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1561
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1561
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1562 1562
                     } else {
1563
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1563
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1564 1564
                     }
1565 1565
                 }
1566 1566
             }
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1589 1589
             }
1590 1590
 
1591
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1591
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1592 1592
         } else if ($gd_region != '') {
1593 1593
             if ($gd_region_actual != '') {
1594 1594
                 $gd_region = $gd_region_actual;
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1599 1599
             }
1600 1600
 
1601
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1601
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1602 1602
         } else if ($gd_country != '') {
1603 1603
             if ($gd_country_actual != '') {
1604 1604
                 $gd_country = $gd_country_actual;
@@ -1608,12 +1608,12 @@  discard block
 block discarded – undo
1608 1608
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1609 1609
             }
1610 1610
 
1611
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1611
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1612 1612
         }
1613 1613
     }
1614 1614
 
1615 1615
     if (is_search()) {
1616
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1616
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1617 1617
     }
1618 1618
     /** This action is documented in geodirectory_template_actions.php */
1619 1619
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1622,26 +1622,26 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 
1624 1624
     $title = $list_title;
1625
-    if(geodir_is_page('pt')){
1625
+    if (geodir_is_page('pt')) {
1626 1626
         $gd_page = 'pt';
1627
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1627
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1628 1628
     }
1629
-    elseif(geodir_is_page('listing')){
1629
+    elseif (geodir_is_page('listing')) {
1630 1630
         $gd_page = 'listing';
1631 1631
         global $wp_query;
1632 1632
         $current_term = $wp_query->get_queried_object();
1633
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1633
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1634 1634
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1635
-        }else{
1635
+        } else {
1636 1636
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1637 1637
         }
1638 1638
 
1639 1639
     }
1640
-    elseif(geodir_is_page('author')){
1640
+    elseif (geodir_is_page('author')) {
1641 1641
         $gd_page = 'author';
1642
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1642
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1643 1643
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1644
-        }else{
1644
+        } else {
1645 1645
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1646 1646
         }
1647 1647
 
@@ -1655,16 +1655,16 @@  discard block
 block discarded – undo
1655 1655
      * @param string $title The page title including variables.
1656 1656
      * @param string $gd_page The GeoDirectory page type if any.
1657 1657
      */
1658
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1658
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1659 1659
 
1660
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1660
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1661 1661
         /**
1662 1662
          * Filter the listing page title.
1663 1663
          *
1664 1664
          * @since 1.0.0
1665 1665
          * @param string $list_title The title for the category page.
1666 1666
          */
1667
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1667
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1668 1668
 }
1669 1669
 
1670 1670
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1683,16 +1683,16 @@  discard block
 block discarded – undo
1683 1683
     $gd_post_type = geodir_get_current_posttype();
1684 1684
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1685 1685
 
1686
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1686
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1687 1687
         $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1688 1688
         if ($term_desc && !$saved_data) {
1689 1689
             $saved_data = $term_desc;
1690 1690
         }
1691 1691
 
1692 1692
         // stop payment manager filtering content length
1693
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1694
-        if ( false !== $filter_priority ) {
1695
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1693
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1694
+        if (false !== $filter_priority) {
1695
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1696 1696
         }
1697 1697
 
1698 1698
         /**
@@ -1706,14 +1706,14 @@  discard block
 block discarded – undo
1706 1706
         $cat_description = apply_filters('the_content', $saved_data);
1707 1707
 
1708 1708
 
1709
-        if ( false !== $filter_priority ) {
1710
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1709
+        if (false !== $filter_priority) {
1710
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1711 1711
         }
1712 1712
 
1713 1713
         if ($cat_description) {
1714 1714
             ?>
1715 1715
 
1716
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1716
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1717 1717
         }
1718 1718
 
1719 1719
     }
@@ -1763,13 +1763,13 @@  discard block
 block discarded – undo
1763 1763
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1764 1764
 {
1765 1765
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1766
-        $width_css = 'style="width:' . $width . '%;"';
1766
+        $width_css = 'style="width:'.$width.'%;"';
1767 1767
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1768
-        $width_css = 'style="width:' . $width . '%;"';
1768
+        $width_css = 'style="width:'.$width.'%;"';
1769 1769
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1770
-        $width_css = 'style="width:' . $width . '%;"';
1770
+        $width_css = 'style="width:'.$width.'%;"';
1771 1771
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1772
-        $width_css = 'style="width:' . $width . '%;"';
1772
+        $width_css = 'style="width:'.$width.'%;"';
1773 1773
     } else {
1774 1774
         $width_css = '';
1775 1775
     }
@@ -2074,11 +2074,11 @@  discard block
 block discarded – undo
2074 2074
 
2075 2075
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2076 2076
 
2077
-    if(geodir_is_page('add-listing')){
2077
+    if (geodir_is_page('add-listing')) {
2078 2078
         $gd_page = 'add-listing';
2079
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2079
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2080 2080
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2081
-        }elseif(isset($listing_type)){
2081
+        }elseif (isset($listing_type)) {
2082 2082
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2083 2083
         }
2084 2084
 
@@ -2092,9 +2092,9 @@  discard block
 block discarded – undo
2092 2092
      * @param string $title The page title including variables.
2093 2093
      * @param string $gd_page The GeoDirectory page type if any.
2094 2094
      */
2095
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2095
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2096 2096
 
2097
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2097
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2098 2098
     echo $title;
2099 2099
     echo '</h1></header>';
2100 2100
 }
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
  */
2109 2109
 function geodir_action_add_listing_page_mandatory()
2110 2110
 {?>
2111
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2111
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2112 2112
 <?php
2113 2113
 }
2114 2114
 
@@ -2143,7 +2143,7 @@  discard block
 block discarded – undo
2143 2143
 
2144 2144
     if (isset($_REQUEST['backandedit'])) {
2145 2145
         global $post;
2146
-        $post = (object)$gd_session->get('listing');
2146
+        $post = (object) $gd_session->get('listing');
2147 2147
         $listing_type = $post->listing_type;
2148 2148
         $title = $post->post_title;
2149 2149
         $desc = $post->post_desc;
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
         $thumb_img_arr = geodir_get_images($post->ID);
2159 2159
         if ($thumb_img_arr) {
2160 2160
             foreach ($thumb_img_arr as $post_img) {
2161
-                $curImages .= $post_img->src . ',';
2161
+                $curImages .= $post_img->src.',';
2162 2162
             }
2163 2163
         }
2164 2164
 
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
         $title = $post->post_title;
2167 2167
         $desc = $post->post_content;
2168 2168
         $kw_tags = $post->post_tags;
2169
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2169
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2170 2170
     } else {
2171 2171
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2172 2172
     }
@@ -2177,18 +2177,18 @@  discard block
 block discarded – undo
2177 2177
 
2178 2178
     $post_type_info = geodir_get_posttype_info($listing_type);
2179 2179
 
2180
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
2180
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing', 'geodirectory');
2181 2181
 
2182 2182
     ?>
2183
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2184
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2185
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2183
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2184
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2185
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2186 2186
         <?php if ($page_id) { ?>
2187
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2187
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2188 2188
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2189
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2189
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2190 2190
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2191
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2191
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2192 2192
         <?php
2193 2193
         } 
2194 2194
         /**
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
          */
2201 2201
         do_action('geodir_before_detail_fields');
2202 2202
         ?>
2203
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2203
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2204 2204
         <?php
2205 2205
         /**
2206 2206
          * Called at the top of the add listing page form for frontend.
@@ -2212,10 +2212,10 @@  discard block
 block discarded – undo
2212 2212
         do_action('geodir_before_main_form_fields');
2213 2213
         ?>
2214 2214
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2215
-            <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
2215
+            <label><?php echo sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name); ?><span>*</span> </label>
2216 2216
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2217 2217
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2218
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2218
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2219 2219
         </div>
2220 2220
         <?php
2221 2221
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2251 2251
         
2252 2252
         $desc_class = '';
2253
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2253
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2254 2254
             /**
2255 2255
              * Called on the add listing page form for frontend just before the description field.
2256 2256
              *
@@ -2263,8 +2263,8 @@  discard block
 block discarded – undo
2263 2263
             $desc_class = ' hidden';
2264 2264
         }
2265 2265
         ?>
2266
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2267
-            <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2266
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2267
+            <label><?php echo sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2268 2268
             <?php
2269 2269
             if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2270 2270
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2273,16 +2273,16 @@  discard block
 block discarded – undo
2273 2273
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2274 2274
                 </div>
2275 2275
             <?php if ($desc_limit != '') { ?>
2276
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2276
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2277 2277
             <?php } } else { ?>
2278 2278
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2279 2279
             <?php } if ($desc_limit_msg != '') { ?>
2280 2280
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2281 2281
             <?php } ?>
2282
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2282
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2283 2283
         </div>
2284 2284
         <?php
2285
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2286 2286
             /**
2287 2287
              * Called on the add listing page form for frontend just after the description field.
2288 2288
              *
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2322 2322
         
2323 2323
         $tags_class = '';
2324
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2324
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2325 2325
             /**
2326 2326
              * Called on the add listing page form for frontend just before the tags field.
2327 2327
              *
@@ -2332,14 +2332,14 @@  discard block
 block discarded – undo
2332 2332
             $tags_class = ' hidden';
2333 2333
         }
2334 2334
         ?>
2335
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2335
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2336 2336
             <label><?php echo TAGKW_TEXT; ?></label>
2337 2337
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2338
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2339
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2338
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2339
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2340 2340
         </div>
2341 2341
         <?php
2342
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2342
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2343 2343
             /**
2344 2344
              * Called on the add listing page form for frontend just after the tags field.
2345 2345
              *
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
         $thumb_img_arr = array();
2366 2366
         $totImg = 0;
2367 2367
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2368
-            $post = (object)$gd_session->get('listing');
2368
+            $post = (object) $gd_session->get('listing');
2369 2369
             if (isset($post->post_images))
2370 2370
                 $curImages = trim($post->post_images, ",");
2371 2371
 
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
             $listing_type = $post->listing_type;
2379 2379
 
2380 2380
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2381
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2381
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2382 2382
             $listing_type = $post->post_type;
2383 2383
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2384 2384
 
@@ -2392,7 +2392,7 @@  discard block
 block discarded – undo
2392 2392
                 //$curImages = $img->src.",";
2393 2393
             }
2394 2394
 
2395
-            $totImg = count((array)$thumb_img_arr);
2395
+            $totImg = count((array) $thumb_img_arr);
2396 2396
         }
2397 2397
 
2398 2398
         if ($curImages != '')
@@ -2413,15 +2413,15 @@  discard block
 block discarded – undo
2413 2413
         if ($show_image_input_box) {
2414 2414
             ?>
2415 2415
 
2416
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2416
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2417 2417
                 <?php if ($image_limit == 1) {
2418
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2418
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2419 2419
                 } ?>
2420 2420
                 <?php if ($image_limit > 1) {
2421
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2421
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2422 2422
                 } ?>
2423 2423
                 <?php if ($image_limit == '') {
2424
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2424
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2425 2425
                 } ?>
2426 2426
             </h5>
2427 2427
 
@@ -2436,11 +2436,11 @@  discard block
 block discarded – undo
2436 2436
                 <div
2437 2437
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2438 2438
                     id="<?php echo $id; ?>plupload-upload-ui">
2439
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2439
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2440 2440
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2441 2441
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2442 2442
                     <span class="ajaxnonceplu"
2443
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2443
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2444 2444
                     <?php if ($width && $height): ?>
2445 2445
                         <span class="plupload-resize"></span>
2446 2446
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2454 2454
                 </div>
2455 2455
                 <span
2456
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2456
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2457 2457
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2458 2458
             </div>
2459 2459
 
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
          *
2466 2466
          * @since 1.0.0
2467 2467
          */
2468
-        do_action('geodir_after_main_form_fields');?>
2468
+        do_action('geodir_after_main_form_fields'); ?>
2469 2469
 
2470 2470
 
2471 2471
         <!-- add captcha code -->
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
         </script>
2477 2477
         <noscript>
2478 2478
             <div>
2479
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2479
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2480 2480
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2481 2481
             </div>
2482 2482
         </noscript>
@@ -2486,10 +2486,10 @@  discard block
 block discarded – undo
2486 2486
         <!-- end captcha code -->
2487 2487
 
2488 2488
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2489
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2490
-                   class="geodir_button" <?php echo $submit_button;?>/>
2489
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2490
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2491 2491
             <span class="geodir_message_note"
2492
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2492
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2493 2493
         </div>
2494 2494
 
2495 2495
     </form>
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
         class="<?php
2552 2552
         /** This action is documented in geodirectory_template_actions.php */
2553 2553
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2554
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2554
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2555 2555
     </div><!-- clearfix ends here-->
2556 2556
 <?php
2557 2557
 }
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 
2574 2574
     ?>
2575 2575
     <script type="text/javascript">
2576
-        <?php if ( $user_login ) { ?>
2576
+        <?php if ($user_login) { ?>
2577 2577
         setTimeout(function () {
2578 2578
             try {
2579 2579
                 d = document.getElementById('user_pass');
@@ -2590,7 +2590,7 @@  discard block
 block discarded – undo
2590 2590
         <?php } ?>
2591 2591
     </script>
2592 2592
     <script type="text/javascript">
2593
-        <?php if ( $user_login ) { ?>
2593
+        <?php if ($user_login) { ?>
2594 2594
         setTimeout(function () {
2595 2595
             try {
2596 2596
                 d = document.getElementById('user_pass');
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
         foreach ($errors as $errorsObj) {
2616 2616
             foreach ($errorsObj as $key => $val) {
2617 2617
                 for ($i = 0; $i < count($val); $i++) {
2618
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2618
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2619 2619
                     $registration_error_msg = 1;
2620 2620
                 }
2621 2621
             }
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
              *
2633 2633
              * @since 1.0.0
2634 2634
              */
2635
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2635
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2636 2636
         </div>
2637 2637
 
2638 2638
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
              *
2645 2645
              * @since 1.0.0
2646 2646
              */
2647
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2647
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2648 2648
         </div>
2649 2649
 
2650 2650
     <?php } else { ?>
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
              *
2657 2657
              * @since 1.0.0
2658 2658
              */
2659
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2659
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2660 2660
         </div>
2661 2661
         <div class="registration_form_r">
2662 2662
             <?php
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
              *
2666 2666
              * @since 1.0.0
2667 2667
              */
2668
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2668
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2669 2669
         </div>
2670 2670
 
2671 2671
     <?php }?>
@@ -2701,12 +2701,12 @@  discard block
 block discarded – undo
2701 2701
     $gd_post_type = geodir_get_current_posttype();
2702 2702
     $post_type_info = get_post_type_object($gd_post_type);
2703 2703
 
2704
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2704
+    $add_string_in_title = __('All', 'geodirectory').' ';
2705 2705
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2706
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2706
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2707 2707
     }
2708 2708
 
2709
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2709
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2710 2710
     $single_name = $post_type_info->labels->singular_name;
2711 2711
 
2712 2712
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2714,12 +2714,12 @@  discard block
 block discarded – undo
2714 2714
     if (!empty($term)) {
2715 2715
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2716 2716
         if (!empty($current_term))
2717
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2717
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2718 2718
     }
2719 2719
 
2720 2720
 
2721 2721
     if (is_search()) {
2722
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2722
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2723 2723
 
2724 2724
     }
2725 2725
     /** This action is documented in geodirectory_template_actions.php */
@@ -2728,11 +2728,11 @@  discard block
 block discarded – undo
2728 2728
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2729 2729
 
2730 2730
     $title = $list_title;
2731
-    if(geodir_is_page('author')){
2731
+    if (geodir_is_page('author')) {
2732 2732
         $gd_page = 'author';
2733
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2733
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2734 2734
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2735
-        }else{
2735
+        } else {
2736 2736
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2737 2737
         }
2738 2738
 
@@ -2746,16 +2746,16 @@  discard block
 block discarded – undo
2746 2746
      * @param string $title The page title including variables.
2747 2747
      * @param string $gd_page The GeoDirectory page type if any.
2748 2748
      */
2749
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2749
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2750 2750
 
2751
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2751
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2752 2752
         /**
2753 2753
          * Filter the author page title text.
2754 2754
          *
2755 2755
          * @since 1.0.0
2756 2756
          * @param string $list_title The title for the page.
2757 2757
          */
2758
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2758
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2759 2759
 }
2760 2760
 
2761 2761
 
@@ -2960,19 +2960,19 @@  discard block
 block discarded – undo
2960 2960
     $post_type_info = get_post_type_object($gd_post_type);
2961 2961
 
2962 2962
     $pt_name = '';
2963
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2963
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
2964 2964
 
2965 2965
     if (is_search()) {
2966
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2966
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2967 2967
 
2968 2968
     }
2969 2969
     /** This action is documented in geodirectory_template_actions.php */
2970 2970
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2971 2971
     /** This action is documented in geodirectory_template_actions.php */
2972 2972
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2973
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2973
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2974 2974
         /** This action is documented in geodirectory_template_actions.php */
2975
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2975
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
2976 2976
 }
2977 2977
 
2978 2978
 // action for adding the listings page top widget area
@@ -3376,7 +3376,7 @@  discard block
 block discarded – undo
3376 3376
         $gd_post_type = geodir_get_current_posttype();
3377 3377
         $post_type_info = get_post_type_object($gd_post_type);
3378 3378
 
3379
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3379
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3380 3380
     }
3381 3381
     return $list_title;
3382 3382
 }
@@ -3392,7 +3392,7 @@  discard block
 block discarded – undo
3392 3392
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3393 3393
  * @param string $gd_page The geodirectory page type. Default null.
3394 3394
  */
3395
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3395
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3396 3396
     global $post;
3397 3397
         
3398 3398
     $gd_page_id = NULL;
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;
@@ -346,8 +351,9 @@  discard block
 block discarded – undo
346 351
     $sort_by = '';
347 352
     $orderby = ' ';
348 353
 
349
-    if (get_query_var('order_by'))
350
-        $sort_by = get_query_var('order_by');
354
+    if (get_query_var('order_by')) {
355
+            $sort_by = get_query_var('order_by');
356
+    }
351 357
 
352 358
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
353 359
         $current_term = $wp_query->get_queried_object();
@@ -367,14 +373,16 @@  discard block
 block discarded – undo
367 373
         $orderby .= " distance,";
368 374
     }
369 375
 
370
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
371
-        $sort_by = esc_attr($_REQUEST['sort_by']);
376
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
377
+            $sort_by = esc_attr($_REQUEST['sort_by']);
378
+    }
372 379
 
373 380
 
374 381
     if ($sort_by == '') {
375 382
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
376
-        if (!empty($default_sort))
377
-            $sort_by = $default_sort;
383
+        if (!empty($default_sort)) {
384
+                    $sort_by = $default_sort;
385
+        }
378 386
     }
379 387
 
380 388
     /*
@@ -562,8 +570,9 @@  discard block
 block discarded – undo
562 570
 
563 571
             add_filter('posts_where', 'searching_filter_where', 1);
564 572
 
565
-            if ($snear != '')
566
-                add_filter('posts_where', 'searching_filter_where', 1);
573
+            if ($snear != '') {
574
+                            add_filter('posts_where', 'searching_filter_where', 1);
575
+            }
567 576
 
568 577
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
569 578
 
@@ -731,10 +740,11 @@  discard block
 block discarded – undo
731 740
     }
732 741
 
733 742
     $better_search_terms = '';
734
-    if (isset($_REQUEST['stype']))
735
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
736
-    else
737
-        $post_types = 'gd_place';
743
+    if (isset($_REQUEST['stype'])) {
744
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
745
+    } else {
746
+            $post_types = 'gd_place';
747
+    }
738 748
 
739 749
     if ($s != '') {
740 750
         $keywords = explode(" ", $s);
@@ -762,7 +772,7 @@  discard block
 block discarded – undo
762 772
     if($taxonomies) {
763 773
         $taxonomies = implode("','", $taxonomies);
764 774
         $taxonomies = "'" . $taxonomies . "'";
765
-    }else{$taxonomies='';}
775
+    } else{$taxonomies='';}
766 776
 
767 777
     $content_where = $terms_where = '';
768 778
 	if ($s != '') {
@@ -878,8 +888,9 @@  discard block
 block discarded – undo
878 888
             $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
879 889
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
880 890
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
881
-        } else
882
-            $where .= " AND $wpdb->posts.post_author = $user_id";
891
+        } else {
892
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
893
+        }
883 894
 
884 895
         if ($user_id == (int)get_current_user_id()) {
885 896
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.
Indentation   +511 added lines, -511 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()
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
-        } //  Latatude
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
+		} //  Latatude
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(ucfirst($addr_details[geoplugin_latitude]));
125
-            $mylon = stripslashes(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(ucfirst($addr_details[geoplugin_latitude]));
125
+			$mylon = stripslashes(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(mb_strlen($kword, 'UTF-8')<=$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(mb_strlen($kword, 'UTF-8')<=$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 (function_exists('icl_object_id')) {
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 (function_exists('icl_object_id')) {
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,116 +366,116 @@  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 != '') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
394
+		if ($snear != '') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
398 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':
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 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
-        default:
436
-
437
-            break;
438
-    endswitch;
439
-
440
-    global $s;
441
-
442
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443
-        $keywords = explode(" ", $s);
444
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
-            foreach($keywords as $kkey=>$kword){
446
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
447
-                    unset($keywords[$kkey]);
448
-                }
449
-            }
450
-        }
451
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452
-            if (count($keywords) > 1) {
453
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454
-            } else {
455
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456
-            }
457
-        } else {
458
-            if (count($keywords) > 1) {
459
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
460
-            } else {
461
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
462
-            }
463
-        }
464
-    }
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
+		default:
436
+
437
+			break;
438
+	endswitch;
439
+
440
+	global $s;
441
+
442
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443
+		$keywords = explode(" ", $s);
444
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
+			foreach($keywords as $kkey=>$kword){
446
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
447
+					unset($keywords[$kkey]);
448
+				}
449
+			}
450
+		}
451
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452
+			if (count($keywords) > 1) {
453
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454
+			} else {
455
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456
+			}
457
+		} else {
458
+			if (count($keywords) > 1) {
459
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
460
+			} else {
461
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
462
+			}
463
+		}
464
+	}
465 465
 
466
-    /**
467
-     * Filter order by SQL.
468
-     *
469
-     * @since 1.0.0
470
-     * @param string $orderby The orderby query string.
471
-     * @param string $sort_by Sortby query string.
472
-     * @param string $table Listing table name.
473
-     */
474
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
466
+	/**
467
+	 * Filter order by SQL.
468
+	 *
469
+	 * @since 1.0.0
470
+	 * @param string $orderby The orderby query string.
471
+	 * @param string $sort_by Sortby query string.
472
+	 * @param string $table Listing table name.
473
+	 */
474
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
475 475
 
476
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
476
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
477 477
 
478
-    return $orderby;
478
+	return $orderby;
479 479
 }
480 480
 
481 481
 
@@ -493,53 +493,53 @@  discard block
 block discarded – undo
493 493
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
494 494
 {
495 495
 
496
-    global $wpdb;
496
+	global $wpdb;
497 497
 
498
-    if ($sort_by != '' && !is_search()) {
498
+	if ($sort_by != '' && !is_search()) {
499 499
 
500
-        $sort_array = explode('_', $sort_by);
500
+		$sort_array = explode('_', $sort_by);
501 501
 
502
-        $sort_by_count = count($sort_array);
502
+		$sort_by_count = count($sort_array);
503 503
 
504
-        $order = $sort_array[$sort_by_count - 1];
504
+		$order = $sort_array[$sort_by_count - 1];
505 505
 
506
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
506
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
507 507
 
508
-            $sort_by = str_replace('_' . $order, '', $sort_by);
508
+			$sort_by = str_replace('_' . $order, '', $sort_by);
509 509
 
510
-            switch ($sort_by):
510
+			switch ($sort_by):
511 511
 
512
-                case 'post_date':
513
-                case 'comment_count':
512
+				case 'post_date':
513
+				case 'comment_count':
514 514
 
515
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
516
-                    break;
515
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
516
+					break;
517 517
 
518
-                case 'distance':
519
-                    $orderby = $sort_by . " " . $order . ", ";
520
-                    break;
518
+				case 'distance':
519
+					$orderby = $sort_by . " " . $order . ", ";
520
+					break;
521 521
 
522 522
 
523
-                // sort by rating
524
-                case 'overall_rating':
525
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
523
+				// sort by rating
524
+				case 'overall_rating':
525
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
526 526
 
527
-                    break;
527
+					break;
528 528
 
529 529
 
530
-                default:
531
-                    if (geodir_column_exist($table, $sort_by)) {
530
+				default:
531
+					if (geodir_column_exist($table, $sort_by)) {
532 532
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
533 533
 					}
534
-                    break;
534
+					break;
535 535
 
536
-            endswitch;
536
+			endswitch;
537 537
 
538
-        }
538
+		}
539 539
 
540
-    }
540
+	}
541 541
 
542
-    return $orderby;
542
+	return $orderby;
543 543
 }
544 544
 
545 545
 /**
@@ -554,34 +554,34 @@  discard block
 block discarded – undo
554 554
 {
555 555
 
556 556
 
557
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
557
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
558 558
 
559
-    if (!is_admin()) {
559
+	if (!is_admin()) {
560 560
 
561
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
562
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
561
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
562
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
563 563
 
564
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
564
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
565 565
 
566
-            add_filter('posts_where', 'searching_filter_where', 1);
566
+			add_filter('posts_where', 'searching_filter_where', 1);
567 567
 
568
-            if ($snear != '')
569
-                add_filter('posts_where', 'searching_filter_where', 1);
568
+			if ($snear != '')
569
+				add_filter('posts_where', 'searching_filter_where', 1);
570 570
 
571
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
571
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
572 572
 
573
-        } elseif (geodir_is_page('author')) {
573
+		} elseif (geodir_is_page('author')) {
574 574
 
575
-            add_filter('posts_where', 'author_filter_where', 1);
575
+			add_filter('posts_where', 'author_filter_where', 1);
576 576
 
577
-        }
577
+		}
578 578
 
579
-        //if (!geodir_is_page('detail'))
580
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
579
+		//if (!geodir_is_page('detail'))
580
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
581 581
 
582
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
582
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
583 583
 
584
-    }
584
+	}
585 585
 }
586 586
 
587 587
 /**
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
  */
597 597
 function geodir_preview_post_cap($allcaps, $caps, $args)
598 598
 {
599
-    $user_id = get_current_user_id();
600
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
599
+	$user_id = get_current_user_id();
600
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
601 601
 
602
-        $allcaps['edit_posts'] = true;
603
-    }
604
-    //print_r($allcaps);
605
-    return $allcaps;
602
+		$allcaps['edit_posts'] = true;
603
+	}
604
+	//print_r($allcaps);
605
+	return $allcaps;
606 606
 }
607 607
 
608 608
 
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_edit_listing_where($where)
619 619
 {
620
-    global $wpdb;
621
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
622
-    return $where;
620
+	global $wpdb;
621
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
622
+	return $where;
623 623
 }
624 624
 
625 625
 
@@ -636,29 +636,29 @@  discard block
 block discarded – undo
636 636
  */
637 637
 function geodir_default_where($where)
638 638
 {
639
-    global $wp_query, $wpdb;
640
-
641
-    //print_r($wp_query);
642
-    ########### WPML ###########
643
-
644
-    if (function_exists('icl_object_id')) {
645
-        global $sitepress, $table_prefix;
646
-        $lang_code = ICL_LANGUAGE_CODE;
647
-        $default_lang_code = $sitepress->get_default_language();
648
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649
-        //echo '##########'.$q_post_type;
650
-        if ($lang_code && $q_post_type) {
651
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
652
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
653
-        }
639
+	global $wp_query, $wpdb;
654 640
 
655
-    }
656
-    ########### WPML ###########
641
+	//print_r($wp_query);
642
+	########### WPML ###########
657 643
 
644
+	if (function_exists('icl_object_id')) {
645
+		global $sitepress, $table_prefix;
646
+		$lang_code = ICL_LANGUAGE_CODE;
647
+		$default_lang_code = $sitepress->get_default_language();
648
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649
+		//echo '##########'.$q_post_type;
650
+		if ($lang_code && $q_post_type) {
651
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
652
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
653
+		}
658 654
 
659
-    return $where = str_replace("0 = 1", "1=1", $where);
655
+	}
656
+	########### WPML ###########
660 657
 
661
-    /* ====== old code start ===
658
+
659
+	return $where = str_replace("0 = 1", "1=1", $where);
660
+
661
+	/* ====== old code start ===
662 662
     $where = str_replace("0 = 1", "1=1", $where);
663 663
     $country = get_query_var('gd_country');
664 664
     $region = get_query_var('gd_region');
@@ -699,108 +699,108 @@  discard block
 block discarded – undo
699 699
  * @return string Modified where query string.
700 700
  */
701 701
 function searching_filter_where($where) {
702
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
702
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
703 703
 	
704
-    $search_term = 'OR';
705
-    $search_term = 'AND';
706
-    $geodir_custom_search = '';
707
-    $category_search_range = '';
704
+	$search_term = 'OR';
705
+	$search_term = 'AND';
706
+	$geodir_custom_search = '';
707
+	$category_search_range = '';
708 708
 
709
-    if (is_single() && get_query_var('post_type')) {
709
+	if (is_single() && get_query_var('post_type')) {
710 710
 		return $where;
711 711
 	}
712 712
 
713
-    if (is_tax()) {
713
+	if (is_tax()) {
714 714
 		return $where;
715 715
 	}
716 716
 	
717 717
 	$s = trim($s);
718
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
720
-
721
-    $where = '';
722
-    $better_search_terms = '';
723
-    if (isset($_REQUEST['stype']))
724
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
725
-    else
726
-        $post_types = 'gd_place';
727
-
728
-    if ($s != '') {
729
-        $keywords = explode(" ", $s);
730
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
-            foreach($keywords as $kkey=>$kword){
732
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
733
-                    unset($keywords[$kkey]);
734
-                }
735
-            }
736
-        }
718
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737 720
 
738
-        if (!empty($keywords)) {
739
-            foreach ($keywords as $keyword) {
740
-                $keyword = trim($keyword);
741
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
742
-                if ($keyword != '') {
743
-                    /**
744
-                     * Filter the search query keywords SQL.
745
-                     *
746
-                     * @since 1.5.9
747
-                     * @package GeoDirectory
748
-                     * @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 . '%" )'`.
749
-                     * @param array $keywords The array of keywords for the query.
750
-                     * @param string $keyword The single keyword being searched.
751
-                     */
721
+	$where = '';
722
+	$better_search_terms = '';
723
+	if (isset($_REQUEST['stype']))
724
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
725
+	else
726
+		$post_types = 'gd_place';
727
+
728
+	if ($s != '') {
729
+		$keywords = explode(" ", $s);
730
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
+			foreach($keywords as $kkey=>$kword){
732
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
733
+					unset($keywords[$kkey]);
734
+				}
735
+			}
736
+		}
737
+
738
+		if (!empty($keywords)) {
739
+			foreach ($keywords as $keyword) {
740
+				$keyword = trim($keyword);
741
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
742
+				if ($keyword != '') {
743
+					/**
744
+					 * Filter the search query keywords SQL.
745
+					 *
746
+					 * @since 1.5.9
747
+					 * @package GeoDirectory
748
+					 * @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 . '%" )'`.
749
+					 * @param array $keywords The array of keywords for the query.
750
+					 * @param string $keyword The single keyword being searched.
751
+					 */
752 752
 					$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);
753
-                }
754
-            }
755
-        }
756
-    }
753
+				}
754
+			}
755
+		}
756
+	}
757 757
 
758
-    /* get taxonomy */
759
-    $taxonomies = geodir_get_taxonomies($post_types, true);
760
-    if($taxonomies) {
761
-        $taxonomies = implode("','", $taxonomies);
762
-        $taxonomies = "'" . $taxonomies . "'";
763
-    }else{$taxonomies='';}
758
+	/* get taxonomy */
759
+	$taxonomies = geodir_get_taxonomies($post_types, true);
760
+	if($taxonomies) {
761
+		$taxonomies = implode("','", $taxonomies);
762
+		$taxonomies = "'" . $taxonomies . "'";
763
+	}else{$taxonomies='';}
764 764
 
765
-    $content_where = $terms_where = '';
765
+	$content_where = $terms_where = '';
766 766
 	if ($s != '') {
767
-        /**
768
-         * Filter the search query content where values.
769
-         *
770
-         * @since 1.5.0
771
-         * @package GeoDirectory
772
-         * @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%\") ") "`.
773
-         */
767
+		/**
768
+		 * Filter the search query content where values.
769
+		 *
770
+		 * @since 1.5.0
771
+		 * @package GeoDirectory
772
+		 * @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%\") ") "`.
773
+		 */
774 774
 		$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%\") ");
775
-        /**
776
-         * Filter the search query term values.
777
-         *
778
-         * @since 1.5.0
779
-         * @package GeoDirectory
780
-         * @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)) "`.
781
-         */
782
-        $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)) ");
775
+		/**
776
+		 * Filter the search query term values.
777
+		 *
778
+		 * @since 1.5.0
779
+		 * @package GeoDirectory
780
+		 * @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)) "`.
781
+		 */
782
+		$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)) ");
783 783
 	}
784 784
 		
785
-    if ($snear != '') {
785
+	if ($snear != '') {
786 786
 
787 787
 
788
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
789
-            $dist = $gd_session->get('near_me_range');
790
-        }
791
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
792
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
793
-        $lat1 = $mylat - ($dist / 69);
794
-        $lat2 = $mylat + ($dist / 69);
788
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
789
+			$dist = $gd_session->get('near_me_range');
790
+		}
791
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
792
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
793
+		$lat1 = $mylat - ($dist / 69);
794
+		$lat2 = $mylat + ($dist / 69);
795 795
 
796
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
797
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
798
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
799
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
796
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
797
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
798
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
799
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
800 800
 
801 801
 
802 802
 
803
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
803
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
804 804
 			                    $content_where 
805 805
 								OR ($wpdb->posts.ID IN( 
806 806
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -817,13 +817,13 @@  discard block
 block discarded – undo
817 817
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
818 818
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
819 819
 
820
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
-            $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;
823
-        }
820
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
+			$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;
823
+		}
824 824
 
825
-    } else {
826
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
825
+	} else {
826
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
827 827
                             $content_where  
828 828
 							OR ( $wpdb->posts.ID IN(	
829 829
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -837,19 +837,19 @@  discard block
 block discarded – undo
837 837
 					) 
838 838
 				AND $wpdb->posts.post_type in ('$post_types')
839 839
 				AND ($wpdb->posts.post_status = 'publish') ";
840
-    }
840
+	}
841 841
 	
842 842
 	########### WPML ###########
843
-    if ( function_exists( 'icl_object_id' ) ) {       
843
+	if ( function_exists( 'icl_object_id' ) ) {       
844 844
 		$lang_code = ICL_LANGUAGE_CODE;
845 845
 		
846 846
 		if ($lang_code && $post_types) {
847
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
848
-        }
849
-    }
850
-    ########### WPML ###########
847
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
848
+		}
849
+	}
850
+	########### WPML ###########
851 851
 	
852
-    return $where;
852
+	return $where;
853 853
 }
854 854
 
855 855
 
@@ -864,45 +864,45 @@  discard block
 block discarded – undo
864 864
  * @return string Modified where query string.
865 865
  */
866 866
 function author_filter_where($where) {
867
-    global $wpdb, $geodir_post_type, $table, $curr;
867
+	global $wpdb, $geodir_post_type, $table, $curr;
868 868
 
869
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
869
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
871 871
     
872
-    if (isset($_REQUEST['stype'])) {
873
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
874
-    } else {
875
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876
-    }
872
+	if (isset($_REQUEST['stype'])) {
873
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
874
+	} else {
875
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876
+	}
877 877
 
878
-    if ($user_id > 0) {
879
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
880
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
881
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
882
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
883
-        } else
884
-            $where .= " AND $wpdb->posts.post_author = $user_id";
885
-
886
-        if ($user_id == (int)get_current_user_id()) {
887
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888
-        } else {
889
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
890
-        }
891
-    } else {
892
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
893
-    }
878
+	if ($user_id > 0) {
879
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
880
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
881
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
882
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
883
+		} else
884
+			$where .= " AND $wpdb->posts.post_author = $user_id";
885
+
886
+		if ($user_id == (int)get_current_user_id()) {
887
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888
+		} else {
889
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
890
+		}
891
+	} else {
892
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
893
+	}
894 894
 
895
-    ########### WPML ###########
896
-    if (function_exists('icl_object_id')) {
897
-        $lang_code = ICL_LANGUAGE_CODE;
898
-        if ($lang_code) {
899
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
900
-        }
895
+	########### WPML ###########
896
+	if (function_exists('icl_object_id')) {
897
+		$lang_code = ICL_LANGUAGE_CODE;
898
+		if ($lang_code) {
899
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
900
+		}
901 901
 
902
-    }
903
-    ########### WPML ###########
902
+	}
903
+	########### WPML ###########
904 904
     
905
-    return $where;
905
+	return $where;
906 906
 }
907 907
 
908 908
 /**
@@ -917,11 +917,11 @@  discard block
 block discarded – undo
917 917
  */
918 918
 function geodir_filter_widget_join($join)
919 919
 {
920
-    global $wp_query, $table;
921
-    if (!empty($wp_query->query['with_pics_only'])) {
922
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
923
-    }
924
-    return $join;
920
+	global $wp_query, $table;
921
+	if (!empty($wp_query->query['with_pics_only'])) {
922
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
923
+	}
924
+	return $join;
925 925
 }
926 926
 
927 927
 /**
@@ -936,42 +936,42 @@  discard block
 block discarded – undo
936 936
  */
937 937
 function geodir_filter_widget_where($where)
938 938
 {
939
-    global $wp_query, $table;
940
-    if (!empty($wp_query->query['show_featured_only'])) {
941
-        $where .= " AND " . $table . ".is_featured = '1'";
942
-    }
943
-    if (!empty($wp_query->query['show_special_only'])) {
944
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
945
-    }
946
-    if (!empty($wp_query->query['with_pics_only'])) {
947
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
948
-    }
949
-    if (!empty($wp_query->query['with_videos_only'])) {
950
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
951
-    }
952
-    return $where;
939
+	global $wp_query, $table;
940
+	if (!empty($wp_query->query['show_featured_only'])) {
941
+		$where .= " AND " . $table . ".is_featured = '1'";
942
+	}
943
+	if (!empty($wp_query->query['show_special_only'])) {
944
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
945
+	}
946
+	if (!empty($wp_query->query['with_pics_only'])) {
947
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
948
+	}
949
+	if (!empty($wp_query->query['with_videos_only'])) {
950
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
951
+	}
952
+	return $where;
953 953
 }
954 954
 
955 955
 
956 956
 function geodir_related_posts_fields($fields) {
957
-    global $wp_query, $wpdb, $table, $post;
957
+	global $wp_query, $wpdb, $table, $post;
958 958
 
959
-    $fields .= ", " . $table . ".* ";
959
+	$fields .= ", " . $table . ".* ";
960 960
 
961
-    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
961
+	$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
962 962
 
963
-    $mylat = $post->post_latitude;
964
-    $mylon = $post->post_longitude;
963
+	$mylat = $post->post_latitude;
964
+	$mylon = $post->post_longitude;
965 965
 
966
-    $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 ";
967
-    return $fields;
966
+	$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 ";
967
+	return $fields;
968 968
 }
969 969
 function geodir_related_posts_fields_filter($query) {
970
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
971
-        && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
972
-        && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
973
-    ) {
974
-        add_filter('posts_fields', 'geodir_related_posts_fields', 1);
975
-    }
970
+	if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
971
+		&& isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
972
+		&& isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
973
+	) {
974
+		add_filter('posts_fields', 'geodir_related_posts_fields', 1);
975
+	}
976 976
 }
977 977
 add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
978 978
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -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
         } //  Latatude
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(ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(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(mb_strlen($kword, 'UTF-8')<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (mb_strlen($kword, 'UTF-8') <= $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;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
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
 
@@ -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, ";
@@ -441,24 +441,24 @@  discard block
 block discarded – undo
441 441
 
442 442
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443 443
         $keywords = explode(" ", $s);
444
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
-            foreach($keywords as $kkey=>$kword){
446
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
444
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
445
+            foreach ($keywords as $kkey=>$kword) {
446
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
447 447
                     unset($keywords[$kkey]);
448 448
                 }
449 449
             }
450 450
         }
451 451
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452 452
             if (count($keywords) > 1) {
453
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
453
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454 454
             } else {
455
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
455
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456 456
             }
457 457
         } else {
458 458
             if (count($keywords) > 1) {
459
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
459
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
460 460
             } else {
461
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
461
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
462 462
             }
463 463
         }
464 464
     }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      */
474 474
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
475 475
 
476
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
476
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
477 477
 
478 478
     return $orderby;
479 479
 }
@@ -505,31 +505,31 @@  discard block
 block discarded – undo
505 505
 
506 506
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
507 507
 
508
-            $sort_by = str_replace('_' . $order, '', $sort_by);
508
+            $sort_by = str_replace('_'.$order, '', $sort_by);
509 509
 
510 510
             switch ($sort_by):
511 511
 
512 512
                 case 'post_date':
513 513
                 case 'comment_count':
514 514
 
515
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
515
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
516 516
                     break;
517 517
 
518 518
                 case 'distance':
519
-                    $orderby = $sort_by . " " . $order . ", ";
519
+                    $orderby = $sort_by." ".$order.", ";
520 520
                     break;
521 521
 
522 522
 
523 523
                 // sort by rating
524 524
                 case 'overall_rating':
525
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
525
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
526 526
 
527 527
                     break;
528 528
 
529 529
 
530 530
                 default:
531 531
                     if (geodir_column_exist($table, $sort_by)) {
532
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
532
+						$orderby = $table.".".$sort_by." ".$order.", ";
533 533
 					}
534 534
                     break;
535 535
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         }
578 578
 
579 579
         //if (!geodir_is_page('detail'))
580
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
580
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
581 581
 
582 582
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
583 583
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649 649
         //echo '##########'.$q_post_type;
650 650
         if ($lang_code && $q_post_type) {
651
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
651
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
652 652
             //$where .= " AND icl_t.language_code = '$lang_code' ";
653 653
         }
654 654
 
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	}
716 716
 	
717 717
 	$s = trim($s);
718
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
718
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
719
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
720 720
 
721 721
     $where = '';
722 722
     $better_search_terms = '';
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 
728 728
     if ($s != '') {
729 729
         $keywords = explode(" ", $s);
730
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
-            foreach($keywords as $kkey=>$kword){
732
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
730
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
731
+            foreach ($keywords as $kkey=>$kword) {
732
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
733 733
                     unset($keywords[$kkey]);
734 734
                 }
735 735
             }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         if (!empty($keywords)) {
739 739
             foreach ($keywords as $keyword) {
740 740
                 $keyword = trim($keyword);
741
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
741
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
742 742
                 if ($keyword != '') {
743 743
                     /**
744 744
                      * Filter the search query keywords SQL.
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                      * @param array $keywords The array of keywords for the query.
750 750
                      * @param string $keyword The single keyword being searched.
751 751
                      */
752
-					$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);
752
+					$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);
753 753
                 }
754 754
             }
755 755
         }
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 
758 758
     /* get taxonomy */
759 759
     $taxonomies = geodir_get_taxonomies($post_types, true);
760
-    if($taxonomies) {
760
+    if ($taxonomies) {
761 761
         $taxonomies = implode("','", $taxonomies);
762
-        $taxonomies = "'" . $taxonomies . "'";
763
-    }else{$taxonomies='';}
762
+        $taxonomies = "'".$taxonomies."'";
763
+    } else {$taxonomies = ''; }
764 764
 
765 765
     $content_where = $terms_where = '';
766 766
 	if ($s != '') {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
          * @package GeoDirectory
772 772
          * @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%\") ") "`.
773 773
          */
774
-		$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%\") ");
774
+		$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%\") ");
775 775
         /**
776 776
          * Filter the search query term values.
777 777
          *
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
          * @package GeoDirectory
780 780
          * @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)) "`.
781 781
          */
782
-        $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)) ");
782
+        $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)) ");
783 783
 	}
784 784
 		
785 785
     if ($snear != '') {
@@ -814,12 +814,12 @@  discard block
 block discarded – undo
814 814
 							)
815 815
 						AND $wpdb->posts.post_type in ('{$post_types}')
816 816
 						AND ($wpdb->posts.post_status = 'publish')
817
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
818
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
817
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
818
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
819 819
 
820 820
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821 821
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
-            $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;
822
+            $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;
823 823
         }
824 824
 
825 825
     } else {
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
     }
841 841
 	
842 842
 	########### WPML ###########
843
-    if ( function_exists( 'icl_object_id' ) ) {       
843
+    if (function_exists('icl_object_id')) {       
844 844
 		$lang_code = ICL_LANGUAGE_CODE;
845 845
 		
846 846
 		if ($lang_code && $post_types) {
847
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
847
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
848 848
         }
849 849
     }
850 850
     ########### WPML ###########
@@ -867,10 +867,10 @@  discard block
 block discarded – undo
867 867
     global $wpdb, $geodir_post_type, $table, $curr;
868 868
 
869 869
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
870
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
871 871
     
872 872
     if (isset($_REQUEST['stype'])) {
873
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
873
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
874 874
     } else {
875 875
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876 876
     }
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
         } else
884 884
             $where .= " AND $wpdb->posts.post_author = $user_id";
885 885
 
886
-        if ($user_id == (int)get_current_user_id()) {
886
+        if ($user_id == (int) get_current_user_id()) {
887 887
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888 888
         } else {
889 889
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
     if (function_exists('icl_object_id')) {
897 897
         $lang_code = ICL_LANGUAGE_CODE;
898 898
         if ($lang_code) {
899
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
899
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
900 900
         }
901 901
 
902 902
     }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 {
920 920
     global $wp_query, $table;
921 921
     if (!empty($wp_query->query['with_pics_only'])) {
922
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
922
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
923 923
     }
924 924
     return $join;
925 925
 }
@@ -938,16 +938,16 @@  discard block
 block discarded – undo
938 938
 {
939 939
     global $wp_query, $table;
940 940
     if (!empty($wp_query->query['show_featured_only'])) {
941
-        $where .= " AND " . $table . ".is_featured = '1'";
941
+        $where .= " AND ".$table.".is_featured = '1'";
942 942
     }
943 943
     if (!empty($wp_query->query['show_special_only'])) {
944
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
944
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
945 945
     }
946 946
     if (!empty($wp_query->query['with_pics_only'])) {
947
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
947
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
948 948
     }
949 949
     if (!empty($wp_query->query['with_videos_only'])) {
950
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
950
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
951 951
     }
952 952
     return $where;
953 953
 }
@@ -956,18 +956,18 @@  discard block
 block discarded – undo
956 956
 function geodir_related_posts_fields($fields) {
957 957
     global $wp_query, $wpdb, $table, $post;
958 958
 
959
-    $fields .= ", " . $table . ".* ";
959
+    $fields .= ", ".$table.".* ";
960 960
 
961 961
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
962 962
 
963 963
     $mylat = $post->post_latitude;
964 964
     $mylon = $post->post_longitude;
965 965
 
966
-    $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 ";
966
+    $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 ";
967 967
     return $fields;
968 968
 }
969 969
 function geodir_related_posts_fields_filter($query) {
970
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
970
+    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
971 971
         && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
972 972
         && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
973 973
     ) {
Please login to merge, or discard this patch.