Completed
Pull Request — master (#211)
by Kiran
05:44
created
geodirectory-functions/compatibility/Multi_News.php 2 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   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multi news theme compatibility functions.
4
- *
5
- * This file lets the GeoDirectory Plugin use the Multi News theme HTML wrappers to fit and work perfectly.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+	 * Multi news theme compatibility functions.
4
+	 *
5
+	 * This file lets the GeoDirectory Plugin use the Multi News theme HTML wrappers to fit and work perfectly.
6
+	 *
7
+	 * @since 1.0.0
8
+	 * @package GeoDirectory
9
+	 */
10 10
 add_action('after_setup_theme', 'multi_news_action_calls', 11);
11 11
 /**
12
- * Action calls for multi news theme compatibility.
13
- *
14
- * @since 1.0.0
15
- * @package GeoDirectory
16
- */
12
+	 * Action calls for multi news theme compatibility.
13
+	 *
14
+	 * @since 1.0.0
15
+	 * @package GeoDirectory
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,21 +179,21 @@  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
 
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   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
                                 $items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(ucfirst($args->labels->name),'geodirectory') . '
138
+															' . __(ucfirst($args->labels->name), 'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
189 189
                                     $items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
191
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
192 192
 											</a>
193 193
 										</li>';
194 194
                                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
268 268
                                         $items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
270
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
271 271
 														</a>
272 272
 													</li>';
273 273
                                     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
401 401
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
402
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
402
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
403 403
         elseif (isset($_REQUEST['listing_type']))
404 404
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
405 405
     }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
         switch ($output):
440 440
             case 'object':
441 441
             case 'Object':
442
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
442
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
443 443
                 break;
444 444
             case 'array':
445 445
             case 'Array':
446
-                $post_types = (array)$post_types;
446
+                $post_types = (array) $post_types;
447 447
                 break;
448 448
 			case 'options':
449
-                $post_types = (array)$post_types;
449
+                $post_types = (array) $post_types;
450 450
 				
451 451
 				$options = array();
452 452
 				if (!empty($post_types)) {
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
     } elseif (isset($wp_query->tax_query->queries)) {
641 641
         $tax_arr = $wp_query->tax_query->queries;
642 642
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
643
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
644 644
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645 645
     }
646 646
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             $cat_exclude = serialize($exclude_cats);
764 764
 
765 765
         if (isset($_REQUEST['backandedit'])) {
766
-            $post = (object)$gd_session->get('listing');
766
+            $post = (object) $gd_session->get('listing');
767 767
 
768 768
             if (!is_array($post->post_category[$cat_taxonomy]))
769 769
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 
842 842
             function show_subcatlist(main_cat, catObj) {
843 843
                 if (main_cat != '') {
844
-					var url = '<?php echo geodir_get_ajax_url();?>';
845
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
846
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
844
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
845
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
846
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
847 847
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
848
-					<?php if ((int)$cat_limit > 0) { ?>
848
+					<?php if ((int) $cat_limit > 0) { ?>
849 849
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
850 850
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
851
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
851
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
852 852
 						return false;
853 853
 					}
854 854
 					<?php } ?>
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
             }
888 888
 
889 889
             function update_listing_cat(el) {
890
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
890
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
891 891
                 var cat_ids = '';
892 892
                 var main_cat = '';
893 893
                 var sub_cat = '';
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         <div class="main_cat_list" style=" <?php if (isset($style)) {
969 969
             echo $style;
970 970
         }?> ">
971
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
971
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
972 972
             ?>
973 973
         </div>
974 974
     <?php
@@ -995,9 +995,9 @@  discard block
 block discarded – undo
995 995
     if ($exclude != '') {
996 996
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
997 997
         print_r($exclude_cats);
998
-        if(is_array( $exclude_cats)){
999
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
998
+        if (is_array($exclude_cats)) {
999
+            $exclude_cats = array_map('intval', $exclude_cats);
1000
+        } else {
1001 1001
             $exclude_cats = intval($exclude_cats);
1002 1002
         }
1003 1003
 
@@ -1011,25 +1011,25 @@  discard block
 block discarded – undo
1011 1011
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1012 1012
 
1013 1013
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1014
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1014
+            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>"
1015 1015
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1016 1016
             <?php /* ?>
1017 1017
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1018 1018
 		<?php */ ?>
1019 1019
 
1020
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1020
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1021 1021
                    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()"
1022 1022
                    checked="checked" disabled="disabled"/>
1023 1023
        <span> 
1024
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1024
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1025 1025
         </span>
1026 1026
             <br/>
1027 1027
 
1028 1028
             <div class="post_default_category">
1029
-                <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" ';?>   />
1029
+                <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" '; ?>   />
1031 1031
         <span> 
1032
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1032
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1033 1033
         </span>
1034 1034
             </div>
1035 1035
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
         $post_cat_str = $post_categories[$request_taxonomy];
1063 1063
         $post_cat_array = explode("#", $post_cat_str);
1064 1064
         if (is_array($post_cat_array)) {
1065
-            $post_cat_array = array_unique( $post_cat_array );
1065
+            $post_cat_array = array_unique($post_cat_array);
1066 1066
 
1067 1067
 			foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 }
1078 1078
                 $post_sub_catid = '';
1079 1079
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
-                    $post_sub_catid = (int)$post_cat_info[1];
1080
+                    $post_sub_catid = (int) $post_cat_info[1];
1081 1081
                 }
1082 1082
 
1083 1083
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             }
1099 1099
 
1100 1100
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
-                $post_sub_catid = (int)$post_cat_info[1];
1101
+                $post_sub_catid = (int) $post_cat_info[1];
1102 1102
             }
1103 1103
 
1104 1104
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
                 $option_selected = ' selected="selected" ';
1141 1141
 
1142 1142
             // Count child terms
1143
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1143
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1144
+            $has_child = !empty($child_terms) ? 't' : 'f';
1145 1145
 
1146 1146
             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>';
1147 1147
         }
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
             2 => __('Custom field updated.', 'geodirectory'),
1175 1175
             3 => __('Custom field deleted.', 'geodirectory'),
1176 1176
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
-            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,
1177
+            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,
1178 1178
             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),
1179 1179
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180 1180
             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),
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
             'menu_icon' => $menu_icon,
1312 1312
             'public' => true,
1313 1313
             'query_var' => true,
1314
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1314
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1315 1315
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316 1316
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317 1317
 
@@ -1333,25 +1333,25 @@  discard block
 block discarded – undo
1333 1333
 }
1334 1334
 
1335 1335
 $gd_wpml_get_languages = "";
1336
-function gd_wpml_get_lang_from_url($url){
1336
+function gd_wpml_get_lang_from_url($url) {
1337 1337
 
1338 1338
     global $gd_wpml_get_languages;
1339
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1339
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1340 1340
 
1341 1341
 
1342 1342
     //
1343
-    $url = str_replace(array("http://","https://"),"",$url);
1344
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1343
+    $url = str_replace(array("http://", "https://"), "", $url);
1344
+    $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url'));
1345 1345
 
1346
-    $url = str_replace($site_url,"",$url);
1346
+    $url = str_replace($site_url, "", $url);
1347 1347
 
1348 1348
 
1349 1349
     $segments = explode('/', trim($url, '/'));
1350 1350
 
1351 1351
     //print_r( $segments);
1352
-    if($gd_wpml_get_languages){
1352
+    if ($gd_wpml_get_languages) {
1353 1353
         $langs = $gd_wpml_get_languages;
1354
-    }else{
1354
+    } else {
1355 1355
         global $sitepress;
1356 1356
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1357 1357
     }
@@ -1414,17 +1414,17 @@  discard block
 block discarded – undo
1414 1414
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1415 1415
 
1416 1416
         // Alter the CPT slug if WPML is set to do so
1417
-        if(function_exists('icl_object_id')){
1418
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1417
+        if (function_exists('icl_object_id')) {
1418
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1419 1419
 
1420 1420
                 $org_slug = $slug;
1421
-                $slug = apply_filters( 'wpml_translate_single_string',
1421
+                $slug = apply_filters('wpml_translate_single_string',
1422 1422
                     $slug,
1423 1423
                     'WordPress',
1424 1424
                     'URL slug: ' . $slug,
1425 1425
                     $language_code);
1426 1426
 
1427
-                if(!$slug){$slug = $org_slug;}
1427
+                if (!$slug) {$slug = $org_slug; }
1428 1428
 
1429 1429
             }
1430 1430
         }
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 		}
1439 1439
 		
1440 1440
         $post_link = trailingslashit(
1441
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1441
+            preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1)
1442 1442
         );
1443 1443
 
1444 1444
 		if ($fix_url) {
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
                 )
1467 1467
             );
1468 1468
 
1469
-            $post = (object)array_merge((array)$post, (array)$post2);
1469
+            $post = (object) array_merge((array) $post, (array) $post2);
1470 1470
 
1471 1471
             $comment_post_cache[$post->ID] = $post;
1472 1472
         }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1477 1477
 
1478
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1478
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1479 1479
                 $location_request = '';
1480 1480
 
1481 1481
 
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490 1490
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1491 1491
 
1492
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1492
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1493 1493
                             'region_slug' => $post->region_slug,
1494 1494
                             'city_slug' => $post->city_slug
1495 1495
                         );
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519 1519
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1520 1520
 
1521
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1521
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1522 1522
                                 'region_slug' => $post->region_slug,
1523 1523
                                 'city_slug' => $post->city_slug
1524 1524
                             );
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659 1659
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1661
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1662 1662
                 $location_terms = array(
1663 1663
                     'gd_country' => $post->country_slug,
1664 1664
                     'gd_region' => $post->region_slug,
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
             if (!empty($location_terms)) {
1679 1679
 
1680
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1680
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1681 1681
 
1682 1682
                 if (get_option('permalink_structure') != '') {
1683 1683
                     $old_listing_slug = '/' . $listing_slug . '/';
@@ -1700,31 +1700,31 @@  discard block
 block discarded – undo
1700 1700
         }*/
1701 1701
 
1702 1702
         // Alter the CPT slug if WPML is set to do so
1703
-        if(function_exists('icl_object_id')){
1703
+        if (function_exists('icl_object_id')) {
1704 1704
             $post_types = get_option('geodir_post_types');
1705
-            $post_type = str_replace("category","",$taxonomy);
1706
-			$post_type = str_replace("_tags","",$post_type);
1705
+            $post_type = str_replace("category", "", $taxonomy);
1706
+			$post_type = str_replace("_tags", "", $post_type);
1707 1707
             $slug = $post_types[$post_type]['rewrite']['slug'];
1708
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1708
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1709 1709
 
1710 1710
                 global $sitepress;
1711 1711
                 $default_lang = $sitepress->get_default_language();
1712 1712
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1713
-                if(!$language_code ){$language_code  = $default_lang;}
1713
+                if (!$language_code) {$language_code = $default_lang; }
1714 1714
 
1715 1715
                 $org_slug = $slug;
1716
-                $slug = apply_filters( 'wpml_translate_single_string',
1716
+                $slug = apply_filters('wpml_translate_single_string',
1717 1717
                     $slug,
1718 1718
                     'WordPress',
1719 1719
                     'URL slug: ' . $slug,
1720 1720
                     $language_code);
1721 1721
 
1722 1722
 
1723
-                if(!$slug){$slug = $org_slug;}
1723
+                if (!$slug) {$slug = $org_slug; }
1724 1724
 
1725 1725
                 $termlink = trailingslashit(
1726 1726
 
1727
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1727
+                    preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1)
1728 1728
                 );
1729 1729
 
1730 1730
             }
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 	
1758 1758
 	if (in_array($post_type, geodir_get_posttypes())) {
1759 1759
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1760
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761 1761
                 $location_terms = array(
1762 1762
                     'gd_country' => $post->country_slug,
1763 1763
                     'gd_region' => $post->region_slug,
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 
1871 1871
     $where_fields = array($slug);
1872 1872
     if (!empty($taxonomy)) {
1873
-        $parent = (int)$parent;
1873
+        $parent = (int) $parent;
1874 1874
         if ($parent > 0) {
1875 1875
             $where_fields[] = $parent;
1876 1876
             $else_where_fields[] = $parent;
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940 1940
         //$terms = get_terms( $taxonomy );
1941 1941
 
1942
-        if($terms) {
1942
+        if ($terms) {
1943 1943
             foreach ($terms as $term) {
1944 1944
                 $post_type = str_replace("category", "", $term->taxonomy);
1945 1945
                 $a_terms[$post_type][] = $term;
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
             }
1948 1948
         }
1949 1949
 
1950
-        if($a_terms) {
1950
+        if ($a_terms) {
1951 1951
             foreach ($a_terms as $pt => $t2) {
1952 1952
 
1953 1953
                 foreach ($t2 as $term) {
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
     }
1973 1973
 
1974 1974
     if (is_ssl()) {
1975
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1975
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
1976 1976
     }
1977 1977
 
1978 1978
     return $terms_icons;
Please login to merge, or discard this patch.
Indentation   +1161 added lines, -1161 removed lines patch added patch discarded remove patch
@@ -33,257 +33,257 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name)) . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul>
148
+			$items .= '	</ul>
149 149
 				</li>';
150
-        }
151
-    }
152
-
153
-    if (get_option('geodir_show_addlisting_nav')) {
154
-
155
-        $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
158
-
159
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160
-        $post_types = geodir_get_posttypes('object');
161
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
162
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
163
-
164
-        if (!empty($post_types)) {
165
-            foreach ($post_types as $post_type => $args) {
166
-                if (!empty($geodir_allow_posttype_frontend)) {
167
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
168
-                        if (!empty($show_add_listing_post_types_main_nav)) {
169
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
170
-                                if (geodir_get_addlisting_link($post_type)) {
171
-
172
-                                    $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
175
-                                    /**
176
-                                     * Filter the menu li class.
177
-                                     *
178
-                                     * @since 1.0.0
179
-                                     * @param string $menu_class The menu HTML class.
180
-                                     */
181
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
182
-                                    /**
183
-                                     * Filter the menu a class.
184
-                                     *
185
-                                     * @since 1.0.0
186
-                                     */
187
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
188
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
189
-                                    $items .= '<li class="' . $li_class . '">
150
+		}
151
+	}
152
+
153
+	if (get_option('geodir_show_addlisting_nav')) {
154
+
155
+		$menu_class = '';
156
+		if (geodir_is_page('add-listing'))
157
+			$menu_class = 'current-menu-item';
158
+
159
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160
+		$post_types = geodir_get_posttypes('object');
161
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
162
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
163
+
164
+		if (!empty($post_types)) {
165
+			foreach ($post_types as $post_type => $args) {
166
+				if (!empty($geodir_allow_posttype_frontend)) {
167
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
168
+						if (!empty($show_add_listing_post_types_main_nav)) {
169
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
170
+								if (geodir_get_addlisting_link($post_type)) {
171
+
172
+									$menu_class = '';
173
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
+										$menu_class = 'current-menu-item';
175
+									/**
176
+									 * Filter the menu li class.
177
+									 *
178
+									 * @since 1.0.0
179
+									 * @param string $menu_class The menu HTML class.
180
+									 */
181
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
182
+									/**
183
+									 * Filter the menu a class.
184
+									 *
185
+									 * @since 1.0.0
186
+									 */
187
+									$a_class = apply_filters('geodir_menu_a_class', '');
188
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
189
+									$items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191 191
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
192 192
 											</a>
193 193
 										</li>';
194
-                                }
195
-                            }
196
-                        }
197
-                    }
198
-                }
199
-            }
200
-        }
201
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
202
-    }
203
-
204
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
205
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
206
-    if ($is_add_listing_sub_meny_exists) {
207
-
208
-        if (get_option('geodir_show_addlisting_nav')) {
209
-            /**
210
-             * Filter the menu li class.
211
-             *
212
-             * @since 1.0.0
213
-             * @param string $menu_class The menu HTML class.
214
-             */
215
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
216
-            /**
217
-             * Filter the sub menu li class.
218
-             *
219
-             * @since 1.0.0
220
-             * @param string $menu_class The menu HTML class.
221
-             */
222
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
223
-            /**
224
-             * Filter the sub menu ul class.
225
-             *
226
-             * @since 1.0.0
227
-             */
228
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
229
-            /**
230
-             * Filter the menu a class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $a_class = apply_filters('geodir_menu_a_class', '');
235
-            /**
236
-             * Filter the sub menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
241
-            $items .= '<li  class="' . $li_class . '">
194
+								}
195
+							}
196
+						}
197
+					}
198
+				}
199
+			}
200
+		}
201
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
202
+	}
203
+
204
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
205
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
206
+	if ($is_add_listing_sub_meny_exists) {
207
+
208
+		if (get_option('geodir_show_addlisting_nav')) {
209
+			/**
210
+			 * Filter the menu li class.
211
+			 *
212
+			 * @since 1.0.0
213
+			 * @param string $menu_class The menu HTML class.
214
+			 */
215
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
216
+			/**
217
+			 * Filter the sub menu li class.
218
+			 *
219
+			 * @since 1.0.0
220
+			 * @param string $menu_class The menu HTML class.
221
+			 */
222
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
223
+			/**
224
+			 * Filter the sub menu ul class.
225
+			 *
226
+			 * @since 1.0.0
227
+			 */
228
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
229
+			/**
230
+			 * Filter the menu a class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$a_class = apply_filters('geodir_menu_a_class', '');
235
+			/**
236
+			 * Filter the sub menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
241
+			$items .= '<li  class="' . $li_class . '">
242 242
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
243 243
 					<ul class="' . $sub_ul_class . '">';
244 244
 
245
-            $post_types = geodir_get_posttypes('object');
246
-
247
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
248
-
249
-            if (!empty($post_types)) {
250
-                foreach ($post_types as $post_type => $args) {
251
-                    if (!empty($geodir_allow_posttype_frontend)) {
252
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
253
-                            if (!empty($show_add_listing_post_types)) {
254
-                                if (in_array($post_type, $show_add_listing_post_types)) {
255
-                                    if (geodir_get_addlisting_link($post_type)) {
256
-
257
-                                        $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
260
-                                        /**
261
-                                         * Filter the menu li class.
262
-                                         *
263
-                                         * @since 1.0.0
264
-                                         * @param string $menu_class The menu HTML class.
265
-                                         */
266
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
267
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
268
-                                        $items .= '<li class="' . $li_class . '">
245
+			$post_types = geodir_get_posttypes('object');
246
+
247
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
248
+
249
+			if (!empty($post_types)) {
250
+				foreach ($post_types as $post_type => $args) {
251
+					if (!empty($geodir_allow_posttype_frontend)) {
252
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
253
+							if (!empty($show_add_listing_post_types)) {
254
+								if (in_array($post_type, $show_add_listing_post_types)) {
255
+									if (geodir_get_addlisting_link($post_type)) {
256
+
257
+										$menu_class = '';
258
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
+											$menu_class = 'current-menu-item';
260
+										/**
261
+										 * Filter the menu li class.
262
+										 *
263
+										 * @since 1.0.0
264
+										 * @param string $menu_class The menu HTML class.
265
+										 */
266
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
267
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
268
+										$items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270 270
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
271 271
 														</a>
272 272
 													</li>';
273
-                                    }
274
-                                }
275
-                            }
276
-                        }
277
-                    }
278
-                }
279
-            }
273
+									}
274
+								}
275
+							}
276
+						}
277
+					}
278
+				}
279
+			}
280 280
 
281
-            $items .= '	</ul>
281
+			$items .= '	</ul>
282 282
 				</li>';
283
-        }
284
-    }
285
-    // apply filter to add more navigations // -Filter-Location-Manager
286
-    return $items;
283
+		}
284
+	}
285
+	// apply filter to add more navigations // -Filter-Location-Manager
286
+	return $items;
287 287
 }
288 288
 
289 289
 
@@ -301,20 +301,20 @@  discard block
 block discarded – undo
301 301
  */
302 302
 function geodir_pagemenu_items($menu, $args)
303 303
 {
304
-    $locations = get_nav_menu_locations();
305
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
306
-    $geodir_theme_location_nav = array();
307
-    if (empty($locations) && empty($geodir_theme_location)) {
308
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
309
-        $geodir_theme_location_nav[] = $args['theme_location'];
310
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
311
-    }
312
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
304
+	$locations = get_nav_menu_locations();
305
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
306
+	$geodir_theme_location_nav = array();
307
+	if (empty($locations) && empty($geodir_theme_location)) {
308
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
309
+		$geodir_theme_location_nav[] = $args['theme_location'];
310
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
311
+	}
312
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 313
 //		$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);
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);
316 316
 
317
-    return $menu;
317
+	return $menu;
318 318
 
319 319
 }
320 320
 
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
 function geodir_menu_items($items, $args)
335 335
 {
336 336
 
337
-    $location = $args->theme_location;
337
+	$location = $args->theme_location;
338 338
 
339
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
339
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
340 340
 
341
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
341
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
342 342
 
343
-        $items = $items . geodir_add_nav_menu_items();
344
-        return $items;
343
+		$items = $items . geodir_add_nav_menu_items();
344
+		return $items;
345 345
 
346
-    } else {
347
-        return $items;
348
-    }
346
+	} else {
347
+		return $items;
348
+	}
349 349
 }
350 350
 
351 351
 /**
@@ -360,25 +360,25 @@  discard block
 block discarded – undo
360 360
  */
361 361
 function geodir_get_category_all_array()
362 362
 {
363
-    global $wpdb;
364
-    $return_array = array();
365
-
366
-    $taxonomies = geodir_get_taxonomies();
367
-    $taxonomies = implode("','", $taxonomies);
368
-    $taxonomies = "'" . $taxonomies . "'";
369
-
370
-    $pn_categories = $wpdb->get_results(
371
-        $wpdb->prepare(
372
-            "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",
373
-            array($wpdb->terms . term_id)
374
-        )
375
-    );
376
-
377
-    foreach ($pn_categories as $pn_categories_obj) {
378
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
379
-            "title" => $pn_categories_obj->name,);
380
-    }
381
-    return $return_array;
363
+	global $wpdb;
364
+	$return_array = array();
365
+
366
+	$taxonomies = geodir_get_taxonomies();
367
+	$taxonomies = implode("','", $taxonomies);
368
+	$taxonomies = "'" . $taxonomies . "'";
369
+
370
+	$pn_categories = $wpdb->get_results(
371
+		$wpdb->prepare(
372
+			"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",
373
+			array($wpdb->terms . term_id)
374
+		)
375
+	);
376
+
377
+	foreach ($pn_categories as $pn_categories_obj) {
378
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
379
+			"title" => $pn_categories_obj->name,);
380
+	}
381
+	return $return_array;
382 382
 }
383 383
 
384 384
 
@@ -393,32 +393,32 @@  discard block
 block discarded – undo
393 393
  */
394 394
 function geodir_get_current_posttype()
395 395
 {
396
-    global $wp_query, $geodir_post_type;
396
+	global $wp_query, $geodir_post_type;
397 397
 
398
-    $geodir_post_type = get_query_var('post_type');
398
+	$geodir_post_type = get_query_var('post_type');
399 399
 
400
-    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']);
405
-    }
400
+	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']);
405
+	}
406 406
 
407
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
407
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
408
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
409 409
 
410
-    if (is_tax())
411
-        $geodir_post_type = geodir_get_taxonomy_posttype();
410
+	if (is_tax())
411
+		$geodir_post_type = geodir_get_taxonomy_posttype();
412 412
 
413 413
 
414
-    $all_postypes = geodir_get_posttypes();
415
-    $all_postypes = stripslashes_deep($all_postypes);
414
+	$all_postypes = geodir_get_posttypes();
415
+	$all_postypes = stripslashes_deep($all_postypes);
416 416
 
417
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
-        $geodir_post_type = '';
417
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
418
+		$geodir_post_type = '';
419 419
 
420 420
 
421
-    return $geodir_post_type;
421
+	return $geodir_post_type;
422 422
 }
423 423
 
424 424
 /**
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function geodir_get_posttypes($output = 'names')
434 434
 {
435
-    $post_types = array();
436
-    $post_types = get_option('geodir_post_types');
437
-    $post_types = stripslashes_deep($post_types);
438
-    if (!empty($post_types)) {
439
-        switch ($output):
440
-            case 'object':
441
-            case 'Object':
442
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
443
-                break;
444
-            case 'array':
445
-            case 'Array':
446
-                $post_types = (array)$post_types;
447
-                break;
435
+	$post_types = array();
436
+	$post_types = get_option('geodir_post_types');
437
+	$post_types = stripslashes_deep($post_types);
438
+	if (!empty($post_types)) {
439
+		switch ($output):
440
+			case 'object':
441
+			case 'Object':
442
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
443
+				break;
444
+			case 'array':
445
+			case 'Array':
446
+				$post_types = (array)$post_types;
447
+				break;
448 448
 			case 'options':
449
-                $post_types = (array)$post_types;
449
+				$post_types = (array)$post_types;
450 450
 				
451 451
 				$options = array();
452 452
 				if (!empty($post_types)) {
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
 					}
456 456
 				}
457 457
 				$post_types = $options;
458
-                break;
459
-            default:
460
-                $post_types = array_keys($post_types);
461
-                break;
462
-        endswitch;
463
-    }
464
-
465
-    if (!empty($post_types))
466
-        return $post_types;
467
-    else
468
-        return array();
458
+				break;
459
+			default:
460
+				$post_types = array_keys($post_types);
461
+				break;
462
+		endswitch;
463
+	}
464
+
465
+	if (!empty($post_types))
466
+		return $post_types;
467
+	else
468
+		return array();
469 469
 }
470 470
 
471 471
 /**
@@ -478,108 +478,108 @@  discard block
 block discarded – undo
478 478
  */
479 479
 function geodir_get_posttype_info($post_type = '')
480 480
 {
481
-    $post_types = array();
482
-    $post_types = get_option('geodir_post_types');
483
-    $post_types = stripslashes_deep($post_types);
484
-    if (!empty($post_types) && $post_type != '') {
485
-        return $post_types[$post_type];
486
-    } else
487
-        return false;
481
+	$post_types = array();
482
+	$post_types = get_option('geodir_post_types');
483
+	$post_types = stripslashes_deep($post_types);
484
+	if (!empty($post_types) && $post_type != '') {
485
+		return $post_types[$post_type];
486
+	} else
487
+		return false;
488 488
 }
489 489
 
490 490
 if (!function_exists('geodir_get_taxonomies')) {
491
-    /**
492
-     * Get all custom taxonomies.
493
-     *
494
-     * @since 1.0.0
495
-     * @package GeoDirectory
496
-     * @param string $post_type The post type.
497
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
498
-     * @return array|bool Taxonomies on success. false on failure.
499
-     */
500
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
501
-    {
491
+	/**
492
+	 * Get all custom taxonomies.
493
+	 *
494
+	 * @since 1.0.0
495
+	 * @package GeoDirectory
496
+	 * @param string $post_type The post type.
497
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
498
+	 * @return array|bool Taxonomies on success. false on failure.
499
+	 */
500
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
501
+	{
502 502
 
503
-        $taxonomies = array();
504
-        $gd_taxonomies = array();
503
+		$taxonomies = array();
504
+		$gd_taxonomies = array();
505 505
 
506
-        if ($taxonomies = get_option('geodir_taxonomies')) {
506
+		if ($taxonomies = get_option('geodir_taxonomies')) {
507 507
 
508 508
 
509
-            $gd_taxonomies = array_keys($taxonomies);
509
+			$gd_taxonomies = array_keys($taxonomies);
510 510
 
511 511
 
512
-            if ($post_type != '')
513
-                $gd_taxonomies = array();
512
+			if ($post_type != '')
513
+				$gd_taxonomies = array();
514 514
 
515
-            $i = 0;
516
-            foreach ($taxonomies as $taxonomy => $args) {
515
+			$i = 0;
516
+			foreach ($taxonomies as $taxonomy => $args) {
517 517
 
518
-                if ($post_type != '' && $args['object_type'] == $post_type)
519
-                    $gd_taxonomies[] = $taxonomy;
518
+				if ($post_type != '' && $args['object_type'] == $post_type)
519
+					$gd_taxonomies[] = $taxonomy;
520 520
 
521
-                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)]);
524
-                }
521
+				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)]);
524
+				}
525 525
 
526
-            }
526
+			}
527 527
 
528
-            $gd_taxonomies = array_values($gd_taxonomies);
529
-        }
530
-
531
-        /**
532
-         * Filter the taxonomies.
533
-         *
534
-         * @since 1.0.0
535
-         * @param array $gd_taxonomies The taxonomy array.
536
-         */
537
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
538
-
539
-        if (!empty($taxonomies)) {
540
-            return $taxonomies;
541
-        } else {
542
-            return false;
543
-        }
544
-    }
528
+			$gd_taxonomies = array_values($gd_taxonomies);
529
+		}
530
+
531
+		/**
532
+		 * Filter the taxonomies.
533
+		 *
534
+		 * @since 1.0.0
535
+		 * @param array $gd_taxonomies The taxonomy array.
536
+		 */
537
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
538
+
539
+		if (!empty($taxonomies)) {
540
+			return $taxonomies;
541
+		} else {
542
+			return false;
543
+		}
544
+	}
545 545
 }
546 546
 
547 547
 if (!function_exists(' geodir_get_categories_dl')) {
548
-    /**
549
-     * Get categories dropdown HTML.
550
-     *
551
-     * @since 1.0.0
552
-     * @package GeoDirectory
553
-     * @param string $post_type The post type.
554
-     * @param string $selected The selected value.
555
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
556
-     * @param bool $echo Prints the HTML when set to true. Default: true.
557
-     * @return void|string Dropdown HTML.
558
-     */
559
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
560
-    {
561
-
562
-        $html = '';
563
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
564
-
565
-        $categories = get_terms($taxonomies);
566
-
567
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
568
-
569
-        foreach ($categories as $category_obj) {
570
-            $select_opt = '';
571
-            if ($selected == $category_obj->term_id) {
572
-                $select_opt = 'selected="selected"';
573
-            }
574
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
575
-                . ucfirst($category_obj->name) . '</option>';
576
-        }
577
-
578
-        if ($echo)
579
-            echo $html;
580
-        else
581
-            return $html;
582
-    }
548
+	/**
549
+	 * Get categories dropdown HTML.
550
+	 *
551
+	 * @since 1.0.0
552
+	 * @package GeoDirectory
553
+	 * @param string $post_type The post type.
554
+	 * @param string $selected The selected value.
555
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
556
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
557
+	 * @return void|string Dropdown HTML.
558
+	 */
559
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
560
+	{
561
+
562
+		$html = '';
563
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
564
+
565
+		$categories = get_terms($taxonomies);
566
+
567
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
568
+
569
+		foreach ($categories as $category_obj) {
570
+			$select_opt = '';
571
+			if ($selected == $category_obj->term_id) {
572
+				$select_opt = 'selected="selected"';
573
+			}
574
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
575
+				. ucfirst($category_obj->name) . '</option>';
576
+		}
577
+
578
+		if ($echo)
579
+			echo $html;
580
+		else
581
+			return $html;
582
+	}
583 583
 }
584 584
 
585 585
 
@@ -594,28 +594,28 @@  discard block
 block discarded – undo
594 594
 function geodir_get_listing_slug($object_type = '')
595 595
 {
596 596
 
597
-    $listing_slug = '';
597
+	$listing_slug = '';
598 598
 
599
-    $post_types = get_option('geodir_post_types');
600
-    $taxonomies = get_option('geodir_taxonomies');
599
+	$post_types = get_option('geodir_post_types');
600
+	$taxonomies = get_option('geodir_taxonomies');
601 601
 
602 602
 
603
-    if ($object_type != '') {
604
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
603
+	if ($object_type != '') {
604
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
605 605
 
606
-            $object_info = $post_types[$object_type];
607
-            $listing_slug = $object_info['listing_slug'];
608
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
609
-            $object_info = $taxonomies[$object_type];
610
-            $listing_slug = $object_info['listing_slug'];
611
-        }
606
+			$object_info = $post_types[$object_type];
607
+			$listing_slug = $object_info['listing_slug'];
608
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
609
+			$object_info = $taxonomies[$object_type];
610
+			$listing_slug = $object_info['listing_slug'];
611
+		}
612 612
 
613
-    }
613
+	}
614 614
 
615
-    if (!empty($listing_slug))
616
-        return $listing_slug;
617
-    else
618
-        return false;
615
+	if (!empty($listing_slug))
616
+		return $listing_slug;
617
+	else
618
+		return false;
619 619
 }
620 620
 
621 621
 
@@ -630,212 +630,212 @@  discard block
 block discarded – undo
630 630
  */
631 631
 function geodir_get_taxonomy_posttype($taxonomy = '')
632 632
 {
633
-    global $wp_query;
634
-
635
-    $post_type = array();
636
-    $taxonomies = array();
637
-
638
-    if (!empty($taxonomy)) {
639
-        $taxonomies[] = $taxonomy;
640
-    } elseif (isset($wp_query->tax_query->queries)) {
641
-        $tax_arr = $wp_query->tax_query->queries;
642
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
644
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645
-    }
646
-
647
-    if (!empty($taxonomies)) {
648
-        foreach (geodir_get_posttypes() as $pt) {
649
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
-            if (array_intersect($taxonomies, $object_taxonomies))
651
-                $post_type[] = $pt;
652
-        }
653
-    }
654
-
655
-    if (!empty($post_type))
656
-        return $post_type[0];
657
-    else
658
-        return false;
633
+	global $wp_query;
634
+
635
+	$post_type = array();
636
+	$taxonomies = array();
637
+
638
+	if (!empty($taxonomy)) {
639
+		$taxonomies[] = $taxonomy;
640
+	} elseif (isset($wp_query->tax_query->queries)) {
641
+		$tax_arr = $wp_query->tax_query->queries;
642
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
643
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
644
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
645
+	}
646
+
647
+	if (!empty($taxonomies)) {
648
+		foreach (geodir_get_posttypes() as $pt) {
649
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
650
+			if (array_intersect($taxonomies, $object_taxonomies))
651
+				$post_type[] = $pt;
652
+		}
653
+	}
654
+
655
+	if (!empty($post_type))
656
+		return $post_type[0];
657
+	else
658
+		return false;
659 659
 }
660 660
 
661 661
 if (!function_exists('geodir_custom_taxonomy_walker')) {
662
-    /**
663
-     * Custom taxonomy walker function.
664
-     *
665
-     * @since 1.0.0
666
-     * @package GeoDirectory
667
-     * @param string $cat_taxonomy The taxonomy name.
668
-     * @param int $cat_parent The parent term ID.
669
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
670
-     * @param int $pading CSS padding in pixels.
671
-     * @return string|void taxonomy HTML.
672
-     */
673
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
674
-    {
675
-        global $cat_display, $post_cat, $exclude_cats;
676
-
677
-        $search_terms = trim($post_cat, ",");
678
-
679
-        $search_terms = explode(",", $search_terms);
680
-
681
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
682
-
683
-        $display = '';
684
-        $onchange = '';
685
-        $term_check = '';
686
-        $main_list_class = '';
687
-        $out = '';
688
-        //If there are terms, start displaying
689
-        if (count($cat_terms) > 0) {
690
-            //Displaying as a list
691
-            $p = $pading * 20;
692
-            $pading++;
693
-
694
-
695
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
696
-                if ($cat_parent == 0) {
697
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
698
-                    $main_list_class = 'class="main_list_selecter"';
699
-                } else {
700
-                    //$display = 'display:none';
701
-                    $list_class = 'sub_list gd-sub-cats-list';
702
-                }
703
-            }
662
+	/**
663
+	 * Custom taxonomy walker function.
664
+	 *
665
+	 * @since 1.0.0
666
+	 * @package GeoDirectory
667
+	 * @param string $cat_taxonomy The taxonomy name.
668
+	 * @param int $cat_parent The parent term ID.
669
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
670
+	 * @param int $pading CSS padding in pixels.
671
+	 * @return string|void taxonomy HTML.
672
+	 */
673
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
674
+	{
675
+		global $cat_display, $post_cat, $exclude_cats;
676
+
677
+		$search_terms = trim($post_cat, ",");
678
+
679
+		$search_terms = explode(",", $search_terms);
680
+
681
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
682
+
683
+		$display = '';
684
+		$onchange = '';
685
+		$term_check = '';
686
+		$main_list_class = '';
687
+		$out = '';
688
+		//If there are terms, start displaying
689
+		if (count($cat_terms) > 0) {
690
+			//Displaying as a list
691
+			$p = $pading * 20;
692
+			$pading++;
693
+
694
+
695
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
696
+				if ($cat_parent == 0) {
697
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
698
+					$main_list_class = 'class="main_list_selecter"';
699
+				} else {
700
+					//$display = 'display:none';
701
+					$list_class = 'sub_list gd-sub-cats-list';
702
+				}
703
+			}
704 704
 
705
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
706
-                $p = 0;
707
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
708
-            }
705
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
706
+				$p = 0;
707
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
708
+			}
709 709
 
710
-            foreach ($cat_terms as $cat_term) {
710
+			foreach ($cat_terms as $cat_term) {
711 711
 
712
-                $checked = '';
712
+				$checked = '';
713 713
 
714
-                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"';
719
-                }
714
+				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"';
719
+				}
720 720
 
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>';
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 725
 
726
-                else {
727
-                    $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
-                }
726
+				else {
727
+					$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
+				}
729 729
 
730
-                // Call recurson to print sub cats
731
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
730
+				// Call recurson to print sub cats
731
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
732 732
 
733
-            }
733
+			}
734 734
 
735
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
-                $out .= '</div>';
735
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
736
+				$out .= '</div>';
737 737
 
738
-            return $out;
739
-        }
740
-        return;
741
-    }
738
+			return $out;
739
+		}
740
+		return;
741
+	}
742 742
 }
743 743
 
744 744
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
745
-    /**
746
-     * Custom taxonomy walker function.
747
-     *
748
-     * @since 1.0.0
749
-     * @package GeoDirectory
750
-     * @global object $post WordPress Post object.
751
-     * @global object $gd_session GeoDirectory Session object.
752
-     * @param string $cat_taxonomy The taxonomy name.
753
-     * @param string $cat_limit Number of categories to display.
754
-     */
755
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
756
-    {
757
-        $post_category = '';
758
-        $post_category_str = '';
759
-        global $exclude_cats, $gd_session;
760
-
761
-        $cat_exclude = '';
762
-        if (is_array($exclude_cats) && !empty($exclude_cats))
763
-            $cat_exclude = serialize($exclude_cats);
764
-
765
-        if (isset($_REQUEST['backandedit'])) {
766
-            $post = (object)$gd_session->get('listing');
767
-
768
-            if (!is_array($post->post_category[$cat_taxonomy]))
769
-                $post_category = $post->post_category[$cat_taxonomy];
770
-
771
-            $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];
774
-
775
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776
-            global $post;
777
-
778
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
779
-            if (empty($post_category) && isset($post->$cat_taxonomy)) {
780
-                $post_category = $post->$cat_taxonomy;
781
-            }
745
+	/**
746
+	 * Custom taxonomy walker function.
747
+	 *
748
+	 * @since 1.0.0
749
+	 * @package GeoDirectory
750
+	 * @global object $post WordPress Post object.
751
+	 * @global object $gd_session GeoDirectory Session object.
752
+	 * @param string $cat_taxonomy The taxonomy name.
753
+	 * @param string $cat_limit Number of categories to display.
754
+	 */
755
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
756
+	{
757
+		$post_category = '';
758
+		$post_category_str = '';
759
+		global $exclude_cats, $gd_session;
760
+
761
+		$cat_exclude = '';
762
+		if (is_array($exclude_cats) && !empty($exclude_cats))
763
+			$cat_exclude = serialize($exclude_cats);
764
+
765
+		if (isset($_REQUEST['backandedit'])) {
766
+			$post = (object)$gd_session->get('listing');
767
+
768
+			if (!is_array($post->post_category[$cat_taxonomy]))
769
+				$post_category = $post->post_category[$cat_taxonomy];
770
+
771
+			$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];
774
+
775
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
776
+			global $post;
777
+
778
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
779
+			if (empty($post_category) && isset($post->$cat_taxonomy)) {
780
+				$post_category = $post->$cat_taxonomy;
781
+			}
782 782
 
783
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
783
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
784 784
 
785
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
786
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
787
-                    if (is_numeric($cat_part)) {
788
-                        $cat_part_arr[] = $cat_part;
789
-                    }
790
-                }
791
-                if (is_array($cat_part_arr)) {
792
-                    $post_category = implode(',', $cat_part_arr);
793
-                }
794
-            }
785
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
786
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
787
+					if (is_numeric($cat_part)) {
788
+						$cat_part_arr[] = $cat_part;
789
+					}
790
+				}
791
+				if (is_array($cat_part_arr)) {
792
+					$post_category = implode(',', $cat_part_arr);
793
+				}
794
+			}
795 795
 
796
-            if (!empty($post_category)) {
797
-                $cat1 = array_filter(explode(',', $post_category));
798
-                $post_category = ',' . implode(',', $cat1) . ',';
796
+			if (!empty($post_category)) {
797
+				$cat1 = array_filter(explode(',', $post_category));
798
+				$post_category = ',' . implode(',', $cat1) . ',';
799 799
 
800
-            }
800
+			}
801 801
 
802
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
802
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
803 803
 
804
-                $post_category_upd = explode(',', $post_category);
805
-                $post_category_change = '';
806
-                foreach ($post_category_upd as $cat) {
804
+				$post_category_upd = explode(',', $post_category);
805
+				$post_category_change = '';
806
+				foreach ($post_category_upd as $cat) {
807 807
 
808
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
809
-                        $post_category_change .= ',' . $cat;
810
-                    }
811
-                }
812
-                $post_category = $post_category_change;
813
-            }
808
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
809
+						$post_category_change .= ',' . $cat;
810
+					}
811
+				}
812
+				$post_category = $post_category_change;
813
+			}
814 814
 
815 815
 
816
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
817
-                $post_category_str = $post_categories[$cat_taxonomy];
818
-            }
819
-        }
816
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
817
+				$post_category_str = $post_categories[$cat_taxonomy];
818
+			}
819
+		}
820 820
 
821
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
821
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
822 822
 
823
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
823
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
824 824
 
825
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
825
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
826 826
 
827 827
 
828
-        ?>
828
+		?>
829 829
         <div class="cat_sublist">
830 830
             <?php
831 831
 
832
-            $post_id = isset($post->ID) ? $post->ID : '';
832
+			$post_id = isset($post->ID) ? $post->ID : '';
833 833
 
834
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
834
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
835 835
 
836
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
837
-            }
838
-            ?>
836
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
837
+			}
838
+			?>
839 839
         </div>
840 840
         <script type="text/javascript">
841 841
 
@@ -958,22 +958,22 @@  discard block
 block discarded – undo
958 958
 
959 959
         </script>
960 960
         <?php
961
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962
-            $post_cat_str = $post_categories[$cat_taxonomy];
963
-            $post_cat_array = explode("#", $post_cat_str);
964
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
-                $style = "display:none;";
966
-        }
967
-        ?>
961
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
962
+			$post_cat_str = $post_categories[$cat_taxonomy];
963
+			$post_cat_array = explode("#", $post_cat_str);
964
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
965
+				$style = "display:none;";
966
+		}
967
+		?>
968 968
         <div class="main_cat_list" style=" <?php if (isset($style)) {
969
-            echo $style;
970
-        }?> ">
969
+			echo $style;
970
+		}?> ">
971 971
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
972
-            ?>
972
+			?>
973 973
         </div>
974 974
     <?php
975 975
 
976
-    }
976
+	}
977 977
 }
978 978
 
979 979
 /**
@@ -990,23 +990,23 @@  discard block
 block discarded – undo
990 990
  */
991 991
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
992 992
 {
993
-    global $exclude_cats;
993
+	global $exclude_cats;
994 994
 
995
-    if ($exclude != '') {
996
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
995
+	if ($exclude != '') {
996
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
997 997
 
998
-        if(is_array( $exclude_cats)){
999
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1000
-        }else{
1001
-            $exclude_cats = intval($exclude_cats);
1002
-        }
998
+		if(is_array( $exclude_cats)){
999
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1000
+		}else{
1001
+			$exclude_cats = intval($exclude_cats);
1002
+		}
1003 1003
 
1004
-    }
1004
+	}
1005 1005
 
1006
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1007
-        (!is_array($exclude_cats) || empty($exclude_cats))
1008
-    ) {
1009
-        ?>
1006
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1007
+		(!is_array($exclude_cats) || empty($exclude_cats))
1008
+	) {
1009
+		?>
1010 1010
 
1011 1011
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1012 1012
 
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
             <br/>
1037 1037
             <?php
1038
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1039
-            if (!empty($cat_terms)) { ?>
1038
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1039
+			if (!empty($cat_terms)) { ?>
1040 1040
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1041 1041
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1042 1042
             <?php } ?>
@@ -1058,53 +1058,53 @@  discard block
 block discarded – undo
1058 1058
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1059 1059
 {
1060 1060
 
1061
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1062
-        $post_cat_str = $post_categories[$request_taxonomy];
1063
-        $post_cat_array = explode("#", $post_cat_str);
1064
-        if (is_array($post_cat_array)) {
1065
-            $post_cat_array = array_unique( $post_cat_array );
1061
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1062
+		$post_cat_str = $post_categories[$request_taxonomy];
1063
+		$post_cat_array = explode("#", $post_cat_str);
1064
+		if (is_array($post_cat_array)) {
1065
+			$post_cat_array = array_unique( $post_cat_array );
1066 1066
 
1067 1067
 			foreach ($post_cat_array as $post_cat_html) {
1068 1068
 
1069
-                $post_cat_info = explode(":", $post_cat_html);
1070
-                $post_maincat_str = $post_cat_info[0];
1069
+				$post_cat_info = explode(":", $post_cat_html);
1070
+				$post_maincat_str = $post_cat_info[0];
1071 1071
 
1072
-                if (!empty($post_maincat_str)) {
1073
-                    $post_maincat_info = explode(",", $post_maincat_str);
1074
-                    $post_maincat_id = $post_maincat_info[0];
1075
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1076
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1077
-                }
1078
-                $post_sub_catid = '';
1079
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
-                    $post_sub_catid = (int)$post_cat_info[1];
1081
-                }
1072
+				if (!empty($post_maincat_str)) {
1073
+					$post_maincat_info = explode(",", $post_maincat_str);
1074
+					$post_maincat_id = $post_maincat_info[0];
1075
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1076
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1077
+				}
1078
+				$post_sub_catid = '';
1079
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1080
+					$post_sub_catid = (int)$post_cat_info[1];
1081
+				}
1082 1082
 
1083
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1083
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1084 1084
 
1085
-            }
1086
-        } else {
1085
+			}
1086
+		} else {
1087 1087
 
1088
-            $post_cat_info = explode(":", $post_cat_str);
1089
-            $post_maincat_str = $post_cat_info[0];
1088
+			$post_cat_info = explode(":", $post_cat_str);
1089
+			$post_maincat_str = $post_cat_info[0];
1090 1090
 
1091
-            $post_sub_catid = '';
1091
+			$post_sub_catid = '';
1092 1092
 
1093
-            if (!empty($post_maincat_str)) {
1094
-                $post_maincat_info = explode(",", $post_maincat_str);
1095
-                $post_maincat_id = $post_maincat_info[0];
1096
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1097
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1098
-            }
1093
+			if (!empty($post_maincat_str)) {
1094
+				$post_maincat_info = explode(",", $post_maincat_str);
1095
+				$post_maincat_id = $post_maincat_info[0];
1096
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1097
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1098
+			}
1099 1099
 
1100
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
-                $post_sub_catid = (int)$post_cat_info[1];
1102
-            }
1100
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1101
+				$post_sub_catid = (int)$post_cat_info[1];
1102
+			}
1103 1103
 
1104
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1104
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1105 1105
 
1106
-        }
1107
-    }
1106
+		}
1107
+	}
1108 1108
 }
1109 1109
 
1110 1110
 /**
@@ -1118,35 +1118,35 @@  discard block
 block discarded – undo
1118 1118
  */
1119 1119
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1120 1120
 {
1121
-    global $exclude_cats;
1121
+	global $exclude_cats;
1122 1122
 
1123
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1123
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1124 1124
 
1125
-    if (!empty($cat_terms)) {
1126
-        $onchange = '';
1127
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1125
+	if (!empty($cat_terms)) {
1126
+		$onchange = '';
1127
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1128 1128
 
1129
-        $option_selected = '';
1130
-        if (!$selected)
1131
-            $option_slected = ' selected="selected" ';
1129
+		$option_selected = '';
1130
+		if (!$selected)
1131
+			$option_slected = ' selected="selected" ';
1132 1132
 
1133
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1133
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1134 1134
 
1135
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1135
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1136 1136
 
1137
-        foreach ($cat_terms as $cat_term) {
1138
-            $option_selected = '';
1139
-            if ($selected == $cat_term->term_id)
1140
-                $option_selected = ' selected="selected" ';
1137
+		foreach ($cat_terms as $cat_term) {
1138
+			$option_selected = '';
1139
+			if ($selected == $cat_term->term_id)
1140
+				$option_selected = ' selected="selected" ';
1141 1141
 
1142
-            // Count child terms
1143
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1142
+			// Count child terms
1143
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1145 1145
 
1146
-            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>';
1147
-        }
1148
-        echo '</select>';
1149
-    }
1146
+			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>';
1147
+		}
1148
+		echo '</select>';
1149
+	}
1150 1150
 }
1151 1151
 
1152 1152
 /**
@@ -1162,28 +1162,28 @@  discard block
 block discarded – undo
1162 1162
  */
1163 1163
 function geodir_custom_update_messages($messages)
1164 1164
 {
1165
-    global $post, $post_ID;
1166
-
1167
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1168
-
1169
-    foreach ($post_types as $post_type => $post_object) {
1170
-
1171
-        $messages[$post_type] = array(
1172
-            0 => '', // Unused. Messages start at index 1.
1173
-            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),
1174
-            2 => __('Custom field updated.', 'geodirectory'),
1175
-            3 => __('Custom field deleted.', 'geodirectory'),
1176
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
-            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,
1178
-            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),
1179
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180
-            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),
1181
-            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),
1182
-            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),
1183
-        );
1184
-    }
1185
-
1186
-    return $messages;
1165
+	global $post, $post_ID;
1166
+
1167
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1168
+
1169
+	foreach ($post_types as $post_type => $post_object) {
1170
+
1171
+		$messages[$post_type] = array(
1172
+			0 => '', // Unused. Messages start at index 1.
1173
+			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),
1174
+			2 => __('Custom field updated.', 'geodirectory'),
1175
+			3 => __('Custom field deleted.', 'geodirectory'),
1176
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1177
+			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,
1178
+			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),
1179
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1180
+			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),
1181
+			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),
1182
+			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),
1183
+		);
1184
+	}
1185
+
1186
+	return $messages;
1187 1187
 }
1188 1188
 
1189 1189
 
@@ -1198,181 +1198,181 @@  discard block
 block discarded – undo
1198 1198
 function geodir_register_defaults()
1199 1199
 {
1200 1200
 
1201
-    global $wpdb;
1202
-
1203
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204
-
1205
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
-        $listing_slug = 'places';
1207
-
1208
-    /**
1209
-     * Taxonomies
1210
-     **/
1211
-    //if ( ! taxonomy_exists('gd_place_tags') )
1212
-    {
1213
-
1214
-        $gd_placetags = array();
1215
-        $gd_placetags['object_type'] = 'gd_place';
1216
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1217
-        $gd_placetags['args'] = array(
1218
-            'public' => true,
1219
-            'hierarchical' => false,
1220
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1221
-            'query_var' => true,
1222
-
1223
-            'labels' => array(
1224
-                'name' => __('Place Tags', 'geodirectory'),
1225
-                'singular_name' => __('Place Tag', 'geodirectory'),
1226
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1227
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1228
-                'all_items' => __('All Place Tags', 'geodirectory'),
1229
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1230
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1231
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1232
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1233
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1234
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1235
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1236
-            ),
1237
-        );
1238
-
1239
-
1240
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1241
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1242
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1243
-
1244
-
1245
-        // Update post types and delete tmp options
1246
-        flush_rewrite_rules();
1247
-
1248
-    }
1249
-
1250
-    //if ( ! taxonomy_exists('gd_placecategory') )
1251
-    {
1252
-
1253
-        $gd_placecategory = array();
1254
-        $gd_placecategory['object_type'] = 'gd_place';
1255
-        $gd_placecategory['listing_slug'] = $listing_slug;
1256
-        $gd_placecategory['args'] = array(
1257
-            'public' => true,
1258
-            'hierarchical' => true,
1259
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1260
-            'query_var' => true,
1261
-            'labels' => array(
1262
-                'name' => __('Place Categories', 'geodirectory'),
1263
-                'singular_name' => __('Place Category', 'geodirectory'),
1264
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1265
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1266
-                'all_items' => __('All Place Categories', 'geodirectory'),
1267
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1268
-                'update_item' => __('Update Place Category', 'geodirectory'),
1269
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1270
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1271
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1272
-            ),
1273
-        );
1274
-
1275
-
1276
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1277
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1278
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1279
-
1280
-
1281
-        flush_rewrite_rules();
1282
-    }
1283
-
1284
-    /**
1285
-     * Post Types
1286
-     **/
1287
-
1288
-    //if ( ! post_type_exists('gd_place') )
1289
-    {
1290
-
1291
-        $labels = array(
1292
-            'name' => __('Places', 'geodirectory'),
1293
-            'singular_name' => __('Place', 'geodirectory'),
1294
-            'add_new' => __('Add New', 'geodirectory'),
1295
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1296
-            'edit_item' => __('Edit Place', 'geodirectory'),
1297
-            'new_item' => __('New Place', 'geodirectory'),
1298
-            'view_item' => __('View Place', 'geodirectory'),
1299
-            'search_items' => __('Search Places', 'geodirectory'),
1300
-            'not_found' => __('No Place Found', 'geodirectory'),
1301
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1302
-
1303
-        $place_default = array(
1304
-            'labels' => $labels,
1305
-            'can_export' => true,
1306
-            'capability_type' => 'post',
1307
-            'description' => 'Place post type.',
1308
-            'has_archive' => $listing_slug,
1309
-            'hierarchical' => false,
1310
-            'map_meta_cap' => true,
1311
-            'menu_icon' => $menu_icon,
1312
-            'public' => true,
1313
-            'query_var' => true,
1314
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1315
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317
-
1318
-        //Update custom post types
1319
-        $geodir_post_types = get_option('geodir_post_types');
1320
-        $geodir_post_types['gd_place'] = $place_default;
1321
-        update_option('geodir_post_types', $geodir_post_types);
1322
-
1323
-        // Update post types and delete tmp options
1324
-        flush_rewrite_rules();
1325
-    }
1326
-
1327
-
1328
-    geodir_register_taxonomies();
1329
-    geodir_register_post_types();
1330
-
1331
-    //die;
1201
+	global $wpdb;
1202
+
1203
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1204
+
1205
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1206
+		$listing_slug = 'places';
1207
+
1208
+	/**
1209
+	 * Taxonomies
1210
+	 **/
1211
+	//if ( ! taxonomy_exists('gd_place_tags') )
1212
+	{
1213
+
1214
+		$gd_placetags = array();
1215
+		$gd_placetags['object_type'] = 'gd_place';
1216
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1217
+		$gd_placetags['args'] = array(
1218
+			'public' => true,
1219
+			'hierarchical' => false,
1220
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1221
+			'query_var' => true,
1222
+
1223
+			'labels' => array(
1224
+				'name' => __('Place Tags', 'geodirectory'),
1225
+				'singular_name' => __('Place Tag', 'geodirectory'),
1226
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1227
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1228
+				'all_items' => __('All Place Tags', 'geodirectory'),
1229
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1230
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1231
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1232
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1233
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1234
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1235
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1236
+			),
1237
+		);
1238
+
1239
+
1240
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1241
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1242
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1243
+
1244
+
1245
+		// Update post types and delete tmp options
1246
+		flush_rewrite_rules();
1247
+
1248
+	}
1249
+
1250
+	//if ( ! taxonomy_exists('gd_placecategory') )
1251
+	{
1252
+
1253
+		$gd_placecategory = array();
1254
+		$gd_placecategory['object_type'] = 'gd_place';
1255
+		$gd_placecategory['listing_slug'] = $listing_slug;
1256
+		$gd_placecategory['args'] = array(
1257
+			'public' => true,
1258
+			'hierarchical' => true,
1259
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1260
+			'query_var' => true,
1261
+			'labels' => array(
1262
+				'name' => __('Place Categories', 'geodirectory'),
1263
+				'singular_name' => __('Place Category', 'geodirectory'),
1264
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1265
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1266
+				'all_items' => __('All Place Categories', 'geodirectory'),
1267
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1268
+				'update_item' => __('Update Place Category', 'geodirectory'),
1269
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1270
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1271
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1272
+			),
1273
+		);
1274
+
1275
+
1276
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1277
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1278
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1279
+
1280
+
1281
+		flush_rewrite_rules();
1282
+	}
1283
+
1284
+	/**
1285
+	 * Post Types
1286
+	 **/
1287
+
1288
+	//if ( ! post_type_exists('gd_place') )
1289
+	{
1290
+
1291
+		$labels = array(
1292
+			'name' => __('Places', 'geodirectory'),
1293
+			'singular_name' => __('Place', 'geodirectory'),
1294
+			'add_new' => __('Add New', 'geodirectory'),
1295
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1296
+			'edit_item' => __('Edit Place', 'geodirectory'),
1297
+			'new_item' => __('New Place', 'geodirectory'),
1298
+			'view_item' => __('View Place', 'geodirectory'),
1299
+			'search_items' => __('Search Places', 'geodirectory'),
1300
+			'not_found' => __('No Place Found', 'geodirectory'),
1301
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1302
+
1303
+		$place_default = array(
1304
+			'labels' => $labels,
1305
+			'can_export' => true,
1306
+			'capability_type' => 'post',
1307
+			'description' => 'Place post type.',
1308
+			'has_archive' => $listing_slug,
1309
+			'hierarchical' => false,
1310
+			'map_meta_cap' => true,
1311
+			'menu_icon' => $menu_icon,
1312
+			'public' => true,
1313
+			'query_var' => true,
1314
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1315
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1316
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1317
+
1318
+		//Update custom post types
1319
+		$geodir_post_types = get_option('geodir_post_types');
1320
+		$geodir_post_types['gd_place'] = $place_default;
1321
+		update_option('geodir_post_types', $geodir_post_types);
1322
+
1323
+		// Update post types and delete tmp options
1324
+		flush_rewrite_rules();
1325
+	}
1326
+
1327
+
1328
+	geodir_register_taxonomies();
1329
+	geodir_register_post_types();
1330
+
1331
+	//die;
1332 1332
 
1333 1333
 }
1334 1334
 
1335 1335
 $gd_wpml_get_languages = "";
1336 1336
 function gd_wpml_get_lang_from_url($url){
1337 1337
 
1338
-    global $gd_wpml_get_languages;
1339
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1338
+	global $gd_wpml_get_languages;
1339
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1340 1340
 
1341 1341
 
1342
-    //
1343
-    $url = str_replace(array("http://","https://"),"",$url);
1344
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1342
+	//
1343
+	$url = str_replace(array("http://","https://"),"",$url);
1344
+	$site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1345 1345
 
1346
-    $url = str_replace($site_url,"",$url);
1346
+	$url = str_replace($site_url,"",$url);
1347 1347
 
1348 1348
 
1349
-    $segments = explode('/', trim($url, '/'));
1349
+	$segments = explode('/', trim($url, '/'));
1350 1350
 
1351
-    //print_r( $segments);
1352
-    if($gd_wpml_get_languages){
1353
-        $langs = $gd_wpml_get_languages;
1354
-    }else{
1355
-        global $sitepress;
1356
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1357
-    }
1351
+	//print_r( $segments);
1352
+	if($gd_wpml_get_languages){
1353
+		$langs = $gd_wpml_get_languages;
1354
+	}else{
1355
+		global $sitepress;
1356
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1357
+	}
1358 1358
 
1359
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1360
-        return $segments[0];
1361
-    }
1359
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1360
+		return $segments[0];
1361
+	}
1362 1362
 
1363
-    return false;
1363
+	return false;
1364 1364
 
1365 1365
 
1366 1366
 }
1367 1367
 
1368 1368
 function gd_wpml_slug_translation_turned_on($post_type) {
1369 1369
 
1370
-    global $sitepress;
1371
-    $settings = $sitepress->get_settings();
1372
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1373
-    && $settings['posts_slug_translation']['types'][$post_type]
1374
-    && isset($settings['posts_slug_translation']['on'])
1375
-    && $settings['posts_slug_translation']['on'];
1370
+	global $sitepress;
1371
+	$settings = $sitepress->get_settings();
1372
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1373
+	&& $settings['posts_slug_translation']['types'][$post_type]
1374
+	&& isset($settings['posts_slug_translation']['on'])
1375
+	&& $settings['posts_slug_translation']['on'];
1376 1376
 }
1377 1377
 
1378 1378
 
@@ -1395,142 +1395,142 @@  discard block
 block discarded – undo
1395 1395
  */
1396 1396
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1397 1397
 {
1398
-    //echo $post_link."<br />".$sample ;
1398
+	//echo $post_link."<br />".$sample ;
1399 1399
 
1400 1400
 
1401
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1402
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1403
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1404
-        return $post_link;
1405
-    } else {
1406
-        $orig_post = $post;
1407
-        $post = $post_obj;
1408
-    }
1401
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1402
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1403
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1404
+		return $post_link;
1405
+	} else {
1406
+		$orig_post = $post;
1407
+		$post = $post_obj;
1408
+	}
1409 1409
 
1410
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1410
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1411 1411
 
1412 1412
 
1413
-        $post_types = get_option('geodir_post_types');
1414
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1413
+		$post_types = get_option('geodir_post_types');
1414
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1415 1415
 
1416
-        // Alter the CPT slug if WPML is set to do so
1417
-        if(function_exists('icl_object_id')){
1418
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1416
+		// Alter the CPT slug if WPML is set to do so
1417
+		if(function_exists('icl_object_id')){
1418
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1419 1419
 
1420
-                $org_slug = $slug;
1421
-                $slug = apply_filters( 'wpml_translate_single_string',
1422
-                    $slug,
1423
-                    'WordPress',
1424
-                    'URL slug: ' . $slug,
1425
-                    $language_code);
1420
+				$org_slug = $slug;
1421
+				$slug = apply_filters( 'wpml_translate_single_string',
1422
+					$slug,
1423
+					'WordPress',
1424
+					'URL slug: ' . $slug,
1425
+					$language_code);
1426 1426
 
1427
-                if(!$slug){$slug = $org_slug;}
1427
+				if(!$slug){$slug = $org_slug;}
1428 1428
 
1429
-            }
1430
-        }
1429
+			}
1430
+		}
1431 1431
 
1432 1432
 		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1433
-        $site_url = trailingslashit(get_bloginfo('url'));
1433
+		$site_url = trailingslashit(get_bloginfo('url'));
1434 1434
 
1435 1435
 		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1436 1436
 		if ($fix_url) {
1437 1437
 			$post_link = str_replace($site_url, '', $post_link);
1438 1438
 		}
1439 1439
 		
1440
-        $post_link = trailingslashit(
1441
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1442
-        );
1440
+		$post_link = trailingslashit(
1441
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1442
+		);
1443 1443
 
1444 1444
 		if ($fix_url) {
1445 1445
 			$post_link = $site_url . $post_link;
1446 1446
 		}
1447 1447
 
1448
-        if (isset($comment_post_cache[$post->ID])) {
1449
-            $post = $comment_post_cache[$post->ID];
1450
-        }
1451
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1452
-            $post_id = $post->ID;
1453
-            if (isset($orig_post)) {
1454
-                $post = $orig_post;
1455
-            }
1456
-            return $gd_permalink_cache[$post_id];
1457
-        }
1458
-
1459
-        if (!isset($post->post_locations)) {
1460
-            $post_type = $post->post_type;
1461
-            $ID = $post->ID;
1462
-            $post2 = $wpdb->get_row(
1463
-                $wpdb->prepare(
1464
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1465
-                    array($post->ID)
1466
-                )
1467
-            );
1448
+		if (isset($comment_post_cache[$post->ID])) {
1449
+			$post = $comment_post_cache[$post->ID];
1450
+		}
1451
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1452
+			$post_id = $post->ID;
1453
+			if (isset($orig_post)) {
1454
+				$post = $orig_post;
1455
+			}
1456
+			return $gd_permalink_cache[$post_id];
1457
+		}
1468 1458
 
1469
-            $post = (object)array_merge((array)$post, (array)$post2);
1459
+		if (!isset($post->post_locations)) {
1460
+			$post_type = $post->post_type;
1461
+			$ID = $post->ID;
1462
+			$post2 = $wpdb->get_row(
1463
+				$wpdb->prepare(
1464
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1465
+					array($post->ID)
1466
+				)
1467
+			);
1470 1468
 
1471
-            $comment_post_cache[$post->ID] = $post;
1472
-        }
1469
+			$post = (object)array_merge((array)$post, (array)$post2);
1473 1470
 
1471
+			$comment_post_cache[$post->ID] = $post;
1472
+		}
1474 1473
 
1475 1474
 
1476
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1477 1475
 
1478
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1479
-                $location_request = '';
1476
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1480 1477
 
1478
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1479
+				$location_request = '';
1481 1480
 
1482
-                if (!empty($post->post_locations)) {
1483
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1484
-                    if (count($geodir_arr_locations) == 3) {
1485
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1486
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1487
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1488
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1489
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1491 1481
 
1492
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1493
-                            'region_slug' => $post->region_slug,
1494
-                            'city_slug' => $post->city_slug
1495
-                        );
1482
+				if (!empty($post->post_locations)) {
1483
+					$geodir_arr_locations = explode(',', $post->post_locations);
1484
+					if (count($geodir_arr_locations) == 3) {
1485
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1486
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1487
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1488
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1489
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1490
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1496 1491
 
1497
-                    } else
1498
-                        $post_location = geodir_get_location();
1492
+						$post_location = (object)array('country_slug' => $post->country_slug,
1493
+							'region_slug' => $post->region_slug,
1494
+							'city_slug' => $post->city_slug
1495
+						);
1499 1496
 
1497
+					} else
1498
+						$post_location = geodir_get_location();
1500 1499
 
1501
-                } else {
1502 1500
 
1503
-                    $post_location_sql = $wpdb->get_results(
1504
-                        $wpdb->prepare(
1505
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1506
-                            array($post->ID)
1507
-                        )
1508
-                    );
1509
-
1510
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1511
-
1512
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1513
-                        if (count($geodir_arr_locations) == 3) {
1514
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1515
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1516
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1517
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1518
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1520
-
1521
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1522
-                                'region_slug' => $post->region_slug,
1523
-                                'city_slug' => $post->city_slug
1524
-                            );
1501
+				} else {
1525 1502
 
1526
-                        }
1527
-                    } else
1528
-                        $post_location = geodir_get_location();
1529
-                }
1503
+					$post_location_sql = $wpdb->get_results(
1504
+						$wpdb->prepare(
1505
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1506
+							array($post->ID)
1507
+						)
1508
+					);
1509
+
1510
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1511
+
1512
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1513
+						if (count($geodir_arr_locations) == 3) {
1514
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1515
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1516
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1517
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1518
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1519
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1520
+
1521
+							$post_location = (object)array('country_slug' => $post->country_slug,
1522
+								'region_slug' => $post->region_slug,
1523
+								'city_slug' => $post->city_slug
1524
+							);
1525
+
1526
+						}
1527
+					} else
1528
+						$post_location = geodir_get_location();
1529
+				}
1530 1530
 
1531 1531
 
1532
-                if (!empty($post_location)) {
1533
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1532
+				if (!empty($post_location)) {
1533
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1534 1534
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1535 1535
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1536 1536
 					
@@ -1548,78 +1548,78 @@  discard block
 block discarded – undo
1548 1548
 					$location_slug[] = $city_slug;
1549 1549
 					
1550 1550
 					$location_request .= implode('/', $location_slug) . '/';
1551
-                }
1552
-            }
1551
+				}
1552
+			}
1553 1553
 
1554
-            if (get_option('geodir_add_categories_url')) {
1554
+			if (get_option('geodir_add_categories_url')) {
1555 1555
 
1556
-                $term_request = '';
1557
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1556
+				$term_request = '';
1557
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1558 1558
 
1559
-                $taxonomies = end($taxonomies);
1559
+				$taxonomies = end($taxonomies);
1560 1560
 
1561
-                if (!empty($post->default_category)) {
1562
-                    $post_terms = $post->default_category;
1563
-                } else {
1564
-                    $post_terms = '';
1561
+				if (!empty($post->default_category)) {
1562
+					$post_terms = $post->default_category;
1563
+				} else {
1564
+					$post_terms = '';
1565 1565
 
1566
-                    if (isset($post->$taxonomies)) {
1567
-                        $post_terms = explode(",", trim($post->$taxonomies, ","));
1568
-                        $post_terms = $post_terms[0];
1569
-                    }
1566
+					if (isset($post->$taxonomies)) {
1567
+						$post_terms = explode(",", trim($post->$taxonomies, ","));
1568
+						$post_terms = $post_terms[0];
1569
+					}
1570 1570
 
1571
-                    if (!$post_terms)
1572
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1571
+					if (!$post_terms)
1572
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1573 1573
 
1574
-                    if (!$post_terms) {
1575
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1574
+					if (!$post_terms) {
1575
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1576 1576
 
1577
-                        if ($post_terms) {
1578
-                            $post_terms = explode(",", trim($post_terms, ","));
1579
-                            $post_terms = $post_terms[0];
1580
-                        }
1581
-                    }
1582
-                }
1577
+						if ($post_terms) {
1578
+							$post_terms = explode(",", trim($post_terms, ","));
1579
+							$post_terms = $post_terms[0];
1580
+						}
1581
+					}
1582
+				}
1583 1583
 
1584
-                $term = get_term_by('id', $post_terms, $taxonomies);
1584
+				$term = get_term_by('id', $post_terms, $taxonomies);
1585 1585
 
1586
-                if (!empty($term))
1587
-                    $term_request = $term->slug;
1588
-                //$term_request = $term->slug.'/';
1589
-            }
1586
+				if (!empty($term))
1587
+					$term_request = $term->slug;
1588
+				//$term_request = $term->slug.'/';
1589
+			}
1590 1590
 
1591
-            $request_term = '';
1592
-            $listingurl_separator = '';
1593
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1594
-            $detailurl_separator = '';
1595
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1596
-                $request_term = $location_request;
1597
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1598
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1599
-                $request_term .= $term_request;
1591
+			$request_term = '';
1592
+			$listingurl_separator = '';
1593
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1594
+			$detailurl_separator = '';
1595
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1596
+				$request_term = $location_request;
1597
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1598
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1599
+				$request_term .= $term_request;
1600 1600
 
1601
-            } else {
1602
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1601
+			} else {
1602
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1603 1603
 
1604
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1605
-            }
1606
-            $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);
1611
-            //echo $post_link ;
1612
-        }
1613
-        // temp cache the permalink
1614
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1615
-            $gd_permalink_cache[$post->ID] = $post_link;
1616
-        }
1617
-    }
1618
-    if (isset($orig_post)) {
1619
-        $post = $orig_post;
1620
-    }
1621
-    //echo $post_link ;
1622
-    return $post_link;
1604
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1605
+			}
1606
+			$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);
1611
+			//echo $post_link ;
1612
+		}
1613
+		// temp cache the permalink
1614
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1615
+			$gd_permalink_cache[$post->ID] = $post_link;
1616
+		}
1617
+	}
1618
+	if (isset($orig_post)) {
1619
+		$post = $orig_post;
1620
+	}
1621
+	//echo $post_link ;
1622
+	return $post_link;
1623 1623
 
1624 1624
 }
1625 1625
 
@@ -1636,103 +1636,103 @@  discard block
 block discarded – undo
1636 1636
  * @return string The term link.
1637 1637
  */
1638 1638
 function geodir_term_link($termlink, $term, $taxonomy) {
1639
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1639
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1640 1640
 
1641
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1642
-        global $geodir_add_location_url, $gd_session;
1643
-        $include_location = false;
1644
-        $request_term = array();
1641
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1642
+		global $geodir_add_location_url, $gd_session;
1643
+		$include_location = false;
1644
+		$request_term = array();
1645 1645
 
1646
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1646
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1647 1647
 
1648
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1649
-            if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650
-                $include_location = true;
1651
-            }
1652
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
-            $include_location = true;
1648
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1649
+			if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1650
+				$include_location = true;
1651
+			}
1652
+		} elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1653
+			$include_location = true;
1654 1654
 
1655
-        if ($include_location) {
1656
-            global $post;
1655
+		if ($include_location) {
1656
+			global $post;
1657 1657
 			
1658 1658
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1659 1659
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1660 1660
             
1661 1661
 			if(geodir_is_page('detail') && isset($post->country_slug)){
1662
-                $location_terms = array(
1663
-                    'gd_country' => $post->country_slug,
1664
-                    'gd_region' => $post->region_slug,
1665
-                    'gd_city' => $post->city_slug
1666
-                );
1662
+				$location_terms = array(
1663
+					'gd_country' => $post->country_slug,
1664
+					'gd_region' => $post->region_slug,
1665
+					'gd_city' => $post->city_slug
1666
+				);
1667 1667
 				
1668 1668
 				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1669 1669
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1670 1670
 				}
1671
-            } else {
1672
-                $location_terms = geodir_get_current_location_terms('query_vars');
1673
-            }
1671
+			} else {
1672
+				$location_terms = geodir_get_current_location_terms('query_vars');
1673
+			}
1674 1674
 
1675
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1676
-            $location_terms = geodir_remove_location_terms($location_terms);
1675
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1676
+			$location_terms = geodir_remove_location_terms($location_terms);
1677 1677
 
1678
-            if (!empty($location_terms)) {
1678
+			if (!empty($location_terms)) {
1679 1679
 
1680
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1680
+				$url_separator = '';//get_option('geodir_listingurl_separator');
1681 1681
 
1682
-                if (get_option('permalink_structure') != '') {
1683
-                    $old_listing_slug = '/' . $listing_slug . '/';
1684
-                    $request_term = implode("/", $location_terms);
1685
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1682
+				if (get_option('permalink_structure') != '') {
1683
+					$old_listing_slug = '/' . $listing_slug . '/';
1684
+					$request_term = implode("/", $location_terms);
1685
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1686 1686
 
1687
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1688
-                } else {
1689
-                    $termlink = geodir_getlink($termlink, $request_term);
1690
-                }
1691
-            }
1692
-        }
1687
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1688
+				} else {
1689
+					$termlink = geodir_getlink($termlink, $request_term);
1690
+				}
1691
+			}
1692
+		}
1693 1693
 
1694
-        // Alter the CPT slug is WPML is set to do so
1695
-        /* we can replace this with the below function
1694
+		// Alter the CPT slug is WPML is set to do so
1695
+		/* we can replace this with the below function
1696 1696
         if(function_exists('icl_object_id')){
1697 1697
             global $sitepress;
1698 1698
             $post_type = str_replace("category","",$taxonomy);
1699 1699
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1700 1700
         }*/
1701 1701
 
1702
-        // Alter the CPT slug if WPML is set to do so
1703
-        if(function_exists('icl_object_id')){
1704
-            $post_types = get_option('geodir_post_types');
1705
-            $post_type = str_replace("category","",$taxonomy);
1702
+		// Alter the CPT slug if WPML is set to do so
1703
+		if(function_exists('icl_object_id')){
1704
+			$post_types = get_option('geodir_post_types');
1705
+			$post_type = str_replace("category","",$taxonomy);
1706 1706
 			$post_type = str_replace("_tags","",$post_type);
1707
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1708
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1707
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1708
+			if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1709 1709
 
1710
-                global $sitepress;
1711
-                $default_lang = $sitepress->get_default_language();
1712
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1713
-                if(!$language_code ){$language_code  = $default_lang;}
1710
+				global $sitepress;
1711
+				$default_lang = $sitepress->get_default_language();
1712
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1713
+				if(!$language_code ){$language_code  = $default_lang;}
1714 1714
 
1715
-                $org_slug = $slug;
1716
-                $slug = apply_filters( 'wpml_translate_single_string',
1717
-                    $slug,
1718
-                    'WordPress',
1719
-                    'URL slug: ' . $slug,
1720
-                    $language_code);
1715
+				$org_slug = $slug;
1716
+				$slug = apply_filters( 'wpml_translate_single_string',
1717
+					$slug,
1718
+					'WordPress',
1719
+					'URL slug: ' . $slug,
1720
+					$language_code);
1721 1721
 
1722 1722
 
1723
-                if(!$slug){$slug = $org_slug;}
1723
+				if(!$slug){$slug = $org_slug;}
1724 1724
 
1725
-                $termlink = trailingslashit(
1725
+				$termlink = trailingslashit(
1726 1726
 
1727
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1728
-                );
1727
+					preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1728
+				);
1729 1729
 
1730
-            }
1731
-        }
1730
+			}
1731
+		}
1732 1732
 
1733
-    }
1733
+	}
1734 1734
 	
1735
-    return $termlink;
1735
+	return $termlink;
1736 1736
 }
1737 1737
 
1738 1738
 /**
@@ -1758,14 +1758,14 @@  discard block
 block discarded – undo
1758 1758
 	if (in_array($post_type, geodir_get_posttypes())) {
1759 1759
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1760 1760
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1761
-                $location_terms = array(
1762
-                    'gd_country' => $post->country_slug,
1763
-                    'gd_region' => $post->region_slug,
1764
-                    'gd_city' => $post->city_slug
1765
-                );
1766
-            } else {
1767
-                $location_terms = geodir_get_current_location_terms('query_vars');
1768
-            }
1761
+				$location_terms = array(
1762
+					'gd_country' => $post->country_slug,
1763
+					'gd_region' => $post->region_slug,
1764
+					'gd_city' => $post->city_slug
1765
+				);
1766
+			} else {
1767
+				$location_terms = geodir_get_current_location_terms('query_vars');
1768
+			}
1769 1769
 			
1770 1770
 			$location_terms = geodir_remove_location_terms($location_terms);
1771 1771
 			
@@ -1796,14 +1796,14 @@  discard block
 block discarded – undo
1796 1796
  */
1797 1797
 function get_post_type_singular_label($post_type, $echo = false)
1798 1798
 {
1799
-    $obj_post_type = get_post_type_object($post_type);
1800
-    if (!is_object($obj_post_type)) {
1801
-        return;
1802
-    }
1803
-    if ($echo)
1804
-        echo $obj_post_type->labels->singular_name;
1805
-    else
1806
-        return $obj_post_type->labels->singular_name;
1799
+	$obj_post_type = get_post_type_object($post_type);
1800
+	if (!is_object($obj_post_type)) {
1801
+		return;
1802
+	}
1803
+	if ($echo)
1804
+		echo $obj_post_type->labels->singular_name;
1805
+	else
1806
+		return $obj_post_type->labels->singular_name;
1807 1807
 
1808 1808
 }
1809 1809
 
@@ -1818,16 +1818,16 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function get_post_type_plural_label($post_type, $echo = false)
1820 1820
 {
1821
-    $all_postypes = geodir_get_posttypes();
1821
+	$all_postypes = geodir_get_posttypes();
1822 1822
 
1823
-    if (!in_array($post_type, $all_postypes))
1824
-        return false;
1823
+	if (!in_array($post_type, $all_postypes))
1824
+		return false;
1825 1825
 
1826
-    $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;
1826
+	$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;
1831 1831
 
1832 1832
 }
1833 1833
 
@@ -1846,51 +1846,51 @@  discard block
 block discarded – undo
1846 1846
  */
1847 1847
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1848 1848
 {
1849
-    global $wpdb;
1850
-
1851
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1852
-    $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
-
1854
-    if (is_int($term)) {
1855
-        if (0 == $term)
1856
-            return 0;
1857
-        $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));
1862
-    }
1849
+	global $wpdb;
1850
+
1851
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1852
+	$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
+
1854
+	if (is_int($term)) {
1855
+		if (0 == $term)
1856
+			return 0;
1857
+		$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));
1862
+	}
1863 1863
 
1864
-    $term = trim(wp_unslash($term));
1864
+	$term = trim(wp_unslash($term));
1865 1865
 
1866
-    if ('' === $slug = sanitize_title($term))
1867
-        return 0;
1866
+	if ('' === $slug = sanitize_title($term))
1867
+		return 0;
1868 1868
 
1869
-    $where = 't.slug = %s';
1869
+	$where = 't.slug = %s';
1870 1870
 
1871
-    $where_fields = array($slug);
1872
-    if (!empty($taxonomy)) {
1873
-        $parent = (int)$parent;
1874
-        if ($parent > 0) {
1875
-            $where_fields[] = $parent;
1876
-            $else_where_fields[] = $parent;
1877
-            $where .= ' AND tt.parent = %d';
1871
+	$where_fields = array($slug);
1872
+	if (!empty($taxonomy)) {
1873
+		$parent = (int)$parent;
1874
+		if ($parent > 0) {
1875
+			$where_fields[] = $parent;
1876
+			$else_where_fields[] = $parent;
1877
+			$where .= ' AND tt.parent = %d';
1878 1878
 
1879
-        }
1879
+		}
1880 1880
 
1881
-        $where_fields[] = $taxonomy;
1881
+		$where_fields[] = $taxonomy;
1882 1882
 
1883 1883
 
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;
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;
1886 1886
 
1887
-        return false;
1888
-    }
1887
+		return false;
1888
+	}
1889 1889
 
1890
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
-        return $result;
1890
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1891
+		return $result;
1892 1892
 
1893
-    return false;
1893
+	return false;
1894 1894
 }
1895 1895
 
1896 1896
 /**
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 function geodir_get_term_icon_rebuild()
1903 1903
 {
1904 1904
 
1905
-    update_option('gd_term_icons', '');
1905
+	update_option('gd_term_icons', '');
1906 1906
 
1907 1907
 }
1908 1908
 
@@ -1920,60 +1920,60 @@  discard block
 block discarded – undo
1920 1920
  */
1921 1921
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1922 1922
 {
1923
-    global $wpdb;
1924
-    if (!$rebuild) {
1925
-        $terms_icons = get_option('gd_term_icons');
1926
-    } else {
1927
-        $terms_icons = '';
1928
-    }
1929
-
1930
-    if (empty($terms_icons)) {
1931
-        $default_icon_url = get_option('geodir_default_marker_icon');
1932
-        $taxonomy = geodir_get_taxonomies();
1933
-        $post_types = geodir_get_posttypes();
1934
-        $tax_arr = array();
1935
-        foreach ($post_types as $post_type) {
1936
-            $tax_arr[] = "'" . $post_type . "category'";
1937
-        }
1938
-        $tax_c = implode(',', $tax_arr);
1939
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940
-        //$terms = get_terms( $taxonomy );
1941
-
1942
-        if($terms) {
1943
-            foreach ($terms as $term) {
1944
-                $post_type = str_replace("category", "", $term->taxonomy);
1945
-                $a_terms[$post_type][] = $term;
1923
+	global $wpdb;
1924
+	if (!$rebuild) {
1925
+		$terms_icons = get_option('gd_term_icons');
1926
+	} else {
1927
+		$terms_icons = '';
1928
+	}
1946 1929
 
1947
-            }
1948
-        }
1930
+	if (empty($terms_icons)) {
1931
+		$default_icon_url = get_option('geodir_default_marker_icon');
1932
+		$taxonomy = geodir_get_taxonomies();
1933
+		$post_types = geodir_get_posttypes();
1934
+		$tax_arr = array();
1935
+		foreach ($post_types as $post_type) {
1936
+			$tax_arr[] = "'" . $post_type . "category'";
1937
+		}
1938
+		$tax_c = implode(',', $tax_arr);
1939
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1940
+		//$terms = get_terms( $taxonomy );
1949 1941
 
1950
-        if($a_terms) {
1951
-            foreach ($a_terms as $pt => $t2) {
1942
+		if($terms) {
1943
+			foreach ($terms as $term) {
1944
+				$post_type = str_replace("category", "", $term->taxonomy);
1945
+				$a_terms[$post_type][] = $term;
1952 1946
 
1953
-                foreach ($t2 as $term) {
1954
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1955
-                    if ($term_icon) {
1956
-                        $term_icon_url = $term_icon["src"];
1957
-                    } else {
1958
-                        $term_icon_url = $default_icon_url;
1959
-                    }
1960
-                    $terms_icons[$term->term_id] = $term_icon_url;
1961
-                }
1962
-            }
1963
-        }
1947
+			}
1948
+		}
1964 1949
 
1965
-        update_option('gd_term_icons', $terms_icons);
1966
-    }
1950
+		if($a_terms) {
1951
+			foreach ($a_terms as $pt => $t2) {
1967 1952
 
1968
-    if ($term_id && isset($terms_icons[$term_id])) {
1969
-        return $terms_icons[$term_id];
1970
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
1971
-        return get_option('geodir_default_marker_icon');
1972
-    }
1953
+				foreach ($t2 as $term) {
1954
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
1955
+					if ($term_icon) {
1956
+						$term_icon_url = $term_icon["src"];
1957
+					} else {
1958
+						$term_icon_url = $default_icon_url;
1959
+					}
1960
+					$terms_icons[$term->term_id] = $term_icon_url;
1961
+				}
1962
+			}
1963
+		}
1964
+
1965
+		update_option('gd_term_icons', $terms_icons);
1966
+	}
1973 1967
 
1974
-    if (is_ssl()) {
1975
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1976
-    }
1968
+	if ($term_id && isset($terms_icons[$term_id])) {
1969
+		return $terms_icons[$term_id];
1970
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
1971
+		return get_option('geodir_default_marker_icon');
1972
+	}
1973
+
1974
+	if (is_ssl()) {
1975
+		$terms_icons = str_replace("http:","https:",$terms_icons );
1976
+	}
1977 1977
 
1978
-    return $terms_icons;
1978
+	return $terms_icons;
1979 1979
 }
1980 1980
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-templates/geodir-information.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@
 block discarded – undo
12 12
         <div class="clearfix">
13 13
             <div id="geodir_content">
14 14
                 <?php
15
-                global $information;
16
-                echo '<h5 class="geodir_information">';
17
-                echo $information;
18
-                echo '</h5>';
15
+				global $information;
16
+				echo '<h5 class="geodir_information">';
17
+				echo $information;
18
+				echo '</h5>';
19 19
 
20
-                ?>
20
+				?>
21 21
             </div>
22 22
             <!-- geodir_content ends here-->
23 23
             <div id="gd-sidebar-wrapper">
24 24
                 <div class="geodir-sidebar-main">
25 25
                     <div class="geodir-gd-sidebar">
26 26
                         <?php
27
-                        /**
28
-                         * Calls the standard sidebar.
29
-                         *
30
-                         * @since 1.0.0
31
-                         */
32
-                        do_action('geodir_sidebar'); ?>
27
+						/**
28
+						 * Calls the standard sidebar.
29
+						 *
30
+						 * @since 1.0.0
31
+						 */
32
+						do_action('geodir_sidebar'); ?>
33 33
                     </div>
34 34
                 </div>
35 35
             </div>
Please login to merge, or discard this patch.
geodirectory-templates/listing-detail.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
 ###### SIDEBAR ON LEFT ######
35 35
 if (get_option('geodir_detail_sidebar_left_section')) {
36
-    /**
37
-     * Adds the details page sidebar to the details template page.
38
-     *
39
-     * @since 1.1.0
40
-     */
41
-    do_action('geodir_detail_sidebar');
36
+	/**
37
+	 * Adds the details page sidebar to the details template page.
38
+	 *
39
+	 * @since 1.1.0
40
+	 */
41
+	do_action('geodir_detail_sidebar');
42 42
 }
43 43
 
44 44
 ###### MAIN CONTENT WRAPPERS OPEN ######
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 ###### MAIN CONTENT ######
64 64
 // this call the main page content
65 65
 if (have_posts() && !$preview) {
66
-    the_post();
67
-    global $post, $post_images;
68
-    /**
69
-     * Calls the details page main content on the details template page.
70
-     *
71
-     * @since 1.1.0
72
-     * @param object $post The current post object.
73
-     */
74
-    do_action('geodir_details_main_content', $post);
66
+	the_post();
67
+	global $post, $post_images;
68
+	/**
69
+	 * Calls the details page main content on the details template page.
70
+	 *
71
+	 * @since 1.1.0
72
+	 * @param object $post The current post object.
73
+	 */
74
+	do_action('geodir_details_main_content', $post);
75 75
 } elseif ($preview) {
76
-    /**
77
-     * Called on the details page if the page is being previewed.
78
-     *
79
-     * This sets the value of `$post` to the preview values before the main content is called.
80
-     *
81
-     * @since 1.1.0
82
-     */
83
-    do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
84
-    /** This action is documented in geodirectory-templates/listing-detail.php */
85
-    do_action('geodir_details_main_content', $post);
76
+	/**
77
+	 * Called on the details page if the page is being previewed.
78
+	 *
79
+	 * This sets the value of `$post` to the preview values before the main content is called.
80
+	 *
81
+	 * @since 1.1.0
82
+	 */
83
+	do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
84
+	/** This action is documented in geodirectory-templates/listing-detail.php */
85
+	do_action('geodir_details_main_content', $post);
86 86
 }
87 87
 
88 88
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 ###### SIDEBAR ON RIGHT ######
106 106
 if (!get_option('geodir_detail_sidebar_left_section')) {
107
-    /** This action is documented in geodirectory-templates/listing-detail.php */
108
-    do_action('geodir_detail_sidebar');
107
+	/** This action is documented in geodirectory-templates/listing-detail.php */
108
+	do_action('geodir_detail_sidebar');
109 109
 }
110 110
 
111 111
 
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.
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
-    wp_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
+	wp_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.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -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;">';
@@ -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>
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_features_widget.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -3,117 +3,117 @@  discard block
 block discarded – undo
3 3
 class Geodir_Features_Widget extends WP_Widget
4 4
 {
5 5
 
6
-    /**
7
-     * Class constructor.
8
-     */
9
-    public function __construct()
10
-    {
11
-        $widget_ops = array(
12
-            'description' => __('Displays "GD Features" widget', 'geodirectory'),
13
-            'classname' => 'widget_gd_features',
14
-        );
15
-        parent::__construct(false, $name = _x('GD > Features', 'widget name', 'geodirectory'), $widget_ops);
16
-
17
-    }
18
-
19
-    /**
20
-     * Display the widget.
21
-     *
22
-     * @param array $args Widget arguments.
23
-     * @param array $instance The widget settings, as saved by the user.
24
-     */
25
-    public function widget($args, $instance)
26
-    {
27
-        extract($args);
28
-
29
-        $title = empty($instance['title']) ? '' : apply_filters('gd_features_widget_title', __($instance['title'], 'geodirectory'));
30
-        $icon_color = $instance['icon_color'];
31
-
32
-        echo $before_widget;
33
-        ?>
6
+	/**
7
+	 * Class constructor.
8
+	 */
9
+	public function __construct()
10
+	{
11
+		$widget_ops = array(
12
+			'description' => __('Displays "GD Features" widget', 'geodirectory'),
13
+			'classname' => 'widget_gd_features',
14
+		);
15
+		parent::__construct(false, $name = _x('GD > Features', 'widget name', 'geodirectory'), $widget_ops);
16
+
17
+	}
18
+
19
+	/**
20
+	 * Display the widget.
21
+	 *
22
+	 * @param array $args Widget arguments.
23
+	 * @param array $instance The widget settings, as saved by the user.
24
+	 */
25
+	public function widget($args, $instance)
26
+	{
27
+		extract($args);
28
+
29
+		$title = empty($instance['title']) ? '' : apply_filters('gd_features_widget_title', __($instance['title'], 'geodirectory'));
30
+		$icon_color = $instance['icon_color'];
31
+
32
+		echo $before_widget;
33
+		?>
34 34
         <?php if ($title) {
35
-        echo '<div class="geodir_list_heading clearfix">';
36
-        echo $before_title . $title . $after_title;
37
-        echo '</div>';
38
-    } ?>
35
+		echo '<div class="geodir_list_heading clearfix">';
36
+		echo $before_title . $title . $after_title;
37
+		echo '</div>';
38
+	} ?>
39 39
         <?php
40
-        echo "<ul class='gd-features'>";
41
-
42
-        $i = 1;
43
-        while ($i < 100) {
44
-
45
-            if (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) {
46
-                echo "<li>";
47
-                if ($instance['title' . $i]) {
48
-                    echo "<h3 class='gd-fe-title'>" . $instance['title' . $i] . "</h3>";
49
-                }
50
-                if ($instance['image' . $i]) {
51
-                    echo "<div class='gd-fe-image'>" . gd_features_parse_image($instance['image' . $i], $icon_color) . "</div>";
52
-                }
53
-                if ($instance['desc' . $i]) {
54
-                    echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($instance['desc' . $i]) . "</div>";
55
-                }
56
-                echo "</li>";
57
-            } else {
58
-                break;
59
-            }
60
-
61
-            $i++;
62
-        }
63
-
64
-        echo "</ul>";
65
-        ?>
40
+		echo "<ul class='gd-features'>";
41
+
42
+		$i = 1;
43
+		while ($i < 100) {
44
+
45
+			if (isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) {
46
+				echo "<li>";
47
+				if ($instance['title' . $i]) {
48
+					echo "<h3 class='gd-fe-title'>" . $instance['title' . $i] . "</h3>";
49
+				}
50
+				if ($instance['image' . $i]) {
51
+					echo "<div class='gd-fe-image'>" . gd_features_parse_image($instance['image' . $i], $icon_color) . "</div>";
52
+				}
53
+				if ($instance['desc' . $i]) {
54
+					echo "<div class='gd-fe-desc'>" . gd_features_parse_desc($instance['desc' . $i]) . "</div>";
55
+				}
56
+				echo "</li>";
57
+			} else {
58
+				break;
59
+			}
60
+
61
+			$i++;
62
+		}
63
+
64
+		echo "</ul>";
65
+		?>
66 66
         <?php echo $after_widget; ?>
67 67
     <?php
68
-    }
69
-
70
-    public function update($new_instance, $old_instance)
71
-    {
72
-        //save the widget
73
-        $instance = $old_instance;
74
-
75
-        $instance['title'] = strip_tags($new_instance['title']);
76
-        $instance['icon_color'] = strip_tags($new_instance['icon_color']);
77
-
78
-        $i = 1;
79
-        while ($i < 100) {
80
-
81
-            if (isset($new_instance['title' . $i]) || isset($new_instance['image' . $i]) || isset($new_instance['desc' . $i])) {
82
-                if ($new_instance['title' . $i]) {
83
-                    $instance['title' . $i] = $new_instance['title' . $i];
84
-                }
85
-                if ($new_instance['image' . $i]) {
86
-                    $instance['image' . $i] = $new_instance['image' . $i];
87
-                }
88
-                if ($new_instance['desc' . $i]) {
89
-                    $instance['desc' . $i] = $new_instance['desc' . $i];
90
-                }
91
-            } else {
92
-                break;
93
-            }
94
-
95
-            $i++;
96
-        }
97
-
98
-        return $instance;
99
-    }
100
-
101
-    public function form($instance)
102
-    {
103
-        //widgetform in backend
104
-        $instance = wp_parse_args((array)$instance, array(
105
-            'title' => '',
106
-            'icon_color' => '#757575',
107
-            'title1' => '',
108
-            'image1' => '',
109
-            'desc1' => '',
110
-        ));
111
-
112
-
113
-        $title = strip_tags($instance['title']);
114
-        $icon_color = strip_tags($instance['icon_color']);
115
-
116
-        ?>
68
+	}
69
+
70
+	public function update($new_instance, $old_instance)
71
+	{
72
+		//save the widget
73
+		$instance = $old_instance;
74
+
75
+		$instance['title'] = strip_tags($new_instance['title']);
76
+		$instance['icon_color'] = strip_tags($new_instance['icon_color']);
77
+
78
+		$i = 1;
79
+		while ($i < 100) {
80
+
81
+			if (isset($new_instance['title' . $i]) || isset($new_instance['image' . $i]) || isset($new_instance['desc' . $i])) {
82
+				if ($new_instance['title' . $i]) {
83
+					$instance['title' . $i] = $new_instance['title' . $i];
84
+				}
85
+				if ($new_instance['image' . $i]) {
86
+					$instance['image' . $i] = $new_instance['image' . $i];
87
+				}
88
+				if ($new_instance['desc' . $i]) {
89
+					$instance['desc' . $i] = $new_instance['desc' . $i];
90
+				}
91
+			} else {
92
+				break;
93
+			}
94
+
95
+			$i++;
96
+		}
97
+
98
+		return $instance;
99
+	}
100
+
101
+	public function form($instance)
102
+	{
103
+		//widgetform in backend
104
+		$instance = wp_parse_args((array)$instance, array(
105
+			'title' => '',
106
+			'icon_color' => '#757575',
107
+			'title1' => '',
108
+			'image1' => '',
109
+			'desc1' => '',
110
+		));
111
+
112
+
113
+		$title = strip_tags($instance['title']);
114
+		$icon_color = strip_tags($instance['icon_color']);
115
+
116
+		?>
117 117
         <p>
118 118
             <b>Heads Up!</b> If you don't have enough content, You can keep some boxes blank.
119 119
         </p>
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
         <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx');?>">
142 142
             <?php
143 143
 
144
-            $i = 1;
145
-            while ($i < 100) {
144
+			$i = 1;
145
+			while ($i < 100) {
146 146
 
147
-                if ((isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148
-                    ?>
147
+				if ((isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148
+					?>
149 149
                     <div class="gdrep<?php echo $i;?>">
150 150
                         <p class="features-title">
151 151
                             <label
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
                         </p>
171 171
                     </div>
172 172
                 <?php
173
-                } else {
174
-                    break;
175
-                }
173
+				} else {
174
+					break;
175
+				}
176 176
 
177
-                $i++;
178
-            }
177
+				$i++;
178
+			}
179 179
 
180
-            ?>
180
+			?>
181 181
             <input class="button button-primary left"
182 182
                    onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx');?>','<?php echo $this->get_field_name('xxx');?>')"
183 183
                    type="button" value="<?php _e('Add item', 'geodirectory');?>"/>
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 
186 186
 
187 187
     <?php
188
-    }
188
+	}
189 189
 
190 190
 }
191 191
 
192 192
 register_widget("Geodir_Features_Widget");
193 193
 function gd_features_parse_image($image, $icon_color)
194 194
 {
195
-    if (substr($image, 0, 4) === "http") {
196
-        $image = '<img src="' . $image . '" />';
197
-    } elseif (substr($image, 0, 3) === "fa-") {
198
-        if (empty($icon_color)) {
199
-            $icon_color = '#757575';
200
-        }
201
-        $image = '<i style="color:' . $icon_color . '" class="fa ' . $image . '"></i>';
202
-    }
203
-    return $image;
195
+	if (substr($image, 0, 4) === "http") {
196
+		$image = '<img src="' . $image . '" />';
197
+	} elseif (substr($image, 0, 3) === "fa-") {
198
+		if (empty($icon_color)) {
199
+			$icon_color = '#757575';
200
+		}
201
+		$image = '<i style="color:' . $icon_color . '" class="fa ' . $image . '"></i>';
202
+	}
203
+	return $image;
204 204
 }
205 205
 
206 206
 function gd_features_parse_desc($desc)
207 207
 {
208
-    return $desc;
208
+	return $desc;
209 209
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function form($instance)
102 102
     {
103 103
         //widgetform in backend
104
-        $instance = wp_parse_args((array)$instance, array(
104
+        $instance = wp_parse_args((array) $instance, array(
105 105
             'title' => '',
106 106
             'icon_color' => '#757575',
107 107
             'title1' => '',
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         </p>
139 139
 
140 140
 
141
-        <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx');?>">
141
+        <div class="gd-fet-rep-<?php echo $this->get_field_id('xxx'); ?>">
142 142
             <?php
143 143
 
144 144
             $i = 1;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
                 if ((isset($instance['title' . $i]) || isset($instance['image' . $i]) || isset($instance['desc' . $i])) && ($instance['title' . $i] || $instance['image' . $i] || $instance['desc' . $i])) {
148 148
                     ?>
149
-                    <div class="gdrep<?php echo $i;?>">
149
+                    <div class="gdrep<?php echo $i; ?>">
150 150
                         <p class="features-title">
151 151
                             <label
152 152
                                 data-gdrep-title-num="1"><?php printf(__('Title %d:', 'geodirectory'), $i); ?></label>
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 
180 180
             ?>
181 181
             <input class="button button-primary left"
182
-                   onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx');?>','<?php echo $this->get_field_name('xxx');?>')"
183
-                   type="button" value="<?php _e('Add item', 'geodirectory');?>"/>
182
+                   onclick="gd_featured_widget_repeat('gd-fet-rep-<?php echo $this->get_field_id('xxx'); ?>','<?php echo $this->get_field_name('xxx'); ?>')"
183
+                   type="button" value="<?php _e('Add item', 'geodirectory'); ?>"/>
184 184
         </div>
185 185
 
186 186
 
Please login to merge, or discard this patch.
geodirectory_widgets.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             public function form($instance)
302 302
             {
303 303
                 //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
304
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305 305
                 $title = strip_tags($instance['title']);
306 306
 
307 307
                 ?>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 ?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376
-                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
376
+                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
377 377
 
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             public function form($instance)
444 444
             {
445 445
                 //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
446
+                $instance = wp_parse_args((array) $instance, array('title' => ''));
447 447
                 $title = strip_tags($instance['title']);
448 448
                 ?>
449 449
                 <p>No settings for this widget</p>
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                 echo 'http://feeds2.feedburner.com/' . $id;
520 520
             } else {
521 521
                 bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
522
+            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             public function form($instance)
585 585
             {
586 586
                 //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
587
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589 589
                 $id = strip_tags($instance['id']);
590 590
 
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
                 ?>
598 598
                 <p><label
599
-                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
599
+                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
601 601
                                name="<?php echo $this->get_field_name('title'); ?>" type="text"
602 602
                                value="<?php echo esc_attr($title); ?>"/></label></p>
603 603
 
604 604
                 <p><label
605
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?>
605
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?>
606 606
                         : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
607 607
                                  name="<?php echo $this->get_field_name('id'); ?>" type="text"
608 608
                                  value="<?php echo esc_attr($id); ?>"/></label></p>
609 609
 
610 610
                 <p><label
611
-                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?>
611
+                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?>
612 612
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>"
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
             public function form($instance)
705 705
             {
706 706
                 //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
707
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708 708
 
709 709
                 $desc1 = ($instance['desc1']);
710 710
                 ?>
711 711
                 <p><label
712
-                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
712
+                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
714 714
                                   name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
715 715
                 </p>
@@ -819,14 +819,14 @@  discard block
 block discarded – undo
819 819
             {
820 820
 
821 821
                 //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
822
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => ''));
823 823
                 $id = strip_tags($instance['id']);
824 824
                 $number = strip_tags($instance['number']);
825 825
                 ?>
826 826
 
827 827
                 <p>
828 828
                     <label
829
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?>
829
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?>
830 830
                         (<a href="http://www.idgettr.com">idGettr</a>):
831 831
                         <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
832 832
                                name="<?php echo $this->get_field_name('id'); ?>" type="text"
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 
837 837
                 <p>
838 838
                     <label
839
-                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?>
839
+                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?>
840 840
                         <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>"
841 841
                                name="<?php echo $this->get_field_name('number'); ?>" type="text"
842 842
                                value="<?php echo esc_attr($number); ?>"/>
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
             public function form($instance)
933 933
             {
934 934
                 //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
935
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936 936
 
937 937
                 $desc1 = ($instance['gd_tw_desc1']);
938 938
                 ?>
939 939
                 <p><label
940
-                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
940
+                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
942 942
                                   id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
943 943
                                   name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                  * @param array $args The widget arguments.
994 994
                  * @param array $instance The widget instance.
995 995
                  */
996
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
996
+                $args = apply_filters('widget_geodir_advance_search_args', $args, $instance);
997 997
 
998 998
                 // prints the widget
999 999
                 extract($args, EXTR_SKIP);
Please login to merge, or discard this patch.
Indentation   +888 added lines, -888 removed lines patch added patch discarded remove patch
@@ -15,296 +15,296 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function geodir_register_sidebar()
17 17
 {
18
-    global $geodir_sidebars;
19
-
20
-    if (function_exists('register_sidebar')) {
21
-        /*===========================*/
22
-        /* Home page sidebars start*/
23
-        /*===========================*/
24
-
25
-        /**
26
-         * Filter the `$before_widget` widget opening HTML tag.
27
-         *
28
-         * @since 1.0.0
29
-         * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
-         * @see 'geodir_after_widget'
31
-         */
32
-        $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
-        /**
34
-         * Filter the `$after_widget` widget closing HTML tag.
35
-         *
36
-         * @since 1.0.0
37
-         * @param string $var The HTML string to filter. Default = '</section>'.
38
-         * @see 'geodir_before_widget'
39
-         */
40
-        $after_widget = apply_filters('geodir_after_widget', '</section>');
41
-        /**
42
-         * Filter the `$before_title` widget title opening HTML tag.
43
-         *
44
-         * @since 1.0.0
45
-         * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
-         * @see 'geodir_after_title'
47
-         */
48
-        $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
-        /**
50
-         * Filter the `$after_title` widget title closing HTML tag.
51
-         *
52
-         * @since 1.0.0
53
-         * @param string $var The HTML string to filter. Default = '</h3>'.
54
-         * @see 'geodir_before_title'
55
-         */
56
-        $after_title = apply_filters('geodir_after_title', '</h3>');
57
-
58
-        if (get_option('geodir_show_home_top_section')) {
59
-            register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
60
-
61
-            $geodir_sidebars[] = 'geodir_home_top';
62
-        }
63
-
64
-        if (get_option('geodir_show_home_contant_section')) {
65
-            register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
18
+	global $geodir_sidebars;
66 19
 
67
-            $geodir_sidebars[] = 'geodir_home_content';
68
-        }
20
+	if (function_exists('register_sidebar')) {
21
+		/*===========================*/
22
+		/* Home page sidebars start*/
23
+		/*===========================*/
69 24
 
70
-        if (get_option('geodir_show_home_right_section')) {
71
-            register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
25
+		/**
26
+		 * Filter the `$before_widget` widget opening HTML tag.
27
+		 *
28
+		 * @since 1.0.0
29
+		 * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
+		 * @see 'geodir_after_widget'
31
+		 */
32
+		$before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
+		/**
34
+		 * Filter the `$after_widget` widget closing HTML tag.
35
+		 *
36
+		 * @since 1.0.0
37
+		 * @param string $var The HTML string to filter. Default = '</section>'.
38
+		 * @see 'geodir_before_widget'
39
+		 */
40
+		$after_widget = apply_filters('geodir_after_widget', '</section>');
41
+		/**
42
+		 * Filter the `$before_title` widget title opening HTML tag.
43
+		 *
44
+		 * @since 1.0.0
45
+		 * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
+		 * @see 'geodir_after_title'
47
+		 */
48
+		$before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
+		/**
50
+		 * Filter the `$after_title` widget title closing HTML tag.
51
+		 *
52
+		 * @since 1.0.0
53
+		 * @param string $var The HTML string to filter. Default = '</h3>'.
54
+		 * @see 'geodir_before_title'
55
+		 */
56
+		$after_title = apply_filters('geodir_after_title', '</h3>');
57
+
58
+		if (get_option('geodir_show_home_top_section')) {
59
+			register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
72 60
 
73
-            $geodir_sidebars[] = 'geodir_home_right';
74
-        }
61
+			$geodir_sidebars[] = 'geodir_home_top';
62
+		}
75 63
 
76
-        if (get_option('geodir_show_home_left_section')) {
77
-            register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
64
+		if (get_option('geodir_show_home_contant_section')) {
65
+			register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
78 66
 
79
-            $geodir_sidebars[] = 'geodir_home_left';
80
-        }
67
+			$geodir_sidebars[] = 'geodir_home_content';
68
+		}
81 69
 
82
-        if (get_option('geodir_show_home_bottom_section')) {
83
-            register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
70
+		if (get_option('geodir_show_home_right_section')) {
71
+			register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
84 72
 
85
-            $geodir_sidebars[] = 'geodir_home_bottom';
86
-        }
73
+			$geodir_sidebars[] = 'geodir_home_right';
74
+		}
87 75
 
88
-        /*===========================*/
89
-        /* Home page sidebars end*/
90
-        /*===========================*/
76
+		if (get_option('geodir_show_home_left_section')) {
77
+			register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
91 78
 
92
-        /*===========================*/
93
-        /* Listing page sidebars start*/
94
-        /*===========================*/
79
+			$geodir_sidebars[] = 'geodir_home_left';
80
+		}
95 81
 
96
-        if (get_option('geodir_show_listing_top_section')) {
97
-            register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
82
+		if (get_option('geodir_show_home_bottom_section')) {
83
+			register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
98 84
 
99
-            $geodir_sidebars[] = 'geodir_listing_top';
100
-        }
85
+			$geodir_sidebars[] = 'geodir_home_bottom';
86
+		}
101 87
 
102
-        if (get_option('geodir_show_listing_left_section')) {
103
-            register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
88
+		/*===========================*/
89
+		/* Home page sidebars end*/
90
+		/*===========================*/
104 91
 
105
-            $geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
-        }
92
+		/*===========================*/
93
+		/* Listing page sidebars start*/
94
+		/*===========================*/
107 95
 
108
-        if (get_option('geodir_show_listing_right_section')) {
109
-            register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
96
+		if (get_option('geodir_show_listing_top_section')) {
97
+			register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
110 98
 
111
-            $geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
-        }
99
+			$geodir_sidebars[] = 'geodir_listing_top';
100
+		}
113 101
 
114
-        if (get_option('geodir_show_listing_bottom_section')) {
115
-            register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
102
+		if (get_option('geodir_show_listing_left_section')) {
103
+			register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
116 104
 
117
-            $geodir_sidebars[] = 'geodir_listing_bottom';
118
-        }
105
+			$geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
+		}
119 107
 
120
-        /*===========================*/
121
-        /* Listing page sidebars start*/
122
-        /*===========================*/
108
+		if (get_option('geodir_show_listing_right_section')) {
109
+			register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
123 110
 
124
-        /*===========================*/
125
-        /* Search page sidebars start*/
126
-        /*===========================*/
111
+			$geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
+		}
127 113
 
128
-        if (get_option('geodir_show_search_top_section')) {
129
-            register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
114
+		if (get_option('geodir_show_listing_bottom_section')) {
115
+			register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
130 116
 
131
-            $geodir_sidebars[] = 'geodir_search_top';
132
-        }
117
+			$geodir_sidebars[] = 'geodir_listing_bottom';
118
+		}
133 119
 
134
-        if (get_option('geodir_show_search_left_section')) {
135
-            register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
120
+		/*===========================*/
121
+		/* Listing page sidebars start*/
122
+		/*===========================*/
136 123
 
137
-            $geodir_sidebars[] = 'geodir_search_left_sidebar';
138
-        }
124
+		/*===========================*/
125
+		/* Search page sidebars start*/
126
+		/*===========================*/
139 127
 
140
-        if (get_option('geodir_show_search_right_section')) {
141
-            register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
128
+		if (get_option('geodir_show_search_top_section')) {
129
+			register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
142 130
 
143
-            $geodir_sidebars[] = 'geodir_search_right_sidebar';
144
-        }
131
+			$geodir_sidebars[] = 'geodir_search_top';
132
+		}
145 133
 
146
-        if (get_option('geodir_show_search_bottom_section')) {
147
-            register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
134
+		if (get_option('geodir_show_search_left_section')) {
135
+			register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
148 136
 
149
-            $geodir_sidebars[] = 'geodir_search_bottom';
150
-        }
137
+			$geodir_sidebars[] = 'geodir_search_left_sidebar';
138
+		}
151 139
 
152
-        /*===========================*/
153
-        /* Search page sidebars end*/
154
-        /*===========================*/
140
+		if (get_option('geodir_show_search_right_section')) {
141
+			register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
155 142
 
156
-        /*==================================*/
157
-        /* Detail/Single page sidebars start*/
158
-        /*==================================*/
159
-        if (get_option('geodir_show_detail_top_section')) {
160
-            register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
143
+			$geodir_sidebars[] = 'geodir_search_right_sidebar';
144
+		}
161 145
 
162
-            $geodir_sidebars[] = 'geodir_detail_top';
163
-        }
146
+		if (get_option('geodir_show_search_bottom_section')) {
147
+			register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
164 148
 
165
-        register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
149
+			$geodir_sidebars[] = 'geodir_search_bottom';
150
+		}
166 151
 
167
-        $geodir_sidebars[] = 'geodir_detail_sidebar';
152
+		/*===========================*/
153
+		/* Search page sidebars end*/
154
+		/*===========================*/
168 155
 
169
-        if (get_option('geodir_show_detail_bottom_section')) {
170
-            register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
156
+		/*==================================*/
157
+		/* Detail/Single page sidebars start*/
158
+		/*==================================*/
159
+		if (get_option('geodir_show_detail_top_section')) {
160
+			register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
171 161
 
172
-            $geodir_sidebars[] = 'geodir_detail_bottom';
173
-        }
162
+			$geodir_sidebars[] = 'geodir_detail_top';
163
+		}
174 164
 
175
-        /*==================================*/
176
-        /* Detail/Single page sidebars end*/
177
-        /*==================================*/
165
+		register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
178 166
 
179
-        /*==================================*/
180
-        /* Author page sidebars start       */
181
-        /*==================================*/
167
+		$geodir_sidebars[] = 'geodir_detail_sidebar';
182 168
 
183
-        if (get_option('geodir_show_author_top_section')) {
184
-            register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
169
+		if (get_option('geodir_show_detail_bottom_section')) {
170
+			register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
185 171
 
186
-            $geodir_sidebars[] = 'geodir_author_top';
187
-        }
172
+			$geodir_sidebars[] = 'geodir_detail_bottom';
173
+		}
188 174
 
189
-        if (get_option('geodir_show_author_left_section')) {
190
-            register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
175
+		/*==================================*/
176
+		/* Detail/Single page sidebars end*/
177
+		/*==================================*/
191 178
 
192
-            $geodir_sidebars[] = 'geodir_author_left_sidebar';
193
-        }
179
+		/*==================================*/
180
+		/* Author page sidebars start       */
181
+		/*==================================*/
194 182
 
195
-        if (get_option('geodir_show_author_right_section')) {
196
-            register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
183
+		if (get_option('geodir_show_author_top_section')) {
184
+			register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
197 185
 
198
-            $geodir_sidebars[] = 'geodir_author_right_sidebar';
199
-        }
186
+			$geodir_sidebars[] = 'geodir_author_top';
187
+		}
200 188
 
201
-        if (get_option('geodir_show_author_bottom_section')) {
202
-            register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
189
+		if (get_option('geodir_show_author_left_section')) {
190
+			register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
203 191
 
204
-            $geodir_sidebars[] = 'geodir_author_bottom';
205
-        }
192
+			$geodir_sidebars[] = 'geodir_author_left_sidebar';
193
+		}
206 194
 
207
-        /*==================================*/
208
-        /* Author page sidebars end         */
209
-        /*==================================*/
195
+		if (get_option('geodir_show_author_right_section')) {
196
+			register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
210 197
 
211
-        /*==================================*/
212
-        /* Add listing page sidebars start       */
213
-        /*==================================*/
198
+			$geodir_sidebars[] = 'geodir_author_right_sidebar';
199
+		}
214 200
 
215
-        register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
201
+		if (get_option('geodir_show_author_bottom_section')) {
202
+			register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
216 203
 
217
-        $geodir_sidebars[] = 'geodir_add_listing_sidebar';
204
+			$geodir_sidebars[] = 'geodir_author_bottom';
205
+		}
218 206
 
219
-        /*==================================*/
220
-        /* Add listing page sidebars end         */
221
-        /*==================================*/
207
+		/*==================================*/
208
+		/* Author page sidebars end         */
209
+		/*==================================*/
222 210
 
223
-    }
211
+		/*==================================*/
212
+		/* Add listing page sidebars start       */
213
+		/*==================================*/
214
+
215
+		register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
216
+
217
+		$geodir_sidebars[] = 'geodir_add_listing_sidebar';
218
+
219
+		/*==================================*/
220
+		/* Add listing page sidebars end         */
221
+		/*==================================*/
222
+
223
+	}
224 224
 }
225 225
 
226 226
 
227 227
 if (!function_exists('register_geodir_widgets')) {
228
-    /**
229
-     * Registers all Widgets.
230
-     *
231
-     * @since 1.0.0
232
-     * @package GeoDirectory
233
-     */
234
-    function register_geodir_widgets()
235
-    {
236
-        /**
237
-         * Login Widget.
238
-         *
239
-         * @since 1.0.0
240
-         */
241
-        class geodir_loginwidget extends WP_Widget
242
-        {
243
-            /**
244
-             * Register the login widget with WordPress.
245
-             *
246
-             * @since 1.0.0
247
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
-             */
249
-            public function __construct() {
250
-                $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
-                parent::__construct(
252
-                    'geodir_loginbox', // Base ID
253
-                    __('GD > Loginbox', 'geodirectory'), // Name
254
-                    $widget_ops// Args
255
-                );
256
-            }
257
-
258
-            /**
259
-             * Front-end display content for login widget.
260
-             *
261
-             * @since 1.0.0
262
-             * @since 1.5.1 Declare function public.
263
-             *
264
-             * @param array $args     Widget arguments.
265
-             * @param array $instance Saved values from database.
266
-             */
267
-            public function widget($args, $instance)
268
-            {
269
-                geodir_loginwidget_output($args, $instance);
270
-            }
271
-
272
-            /**
273
-             * Sanitize login widget form values as they are saved.
274
-             *
275
-             * @since 1.0.0
276
-             * @since 1.5.1 Declare function public.
277
-             *
278
-             * @param array $new_instance Values just sent to be saved.
279
-             * @param array $old_instance Previously saved values from database.
280
-             *
281
-             * @return array Updated safe values to be saved.
282
-             */
283
-            public function update($new_instance, $old_instance)
284
-            {
285
-                //save the widget
286
-                $instance = $old_instance;
287
-                $instance['title'] = strip_tags($new_instance['title']);
288
-
289
-                return $instance;
290
-            }
291
-
292
-            /**
293
-             * Back-end login widget settings form.
294
-             *
295
-             * @since 1.0.0
296
-             * @since 1.5.1 Declare function public.
297
-             *
298
-             * @param array $instance Previously saved values from database.
299
-             * @return string|void
300
-             */
301
-            public function form($instance)
302
-            {
303
-                //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
-                $title = strip_tags($instance['title']);
306
-
307
-                ?>
228
+	/**
229
+	 * Registers all Widgets.
230
+	 *
231
+	 * @since 1.0.0
232
+	 * @package GeoDirectory
233
+	 */
234
+	function register_geodir_widgets()
235
+	{
236
+		/**
237
+		 * Login Widget.
238
+		 *
239
+		 * @since 1.0.0
240
+		 */
241
+		class geodir_loginwidget extends WP_Widget
242
+		{
243
+			/**
244
+			 * Register the login widget with WordPress.
245
+			 *
246
+			 * @since 1.0.0
247
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
+			 */
249
+			public function __construct() {
250
+				$widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
+				parent::__construct(
252
+					'geodir_loginbox', // Base ID
253
+					__('GD > Loginbox', 'geodirectory'), // Name
254
+					$widget_ops// Args
255
+				);
256
+			}
257
+
258
+			/**
259
+			 * Front-end display content for login widget.
260
+			 *
261
+			 * @since 1.0.0
262
+			 * @since 1.5.1 Declare function public.
263
+			 *
264
+			 * @param array $args     Widget arguments.
265
+			 * @param array $instance Saved values from database.
266
+			 */
267
+			public function widget($args, $instance)
268
+			{
269
+				geodir_loginwidget_output($args, $instance);
270
+			}
271
+
272
+			/**
273
+			 * Sanitize login widget form values as they are saved.
274
+			 *
275
+			 * @since 1.0.0
276
+			 * @since 1.5.1 Declare function public.
277
+			 *
278
+			 * @param array $new_instance Values just sent to be saved.
279
+			 * @param array $old_instance Previously saved values from database.
280
+			 *
281
+			 * @return array Updated safe values to be saved.
282
+			 */
283
+			public function update($new_instance, $old_instance)
284
+			{
285
+				//save the widget
286
+				$instance = $old_instance;
287
+				$instance['title'] = strip_tags($new_instance['title']);
288
+
289
+				return $instance;
290
+			}
291
+
292
+			/**
293
+			 * Back-end login widget settings form.
294
+			 *
295
+			 * @since 1.0.0
296
+			 * @since 1.5.1 Declare function public.
297
+			 *
298
+			 * @param array $instance Previously saved values from database.
299
+			 * @return string|void
300
+			 */
301
+			public function form($instance)
302
+			{
303
+				//widgetform in backend
304
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
+				$title = strip_tags($instance['title']);
306
+
307
+				?>
308 308
                 <p><label
309 309
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
310 310
                         : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -313,64 +313,64 @@  discard block
 block discarded – undo
313 313
 
314 314
 
315 315
             <?php
316
-            }
317
-        }
318
-
319
-        register_widget('geodir_loginwidget');
320
-
321
-
322
-        /**
323
-         * GeoDirectory Social Like Widget.
324
-         *
325
-         * @since 1.0.0
326
-         */
327
-        class geodir_social_like_widget extends WP_Widget
328
-        {
329
-
330
-            /**
331
-             * Register the social like widget with WordPress.
332
-             *
333
-             * @since 1.0.0
334
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
-             */
336
-            public function __construct() {
337
-                $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
-                parent::__construct(
339
-                    'social_like_widget', // Base ID
340
-                    __('GD > Social Like', 'geodirectory'), // Name
341
-                    $widget_ops// Args
342
-                );
343
-            }
344
-
345
-            /**
346
-             * Front-end display content for social like widget.
347
-             *
348
-             * @since 1.0.0
349
-             * @since 1.5.1 Declare function public.
350
-             *
351
-             * @param array $args     Widget arguments.
352
-             * @param array $instance Saved values from database.
353
-             */
354
-            public function widget($args, $instance)
355
-            {
356
-                // prints the widget
357
-                extract($args, EXTR_SKIP);
358
-
359
-                /**
360
-                 * Filter the widget title text.
361
-                 *
362
-                 * @since 1.0.0
363
-                 * @global object $current_user Current user object.
364
-                 * @param string $title The widget title text.
365
-                 */
366
-                $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
-
368
-                global $current_user, $post;
369
-                echo $before_widget;
370
-                ?>
316
+			}
317
+		}
318
+
319
+		register_widget('geodir_loginwidget');
320
+
321
+
322
+		/**
323
+		 * GeoDirectory Social Like Widget.
324
+		 *
325
+		 * @since 1.0.0
326
+		 */
327
+		class geodir_social_like_widget extends WP_Widget
328
+		{
329
+
330
+			/**
331
+			 * Register the social like widget with WordPress.
332
+			 *
333
+			 * @since 1.0.0
334
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
+			 */
336
+			public function __construct() {
337
+				$widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
+				parent::__construct(
339
+					'social_like_widget', // Base ID
340
+					__('GD > Social Like', 'geodirectory'), // Name
341
+					$widget_ops// Args
342
+				);
343
+			}
344
+
345
+			/**
346
+			 * Front-end display content for social like widget.
347
+			 *
348
+			 * @since 1.0.0
349
+			 * @since 1.5.1 Declare function public.
350
+			 *
351
+			 * @param array $args     Widget arguments.
352
+			 * @param array $instance Saved values from database.
353
+			 */
354
+			public function widget($args, $instance)
355
+			{
356
+				// prints the widget
357
+				extract($args, EXTR_SKIP);
358
+
359
+				/**
360
+				 * Filter the widget title text.
361
+				 *
362
+				 * @since 1.0.0
363
+				 * @global object $current_user Current user object.
364
+				 * @param string $title The widget title text.
365
+				 */
366
+				$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
+
368
+				global $current_user, $post;
369
+				echo $before_widget;
370
+				?>
371 371
 
372 372
                 <?php //if ( get_option('gd_tweet_button') ) {
373
-                ?>
373
+				?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376 376
                    class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
380 380
                 <?php //}
381
-                ?>
381
+				?>
382 382
 
383 383
                 <?php // if ( get_option('gd_facebook_button') ) {
384
-                ?>
384
+				?>
385 385
 
386 386
                 <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
387
-                    echo 'allowtransparency="true"';
388
-                }?> class="facebook"
387
+					echo 'allowtransparency="true"';
388
+				}?> class="facebook"
389 389
                     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
390 390
                     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
391 391
 
392 392
 
393 393
                 <?php //}
394
-                ?>
394
+				?>
395 395
 
396 396
                 <?php //if ( get_option('gd_google_button') ) {
397
-                ?>
397
+				?>
398 398
                 <script>
399 399
                     window.___gcfg = {
400 400
                         parsetags: 'explicit'
@@ -408,118 +408,118 @@  discard block
 block discarded – undo
408 408
                         "count": "true"
409 409
                     });</script>
410 410
                 <?php //}
411
-                echo $after_widget;
412
-
413
-            }
414
-
415
-            /**
416
-             * Sanitize social like widget form values as they are saved.
417
-             *
418
-             * @since 1.0.0
419
-             * @since 1.5.1 Declare function public.
420
-             *
421
-             * @param array $new_instance Values just sent to be saved.
422
-             * @param array $old_instance Previously saved values from database.
423
-             *
424
-             * @return array Updated safe values to be saved.
425
-             */
426
-            public function update($new_instance, $old_instance)
427
-            {
428
-                //save the widget
429
-                $instance = $old_instance;
430
-                $instance['title'] = strip_tags($new_instance['title']);
431
-                return $instance;
432
-            }
433
-
434
-            /**
435
-             * Back-end social like widget settings form.
436
-             *
437
-             * @since 1.0.0
438
-             * @since 1.5.1 Declare function public.
439
-             *
440
-             * @param array $instance Previously saved values from database.
441
-             * @return string|void
442
-             */
443
-            public function form($instance)
444
-            {
445
-                //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
447
-                $title = strip_tags($instance['title']);
448
-                ?>
411
+				echo $after_widget;
412
+
413
+			}
414
+
415
+			/**
416
+			 * Sanitize social like widget form values as they are saved.
417
+			 *
418
+			 * @since 1.0.0
419
+			 * @since 1.5.1 Declare function public.
420
+			 *
421
+			 * @param array $new_instance Values just sent to be saved.
422
+			 * @param array $old_instance Previously saved values from database.
423
+			 *
424
+			 * @return array Updated safe values to be saved.
425
+			 */
426
+			public function update($new_instance, $old_instance)
427
+			{
428
+				//save the widget
429
+				$instance = $old_instance;
430
+				$instance['title'] = strip_tags($new_instance['title']);
431
+				return $instance;
432
+			}
433
+
434
+			/**
435
+			 * Back-end social like widget settings form.
436
+			 *
437
+			 * @since 1.0.0
438
+			 * @since 1.5.1 Declare function public.
439
+			 *
440
+			 * @param array $instance Previously saved values from database.
441
+			 * @return string|void
442
+			 */
443
+			public function form($instance)
444
+			{
445
+				//widgetform in backend
446
+				$instance = wp_parse_args((array)$instance, array('title' => ''));
447
+				$title = strip_tags($instance['title']);
448
+				?>
449 449
                 <p>No settings for this widget</p>
450 450
 
451 451
 
452 452
             <?php
453
-            }
454
-        }
455
-
456
-        register_widget('geodir_social_like_widget');
457
-
458
-
459
-        /**
460
-         * GeoDirectory Feedburner Subscribe widget.
461
-         *
462
-         * @since 1.0.0
463
-         */
464
-        class geodirsubscribeWidget extends WP_Widget
465
-        {
466
-
467
-            /**
468
-             * Register the feedburner subscribe widget with WordPress.
469
-             *
470
-             * @since 1.0.0
471
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
-             */
473
-            public function __construct() {
474
-                $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
-                parent::__construct(
476
-                    'widget_subscribeWidget', // Base ID
477
-                    __('GD > Subscribe', 'geodirectory'), // Name
478
-                    $widget_ops// Args
479
-                );
480
-            }
481
-
482
-            /**
483
-             * Front-end display content for feedburner subscribe widget.
484
-             *
485
-             * @since 1.0.0
486
-             * @since 1.5.1 Declare function public.
487
-             *
488
-             * @param array $args     Widget arguments.
489
-             * @param array $instance Saved values from database.
490
-             */
491
-            public function widget($args, $instance)
492
-            {
493
-                // prints the widget
494
-                extract($args, EXTR_SKIP);
495
-
496
-                /**
497
-                 * Filter the widget instance id.
498
-                 *
499
-                 * @since 1.0.0
500
-                 * @param string $id The widget instance id.
501
-                 */
502
-                $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
-
504
-                /** This filter is documented in geodirectory_widgets.php */
505
-                $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
-
507
-                /**
508
-                 * Filter the widget text.
509
-                 *
510
-                 * @since 1.0.0
511
-                 * @param string $text The widget text.
512
-                 */
513
-                $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
-
515
-                echo $before_widget;
516
-                ?>
453
+			}
454
+		}
455
+
456
+		register_widget('geodir_social_like_widget');
457
+
458
+
459
+		/**
460
+		 * GeoDirectory Feedburner Subscribe widget.
461
+		 *
462
+		 * @since 1.0.0
463
+		 */
464
+		class geodirsubscribeWidget extends WP_Widget
465
+		{
466
+
467
+			/**
468
+			 * Register the feedburner subscribe widget with WordPress.
469
+			 *
470
+			 * @since 1.0.0
471
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
+			 */
473
+			public function __construct() {
474
+				$widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
+				parent::__construct(
476
+					'widget_subscribeWidget', // Base ID
477
+					__('GD > Subscribe', 'geodirectory'), // Name
478
+					$widget_ops// Args
479
+				);
480
+			}
481
+
482
+			/**
483
+			 * Front-end display content for feedburner subscribe widget.
484
+			 *
485
+			 * @since 1.0.0
486
+			 * @since 1.5.1 Declare function public.
487
+			 *
488
+			 * @param array $args     Widget arguments.
489
+			 * @param array $instance Saved values from database.
490
+			 */
491
+			public function widget($args, $instance)
492
+			{
493
+				// prints the widget
494
+				extract($args, EXTR_SKIP);
495
+
496
+				/**
497
+				 * Filter the widget instance id.
498
+				 *
499
+				 * @since 1.0.0
500
+				 * @param string $id The widget instance id.
501
+				 */
502
+				$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
+
504
+				/** This filter is documented in geodirectory_widgets.php */
505
+				$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
+
507
+				/**
508
+				 * Filter the widget text.
509
+				 *
510
+				 * @since 1.0.0
511
+				 * @param string $text The widget text.
512
+				 */
513
+				$text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
+
515
+				echo $before_widget;
516
+				?>
517 517
 
518 518
                 <?php echo $before_title . $title; ?>  <a href="<?php if ($id) {
519
-                echo 'http://feeds2.feedburner.com/' . $id;
520
-            } else {
521
-                bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
519
+				echo 'http://feeds2.feedburner.com/' . $id;
520
+			} else {
521
+				bloginfo('rss_url');
522
+			} ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -544,57 +544,57 @@  discard block
 block discarded – undo
544 544
                 </form>
545 545
 
546 546
                 <?php
547
-                echo $after_widget;
547
+				echo $after_widget;
548 548
 
549
-            }
549
+			}
550 550
 
551
-            /**
552
-             * Sanitize feedburner subscribe widget form values as they are saved.
553
-             *
554
-             * @since 1.0.0
555
-             * @since 1.5.1 Declare function public.
556
-             *
557
-             * @param array $new_instance Values just sent to be saved.
558
-             * @param array $old_instance Previously saved values from database.
559
-             *
560
-             * @return array Updated safe values to be saved.
561
-             */
562
-            public function update($new_instance, $old_instance)
563
-            {
551
+			/**
552
+			 * Sanitize feedburner subscribe widget form values as they are saved.
553
+			 *
554
+			 * @since 1.0.0
555
+			 * @since 1.5.1 Declare function public.
556
+			 *
557
+			 * @param array $new_instance Values just sent to be saved.
558
+			 * @param array $old_instance Previously saved values from database.
559
+			 *
560
+			 * @return array Updated safe values to be saved.
561
+			 */
562
+			public function update($new_instance, $old_instance)
563
+			{
564 564
 
565
-                //save the widget
566
-                $instance = $old_instance;
567
-                $instance['id'] = strip_tags($new_instance['id']);
568
-                $instance['title'] = ($new_instance['title']);
569
-                $instance['text'] = ($new_instance['text']);
565
+				//save the widget
566
+				$instance = $old_instance;
567
+				$instance['id'] = strip_tags($new_instance['id']);
568
+				$instance['title'] = ($new_instance['title']);
569
+				$instance['text'] = ($new_instance['text']);
570 570
 
571 571
 
572
-                return $instance;
573
-            }
572
+				return $instance;
573
+			}
574 574
 
575
-            /**
576
-             * Back-end feedburner subscribe widget settings form.
577
-             *
578
-             * @since 1.0.0
579
-             * @since 1.5.1 Declare function public.
580
-             *
581
-             * @param array $instance Previously saved values from database.
582
-             * @return string|void
583
-             */
584
-            public function form($instance)
585
-            {
586
-                //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
575
+			/**
576
+			 * Back-end feedburner subscribe widget settings form.
577
+			 *
578
+			 * @since 1.0.0
579
+			 * @since 1.5.1 Declare function public.
580
+			 *
581
+			 * @param array $instance Previously saved values from database.
582
+			 * @return string|void
583
+			 */
584
+			public function form($instance)
585
+			{
586
+				//widgetform in backend
587
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589
-                $id = strip_tags($instance['id']);
589
+				$id = strip_tags($instance['id']);
590 590
 
591
-                $title = strip_tags($instance['title']);
591
+				$title = strip_tags($instance['title']);
592 592
 
593
-                $text = strip_tags($instance['text']);
593
+				$text = strip_tags($instance['text']);
594 594
 
595 595
 
596 596
 
597
-                ?>
597
+				?>
598 598
                 <p><label
599 599
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -613,101 +613,101 @@  discard block
 block discarded – undo
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
615 615
             <?php
616
-            }
617
-        }
618
-
619
-        register_widget('geodirsubscribeWidget');
620
-
621
-        /**
622
-         * GeoDirectory advertise widget.
623
-         *
624
-         * @since 1.0.0
625
-         */
626
-        class geodiradvtwidget extends WP_Widget
627
-        {
628
-
629
-            /**
630
-             * Register the advertise widget with WordPress.
631
-             *
632
-             * @since 1.0.0
633
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
-             */
635
-            public function __construct() {
636
-                $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
-                parent::__construct(
638
-                    'advtwidget', // Base ID
639
-                    __('GD > Advertise', 'geodirectory'), // Name
640
-                    $widget_ops// Args
641
-                );
642
-            }
643
-
644
-
645
-            /**
646
-             * Front-end display content for advertise widget.
647
-             *
648
-             * @since 1.0.0
649
-             * @since 1.5.1 Declare function public.
650
-             *
651
-             * @param array $args     Widget arguments.
652
-             * @param array $instance Saved values from database.
653
-             */
654
-            public function widget($args, $instance)
655
-            {
656
-
657
-                // prints the widget
658
-
659
-                extract($args, EXTR_SKIP);
660
-
661
-                /**
662
-                 * Filter the description text.
663
-                 *
664
-                 * @since 1.0.0
665
-                 * @param string $desc1 The widget description text.
666
-                 */
667
-                $desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
-                echo $before_widget;
669
-                ?>
616
+			}
617
+		}
618
+
619
+		register_widget('geodirsubscribeWidget');
620
+
621
+		/**
622
+		 * GeoDirectory advertise widget.
623
+		 *
624
+		 * @since 1.0.0
625
+		 */
626
+		class geodiradvtwidget extends WP_Widget
627
+		{
628
+
629
+			/**
630
+			 * Register the advertise widget with WordPress.
631
+			 *
632
+			 * @since 1.0.0
633
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
+			 */
635
+			public function __construct() {
636
+				$widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
+				parent::__construct(
638
+					'advtwidget', // Base ID
639
+					__('GD > Advertise', 'geodirectory'), // Name
640
+					$widget_ops// Args
641
+				);
642
+			}
643
+
644
+
645
+			/**
646
+			 * Front-end display content for advertise widget.
647
+			 *
648
+			 * @since 1.0.0
649
+			 * @since 1.5.1 Declare function public.
650
+			 *
651
+			 * @param array $args     Widget arguments.
652
+			 * @param array $instance Saved values from database.
653
+			 */
654
+			public function widget($args, $instance)
655
+			{
656
+
657
+				// prints the widget
658
+
659
+				extract($args, EXTR_SKIP);
660
+
661
+				/**
662
+				 * Filter the description text.
663
+				 *
664
+				 * @since 1.0.0
665
+				 * @param string $desc1 The widget description text.
666
+				 */
667
+				$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
+				echo $before_widget;
669
+				?>
670 670
                 <?php if ($desc1 <> "") { ?>
671 671
                 <?php echo $desc1; ?>
672 672
             <?php }
673
-                echo $after_widget;
674
-            }
675
-
676
-            /**
677
-             * Sanitize advertise widget form values as they are saved.
678
-             *
679
-             * @since 1.0.0
680
-             * @since 1.5.1 Declare function public.
681
-             *
682
-             * @param array $new_instance Values just sent to be saved.
683
-             * @param array $old_instance Previously saved values from database.
684
-             *
685
-             * @return array Updated safe values to be saved.
686
-             */
687
-            public function update($new_instance, $old_instance)
688
-            {
689
-                //save the widget
690
-                $instance = $old_instance;
691
-                $instance['desc1'] = ($new_instance['desc1']);
692
-                return $instance;
693
-            }
694
-
695
-            /**
696
-             * Back-end advertise widget settings form.
697
-             *
698
-             * @since 1.0.0
699
-             * @since 1.5.1 Declare function public.
700
-             *
701
-             * @param array $instance Previously saved values from database.
702
-             * @return string|void
703
-             */
704
-            public function form($instance)
705
-            {
706
-                //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
-
709
-                $desc1 = ($instance['desc1']);
710
-                ?>
673
+				echo $after_widget;
674
+			}
675
+
676
+			/**
677
+			 * Sanitize advertise widget form values as they are saved.
678
+			 *
679
+			 * @since 1.0.0
680
+			 * @since 1.5.1 Declare function public.
681
+			 *
682
+			 * @param array $new_instance Values just sent to be saved.
683
+			 * @param array $old_instance Previously saved values from database.
684
+			 *
685
+			 * @return array Updated safe values to be saved.
686
+			 */
687
+			public function update($new_instance, $old_instance)
688
+			{
689
+				//save the widget
690
+				$instance = $old_instance;
691
+				$instance['desc1'] = ($new_instance['desc1']);
692
+				return $instance;
693
+			}
694
+
695
+			/**
696
+			 * Back-end advertise widget settings form.
697
+			 *
698
+			 * @since 1.0.0
699
+			 * @since 1.5.1 Declare function public.
700
+			 *
701
+			 * @param array $instance Previously saved values from database.
702
+			 * @return string|void
703
+			 */
704
+			public function form($instance)
705
+			{
706
+				//widgetform in backend
707
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
+
709
+				$desc1 = ($instance['desc1']);
710
+				?>
711 711
                 <p><label
712 712
                         for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
@@ -715,65 +715,65 @@  discard block
 block discarded – undo
715 715
                 </p>
716 716
 
717 717
             <?php
718
-            }
719
-        }
720
-
721
-        register_widget('geodiradvtwidget');
722
-
723
-        /**
724
-         * GeoDirectory Flickr widget.
725
-         *
726
-         * @since 1.0.0
727
-         */
728
-        class GeodirFlickrWidget extends WP_Widget
729
-        {
730
-
731
-            /**
732
-             * Register the flickr widget with WordPress.
733
-             *
734
-             * @since 1.0.0
735
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
-             */
737
-            public function __construct() {
738
-                $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
-                parent::__construct(
740
-                    'widget_flickrwidget', // Base ID
741
-                    __('GD > Flickr Photos', 'geodirectory'), // Name
742
-                    $widget_ops// Args
743
-                );
744
-            }
745
-
746
-            /**
747
-             * Front-end display content for flickr widget.
748
-             *
749
-             * @since 1.0.0
750
-             * @since 1.5.1 Declare function public.
751
-             *
752
-             * @param array $args     Widget arguments.
753
-             * @param array $instance Saved values from database.
754
-             */
755
-            public function widget($args, $instance)
756
-            {
757
-
758
-                // prints the widget
759
-                extract($args, EXTR_SKIP);
760
-
761
-                echo $before_widget;
762
-
763
-                /** This filter is documented in geodirectory_widgets.php */
764
-                $id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
-
766
-                /**
767
-                 * Filter the widget number.
768
-                 *
769
-                 * This is used in the flicker widget to show how many images to show.
770
-                 *
771
-                 * @since 1.0.0
772
-                 * @param string $number The image count.
773
-                 */
774
-                $number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
-                echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
-                ?>
718
+			}
719
+		}
720
+
721
+		register_widget('geodiradvtwidget');
722
+
723
+		/**
724
+		 * GeoDirectory Flickr widget.
725
+		 *
726
+		 * @since 1.0.0
727
+		 */
728
+		class GeodirFlickrWidget extends WP_Widget
729
+		{
730
+
731
+			/**
732
+			 * Register the flickr widget with WordPress.
733
+			 *
734
+			 * @since 1.0.0
735
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
+			 */
737
+			public function __construct() {
738
+				$widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
+				parent::__construct(
740
+					'widget_flickrwidget', // Base ID
741
+					__('GD > Flickr Photos', 'geodirectory'), // Name
742
+					$widget_ops// Args
743
+				);
744
+			}
745
+
746
+			/**
747
+			 * Front-end display content for flickr widget.
748
+			 *
749
+			 * @since 1.0.0
750
+			 * @since 1.5.1 Declare function public.
751
+			 *
752
+			 * @param array $args     Widget arguments.
753
+			 * @param array $instance Saved values from database.
754
+			 */
755
+			public function widget($args, $instance)
756
+			{
757
+
758
+				// prints the widget
759
+				extract($args, EXTR_SKIP);
760
+
761
+				echo $before_widget;
762
+
763
+				/** This filter is documented in geodirectory_widgets.php */
764
+				$id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
+
766
+				/**
767
+				 * Filter the widget number.
768
+				 *
769
+				 * This is used in the flicker widget to show how many images to show.
770
+				 *
771
+				 * @since 1.0.0
772
+				 * @param string $number The image count.
773
+				 */
774
+				$number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
+				echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
+				?>
777 777
 
778 778
                 <div class="geodir-flickr clearfix">
779 779
 
@@ -784,45 +784,45 @@  discard block
 block discarded – undo
784 784
 
785 785
 
786 786
                 <?php echo $after_widget;
787
-            }
788
-
789
-            /**
790
-             * Sanitize flickr widget form values as they are saved.
791
-             *
792
-             * @since 1.0.0
793
-             * @since 1.5.1 Declare function public.
794
-             *
795
-             * @param array $new_instance Values just sent to be saved.
796
-             * @param array $old_instance Previously saved values from database.
797
-             *
798
-             * @return array Updated safe values to be saved.
799
-             */
800
-            public function update($new_instance, $old_instance)
801
-            {
802
-                //save the widget
803
-                $instance = $old_instance;
804
-                $instance['id'] = strip_tags($new_instance['id']);
805
-                $instance['number'] = strip_tags($new_instance['number']);
806
-                return $instance;
807
-            }
808
-
809
-            /**
810
-             * Back-end flickr widget settings form.
811
-             *
812
-             * @since 1.0.0
813
-             * @since 1.5.1 Declare function public.
814
-             *
815
-             * @param array $instance Previously saved values from database.
816
-             * @return string|void
817
-             */
818
-            public function form($instance)
819
-            {
820
-
821
-                //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
-                $id = strip_tags($instance['id']);
824
-                $number = strip_tags($instance['number']);
825
-                ?>
787
+			}
788
+
789
+			/**
790
+			 * Sanitize flickr widget form values as they are saved.
791
+			 *
792
+			 * @since 1.0.0
793
+			 * @since 1.5.1 Declare function public.
794
+			 *
795
+			 * @param array $new_instance Values just sent to be saved.
796
+			 * @param array $old_instance Previously saved values from database.
797
+			 *
798
+			 * @return array Updated safe values to be saved.
799
+			 */
800
+			public function update($new_instance, $old_instance)
801
+			{
802
+				//save the widget
803
+				$instance = $old_instance;
804
+				$instance['id'] = strip_tags($new_instance['id']);
805
+				$instance['number'] = strip_tags($new_instance['number']);
806
+				return $instance;
807
+			}
808
+
809
+			/**
810
+			 * Back-end flickr widget settings form.
811
+			 *
812
+			 * @since 1.0.0
813
+			 * @since 1.5.1 Declare function public.
814
+			 *
815
+			 * @param array $instance Previously saved values from database.
816
+			 * @return string|void
817
+			 */
818
+			public function form($instance)
819
+			{
820
+
821
+				//widgetform in backend
822
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
+				$id = strip_tags($instance['id']);
824
+				$number = strip_tags($instance['number']);
825
+				?>
826 826
 
827 827
                 <p>
828 828
                     <label
@@ -843,99 +843,99 @@  discard block
 block discarded – undo
843 843
                     </label>
844 844
                 </p>
845 845
             <?php
846
-            }
847
-        }
848
-
849
-        register_widget('GeodirFlickrWidget');
850
-
851
-        /**
852
-         * GeoDirectory Twitter widget.
853
-         *
854
-         * @since 1.0.0
855
-         */
856
-        class geodir_twitter extends WP_Widget
857
-        {
858
-            /**
859
-             * Register the Twitter widget with WordPress.
860
-             *
861
-             * @since 1.0.0
862
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
-             */
864
-            public function __construct() {
865
-                $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
-                parent::__construct(
867
-                    'widget_Twidget', // Base ID
868
-                    __('GD > Twitter', 'geodirectory'), // Name
869
-                    $widget_ops// Args
870
-                );
871
-            }
872
-
873
-
874
-            /**
875
-             * Front-end display content for Twitter widget.
876
-             *
877
-             * @since 1.0.0
878
-             * @since 1.5.1 Declare function public.
879
-             *
880
-             * @param array $args     Widget arguments.
881
-             * @param array $instance Saved values from database.
882
-             */
883
-            public function widget($args, $instance)
884
-            {
885
-
886
-                // prints the widget
887
-
888
-                extract($args, EXTR_SKIP);
889
-
890
-                /**
891
-                 * Filter the twitter widget description text.
892
-                 *
893
-                 * @since 1.0.0
894
-                 * @param string $desc1 The widget description text.
895
-                 */
896
-                $desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
-                echo $before_widget;
898
-                if ($desc1 <> "") {
899
-                    echo $desc1;
900
-                }
901
-                echo $after_widget;
902
-            }
903
-
904
-            /**
905
-             * Sanitize twitter widget form values as they are saved.
906
-             *
907
-             * @since 1.0.0
908
-             * @since 1.5.1 Declare function public.
909
-             *
910
-             * @param array $new_instance Values just sent to be saved.
911
-             * @param array $old_instance Previously saved values from database.
912
-             *
913
-             * @return array Updated safe values to be saved.
914
-             */
915
-            public function update($new_instance, $old_instance)
916
-            {
917
-                //save the widget
918
-                $instance = $old_instance;
919
-                $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
-                return $instance;
921
-            }
922
-
923
-            /**
924
-             * Back-end twitter widget settings form.
925
-             *
926
-             * @since 1.0.0
927
-             * @since 1.5.1 Declare function public.
928
-             *
929
-             * @param array $instance Previously saved values from database.
930
-             * @return string|void
931
-             */
932
-            public function form($instance)
933
-            {
934
-                //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
-
937
-                $desc1 = ($instance['gd_tw_desc1']);
938
-                ?>
846
+			}
847
+		}
848
+
849
+		register_widget('GeodirFlickrWidget');
850
+
851
+		/**
852
+		 * GeoDirectory Twitter widget.
853
+		 *
854
+		 * @since 1.0.0
855
+		 */
856
+		class geodir_twitter extends WP_Widget
857
+		{
858
+			/**
859
+			 * Register the Twitter widget with WordPress.
860
+			 *
861
+			 * @since 1.0.0
862
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
+			 */
864
+			public function __construct() {
865
+				$widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
+				parent::__construct(
867
+					'widget_Twidget', // Base ID
868
+					__('GD > Twitter', 'geodirectory'), // Name
869
+					$widget_ops// Args
870
+				);
871
+			}
872
+
873
+
874
+			/**
875
+			 * Front-end display content for Twitter widget.
876
+			 *
877
+			 * @since 1.0.0
878
+			 * @since 1.5.1 Declare function public.
879
+			 *
880
+			 * @param array $args     Widget arguments.
881
+			 * @param array $instance Saved values from database.
882
+			 */
883
+			public function widget($args, $instance)
884
+			{
885
+
886
+				// prints the widget
887
+
888
+				extract($args, EXTR_SKIP);
889
+
890
+				/**
891
+				 * Filter the twitter widget description text.
892
+				 *
893
+				 * @since 1.0.0
894
+				 * @param string $desc1 The widget description text.
895
+				 */
896
+				$desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
+				echo $before_widget;
898
+				if ($desc1 <> "") {
899
+					echo $desc1;
900
+				}
901
+				echo $after_widget;
902
+			}
903
+
904
+			/**
905
+			 * Sanitize twitter widget form values as they are saved.
906
+			 *
907
+			 * @since 1.0.0
908
+			 * @since 1.5.1 Declare function public.
909
+			 *
910
+			 * @param array $new_instance Values just sent to be saved.
911
+			 * @param array $old_instance Previously saved values from database.
912
+			 *
913
+			 * @return array Updated safe values to be saved.
914
+			 */
915
+			public function update($new_instance, $old_instance)
916
+			{
917
+				//save the widget
918
+				$instance = $old_instance;
919
+				$instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
+				return $instance;
921
+			}
922
+
923
+			/**
924
+			 * Back-end twitter widget settings form.
925
+			 *
926
+			 * @since 1.0.0
927
+			 * @since 1.5.1 Declare function public.
928
+			 *
929
+			 * @param array $instance Previously saved values from database.
930
+			 * @return string|void
931
+			 */
932
+			public function form($instance)
933
+			{
934
+				//widgetform in backend
935
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
+
937
+				$desc1 = ($instance['gd_tw_desc1']);
938
+				?>
939 939
                 <p><label
940 940
                         for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
@@ -944,169 +944,169 @@  discard block
 block discarded – undo
944 944
                 </p>
945 945
 
946 946
             <?php
947
-            }
948
-        }
949
-
950
-        register_widget('geodir_twitter');
951
-
952
-        /**
953
-         * GeoDirectory Advanced Search widget.
954
-         *
955
-         * @since 1.0.0
956
-         */
957
-        class geodir_advance_search_widget extends WP_Widget
958
-        {
959
-            /**
960
-             * Register the advanced search widget with WordPress.
961
-             *
962
-             * @since 1.0.0
963
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
-             */
965
-            public function __construct() {
966
-                $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'));
967
-                parent::__construct(
968
-                    'geodir_advance_search', // Base ID
969
-                    __('GD > Search', 'geodirectory'), // Name
970
-                    $widget_ops// Args
971
-                );
972
-            }
973
-
974
-
975
-            /**
976
-             * Front-end display content for advanced search widget.
977
-             *
978
-             * @since 1.0.0
979
-             * @since 1.5.1 Declare function public.
980
-             *
981
-             * @param array $args     Widget arguments.
982
-             * @param array $instance Saved values from database.
983
-             */
984
-            public function widget($args, $instance)
985
-            {
986
-                /**
987
-                 * Filter the search widget arguments.
988
-                 *
989
-                 * @since 1.5.7
990
-                 * @param array $args The widget arguments.
991
-                 * @param array $instance The widget instance.
992
-                 */
993
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
-
995
-                // prints the widget
996
-                extract($args, EXTR_SKIP);
997
-
998
-                echo $before_widget;
999
-
1000
-                /** This filter is documented in geodirectory_widgets.php */
1001
-                $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1002
-
1003
-                geodir_get_template_part('listing', 'filter-form');
1004
-
1005
-                echo $after_widget;
1006
-            }
1007
-
1008
-            /**
1009
-             * Sanitize advanced search widget form values as they are saved.
1010
-             *
1011
-             * @since 1.0.0
1012
-             * @since 1.5.1 Declare function public.
1013
-             *
1014
-             * @param array $new_instance Values just sent to be saved.
1015
-             * @param array $old_instance Previously saved values from database.
1016
-             *
1017
-             * @return array Updated safe values to be saved.
1018
-             */
1019
-            public function update($new_instance, $old_instance)
1020
-            {
1021
-                //save the widget
1022
-                //Nothing to save
1023
-                return isset($instance) ? $instance : '';
1024
-            }
1025
-
1026
-            /**
1027
-             * Back-end advanced search widget settings form.
1028
-             *
1029
-             * @since 1.0.0
1030
-             * @since 1.5.1 Declare function public.
1031
-             *
1032
-             * @param array $instance Previously saved values from database.
1033
-             * @return string|void
1034
-             */
1035
-            public function form($instance)
1036
-            {
1037
-                //widgetform in backend
1038
-                echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1039
-            }
1040
-        }
1041
-
1042
-        register_widget('geodir_advance_search_widget');
1043
-
1044
-
1045
-        /**
1046
-         * Contains all functions for popular widget.
1047
-         *
1048
-         * @since 1.0.0
1049
-         * @package GeoDirectory
1050
-         */
1051
-        include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1052
-        /**
1053
-         * Contains all functions for listing slider widget.
1054
-         *
1055
-         * @since 1.0.0
1056
-         * @package GeoDirectory
1057
-         */
1058
-        include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1059
-        /**
1060
-         * Contains all functions for home map widget.
1061
-         *
1062
-         * @since 1.0.0
1063
-         * @package GeoDirectory
1064
-         */
1065
-        include_once('geodirectory-widgets/home_map_widget.php');
1066
-        /**
1067
-         * Contains all functions for listing map widget.
1068
-         *
1069
-         * @since 1.0.0
1070
-         * @package GeoDirectory
1071
-         */
1072
-        include_once('geodirectory-widgets/listing_map_widget.php');
1073
-        /**
1074
-         * Contains all functions for reviews widget.
1075
-         *
1076
-         * @since 1.0.0
1077
-         * @package GeoDirectory
1078
-         */
1079
-        include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1080
-        /**
1081
-         * Contains all functions for related listing widget.
1082
-         *
1083
-         * @since 1.0.0
1084
-         * @package GeoDirectory
1085
-         */
1086
-        include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1087
-        /**
1088
-         * Contains all functions for bestof widget.
1089
-         *
1090
-         * @since 1.0.0
1091
-         * @package GeoDirectory
1092
-         */
1093
-        include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
947
+			}
948
+		}
949
+
950
+		register_widget('geodir_twitter');
951
+
952
+		/**
953
+		 * GeoDirectory Advanced Search widget.
954
+		 *
955
+		 * @since 1.0.0
956
+		 */
957
+		class geodir_advance_search_widget extends WP_Widget
958
+		{
959
+			/**
960
+			 * Register the advanced search widget with WordPress.
961
+			 *
962
+			 * @since 1.0.0
963
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
+			 */
965
+			public function __construct() {
966
+				$widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'));
967
+				parent::__construct(
968
+					'geodir_advance_search', // Base ID
969
+					__('GD > Search', 'geodirectory'), // Name
970
+					$widget_ops// Args
971
+				);
972
+			}
973
+
974
+
975
+			/**
976
+			 * Front-end display content for advanced search widget.
977
+			 *
978
+			 * @since 1.0.0
979
+			 * @since 1.5.1 Declare function public.
980
+			 *
981
+			 * @param array $args     Widget arguments.
982
+			 * @param array $instance Saved values from database.
983
+			 */
984
+			public function widget($args, $instance)
985
+			{
986
+				/**
987
+				 * Filter the search widget arguments.
988
+				 *
989
+				 * @since 1.5.7
990
+				 * @param array $args The widget arguments.
991
+				 * @param array $instance The widget instance.
992
+				 */
993
+				$args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
+
995
+				// prints the widget
996
+				extract($args, EXTR_SKIP);
997
+
998
+				echo $before_widget;
999
+
1000
+				/** This filter is documented in geodirectory_widgets.php */
1001
+				$title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1002
+
1003
+				geodir_get_template_part('listing', 'filter-form');
1004
+
1005
+				echo $after_widget;
1006
+			}
1007
+
1008
+			/**
1009
+			 * Sanitize advanced search widget form values as they are saved.
1010
+			 *
1011
+			 * @since 1.0.0
1012
+			 * @since 1.5.1 Declare function public.
1013
+			 *
1014
+			 * @param array $new_instance Values just sent to be saved.
1015
+			 * @param array $old_instance Previously saved values from database.
1016
+			 *
1017
+			 * @return array Updated safe values to be saved.
1018
+			 */
1019
+			public function update($new_instance, $old_instance)
1020
+			{
1021
+				//save the widget
1022
+				//Nothing to save
1023
+				return isset($instance) ? $instance : '';
1024
+			}
1025
+
1026
+			/**
1027
+			 * Back-end advanced search widget settings form.
1028
+			 *
1029
+			 * @since 1.0.0
1030
+			 * @since 1.5.1 Declare function public.
1031
+			 *
1032
+			 * @param array $instance Previously saved values from database.
1033
+			 * @return string|void
1034
+			 */
1035
+			public function form($instance)
1036
+			{
1037
+				//widgetform in backend
1038
+				echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1039
+			}
1040
+		}
1041
+
1042
+		register_widget('geodir_advance_search_widget');
1043
+
1044
+
1045
+		/**
1046
+		 * Contains all functions for popular widget.
1047
+		 *
1048
+		 * @since 1.0.0
1049
+		 * @package GeoDirectory
1050
+		 */
1051
+		include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1052
+		/**
1053
+		 * Contains all functions for listing slider widget.
1054
+		 *
1055
+		 * @since 1.0.0
1056
+		 * @package GeoDirectory
1057
+		 */
1058
+		include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1059
+		/**
1060
+		 * Contains all functions for home map widget.
1061
+		 *
1062
+		 * @since 1.0.0
1063
+		 * @package GeoDirectory
1064
+		 */
1065
+		include_once('geodirectory-widgets/home_map_widget.php');
1066
+		/**
1067
+		 * Contains all functions for listing map widget.
1068
+		 *
1069
+		 * @since 1.0.0
1070
+		 * @package GeoDirectory
1071
+		 */
1072
+		include_once('geodirectory-widgets/listing_map_widget.php');
1073
+		/**
1074
+		 * Contains all functions for reviews widget.
1075
+		 *
1076
+		 * @since 1.0.0
1077
+		 * @package GeoDirectory
1078
+		 */
1079
+		include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1080
+		/**
1081
+		 * Contains all functions for related listing widget.
1082
+		 *
1083
+		 * @since 1.0.0
1084
+		 * @package GeoDirectory
1085
+		 */
1086
+		include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1087
+		/**
1088
+		 * Contains all functions for bestof widget.
1089
+		 *
1090
+		 * @since 1.0.0
1091
+		 * @package GeoDirectory
1092
+		 */
1093
+		include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
1094
+		/**
1095
+		 * Contains all functions for cpt categories widget.
1096
+		 *
1097
+		 * @since 1.5.4
1098
+		 * @package GeoDirectory
1099
+		 */
1100
+		include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1094 1101
 		/**
1095
-         * Contains all functions for cpt categories widget.
1096
-         *
1097
-         * @since 1.5.4
1098
-         * @package GeoDirectory
1099
-         */
1100
-        include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1101
-        /**
1102
-         * Contains all functions for features widget.
1103
-         *
1104
-         * @since 1.5.6
1105
-         * @package GeoDirectory
1106
-         * @todo make the image field recurring
1107
-         */
1108
-        include_once('geodirectory-widgets/geodirectory_features_widget.php');
1109
-    }
1102
+		 * Contains all functions for features widget.
1103
+		 *
1104
+		 * @since 1.5.6
1105
+		 * @package GeoDirectory
1106
+		 * @todo make the image field recurring
1107
+		 */
1108
+		include_once('geodirectory-widgets/geodirectory_features_widget.php');
1109
+	}
1110 1110
 
1111 1111
 }
1112 1112
 
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -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)) {
@@ -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)) {
@@ -1052,9 +1052,9 @@  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>' : '';
1055
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056 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>';
1057
+                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />' . $caption . '</li>';
1058 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
             }
@@ -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();
@@ -1168,12 +1168,12 @@  discard block
 block discarded – undo
1168 1168
                          * @param string $tag_link The tag link html.
1169 1169
                          * @param object $term The tag term object.
1170 1170
                          */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1171
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1172 1172
                         $links[] = $tag_link;
1173 1173
                     } else {
1174 1174
                         $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175 1175
                         /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1176
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1177 1177
                         $links[] = $tag_link;
1178 1178
                     }
1179 1179
                     $terms[] = $term;
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
             if (!isset($listing_label)) {
1184 1184
                 $listing_label = '';
1185 1185
             }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object)$terms);
1186
+            $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object) $terms);
1187 1187
         endif;
1188 1188
 
1189 1189
     }
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
                          * @param string $term_link The link html to the category.
1220 1220
                          * @param object $term The category term object.
1221 1221
                          */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1222
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1223 1223
                         $links[] = $term_link;
1224 1224
                         $terms[] = $term;
1225 1225
                     }
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         if (!isset($listing_label)) {
1238 1238
             $listing_label = '';
1239 1239
         }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object)$terms);
1240
+        $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object) $terms);
1241 1241
 
1242 1242
     }
1243 1243
 
@@ -1268,11 +1268,11 @@  discard block
 block discarded – undo
1268 1268
  * @param object $post Optional. The post object or blank.
1269 1269
  * @package GeoDirectory
1270 1270
  */
1271
-function geodir_action_details_micordata($post='')
1271
+function geodir_action_details_micordata($post = '')
1272 1272
 {
1273 1273
 
1274 1274
     global $preview;
1275
-    if(empty($post)){global $post;}
1275
+    if (empty($post)) {global $post; }
1276 1276
     if ($preview || !geodir_is_page('detail')) {
1277 1277
         return;
1278 1278
     }
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
                 "description" => $review->comment_content,
1294 1294
                 "reviewRating" => array(
1295 1295
                     "@type" => "Rating",
1296
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1296
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1297 1297
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1298 1298
                     "worstRating" => "1"
1299 1299
                 )
@@ -1321,13 +1321,13 @@  discard block
 block discarded – undo
1321 1321
     }
1322 1322
     //print_r($post);
1323 1323
     // external links
1324
-    $external_links =  array();
1324
+    $external_links = array();
1325 1325
     $external_links[] = $post->geodir_website;
1326 1326
     $external_links[] = $post->geodir_twitter;
1327 1327
     $external_links[] = $post->geodir_facebook;
1328 1328
     $external_links = array_filter($external_links);
1329 1329
 
1330
-    if(!empty($external_links)){
1330
+    if (!empty($external_links)) {
1331 1331
         $external_links = array_values($external_links);
1332 1332
     }
1333 1333
 
@@ -1337,16 +1337,16 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
     // schema type
1339 1339
     $schema_type = 'LocalBusiness';
1340
-    if(isset($post->default_category) && $post->default_category){
1340
+    if (isset($post->default_category) && $post->default_category) {
1341 1341
         $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1342
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1342
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1343 1343
     }
1344 1344
 
1345 1345
     $schema = array();
1346 1346
     $schema['@context'] = "http://schema.org";
1347 1347
     $schema['@type'] = $schema_type;
1348 1348
     $schema['name'] = $post->post_name;
1349
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1349
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1350 1350
     $schema['telephone'] = $post->geodir_contact;
1351 1351
     $schema['url'] = $c_url;
1352 1352
     $schema['sameAs'] = $external_links;
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
         "postalCode" => $post->post_zip
1361 1361
     );
1362 1362
 
1363
-    if($post->post_latitude && $post->post_longitude) {
1363
+    if ($post->post_latitude && $post->post_longitude) {
1364 1364
         $schema['geo'] = array(
1365 1365
             "@type" => "GeoCoordinates",
1366 1366
             "latitude" => $post->post_latitude,
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
         );
1369 1369
     }
1370 1370
 
1371
-    if($post_avgratings) {
1371
+    if ($post_avgratings) {
1372 1372
         $schema['aggregateRating'] = array(
1373 1373
             "@type" => "AggregateRating",
1374 1374
             "ratingValue" => $post_avgratings,
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
      * @param array $schema The array of schema data to be filtered.
1388 1388
      * @param object $post The post object.
1389 1389
      */
1390
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1390
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1391 1391
 
1392 1392
 
1393 1393
     echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
@@ -1595,26 +1595,26 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
 
1597 1597
     $title = $list_title;
1598
-    if(geodir_is_page('pt')){
1598
+    if (geodir_is_page('pt')) {
1599 1599
         $gd_page = 'pt';
1600
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1600
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601 1601
     }
1602
-    elseif(geodir_is_page('listing')){
1602
+    elseif (geodir_is_page('listing')) {
1603 1603
         $gd_page = 'listing';
1604 1604
         global $wp_query;
1605 1605
         $current_term = $wp_query->get_queried_object();
1606
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1606
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1607 1607
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1608
+        } else {
1609 1609
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1610
         }
1611 1611
 
1612 1612
     }
1613
-    elseif(geodir_is_page('author')){
1613
+    elseif (geodir_is_page('author')) {
1614 1614
         $gd_page = 'author';
1615
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
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
 
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
      * @param string $title The page title including variables.
1629 1629
      * @param string $gd_page The GeoDirectory page type if any.
1630 1630
      */
1631
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1631
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1632 1632
 
1633 1633
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1634 1634
         /**
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
         if ($cat_description) {
1674 1674
             ?>
1675 1675
 
1676
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1676
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1677 1677
         }
1678 1678
 
1679 1679
     }
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
      */
1959 1959
     do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1960 1960
     $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1961
-    echo '<div class="clearfix '.$extra_class.'">';
1961
+    echo '<div class="clearfix ' . $extra_class . '">';
1962 1962
     /**
1963 1963
      * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1964 1964
      *
@@ -2034,11 +2034,11 @@  discard block
 block discarded – undo
2034 2034
 
2035 2035
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2036 2036
 
2037
-    if(geodir_is_page('add-listing')){
2037
+    if (geodir_is_page('add-listing')) {
2038 2038
         $gd_page = 'add-listing';
2039
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2039
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2040 2040
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2041
+        }elseif (isset($listing_type)) {
2042 2042
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2043
         }
2044 2044
 
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
      * @param string $title The page title including variables.
2053 2053
      * @param string $gd_page The GeoDirectory page type if any.
2054 2054
      */
2055
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2055
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2056 2056
 
2057 2057
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2058 2058
     echo $title;
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
  */
2069 2069
 function geodir_action_add_listing_page_mandatory()
2070 2070
 {?>
2071
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2071
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2072 2072
 <?php
2073 2073
 }
2074 2074
 
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 
2104 2104
     if (isset($_REQUEST['backandedit'])) {
2105 2105
         global $post;
2106
-        $post = (object)$gd_session->get('listing');
2106
+        $post = (object) $gd_session->get('listing');
2107 2107
         $listing_type = $post->listing_type;
2108 2108
         $title = $post->post_title;
2109 2109
         $desc = $post->post_desc;
@@ -2135,15 +2135,15 @@  discard block
 block discarded – undo
2135 2135
         $user_login = true;
2136 2136
     }
2137 2137
     ?>
2138
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2139
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2140
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2138
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2139
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2140
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2141 2141
         <?php if ($page_id) { ?>
2142
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2142
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2143 2143
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2144
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2144
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2145 2145
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2146
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2146
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2147 2147
         <?php
2148 2148
         } 
2149 2149
         /**
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
          */
2156 2156
         do_action('geodir_before_detail_fields');
2157 2157
         ?>
2158
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2158
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2159 2159
         <?php
2160 2160
         /**
2161 2161
          * Called at the top of the add listing page form for frontend.
@@ -2167,10 +2167,10 @@  discard block
 block discarded – undo
2167 2167
         do_action('geodir_before_main_form_fields');
2168 2168
         ?>
2169 2169
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2170
-            <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2170
+            <label><?php echo PLACE_TITLE_TEXT; ?><span>*</span> </label>
2171 2171
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2172 2172
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2173
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2173
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2174 2174
         </div>
2175 2175
         <?php
2176 2176
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2205,7 +2205,7 @@  discard block
 block discarded – undo
2205 2205
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2206 2206
         
2207 2207
         $desc_class = '';
2208
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2208
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2209 2209
             /**
2210 2210
              * Called on the add listing page form for frontend just before the description field.
2211 2211
              *
@@ -2218,8 +2218,8 @@  discard block
 block discarded – undo
2218 2218
             $desc_class = ' hidden';
2219 2219
         }
2220 2220
         ?>
2221
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2222
-            <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2221
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2222
+            <label><?php echo PLACE_DESC_TEXT; ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2223 2223
             <?php
2224 2224
             if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2225 2225
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2228,16 +2228,16 @@  discard block
 block discarded – undo
2228 2228
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2229 2229
                 </div>
2230 2230
             <?php if ($desc_limit != '') { ?>
2231
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2231
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2232 2232
             <?php } } else { ?>
2233 2233
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2234 2234
             <?php } if ($desc_limit_msg != '') { ?>
2235 2235
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2236 2236
             <?php } ?>
2237
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2237
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2238 2238
         </div>
2239 2239
         <?php
2240
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2240
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2241 2241
             /**
2242 2242
              * Called on the add listing page form for frontend just after the description field.
2243 2243
              *
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2277 2277
         
2278 2278
         $tags_class = '';
2279
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2279
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2280 2280
             /**
2281 2281
              * Called on the add listing page form for frontend just before the tags field.
2282 2282
              *
@@ -2287,14 +2287,14 @@  discard block
 block discarded – undo
2287 2287
             $tags_class = ' hidden';
2288 2288
         }
2289 2289
         ?>
2290
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2290
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2291 2291
             <label><?php echo TAGKW_TEXT; ?></label>
2292 2292
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2293
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2294
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2293
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2294
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2295 2295
         </div>
2296 2296
         <?php
2297
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2297
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2298 2298
             /**
2299 2299
              * Called on the add listing page form for frontend just after the tags field.
2300 2300
              *
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
         $thumb_img_arr = array();
2321 2321
         $totImg = 0;
2322 2322
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2323
-            $post = (object)$gd_session->get('listing');
2323
+            $post = (object) $gd_session->get('listing');
2324 2324
             if (isset($post->post_images))
2325 2325
                 $curImages = trim($post->post_images, ",");
2326 2326
 
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
             $listing_type = $post->listing_type;
2334 2334
 
2335 2335
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2336
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2336
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2337 2337
             $listing_type = $post->post_type;
2338 2338
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2339 2339
 
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
                 //$curImages = $img->src.",";
2348 2348
             }
2349 2349
 
2350
-            $totImg = count((array)$thumb_img_arr);
2350
+            $totImg = count((array) $thumb_img_arr);
2351 2351
         }
2352 2352
 
2353 2353
         if ($curImages != '')
@@ -2368,7 +2368,7 @@  discard block
 block discarded – undo
2368 2368
         if ($show_image_input_box) {
2369 2369
             ?>
2370 2370
 
2371
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2371
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2372 2372
                 <?php if ($image_limit == 1) {
2373 2373
                     echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2374 2374
                 } ?>
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
                 <div
2392 2392
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2393 2393
                     id="<?php echo $id; ?>plupload-upload-ui">
2394
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2394
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2395 2395
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2396 2396
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2397 2397
                     <span class="ajaxnonceplu"
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2409 2409
                 </div>
2410 2410
                 <span
2411
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2411
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2412 2412
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2413 2413
             </div>
2414 2414
 
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
          *
2421 2421
          * @since 1.0.0
2422 2422
          */
2423
-        do_action('geodir_after_main_form_fields');?>
2423
+        do_action('geodir_after_main_form_fields'); ?>
2424 2424
 
2425 2425
 
2426 2426
         <!-- add captcha code -->
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
         </script>
2432 2432
         <noscript>
2433 2433
             <div>
2434
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2434
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2435 2435
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2436 2436
             </div>
2437 2437
         </noscript>
@@ -2441,10 +2441,10 @@  discard block
 block discarded – undo
2441 2441
         <!-- end captcha code -->
2442 2442
 
2443 2443
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2444
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2445
-                   class="geodir_button" <?php echo $submit_button;?>/>
2444
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2445
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2446 2446
             <span class="geodir_message_note"
2447
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2447
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2448 2448
         </div>
2449 2449
 
2450 2450
     </form>
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
         class="<?php
2507 2507
         /** This action is documented in geodirectory_template_actions.php */
2508 2508
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2509
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2509
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2510 2510
     </div><!-- clearfix ends here-->
2511 2511
 <?php
2512 2512
 }
@@ -2528,7 +2528,7 @@  discard block
 block discarded – undo
2528 2528
 
2529 2529
     ?>
2530 2530
     <script type="text/javascript">
2531
-        <?php if ( $user_login ) { ?>
2531
+        <?php if ($user_login) { ?>
2532 2532
         setTimeout(function () {
2533 2533
             try {
2534 2534
                 d = document.getElementById('user_pass');
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
         <?php } ?>
2546 2546
     </script>
2547 2547
     <script type="text/javascript">
2548
-        <?php if ( $user_login ) { ?>
2548
+        <?php if ($user_login) { ?>
2549 2549
         setTimeout(function () {
2550 2550
             try {
2551 2551
                 d = document.getElementById('user_pass');
@@ -2683,11 +2683,11 @@  discard block
 block discarded – undo
2683 2683
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2684 2684
 
2685 2685
     $title = $list_title;
2686
-    if(geodir_is_page('author')){
2686
+    if (geodir_is_page('author')) {
2687 2687
         $gd_page = 'author';
2688
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2688
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2689 2689
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2690
-        }else{
2690
+        } else {
2691 2691
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2692 2692
         }
2693 2693
 
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
      * @param string $title The page title including variables.
2702 2702
      * @param string $gd_page The GeoDirectory page type if any.
2703 2703
      */
2704
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2704
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2705 2705
 
2706 2706
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2707 2707
         /**
@@ -2915,7 +2915,7 @@  discard block
 block discarded – undo
2915 2915
     $post_type_info = get_post_type_object($gd_post_type);
2916 2916
 
2917 2917
     $pt_name = '';
2918
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2918
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
2919 2919
 
2920 2920
     if (is_search()) {
2921 2921
         $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
Please login to merge, or discard this patch.
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   +1671 added lines, -1671 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,166 +1090,166 @@  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;
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
-            foreach ($post_tags as $post_term) {
1135
-
1136
-                // fix slug creation order for tags & location
1137
-                $post_term = trim($post_term);
1138
-
1139
-                $priority_location = false;
1140
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
-                    $term = get_term_by('name', $post_term, $post_type . '_tags');
1142
-                } else {
1143
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
-                    if ($match_country || $match_region || $match_city) {
1150
-                        $priority_location = true;
1151
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1152
-                    } else {
1153
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1155
-                    }
1156
-                }
1157
-
1158
-                if (!is_wp_error($term) && is_object($term)) {
1159
-
1160
-                    // fix tag link on detail page
1161
-                    if ($priority_location) {
1162
-
1163
-                        $tag_link = "<a href=''>$post_term</a>";
1164
-                        /**
1165
-                         * Filter the tag name on the details page.
1166
-                         *
1167
-                         * @since 1.5.6
1168
-                         * @param string $tag_link The tag link html.
1169
-                         * @param object $term The tag term object.
1170
-                         */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
-                        $links[] = $tag_link;
1173
-                    } else {
1174
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
-                        /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
-                        $links[] = $tag_link;
1178
-                    }
1179
-                    $terms[] = $term;
1180
-                }
1181
-                //
1182
-            }
1183
-            if (!isset($listing_label)) {
1184
-                $listing_label = '';
1185
-            }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object)$terms);
1187
-        endif;
1188
-
1189
-    }
1190
-
1191
-    if (!empty($post->$post_taxonomy)) {
1192
-        $links = array();
1193
-        $terms = array();
1194
-        $termsOrdered = array();
1195
-        if (!is_array($post->$post_taxonomy)) {
1196
-            $post_term = explode(",", trim($post->$post_taxonomy, ","));
1197
-        } else {
1198
-            $post_term = $post->$post_taxonomy;
1109
+	$post_type_info = get_post_type_object($post_type);
1110
+	$listing_label = $post_type_info->labels->singular_name;
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
+			foreach ($post_tags as $post_term) {
1135
+
1136
+				// fix slug creation order for tags & location
1137
+				$post_term = trim($post_term);
1138
+
1139
+				$priority_location = false;
1140
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
+					$term = get_term_by('name', $post_term, $post_type . '_tags');
1142
+				} else {
1143
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
+					if ($match_country || $match_region || $match_city) {
1150
+						$priority_location = true;
1151
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1152
+					} else {
1153
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1155
+					}
1156
+				}
1157
+
1158
+				if (!is_wp_error($term) && is_object($term)) {
1159
+
1160
+					// fix tag link on detail page
1161
+					if ($priority_location) {
1162
+
1163
+						$tag_link = "<a href=''>$post_term</a>";
1164
+						/**
1165
+						 * Filter the tag name on the details page.
1166
+						 *
1167
+						 * @since 1.5.6
1168
+						 * @param string $tag_link The tag link html.
1169
+						 * @param object $term The tag term object.
1170
+						 */
1171
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
+						$links[] = $tag_link;
1173
+					} else {
1174
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
+						/** This action is documented in geodirectory-template_actions.php */
1176
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
+						$links[] = $tag_link;
1178
+					}
1179
+					$terms[] = $term;
1180
+				}
1181
+				//
1182
+			}
1183
+			if (!isset($listing_label)) {
1184
+				$listing_label = '';
1185
+			}
1186
+			$taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object)$terms);
1187
+		endif;
1188
+
1189
+	}
1190
+
1191
+	if (!empty($post->$post_taxonomy)) {
1192
+		$links = array();
1193
+		$terms = array();
1194
+		$termsOrdered = array();
1195
+		if (!is_array($post->$post_taxonomy)) {
1196
+			$post_term = explode(",", trim($post->$post_taxonomy, ","));
1197
+		} else {
1198
+			$post_term = $post->$post_taxonomy;
1199 1199
 			
1200 1200
 			if ($preview && !$is_backend_preview) {
1201 1201
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1202 1202
 			}
1203
-        }
1204
-
1205
-        $post_term = array_unique($post_term);
1206
-        if (!empty($post_term)) {
1207
-            foreach ($post_term as $post_term) {
1208
-                $post_term = trim($post_term);
1209
-
1210
-                if ($post_term != ''):
1211
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1212
-
1213
-                    if (is_object($term)) {
1214
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
-                        /**
1216
-                         * Filter the category name on the details page.
1217
-                         *
1218
-                         * @since 1.5.6
1219
-                         * @param string $term_link The link html to the category.
1220
-                         * @param object $term The category term object.
1221
-                         */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
-                        $links[] = $term_link;
1224
-                        $terms[] = $term;
1225
-                    }
1226
-                endif;
1227
-            }
1228
-            // order alphabetically
1229
-            asort($links);
1230
-            foreach (array_keys($links) as $key) {
1231
-                $termsOrdered[$key] = $terms[$key];
1232
-            }
1233
-            $terms = $termsOrdered;
1203
+		}
1204
+
1205
+		$post_term = array_unique($post_term);
1206
+		if (!empty($post_term)) {
1207
+			foreach ($post_term as $post_term) {
1208
+				$post_term = trim($post_term);
1209
+
1210
+				if ($post_term != ''):
1211
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1212
+
1213
+					if (is_object($term)) {
1214
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
+						/**
1216
+						 * Filter the category name on the details page.
1217
+						 *
1218
+						 * @since 1.5.6
1219
+						 * @param string $term_link The link html to the category.
1220
+						 * @param object $term The category term object.
1221
+						 */
1222
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
+						$links[] = $term_link;
1224
+						$terms[] = $term;
1225
+					}
1226
+				endif;
1227
+			}
1228
+			// order alphabetically
1229
+			asort($links);
1230
+			foreach (array_keys($links) as $key) {
1231
+				$termsOrdered[$key] = $terms[$key];
1232
+			}
1233
+			$terms = $termsOrdered;
1234 1234
 
1235
-        }
1235
+		}
1236 1236
 
1237
-        if (!isset($listing_label)) {
1238
-            $listing_label = '';
1239
-        }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object)$terms);
1237
+		if (!isset($listing_label)) {
1238
+			$listing_label = '';
1239
+		}
1240
+		$taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object)$terms);
1241 1241
 
1242
-    }
1242
+	}
1243 1243
 
1244 1244
 
1245
-    if (isset($taxonomies[$post_taxonomy])) {
1246
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247
-    }
1245
+	if (isset($taxonomies[$post_taxonomy])) {
1246
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247
+	}
1248 1248
 
1249
-    if (isset($taxonomies[$post_type . '_tags']))
1250
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1249
+	if (isset($taxonomies[$post_type . '_tags']))
1250
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1251 1251
 
1252
-    ?>
1252
+	?>
1253 1253
     </p><?php
1254 1254
 }
1255 1255
 
@@ -1271,126 +1271,126 @@  discard block
 block discarded – undo
1271 1271
 function geodir_action_details_micordata($post='')
1272 1272
 {
1273 1273
 
1274
-    global $preview;
1275
-    if(empty($post)){global $post;}
1276
-    if ($preview || !geodir_is_page('detail')) {
1277
-        return;
1278
-    }
1279
-
1280
-    // url
1281
-    $c_url = geodir_curPageURL();
1282
-
1283
-    // post reviews
1284
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1285
-    if (empty($post_reviews)) {
1286
-        $reviews = '';
1287
-    } else {
1288
-        foreach ($post_reviews as $review) {
1289
-            $reviews[] = array(
1290
-                "@type" => "Review",
1291
-                "author" => $review->comment_author,
1292
-                "datePublished" => $review->comment_date,
1293
-                "description" => $review->comment_content,
1294
-                "reviewRating" => array(
1295
-                    "@type" => "Rating",
1296
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1297
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1298
-                    "worstRating" => "1"
1299
-                )
1300
-            );
1301
-        }
1302
-
1303
-    }
1304
-
1305
-    // post images
1306
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1307
-    if (empty($post_images)) {
1308
-        $images = '';
1309
-    } else {
1310
-        $i_arr = array();
1311
-        foreach ($post_images as $img) {
1312
-            $i_arr[] = $img->src;
1313
-        }
1314
-
1315
-        if (count($i_arr) == 1) {
1316
-            $images = $i_arr[0];
1317
-        } else {
1318
-            $images = $i_arr;
1319
-        }
1320
-
1321
-    }
1322
-    //print_r($post);
1323
-    // external links
1324
-    $external_links =  array();
1325
-    $external_links[] = $post->geodir_website;
1326
-    $external_links[] = $post->geodir_twitter;
1327
-    $external_links[] = $post->geodir_facebook;
1328
-    $external_links = array_filter($external_links);
1329
-
1330
-    if(!empty($external_links)){
1331
-        $external_links = array_values($external_links);
1332
-    }
1333
-
1334
-    // reviews
1335
-    $comment_count = geodir_get_review_count_total($post->ID);
1336
-    $post_avgratings = geodir_get_post_rating($post->ID);
1337
-
1338
-    // schema type
1339
-    $schema_type = 'LocalBusiness';
1340
-    if(isset($post->default_category) && $post->default_category){
1341
-        $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1342
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1343
-    }
1344
-
1345
-    $schema = array();
1346
-    $schema['@context'] = "http://schema.org";
1347
-    $schema['@type'] = $schema_type;
1348
-    $schema['name'] = $post->post_name;
1349
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1350
-    $schema['telephone'] = $post->geodir_contact;
1351
-    $schema['url'] = $c_url;
1352
-    $schema['sameAs'] = $external_links;
1353
-    $schema['image'] = $images;
1354
-    $schema['address'] = array(
1355
-        "@type" => "PostalAddress",
1356
-        "streetAddress" => $post->post_address,
1357
-        "addressLocality" => $post->post_city,
1358
-        "addressRegion" => $post->post_region,
1359
-        "addressCountry" => $post->post_country,
1360
-        "postalCode" => $post->post_zip
1361
-    );
1362
-
1363
-    if($post->post_latitude && $post->post_longitude) {
1364
-        $schema['geo'] = array(
1365
-            "@type" => "GeoCoordinates",
1366
-            "latitude" => $post->post_latitude,
1367
-            "longitude" => $post->post_longitude
1368
-        );
1369
-    }
1370
-
1371
-    if($post_avgratings) {
1372
-        $schema['aggregateRating'] = array(
1373
-            "@type" => "AggregateRating",
1374
-            "ratingValue" => $post_avgratings,
1375
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1376
-            "worstRating" => "1",
1377
-            "ratingCount" => $comment_count
1378
-        );
1379
-    }
1380
-    $schema['review'] = $reviews;
1381
-
1382
-    /**
1383
-     * Allow the schema JSON-LD info to be filtered.
1384
-     *
1385
-     * @since 1.5.4
1386
-     * @since 1.5.7 Added $post variable.
1387
-     * @param array $schema The array of schema data to be filtered.
1388
-     * @param object $post The post object.
1389
-     */
1390
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1391
-
1392
-
1393
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1274
+	global $preview;
1275
+	if(empty($post)){global $post;}
1276
+	if ($preview || !geodir_is_page('detail')) {
1277
+		return;
1278
+	}
1279
+
1280
+	// url
1281
+	$c_url = geodir_curPageURL();
1282
+
1283
+	// post reviews
1284
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1285
+	if (empty($post_reviews)) {
1286
+		$reviews = '';
1287
+	} else {
1288
+		foreach ($post_reviews as $review) {
1289
+			$reviews[] = array(
1290
+				"@type" => "Review",
1291
+				"author" => $review->comment_author,
1292
+				"datePublished" => $review->comment_date,
1293
+				"description" => $review->comment_content,
1294
+				"reviewRating" => array(
1295
+					"@type" => "Rating",
1296
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1297
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1298
+					"worstRating" => "1"
1299
+				)
1300
+			);
1301
+		}
1302
+
1303
+	}
1304
+
1305
+	// post images
1306
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1307
+	if (empty($post_images)) {
1308
+		$images = '';
1309
+	} else {
1310
+		$i_arr = array();
1311
+		foreach ($post_images as $img) {
1312
+			$i_arr[] = $img->src;
1313
+		}
1314
+
1315
+		if (count($i_arr) == 1) {
1316
+			$images = $i_arr[0];
1317
+		} else {
1318
+			$images = $i_arr;
1319
+		}
1320
+
1321
+	}
1322
+	//print_r($post);
1323
+	// external links
1324
+	$external_links =  array();
1325
+	$external_links[] = $post->geodir_website;
1326
+	$external_links[] = $post->geodir_twitter;
1327
+	$external_links[] = $post->geodir_facebook;
1328
+	$external_links = array_filter($external_links);
1329
+
1330
+	if(!empty($external_links)){
1331
+		$external_links = array_values($external_links);
1332
+	}
1333
+
1334
+	// reviews
1335
+	$comment_count = geodir_get_review_count_total($post->ID);
1336
+	$post_avgratings = geodir_get_post_rating($post->ID);
1337
+
1338
+	// schema type
1339
+	$schema_type = 'LocalBusiness';
1340
+	if(isset($post->default_category) && $post->default_category){
1341
+		$schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1342
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1343
+	}
1344
+
1345
+	$schema = array();
1346
+	$schema['@context'] = "http://schema.org";
1347
+	$schema['@type'] = $schema_type;
1348
+	$schema['name'] = $post->post_name;
1349
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1350
+	$schema['telephone'] = $post->geodir_contact;
1351
+	$schema['url'] = $c_url;
1352
+	$schema['sameAs'] = $external_links;
1353
+	$schema['image'] = $images;
1354
+	$schema['address'] = array(
1355
+		"@type" => "PostalAddress",
1356
+		"streetAddress" => $post->post_address,
1357
+		"addressLocality" => $post->post_city,
1358
+		"addressRegion" => $post->post_region,
1359
+		"addressCountry" => $post->post_country,
1360
+		"postalCode" => $post->post_zip
1361
+	);
1362
+
1363
+	if($post->post_latitude && $post->post_longitude) {
1364
+		$schema['geo'] = array(
1365
+			"@type" => "GeoCoordinates",
1366
+			"latitude" => $post->post_latitude,
1367
+			"longitude" => $post->post_longitude
1368
+		);
1369
+	}
1370
+
1371
+	if($post_avgratings) {
1372
+		$schema['aggregateRating'] = array(
1373
+			"@type" => "AggregateRating",
1374
+			"ratingValue" => $post_avgratings,
1375
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1376
+			"worstRating" => "1",
1377
+			"ratingCount" => $comment_count
1378
+		);
1379
+	}
1380
+	$schema['review'] = $reviews;
1381
+
1382
+	/**
1383
+	 * Allow the schema JSON-LD info to be filtered.
1384
+	 *
1385
+	 * @since 1.5.4
1386
+	 * @since 1.5.7 Added $post variable.
1387
+	 * @param array $schema The array of schema data to be filtered.
1388
+	 * @param object $post The post object.
1389
+	 */
1390
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1391
+
1392
+
1393
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1394 1394
 
1395 1395
 }
1396 1396
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
  */
1409 1409
 function geodir_action_details_next_prev()
1410 1410
 {
1411
-    ?>
1411
+	?>
1412 1412
     <div class="geodir-pos_navigation clearfix">
1413 1413
     <div
1414 1414
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1426,15 +1426,15 @@  discard block
 block discarded – undo
1426 1426
  */
1427 1427
 function geodir_action_before_single_post()
1428 1428
 {
1429
-    global $post;
1430
-    /**
1431
-     * Called at the very start fo the details page output, before the title section.
1432
-     *
1433
-     * @since 1.0.0
1434
-     * @param object $post The current post object.
1435
-     * @global WP_Post|null $post The current post, if available.
1436
-     */
1437
-    do_action('geodir_before_single_post', $post); // extra action	
1429
+	global $post;
1430
+	/**
1431
+	 * Called at the very start fo the details page output, before the title section.
1432
+	 *
1433
+	 * @since 1.0.0
1434
+	 * @param object $post The current post object.
1435
+	 * @global WP_Post|null $post The current post, if available.
1436
+	 */
1437
+	do_action('geodir_before_single_post', $post); // extra action	
1438 1438
 }
1439 1439
 
1440 1440
 /**
@@ -1445,13 +1445,13 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function geodir_action_after_single_post($post)
1447 1447
 {
1448
-    /**
1449
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1450
-     *
1451
-     * @since 1.0.0
1452
-     * @param object $post The current post object.
1453
-     */
1454
-    do_action('geodir_after_single_post', $post); // extra action	
1448
+	/**
1449
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1450
+	 *
1451
+	 * @since 1.0.0
1452
+	 * @param object $post The current post object.
1453
+	 */
1454
+	do_action('geodir_after_single_post', $post); // extra action	
1455 1455
 }
1456 1456
 
1457 1457
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1477,167 +1477,167 @@  discard block
 block discarded – undo
1477 1477
  */
1478 1478
 function geodir_action_listings_title()
1479 1479
 {
1480
-    global $wp, $term;
1481
-
1482
-    $gd_post_type = geodir_get_current_posttype();
1483
-    $post_type_info = get_post_type_object($gd_post_type);
1484
-
1485
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1486
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1487
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1488
-    }
1489
-
1490
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1491
-    $single_name = $post_type_info->labels->singular_name;
1492
-
1493
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1494
-
1495
-    $gd_country = get_query_var('gd_country');
1496
-    $gd_region = get_query_var('gd_region');
1497
-    $gd_city = get_query_var('gd_city');
1498
-
1499
-    if (!empty($term)) {
1500
-        $location_name = '';
1501
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1502
-            if ($gd_country != '') {
1503
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1504
-            }
1480
+	global $wp, $term;
1505 1481
 
1506
-            if ($gd_region != '') {
1507
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1508
-            }
1482
+	$gd_post_type = geodir_get_current_posttype();
1483
+	$post_type_info = get_post_type_object($gd_post_type);
1509 1484
 
1510
-            if ($gd_city != '') {
1511
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1512
-            }
1513
-        }
1485
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1486
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1487
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1488
+	}
1514 1489
 
1515
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1516
-        if (!empty($current_term)) {
1517
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1518
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1519
-                $location_last_char = substr($location_name, -1);
1520
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1521
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1522
-            } else {
1523
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1524
-            }
1525
-        } else {
1526
-            if (count($taxonomy) > 1) {
1527
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1528
-
1529
-                if (!empty($current_term)) {
1530
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1531
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1532
-                        $location_last_char = substr($location_name, -1);
1533
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1534
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1535
-                    } else {
1536
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1537
-                    }
1538
-                }
1539
-            }
1540
-        }
1541
-
1542
-    } else {
1543
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1544
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1545
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1546
-
1547
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1548
-
1549
-        if (function_exists('get_actual_location_name')) {
1550
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1551
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1552
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1553
-        }
1554
-
1555
-        if ($gd_city != '') {
1556
-            if ($gd_city_actual != '') {
1557
-                $gd_city = $gd_city_actual;
1558
-            } else {
1559
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1560
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1561
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1562
-            }
1490
+	$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1491
+	$single_name = $post_type_info->labels->singular_name;
1563 1492
 
1564
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1565
-        } else if ($gd_region != '') {
1566
-            if ($gd_region_actual != '') {
1567
-                $gd_region = $gd_region_actual;
1568
-            } else {
1569
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1570
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1571
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1572
-            }
1493
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1573 1494
 
1574
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1575
-        } else if ($gd_country != '') {
1576
-            if ($gd_country_actual != '') {
1577
-                $gd_country = $gd_country_actual;
1578
-            } else {
1579
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1580
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1581
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1582
-            }
1495
+	$gd_country = get_query_var('gd_country');
1496
+	$gd_region = get_query_var('gd_region');
1497
+	$gd_city = get_query_var('gd_city');
1583 1498
 
1584
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1585
-        }
1586
-    }
1587
-
1588
-    if (is_search()) {
1589
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1590
-    }
1591
-    /** This action is documented in geodirectory_template_actions.php */
1592
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1593
-    /** This action is documented in geodirectory_template_actions.php */
1594
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1595
-
1596
-
1597
-    $title = $list_title;
1598
-    if(geodir_is_page('pt')){
1599
-        $gd_page = 'pt';
1600
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
-    }
1602
-    elseif(geodir_is_page('listing')){
1603
-        $gd_page = 'listing';
1604
-        global $wp_query;
1605
-        $current_term = $wp_query->get_queried_object();
1606
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1607
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1609
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610
-        }
1499
+	if (!empty($term)) {
1500
+		$location_name = '';
1501
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1502
+			if ($gd_country != '') {
1503
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1504
+			}
1611 1505
 
1612
-    }
1613
-    elseif(geodir_is_page('author')){
1614
-        $gd_page = 'author';
1615
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1618
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619
-        }
1506
+			if ($gd_region != '') {
1507
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1508
+			}
1620 1509
 
1621
-    }
1510
+			if ($gd_city != '') {
1511
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1512
+			}
1513
+		}
1514
+
1515
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1516
+		if (!empty($current_term)) {
1517
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1518
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1519
+				$location_last_char = substr($location_name, -1);
1520
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1521
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1522
+			} else {
1523
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1524
+			}
1525
+		} else {
1526
+			if (count($taxonomy) > 1) {
1527
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1528
+
1529
+				if (!empty($current_term)) {
1530
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1531
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1532
+						$location_last_char = substr($location_name, -1);
1533
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1534
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1535
+					} else {
1536
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1537
+					}
1538
+				}
1539
+			}
1540
+		}
1541
+
1542
+	} else {
1543
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1544
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1545
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1546
+
1547
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1548
+
1549
+		if (function_exists('get_actual_location_name')) {
1550
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1551
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1552
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1553
+		}
1554
+
1555
+		if ($gd_city != '') {
1556
+			if ($gd_city_actual != '') {
1557
+				$gd_city = $gd_city_actual;
1558
+			} else {
1559
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1560
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1561
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1562
+			}
1622 1563
 
1564
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1565
+		} else if ($gd_region != '') {
1566
+			if ($gd_region_actual != '') {
1567
+				$gd_region = $gd_region_actual;
1568
+			} else {
1569
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1570
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1571
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1572
+			}
1623 1573
 
1624
-    /**
1625
-     * Filter page title to replace variables.
1626
-     *
1627
-     * @since 1.5.4
1628
-     * @param string $title The page title including variables.
1629
-     * @param string $gd_page The GeoDirectory page type if any.
1630
-     */
1631
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1574
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1575
+		} else if ($gd_country != '') {
1576
+			if ($gd_country_actual != '') {
1577
+				$gd_country = $gd_country_actual;
1578
+			} else {
1579
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1580
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1581
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1582
+			}
1632 1583
 
1633
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1634
-        /**
1635
-         * Filter the listing page title.
1636
-         *
1637
-         * @since 1.0.0
1638
-         * @param string $list_title The title for the category page.
1639
-         */
1640
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1584
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1585
+		}
1586
+	}
1587
+
1588
+	if (is_search()) {
1589
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1590
+	}
1591
+	/** This action is documented in geodirectory_template_actions.php */
1592
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1593
+	/** This action is documented in geodirectory_template_actions.php */
1594
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1595
+
1596
+
1597
+	$title = $list_title;
1598
+	if(geodir_is_page('pt')){
1599
+		$gd_page = 'pt';
1600
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
+	}
1602
+	elseif(geodir_is_page('listing')){
1603
+		$gd_page = 'listing';
1604
+		global $wp_query;
1605
+		$current_term = $wp_query->get_queried_object();
1606
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1607
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
+		}else{
1609
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610
+		}
1611
+
1612
+	}
1613
+	elseif(geodir_is_page('author')){
1614
+		$gd_page = 'author';
1615
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
+		}else{
1618
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619
+		}
1620
+
1621
+	}
1622
+
1623
+
1624
+	/**
1625
+	 * Filter page title to replace variables.
1626
+	 *
1627
+	 * @since 1.5.4
1628
+	 * @param string $title The page title including variables.
1629
+	 * @param string $gd_page The GeoDirectory page type if any.
1630
+	 */
1631
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1632
+
1633
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1634
+		/**
1635
+		 * Filter the listing page title.
1636
+		 *
1637
+		 * @since 1.0.0
1638
+		 * @param string $list_title The title for the category page.
1639
+		 */
1640
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1641 1641
 }
1642 1642
 
1643 1643
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1650,33 +1650,33 @@  discard block
 block discarded – undo
1650 1650
  */
1651 1651
 function geodir_action_listings_description()
1652 1652
 {
1653
-    global $wp_query;
1654
-    $current_term = $wp_query->get_queried_object();
1655
-
1656
-    $gd_post_type = geodir_get_current_posttype();
1657
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1658
-
1659
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1660
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1661
-        if ($term_desc && !$saved_data) {
1662
-            $saved_data = $term_desc;
1663
-        }
1664
-        /**
1665
-         * Apply the core filter `the_content` filter to the variable string.
1666
-         *
1667
-         * This is a WordPress core filter that does many things.
1668
-         *
1669
-         * @since 1.0.0
1670
-         * @param string $var The string to apply the filter to.
1671
-         */
1672
-        $cat_description = apply_filters('the_content', $saved_data);
1673
-        if ($cat_description) {
1674
-            ?>
1653
+	global $wp_query;
1654
+	$current_term = $wp_query->get_queried_object();
1655
+
1656
+	$gd_post_type = geodir_get_current_posttype();
1657
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1658
+
1659
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1660
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1661
+		if ($term_desc && !$saved_data) {
1662
+			$saved_data = $term_desc;
1663
+		}
1664
+		/**
1665
+		 * Apply the core filter `the_content` filter to the variable string.
1666
+		 *
1667
+		 * This is a WordPress core filter that does many things.
1668
+		 *
1669
+		 * @since 1.0.0
1670
+		 * @param string $var The string to apply the filter to.
1671
+		 */
1672
+		$cat_description = apply_filters('the_content', $saved_data);
1673
+		if ($cat_description) {
1674
+			?>
1675 1675
 
1676 1676
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1677
-        }
1677
+		}
1678 1678
 
1679
-    }
1679
+	}
1680 1680
 }
1681 1681
 
1682 1682
 // action for adding the listings page top widget area
@@ -1695,11 +1695,11 @@  discard block
 block discarded – undo
1695 1695
  */
1696 1696
 function geodir_action_geodir_sidebar_listings_top()
1697 1697
 {
1698
-    if (get_option('geodir_show_listing_top_section')) { ?>
1698
+	if (get_option('geodir_show_listing_top_section')) { ?>
1699 1699
         <div
1700 1700
             class="<?php
1701
-            /** This action is documented in geodirectory_template_actions.php */
1702
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1701
+			/** This action is documented in geodirectory_template_actions.php */
1702
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1703 1703
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1704 1704
         </div><!-- clearfix ends here-->
1705 1705
     <?php }
@@ -1722,35 +1722,35 @@  discard block
 block discarded – undo
1722 1722
  */
1723 1723
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1724 1724
 {
1725
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1726
-        $width_css = 'style="width:' . $width . '%;"';
1727
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1728
-        $width_css = 'style="width:' . $width . '%;"';
1729
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1730
-        $width_css = 'style="width:' . $width . '%;"';
1731
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1732
-        $width_css = 'style="width:' . $width . '%;"';
1733
-    } else {
1734
-        $width_css = '';
1735
-    }
1736
-
1737
-    $tc = get_option('theme_compatibility_setting');
1738
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1739
-        $text = $tc['geodir_sidebar_left_open_replace'];
1740
-    } else {
1741
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1742
-    }
1743
-
1744
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1745
-        $id = $tc['geodir_sidebar_left_open_id'];
1746
-    }
1747
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1748
-        $class = $tc['geodir_sidebar_left_open_class'];
1749
-    }
1750
-
1751
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1752
-
1753
-    echo $text;
1725
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1726
+		$width_css = 'style="width:' . $width . '%;"';
1727
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1728
+		$width_css = 'style="width:' . $width . '%;"';
1729
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1730
+		$width_css = 'style="width:' . $width . '%;"';
1731
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1732
+		$width_css = 'style="width:' . $width . '%;"';
1733
+	} else {
1734
+		$width_css = '';
1735
+	}
1736
+
1737
+	$tc = get_option('theme_compatibility_setting');
1738
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1739
+		$text = $tc['geodir_sidebar_left_open_replace'];
1740
+	} else {
1741
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1742
+	}
1743
+
1744
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1745
+		$id = $tc['geodir_sidebar_left_open_id'];
1746
+	}
1747
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1748
+		$class = $tc['geodir_sidebar_left_open_class'];
1749
+	}
1750
+
1751
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1752
+
1753
+	echo $text;
1754 1754
 }
1755 1755
 
1756 1756
 // action for adding the primary div closing tag
@@ -1766,13 +1766,13 @@  discard block
 block discarded – undo
1766 1766
  */
1767 1767
 function geodir_action_sidebar_left_close($type = '')
1768 1768
 {
1769
-    $tc = get_option('theme_compatibility_setting');
1770
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1771
-        $text = $tc['geodir_sidebar_left_close_replace'];
1772
-    } else {
1773
-        $text = '</aside><!-- sidebar ends here-->';
1774
-    }
1775
-    echo $text;
1769
+	$tc = get_option('theme_compatibility_setting');
1770
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1771
+		$text = $tc['geodir_sidebar_left_close_replace'];
1772
+	} else {
1773
+		$text = '</aside><!-- sidebar ends here-->';
1774
+	}
1775
+	echo $text;
1776 1776
 }
1777 1777
 
1778 1778
 /**
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
  */
1786 1786
 function geodir_listing_left_section()
1787 1787
 {
1788
-    if (get_option('geodir_show_listing_left_section')) { ?>
1788
+	if (get_option('geodir_show_listing_left_section')) { ?>
1789 1789
         <div class="geodir-content-left geodir-sidebar-wrap">
1790 1790
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1791 1791
         </div><!-- end geodir-content-left -->
@@ -1803,20 +1803,20 @@  discard block
 block discarded – undo
1803 1803
  */
1804 1804
 function geodir_action_listings_sidebar_left()
1805 1805
 {
1806
-    if (get_option('geodir_show_listing_left_section')) {
1807
-        /** This action is documented in geodirectory_template_actions.php */
1808
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1809
-        /**
1810
-         * Calls the listings page (category) left sidebar content.
1811
-         *
1812
-         * All the content for the listings page left sidebar is added via this hook.
1813
-         *
1814
-         * @since 1.0.0
1815
-         */
1816
-        do_action('geodir_listings_sidebar_left_inside');
1817
-        /** This action is documented in geodirectory_template_actions.php */
1818
-        do_action('geodir_sidebar_left_close', 'listings-page');
1819
-    }
1806
+	if (get_option('geodir_show_listing_left_section')) {
1807
+		/** This action is documented in geodirectory_template_actions.php */
1808
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1809
+		/**
1810
+		 * Calls the listings page (category) left sidebar content.
1811
+		 *
1812
+		 * All the content for the listings page left sidebar is added via this hook.
1813
+		 *
1814
+		 * @since 1.0.0
1815
+		 */
1816
+		do_action('geodir_listings_sidebar_left_inside');
1817
+		/** This action is documented in geodirectory_template_actions.php */
1818
+		do_action('geodir_sidebar_left_close', 'listings-page');
1819
+	}
1820 1820
 }
1821 1821
 
1822 1822
 /**
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
  */
1830 1830
 function geodir_listing_right_section()
1831 1831
 {
1832
-    if (get_option('geodir_show_listing_right_section')) { ?>
1832
+	if (get_option('geodir_show_listing_right_section')) { ?>
1833 1833
         <div class="geodir-content-right geodir-sidebar-wrap">
1834 1834
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1835 1835
         </div><!-- end geodir-content-right -->
@@ -1847,20 +1847,20 @@  discard block
 block discarded – undo
1847 1847
  */
1848 1848
 function geodir_action_listings_sidebar_right()
1849 1849
 {
1850
-    if (get_option('geodir_show_listing_right_section')) {
1851
-        /** This action is documented in geodirectory_template_actions.php */
1852
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1853
-        /**
1854
-         * Calls the listings page (category) right sidebar content.
1855
-         *
1856
-         * All the content for the listings page right sidebar is added via this hook.
1857
-         *
1858
-         * @since 1.0.0
1859
-         */
1860
-        do_action('geodir_listings_sidebar_right_inside');
1861
-        /** This action is documented in geodirectory_template_actions.php */
1862
-        do_action('geodir_sidebar_right_close', 'listings-page');
1863
-    }
1850
+	if (get_option('geodir_show_listing_right_section')) {
1851
+		/** This action is documented in geodirectory_template_actions.php */
1852
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1853
+		/**
1854
+		 * Calls the listings page (category) right sidebar content.
1855
+		 *
1856
+		 * All the content for the listings page right sidebar is added via this hook.
1857
+		 *
1858
+		 * @since 1.0.0
1859
+		 */
1860
+		do_action('geodir_listings_sidebar_right_inside');
1861
+		/** This action is documented in geodirectory_template_actions.php */
1862
+		do_action('geodir_sidebar_right_close', 'listings-page');
1863
+	}
1864 1864
 }
1865 1865
 
1866 1866
 
@@ -1877,23 +1877,23 @@  discard block
 block discarded – undo
1877 1877
  */
1878 1878
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1879 1879
 {
1880
-    $tc = get_option('theme_compatibility_setting');
1881
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1882
-        $text = $tc['geodir_main_content_open_replace'];
1883
-    } else {
1884
-        $text = '<main id="[id]" class="[class]" role="main">';
1885
-    }
1880
+	$tc = get_option('theme_compatibility_setting');
1881
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1882
+		$text = $tc['geodir_main_content_open_replace'];
1883
+	} else {
1884
+		$text = '<main id="[id]" class="[class]" role="main">';
1885
+	}
1886 1886
 
1887
-    if (!empty($tc['geodir_main_content_open_id'])) {
1888
-        $id = $tc['geodir_main_content_open_id'];
1889
-    }
1890
-    if (!empty($tc['geodir_main_content_open_class'])) {
1891
-        $class = $tc['geodir_main_content_open_class'];
1892
-    }
1887
+	if (!empty($tc['geodir_main_content_open_id'])) {
1888
+		$id = $tc['geodir_main_content_open_id'];
1889
+	}
1890
+	if (!empty($tc['geodir_main_content_open_class'])) {
1891
+		$class = $tc['geodir_main_content_open_class'];
1892
+	}
1893 1893
 
1894
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1894
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1895 1895
 
1896
-    echo $text;
1896
+	echo $text;
1897 1897
 }
1898 1898
 
1899 1899
 // action for adding the primary div closing tag
@@ -1906,13 +1906,13 @@  discard block
 block discarded – undo
1906 1906
  */
1907 1907
 function geodir_action_main_content_close()
1908 1908
 {
1909
-    $tc = get_option('theme_compatibility_setting');
1910
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1911
-        $text = $tc['geodir_main_content_close_replace'];
1912
-    } else {
1913
-        $text = '</main><!-- main ends here-->';
1914
-    }
1915
-    echo $text;
1909
+	$tc = get_option('theme_compatibility_setting');
1910
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1911
+		$text = $tc['geodir_main_content_close_replace'];
1912
+	} else {
1913
+		$text = '</main><!-- main ends here-->';
1914
+	}
1915
+	echo $text;
1916 1916
 }
1917 1917
 
1918 1918
 /**
@@ -1924,14 +1924,14 @@  discard block
 block discarded – undo
1924 1924
  */
1925 1925
 function geodir_action_listings_content_inside()
1926 1926
 {
1927
-    global $gridview_columns;
1928
-    $listing_view = get_option('geodir_listing_view');
1929
-    if (strstr($listing_view, 'gridview')) {
1930
-        $gridview_columns = $listing_view;
1931
-        $listing_view_exp = explode('_', $listing_view);
1932
-        $listing_view = $listing_view_exp[0];
1933
-    }
1934
-    geodir_get_template_part('listing', 'listview');
1927
+	global $gridview_columns;
1928
+	$listing_view = get_option('geodir_listing_view');
1929
+	if (strstr($listing_view, 'gridview')) {
1930
+		$gridview_columns = $listing_view;
1931
+		$listing_view_exp = explode('_', $listing_view);
1932
+		$listing_view = $listing_view_exp[0];
1933
+	}
1934
+	geodir_get_template_part('listing', 'listview');
1935 1935
 }
1936 1936
 
1937 1937
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1947,47 +1947,47 @@  discard block
 block discarded – undo
1947 1947
  */
1948 1948
 function geodir_action_listings_content()
1949 1949
 {
1950
-    /**
1951
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1952
-     *
1953
-     * @since 1.0.0
1954
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1955
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
1956
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1957
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1958
-     */
1959
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1960
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1961
-    echo '<div class="clearfix '.$extra_class.'">';
1962
-    /**
1963
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1964
-     *
1965
-     * @since 1.0.0
1966
-     */
1967
-    do_action('geodir_before_listing');
1968
-    echo '</div>';
1969
-
1970
-    /**
1971
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
1972
-     *
1973
-     * @since 1.0.0
1974
-     */
1975
-    do_action('geodir_listings_content_inside');
1976
-
1977
-    /**
1978
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1979
-     *
1980
-     * @since 1.0.0
1981
-     */
1982
-    do_action('geodir_after_listing');
1983
-
1984
-    /**
1985
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1986
-     *
1987
-     * @since 1.0.0
1988
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
1989
-     */
1990
-    do_action('geodir_main_content_close', 'listings-page');
1950
+	/**
1951
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1952
+	 *
1953
+	 * @since 1.0.0
1954
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1955
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
1956
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1957
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1958
+	 */
1959
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1960
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1961
+	echo '<div class="clearfix '.$extra_class.'">';
1962
+	/**
1963
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1964
+	 *
1965
+	 * @since 1.0.0
1966
+	 */
1967
+	do_action('geodir_before_listing');
1968
+	echo '</div>';
1969
+
1970
+	/**
1971
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
1972
+	 *
1973
+	 * @since 1.0.0
1974
+	 */
1975
+	do_action('geodir_listings_content_inside');
1976
+
1977
+	/**
1978
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1979
+	 *
1980
+	 * @since 1.0.0
1981
+	 */
1982
+	do_action('geodir_after_listing');
1983
+
1984
+	/**
1985
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1986
+	 *
1987
+	 * @since 1.0.0
1988
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
1989
+	 */
1990
+	do_action('geodir_main_content_close', 'listings-page');
1991 1991
 }
1992 1992
 
1993 1993
 
@@ -2002,10 +2002,10 @@  discard block
 block discarded – undo
2002 2002
  */
2003 2003
 function geodir_action_sidebar_listings_bottom_section()
2004 2004
 {
2005
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2005
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2006 2006
         <div class="<?php
2007
-            /** This action is documented in geodirectory_template_actions.php */
2008
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2007
+			/** This action is documented in geodirectory_template_actions.php */
2008
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2009 2009
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2010 2010
         </div><!-- clearfix ends here-->
2011 2011
     <?php }
@@ -2025,38 +2025,38 @@  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']);
2030
-    /** This action is documented in geodirectory_template_actions.php */
2031
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032
-    /** This action is documented in geodirectory_template_actions.php */
2033
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2034
-
2035
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2036
-
2037
-    if(geodir_is_page('add-listing')){
2038
-        $gd_page = 'add-listing';
2039
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2042
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043
-        }
2028
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2029
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2030
+	/** This action is documented in geodirectory_template_actions.php */
2031
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032
+	/** This action is documented in geodirectory_template_actions.php */
2033
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2034
+
2035
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2036
+
2037
+	if(geodir_is_page('add-listing')){
2038
+		$gd_page = 'add-listing';
2039
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
+		}elseif(isset($listing_type)){
2042
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043
+		}
2044 2044
 
2045
-    }
2045
+	}
2046 2046
 
2047 2047
 
2048
-    /**
2049
-     * Filter page title to replace variables.
2050
-     *
2051
-     * @since 1.5.4
2052
-     * @param string $title The page title including variables.
2053
-     * @param string $gd_page The GeoDirectory page type if any.
2054
-     */
2055
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2048
+	/**
2049
+	 * Filter page title to replace variables.
2050
+	 *
2051
+	 * @since 1.5.4
2052
+	 * @param string $title The page title including variables.
2053
+	 * @param string $gd_page The GeoDirectory page type if any.
2054
+	 */
2055
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2056 2056
 
2057
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2058
-    echo $title;
2059
-    echo '</h1></header>';
2057
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2058
+	echo $title;
2059
+	echo '</h1></header>';
2060 2060
 }
2061 2061
 
2062 2062
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2087,54 +2087,54 @@  discard block
 block discarded – undo
2087 2087
  */
2088 2088
 function geodir_action_add_listing_form()
2089 2089
 {
2090
-    global $cat_display, $post_cat, $current_user, $gd_session;
2091
-    $page_id = get_the_ID();
2092
-    $post = '';
2093
-    $title = '';
2094
-    $desc = '';
2095
-    $kw_tags = '';
2096
-    $required_msg = '';
2097
-    $submit_button = '';
2098
-
2099
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2100
-
2101
-    $thumb_img_arr = array();
2102
-    $curImages = '';
2103
-
2104
-    if (isset($_REQUEST['backandedit'])) {
2105
-        global $post;
2106
-        $post = (object)$gd_session->get('listing');
2107
-        $listing_type = $post->listing_type;
2108
-        $title = $post->post_title;
2109
-        $desc = $post->post_desc;
2110
-        $post_cat = $post->post_category;
2111
-
2112
-        $kw_tags = $post->post_tags;
2113
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2114
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2115
-        global $post, $post_images;
2116
-
2117
-        $post = geodir_get_post_info($_REQUEST['pid']);
2118
-        $thumb_img_arr = geodir_get_images($post->ID);
2119
-        if ($thumb_img_arr) {
2120
-            foreach ($thumb_img_arr as $post_img) {
2121
-                $curImages .= $post_img->src . ',';
2122
-            }
2123
-        }
2124
-
2125
-        $listing_type = $post->post_type;
2126
-        $title = $post->post_title;
2127
-        $desc = $post->post_content;
2128
-        $kw_tags = $post->post_tags;
2129
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2130
-    } else {
2131
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2132
-    }
2133
-
2134
-    if ($current_user->ID != '0') {
2135
-        $user_login = true;
2136
-    }
2137
-    ?>
2090
+	global $cat_display, $post_cat, $current_user, $gd_session;
2091
+	$page_id = get_the_ID();
2092
+	$post = '';
2093
+	$title = '';
2094
+	$desc = '';
2095
+	$kw_tags = '';
2096
+	$required_msg = '';
2097
+	$submit_button = '';
2098
+
2099
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2100
+
2101
+	$thumb_img_arr = array();
2102
+	$curImages = '';
2103
+
2104
+	if (isset($_REQUEST['backandedit'])) {
2105
+		global $post;
2106
+		$post = (object)$gd_session->get('listing');
2107
+		$listing_type = $post->listing_type;
2108
+		$title = $post->post_title;
2109
+		$desc = $post->post_desc;
2110
+		$post_cat = $post->post_category;
2111
+
2112
+		$kw_tags = $post->post_tags;
2113
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2114
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2115
+		global $post, $post_images;
2116
+
2117
+		$post = geodir_get_post_info($_REQUEST['pid']);
2118
+		$thumb_img_arr = geodir_get_images($post->ID);
2119
+		if ($thumb_img_arr) {
2120
+			foreach ($thumb_img_arr as $post_img) {
2121
+				$curImages .= $post_img->src . ',';
2122
+			}
2123
+		}
2124
+
2125
+		$listing_type = $post->post_type;
2126
+		$title = $post->post_title;
2127
+		$desc = $post->post_content;
2128
+		$kw_tags = $post->post_tags;
2129
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2130
+	} else {
2131
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2132
+	}
2133
+
2134
+	if ($current_user->ID != '0') {
2135
+		$user_login = true;
2136
+	}
2137
+	?>
2138 2138
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2139 2139
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2140 2140
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2145,27 +2145,27 @@  discard block
 block discarded – undo
2145 2145
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2146 2146
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2147 2147
         <?php
2148
-        } 
2149
-        /**
2150
-         * Called at the very top of the add listing page form for frontend.
2151
-         *
2152
-         * This is called just before the "Enter Listing Details" text.
2153
-         *
2154
-         * @since 1.0.0
2155
-         */
2156
-        do_action('geodir_before_detail_fields');
2157
-        ?>
2148
+		} 
2149
+		/**
2150
+		 * Called at the very top of the add listing page form for frontend.
2151
+		 *
2152
+		 * This is called just before the "Enter Listing Details" text.
2153
+		 *
2154
+		 * @since 1.0.0
2155
+		 */
2156
+		do_action('geodir_before_detail_fields');
2157
+		?>
2158 2158
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2159 2159
         <?php
2160
-        /**
2161
-         * Called at the top of the add listing page form for frontend.
2162
-         *
2163
-         * This is called after the "Enter Listing Details" text.
2164
-         *
2165
-         * @since 1.0.0
2166
-         */
2167
-        do_action('geodir_before_main_form_fields');
2168
-        ?>
2160
+		/**
2161
+		 * Called at the top of the add listing page form for frontend.
2162
+		 *
2163
+		 * This is called after the "Enter Listing Details" text.
2164
+		 *
2165
+		 * @since 1.0.0
2166
+		 */
2167
+		do_action('geodir_before_main_form_fields');
2168
+		?>
2169 2169
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2170 2170
             <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2171 2171
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
@@ -2173,57 +2173,57 @@  discard block
 block discarded – undo
2173 2173
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2174 2174
         </div>
2175 2175
         <?php
2176
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2177
-
2178
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2179
-        $desc_limit = '';
2180
-        /**
2181
-         * Filter the add listing description field character limit number.
2182
-         *
2183
-         * @since 1.0.0
2184
-         * @param int $desc_limit The amount of characters to limit the description to.
2185
-         */
2186
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2187
-        /**
2188
-         * Filter the add listing description field text.
2189
-         *
2190
-         * @since 1.0.0
2191
-         * @param string $desc The text for the description field.
2192
-         * @param int $desc_limit The character limit numer if any.
2193
-         */
2194
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2195
-        $desc_limit_msg = '';
2196
-        /**
2197
-         * Filter the add listing description limit message.
2198
-         *
2199
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2200
-         *
2201
-         * @since 1.0.0
2202
-         * @param string $desc_limit_msg The limit message string if any.
2203
-         * @param int $desc_limit The character limit numer if any.
2204
-         */
2205
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2176
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2177
+
2178
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2179
+		$desc_limit = '';
2180
+		/**
2181
+		 * Filter the add listing description field character limit number.
2182
+		 *
2183
+		 * @since 1.0.0
2184
+		 * @param int $desc_limit The amount of characters to limit the description to.
2185
+		 */
2186
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2187
+		/**
2188
+		 * Filter the add listing description field text.
2189
+		 *
2190
+		 * @since 1.0.0
2191
+		 * @param string $desc The text for the description field.
2192
+		 * @param int $desc_limit The character limit numer if any.
2193
+		 */
2194
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2195
+		$desc_limit_msg = '';
2196
+		/**
2197
+		 * Filter the add listing description limit message.
2198
+		 *
2199
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2200
+		 *
2201
+		 * @since 1.0.0
2202
+		 * @param string $desc_limit_msg The limit message string if any.
2203
+		 * @param int $desc_limit The character limit numer if any.
2204
+		 */
2205
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2206 2206
         
2207
-        $desc_class = '';
2208
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2209
-            /**
2210
-             * Called on the add listing page form for frontend just before the description field.
2211
-             *
2212
-             * @since 1.0.0
2213
-             */
2214
-            do_action('geodir_before_description_field');
2207
+		$desc_class = '';
2208
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2209
+			/**
2210
+			 * Called on the add listing page form for frontend just before the description field.
2211
+			 *
2212
+			 * @since 1.0.0
2213
+			 */
2214
+			do_action('geodir_before_description_field');
2215 2215
             
2216
-            $desc_class = ' required_field';
2217
-        } else {
2218
-            $desc_class = ' hidden';
2219
-        }
2220
-        ?>
2216
+			$desc_class = ' required_field';
2217
+		} else {
2218
+			$desc_class = ' hidden';
2219
+		}
2220
+		?>
2221 2221
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2222 2222
             <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2223 2223
             <?php
2224
-            if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2225
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2226
-            ?>
2224
+			if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2225
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2226
+			?>
2227 2227
                 <div class="editor" field_id="post_desc" field_type="editor">
2228 2228
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2229 2229
                 </div>
@@ -2237,56 +2237,56 @@  discard block
 block discarded – undo
2237 2237
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2238 2238
         </div>
2239 2239
         <?php
2240
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2241
-            /**
2242
-             * Called on the add listing page form for frontend just after the description field.
2243
-             *
2244
-             * @since 1.0.0
2245
-             */
2246
-            do_action('geodir_after_description_field');
2247
-        }
2240
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2241
+			/**
2242
+			 * Called on the add listing page form for frontend just after the description field.
2243
+			 *
2244
+			 * @since 1.0.0
2245
+			 */
2246
+			do_action('geodir_after_description_field');
2247
+		}
2248 2248
         
2249
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2250
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2251
-        $kw_tags_msg = TAGKW_MSG;
2252
-        /**
2253
-         * Filter the add listing tags character limit.
2254
-         *
2255
-         * @since 1.0.0
2256
-         * @param int $kw_tags_count The character count limit if any.
2257
-         */
2258
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2259
-        /**
2260
-         * Filter the add listing tags field value.
2261
-         *
2262
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2263
-         *
2264
-         * @since 1.0.0
2265
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2266
-         * @param int $kw_tags_count The character count limit if any.
2267
-         */
2268
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2269
-        /**
2270
-         * Filter the add listing tags field message text.
2271
-         *
2272
-         * @since 1.0.0
2273
-         * @param string $kw_tags_msg The message shown under the field.
2274
-         * @param int $kw_tags_count The character count limit if any.
2275
-         */
2276
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2249
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2250
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2251
+		$kw_tags_msg = TAGKW_MSG;
2252
+		/**
2253
+		 * Filter the add listing tags character limit.
2254
+		 *
2255
+		 * @since 1.0.0
2256
+		 * @param int $kw_tags_count The character count limit if any.
2257
+		 */
2258
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2259
+		/**
2260
+		 * Filter the add listing tags field value.
2261
+		 *
2262
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2263
+		 *
2264
+		 * @since 1.0.0
2265
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2266
+		 * @param int $kw_tags_count The character count limit if any.
2267
+		 */
2268
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2269
+		/**
2270
+		 * Filter the add listing tags field message text.
2271
+		 *
2272
+		 * @since 1.0.0
2273
+		 * @param string $kw_tags_msg The message shown under the field.
2274
+		 * @param int $kw_tags_count The character count limit if any.
2275
+		 */
2276
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2277 2277
         
2278
-        $tags_class = '';
2279
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2280
-            /**
2281
-             * Called on the add listing page form for frontend just before the tags field.
2282
-             *
2283
-             * @since 1.0.0
2284
-             */
2285
-            do_action('geodir_before_listing_tags_field');
2286
-        } else {
2287
-            $tags_class = ' hidden';
2288
-        }
2289
-        ?>
2278
+		$tags_class = '';
2279
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2280
+			/**
2281
+			 * Called on the add listing page form for frontend just before the tags field.
2282
+			 *
2283
+			 * @since 1.0.0
2284
+			 */
2285
+			do_action('geodir_before_listing_tags_field');
2286
+		} else {
2287
+			$tags_class = ' hidden';
2288
+		}
2289
+		?>
2290 2290
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2291 2291
             <label><?php echo TAGKW_TEXT; ?></label>
2292 2292
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2294,90 +2294,90 @@  discard block
 block discarded – undo
2294 2294
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2295 2295
         </div>
2296 2296
         <?php
2297
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2298
-            /**
2299
-             * Called on the add listing page form for frontend just after the tags field.
2300
-             *
2301
-             * @since 1.0.0
2302
-             */
2303
-            do_action('geodir_after_listing_tags_field');
2304
-        }
2297
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2298
+			/**
2299
+			 * Called on the add listing page form for frontend just after the tags field.
2300
+			 *
2301
+			 * @since 1.0.0
2302
+			 */
2303
+			do_action('geodir_after_listing_tags_field');
2304
+		}
2305 2305
         
2306
-        $package_info = array();
2307
-        $package_info = geodir_post_package_info($package_info, $post);
2306
+		$package_info = array();
2307
+		$package_info = geodir_post_package_info($package_info, $post);
2308 2308
         
2309
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2309
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2310 2310
         
2311
-        // adjust values here
2312
-        $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
2311
+		// adjust values here
2312
+		$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
2313 2313
 
2314
-        $multiple = true; // allow multiple files upload
2314
+		$multiple = true; // allow multiple files upload
2315 2315
 
2316
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2316
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2317 2317
 
2318
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2318
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2319 2319
 
2320
-        $thumb_img_arr = array();
2321
-        $totImg = 0;
2322
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2323
-            $post = (object)$gd_session->get('listing');
2324
-            if (isset($post->post_images))
2325
-                $curImages = trim($post->post_images, ",");
2320
+		$thumb_img_arr = array();
2321
+		$totImg = 0;
2322
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2323
+			$post = (object)$gd_session->get('listing');
2324
+			if (isset($post->post_images))
2325
+				$curImages = trim($post->post_images, ",");
2326 2326
 
2327 2327
 
2328
-            if ($curImages != '') {
2329
-                $curImages_array = explode(',', $curImages);
2330
-                $totImg = count($curImages_array);
2331
-            }
2332
-
2333
-            $listing_type = $post->listing_type;
2328
+			if ($curImages != '') {
2329
+				$curImages_array = explode(',', $curImages);
2330
+				$totImg = count($curImages_array);
2331
+			}
2334 2332
 
2335
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2336
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2337
-            $listing_type = $post->post_type;
2338
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2333
+			$listing_type = $post->listing_type;
2339 2334
 
2340
-        } else {
2341
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2342
-        }
2335
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2336
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2337
+			$listing_type = $post->post_type;
2338
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2343 2339
 
2340
+		} else {
2341
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2342
+		}
2344 2343
 
2345
-        if (!empty($thumb_img_arr)) {
2346
-            foreach ($thumb_img_arr as $img) {
2347
-                //$curImages = $img->src.",";
2348
-            }
2349 2344
 
2350
-            $totImg = count((array)$thumb_img_arr);
2351
-        }
2345
+		if (!empty($thumb_img_arr)) {
2346
+			foreach ($thumb_img_arr as $img) {
2347
+				//$curImages = $img->src.",";
2348
+			}
2352 2349
 
2353
-        if ($curImages != '')
2354
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2355
-        else
2356
-            $svalue = '';
2357
-
2358
-        $image_limit = $package_info->image_limit;
2359
-        $show_image_input_box = ($image_limit != '0');
2360
-        /**
2361
-         * Filter to be able to show/hide the image upload section of the add listing form.
2362
-         *
2363
-         * @since 1.0.0
2364
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2365
-         * @param string $listing_type The custom post type slug.
2366
-         */
2367
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2368
-        if ($show_image_input_box) {
2369
-            ?>
2350
+			$totImg = count((array)$thumb_img_arr);
2351
+		}
2352
+
2353
+		if ($curImages != '')
2354
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2355
+		else
2356
+			$svalue = '';
2357
+
2358
+		$image_limit = $package_info->image_limit;
2359
+		$show_image_input_box = ($image_limit != '0');
2360
+		/**
2361
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2362
+		 *
2363
+		 * @since 1.0.0
2364
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2365
+		 * @param string $listing_type The custom post type slug.
2366
+		 */
2367
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2368
+		if ($show_image_input_box) {
2369
+			?>
2370 2370
 
2371 2371
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2372 2372
                 <?php if ($image_limit == 1) {
2373
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2374
-                } ?>
2373
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2374
+				} ?>
2375 2375
                 <?php if ($image_limit > 1) {
2376
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2377
-                } ?>
2376
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2377
+				} ?>
2378 2378
                 <?php if ($image_limit == '') {
2379
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2380
-                } ?>
2379
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2380
+				} ?>
2381 2381
             </h5>
2382 2382
 
2383 2383
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2415,12 +2415,12 @@  discard block
 block discarded – undo
2415 2415
         <?php } ?>
2416 2416
 
2417 2417
         <?php
2418
-        /**
2419
-         * Called on the add listing page form for frontend just after the image upload field.
2420
-         *
2421
-         * @since 1.0.0
2422
-         */
2423
-        do_action('geodir_after_main_form_fields');?>
2418
+		/**
2419
+		 * Called on the add listing page form for frontend just after the image upload field.
2420
+		 *
2421
+		 * @since 1.0.0
2422
+		 */
2423
+		do_action('geodir_after_main_form_fields');?>
2424 2424
 
2425 2425
 
2426 2426
         <!-- add captcha code -->
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 
2450 2450
     </form>
2451 2451
     <?php
2452
-    wp_reset_query();
2452
+	wp_reset_query();
2453 2453
 }
2454 2454
 
2455 2455
 /**
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
  */
2461 2461
 function geodir_add_listing_sidebar_widget_area()
2462 2462
 {
2463
-    dynamic_sidebar('geodir_add_listing_sidebar');
2463
+	dynamic_sidebar('geodir_add_listing_sidebar');
2464 2464
 }
2465 2465
 
2466 2466
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2475,16 +2475,16 @@  discard block
 block discarded – undo
2475 2475
  */
2476 2476
 function geodir_action_add_listing_sidebar()
2477 2477
 {
2478
-    /** This action is documented in geodirectory_template_actions.php */
2479
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2480
-    /**
2481
-     * This is used to add the content to the add listing page sidebar.
2482
-     *
2483
-     * @since 1.0.0
2484
-     */
2485
-    do_action('geodir_add_listing_sidebar_inside');
2486
-    /** This action is documented in geodirectory_template_actions.php */
2487
-    do_action('geodir_sidebar_right_close', 'details-page');
2478
+	/** This action is documented in geodirectory_template_actions.php */
2479
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2480
+	/**
2481
+	 * This is used to add the content to the add listing page sidebar.
2482
+	 *
2483
+	 * @since 1.0.0
2484
+	 */
2485
+	do_action('geodir_add_listing_sidebar_inside');
2486
+	/** This action is documented in geodirectory_template_actions.php */
2487
+	do_action('geodir_sidebar_right_close', 'details-page');
2488 2488
 }
2489 2489
 
2490 2490
 ###############################################
@@ -2501,11 +2501,11 @@  discard block
 block discarded – undo
2501 2501
  */
2502 2502
 function geodir_action_geodir_sidebar_signup_top()
2503 2503
 {
2504
-    ?>
2504
+	?>
2505 2505
     <div
2506 2506
         class="<?php
2507
-        /** This action is documented in geodirectory_template_actions.php */
2508
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2507
+		/** This action is documented in geodirectory_template_actions.php */
2508
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2509 2509
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2510 2510
     </div><!-- clearfix ends here-->
2511 2511
 <?php
@@ -2524,9 +2524,9 @@  discard block
 block discarded – undo
2524 2524
 function geodir_action_signup_forms()
2525 2525
 {
2526 2526
 
2527
-    global $user_login;
2527
+	global $user_login;
2528 2528
 
2529
-    ?>
2529
+	?>
2530 2530
     <script type="text/javascript">
2531 2531
         <?php if ( $user_login ) { ?>
2532 2532
         setTimeout(function () {
@@ -2562,65 +2562,65 @@  discard block
 block discarded – undo
2562 2562
         <?php } ?>
2563 2563
     </script><?php
2564 2564
 
2565
-    global $errors;
2566
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2567
-        $errors->add('claim_login', LOGIN_CLAIM);
2568
-
2569
-    if (!empty($errors)) {
2570
-        foreach ($errors as $errorsObj) {
2571
-            foreach ($errorsObj as $key => $val) {
2572
-                for ($i = 0; $i < count($val); $i++) {
2573
-                    echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2574
-                    $registration_error_msg = 1;
2575
-                }
2576
-            }
2577
-        }
2578
-    }
2565
+	global $errors;
2566
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2567
+		$errors->add('claim_login', LOGIN_CLAIM);
2568
+
2569
+	if (!empty($errors)) {
2570
+		foreach ($errors as $errorsObj) {
2571
+			foreach ($errorsObj as $key => $val) {
2572
+				for ($i = 0; $i < count($val); $i++) {
2573
+					echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2574
+					$registration_error_msg = 1;
2575
+				}
2576
+			}
2577
+		}
2578
+	}
2579 2579
 
2580
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2581
-        ?>
2580
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2581
+		?>
2582 2582
 
2583 2583
         <div class="login_form">
2584 2584
             <?php
2585
-            /**
2586
-             * Contains login form template.
2587
-             *
2588
-             * @since 1.0.0
2589
-             */
2590
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2585
+			/**
2586
+			 * Contains login form template.
2587
+			 *
2588
+			 * @since 1.0.0
2589
+			 */
2590
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2591 2591
         </div>
2592 2592
 
2593 2593
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
2594 2594
 
2595 2595
         <div class="registration_form">
2596 2596
             <?php
2597
-            /**
2598
-             * Contains registration form template.
2599
-             *
2600
-             * @since 1.0.0
2601
-             */
2602
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2597
+			/**
2598
+			 * Contains registration form template.
2599
+			 *
2600
+			 * @since 1.0.0
2601
+			 */
2602
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2603 2603
         </div>
2604 2604
 
2605 2605
     <?php } else { ?>
2606 2606
 
2607 2607
         <div class="login_form_l">
2608 2608
             <?php
2609
-            /**
2610
-             * Contains login form template.
2611
-             *
2612
-             * @since 1.0.0
2613
-             */
2614
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2609
+			/**
2610
+			 * Contains login form template.
2611
+			 *
2612
+			 * @since 1.0.0
2613
+			 */
2614
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2615 2615
         </div>
2616 2616
         <div class="registration_form_r">
2617 2617
             <?php
2618
-            /**
2619
-             * Contains registration form template.
2620
-             *
2621
-             * @since 1.0.0
2622
-             */
2623
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2618
+			/**
2619
+			 * Contains registration form template.
2620
+			 *
2621
+			 * @since 1.0.0
2622
+			 */
2623
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2624 2624
         </div>
2625 2625
 
2626 2626
     <?php }?>
@@ -2651,66 +2651,66 @@  discard block
 block discarded – undo
2651 2651
  */
2652 2652
 function geodir_action_author_page_title()
2653 2653
 {
2654
-    global $term;
2654
+	global $term;
2655 2655
 
2656
-    $gd_post_type = geodir_get_current_posttype();
2657
-    $post_type_info = get_post_type_object($gd_post_type);
2656
+	$gd_post_type = geodir_get_current_posttype();
2657
+	$post_type_info = get_post_type_object($gd_post_type);
2658 2658
 
2659
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2660
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2661
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2662
-    }
2659
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2660
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2661
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2662
+	}
2663 2663
 
2664
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2665
-    $single_name = $post_type_info->labels->singular_name;
2664
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2665
+	$single_name = $post_type_info->labels->singular_name;
2666 2666
 
2667
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2667
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2668 2668
 
2669
-    if (!empty($term)) {
2670
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2671
-        if (!empty($current_term))
2672
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2673
-    }
2669
+	if (!empty($term)) {
2670
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2671
+		if (!empty($current_term))
2672
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2673
+	}
2674 2674
 
2675 2675
 
2676
-    if (is_search()) {
2677
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2676
+	if (is_search()) {
2677
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2678 2678
 
2679
-    }
2680
-    /** This action is documented in geodirectory_template_actions.php */
2681
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2682
-    /** This action is documented in geodirectory_template_actions.php */
2683
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2679
+	}
2680
+	/** This action is documented in geodirectory_template_actions.php */
2681
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2682
+	/** This action is documented in geodirectory_template_actions.php */
2683
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2684 2684
 
2685
-    $title = $list_title;
2686
-    if(geodir_is_page('author')){
2687
-        $gd_page = 'author';
2688
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2689
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2690
-        }else{
2691
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2692
-        }
2685
+	$title = $list_title;
2686
+	if(geodir_is_page('author')){
2687
+		$gd_page = 'author';
2688
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2689
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2690
+		}else{
2691
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2692
+		}
2693 2693
 
2694
-    }
2694
+	}
2695 2695
 
2696 2696
 
2697
-    /**
2698
-     * Filter page title to replace variables.
2699
-     *
2700
-     * @since 1.5.4
2701
-     * @param string $title The page title including variables.
2702
-     * @param string $gd_page The GeoDirectory page type if any.
2703
-     */
2704
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2697
+	/**
2698
+	 * Filter page title to replace variables.
2699
+	 *
2700
+	 * @since 1.5.4
2701
+	 * @param string $title The page title including variables.
2702
+	 * @param string $gd_page The GeoDirectory page type if any.
2703
+	 */
2704
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2705 2705
 
2706
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2707
-        /**
2708
-         * Filter the author page title text.
2709
-         *
2710
-         * @since 1.0.0
2711
-         * @param string $list_title The title for the page.
2712
-         */
2713
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2706
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2707
+		/**
2708
+		 * Filter the author page title text.
2709
+		 *
2710
+		 * @since 1.0.0
2711
+		 * @param string $list_title The title for the page.
2712
+		 */
2713
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2714 2714
 }
2715 2715
 
2716 2716
 
@@ -2728,11 +2728,11 @@  discard block
 block discarded – undo
2728 2728
  */
2729 2729
 function geodir_action_geodir_sidebar_author_top()
2730 2730
 {
2731
-    if (get_option('geodir_show_author_top_section')) { ?>
2731
+	if (get_option('geodir_show_author_top_section')) { ?>
2732 2732
         <div
2733 2733
             class="<?php
2734
-            /** This action is documented in geodirectory_template_actions.php */
2735
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2734
+			/** This action is documented in geodirectory_template_actions.php */
2735
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2736 2736
             <?php dynamic_sidebar('geodir_author_top'); ?>
2737 2737
         </div><!-- clearfix ends here-->
2738 2738
     <?php }
@@ -2748,7 +2748,7 @@  discard block
 block discarded – undo
2748 2748
  */
2749 2749
 function geodir_author_left_section()
2750 2750
 {
2751
-    if (get_option('geodir_show_author_left_section')) { ?>
2751
+	if (get_option('geodir_show_author_left_section')) { ?>
2752 2752
         <div class="geodir-content-left geodir-sidebar-wrap">
2753 2753
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2754 2754
         </div><!-- end geodir-content-left -->
@@ -2769,19 +2769,19 @@  discard block
 block discarded – undo
2769 2769
  */
2770 2770
 function geodir_action_author_sidebar_left()
2771 2771
 {
2772
-    if (get_option('geodir_show_author_left_section')) {
2772
+	if (get_option('geodir_show_author_left_section')) {
2773 2773
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2774
-        /** This action is documented in geodirectory_template_actions.php */
2775
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2776
-        /**
2777
-         * This is used to add the content to the author page left sidebar (if active).
2778
-         *
2779
-         * @since 1.0.0
2780
-         */
2781
-        do_action('geodir_author_sidebar_left_inside');
2782
-        /** This action is documented in geodirectory_template_actions.php */
2783
-        do_action('geodir_sidebar_left_close', 'author-page');
2784
-    }
2774
+		/** This action is documented in geodirectory_template_actions.php */
2775
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2776
+		/**
2777
+		 * This is used to add the content to the author page left sidebar (if active).
2778
+		 *
2779
+		 * @since 1.0.0
2780
+		 */
2781
+		do_action('geodir_author_sidebar_left_inside');
2782
+		/** This action is documented in geodirectory_template_actions.php */
2783
+		do_action('geodir_sidebar_left_close', 'author-page');
2784
+	}
2785 2785
 }
2786 2786
 
2787 2787
 /**
@@ -2794,7 +2794,7 @@  discard block
 block discarded – undo
2794 2794
  */
2795 2795
 function geodir_author_right_section()
2796 2796
 {
2797
-    if (get_option('geodir_show_author_right_section')) { ?>
2797
+	if (get_option('geodir_show_author_right_section')) { ?>
2798 2798
         <div class="geodir-content-right geodir-sidebar-wrap">
2799 2799
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2800 2800
         </div><!-- end geodir-content-right -->
@@ -2814,18 +2814,18 @@  discard block
 block discarded – undo
2814 2814
  */
2815 2815
 function geodir_action_author_sidebar_right()
2816 2816
 {
2817
-    if (get_option('geodir_show_author_right_section')) {
2818
-        /** This action is documented in geodirectory_template_actions.php */
2819
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2820
-        /**
2821
-         * This is used to add the content to the author page right sidebar (if active).
2822
-         *
2823
-         * @since 1.0.0
2824
-         */
2825
-        do_action('geodir_author_sidebar_right_inside');
2826
-        /** This action is documented in geodirectory_template_actions.php */
2827
-        do_action('geodir_sidebar_right_close', 'author-page');
2828
-    }
2817
+	if (get_option('geodir_show_author_right_section')) {
2818
+		/** This action is documented in geodirectory_template_actions.php */
2819
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2820
+		/**
2821
+		 * This is used to add the content to the author page right sidebar (if active).
2822
+		 *
2823
+		 * @since 1.0.0
2824
+		 */
2825
+		do_action('geodir_author_sidebar_right_inside');
2826
+		/** This action is documented in geodirectory_template_actions.php */
2827
+		do_action('geodir_sidebar_right_close', 'author-page');
2828
+	}
2829 2829
 }
2830 2830
 
2831 2831
 /**
@@ -2837,14 +2837,14 @@  discard block
 block discarded – undo
2837 2837
  */
2838 2838
 function geodir_action_author_content_inside()
2839 2839
 {
2840
-    global $gridview_columns;
2841
-    $listing_view = get_option('geodir_author_view');
2842
-    if (strstr($listing_view, 'gridview')) {
2843
-        $gridview_columns = $listing_view;
2844
-        $listing_view_exp = explode('_', $listing_view);
2845
-        $listing_view = $listing_view_exp[0];
2846
-    }
2847
-    geodir_get_template_part('listing', 'listview');
2840
+	global $gridview_columns;
2841
+	$listing_view = get_option('geodir_author_view');
2842
+	if (strstr($listing_view, 'gridview')) {
2843
+		$gridview_columns = $listing_view;
2844
+		$listing_view_exp = explode('_', $listing_view);
2845
+		$listing_view = $listing_view_exp[0];
2846
+	}
2847
+	geodir_get_template_part('listing', 'listview');
2848 2848
 }
2849 2849
 
2850 2850
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2859,22 +2859,22 @@  discard block
 block discarded – undo
2859 2859
  */
2860 2860
 function geodir_action_author_content()
2861 2861
 {
2862
-    /** This action is documented in geodirectory_template_actions.php */
2863
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2864
-    echo '<div class="clearfix">';
2865
-    /** This action is documented in geodirectory_template_actions.php */
2866
-    do_action('geodir_before_listing');
2867
-    echo '</div>';
2868
-    /**
2869
-     * This is used to add the content to the author page main content.
2870
-     *
2871
-     * @since 1.0.0
2872
-     */
2873
-    do_action('geodir_author_content_inside');
2874
-    /** This action is documented in geodirectory_template_actions.php */
2875
-    do_action('geodir_after_listing');
2876
-    /** This action is documented in geodirectory_template_actions.php */
2877
-    do_action('geodir_main_content_close', 'author-page');
2862
+	/** This action is documented in geodirectory_template_actions.php */
2863
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2864
+	echo '<div class="clearfix">';
2865
+	/** This action is documented in geodirectory_template_actions.php */
2866
+	do_action('geodir_before_listing');
2867
+	echo '</div>';
2868
+	/**
2869
+	 * This is used to add the content to the author page main content.
2870
+	 *
2871
+	 * @since 1.0.0
2872
+	 */
2873
+	do_action('geodir_author_content_inside');
2874
+	/** This action is documented in geodirectory_template_actions.php */
2875
+	do_action('geodir_after_listing');
2876
+	/** This action is documented in geodirectory_template_actions.php */
2877
+	do_action('geodir_main_content_close', 'author-page');
2878 2878
 }
2879 2879
 
2880 2880
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2888,11 +2888,11 @@  discard block
 block discarded – undo
2888 2888
  */
2889 2889
 function geodir_action_sidebar_author_bottom_section()
2890 2890
 {
2891
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2891
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2892 2892
         <div
2893 2893
             class="<?php
2894
-            /** This action is documented in geodirectory_template_actions.php */
2895
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2894
+			/** This action is documented in geodirectory_template_actions.php */
2895
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2896 2896
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2897 2897
         </div><!-- clearfix ends here-->
2898 2898
     <?php }
@@ -2911,23 +2911,23 @@  discard block
 block discarded – undo
2911 2911
  */
2912 2912
 function geodir_action_search_page_title()
2913 2913
 {
2914
-    $gd_post_type = geodir_get_current_posttype();
2915
-    $post_type_info = get_post_type_object($gd_post_type);
2914
+	$gd_post_type = geodir_get_current_posttype();
2915
+	$post_type_info = get_post_type_object($gd_post_type);
2916 2916
 
2917
-    $pt_name = '';
2918
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2917
+	$pt_name = '';
2918
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2919 2919
 
2920
-    if (is_search()) {
2921
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2920
+	if (is_search()) {
2921
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2922 2922
 
2923
-    }
2924
-    /** This action is documented in geodirectory_template_actions.php */
2925
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2926
-    /** This action is documented in geodirectory_template_actions.php */
2927
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2928
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2929
-        /** This action is documented in geodirectory_template_actions.php */
2930
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2923
+	}
2924
+	/** This action is documented in geodirectory_template_actions.php */
2925
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2926
+	/** This action is documented in geodirectory_template_actions.php */
2927
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2928
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2929
+		/** This action is documented in geodirectory_template_actions.php */
2930
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2931 2931
 }
2932 2932
 
2933 2933
 // action for adding the listings page top widget area
@@ -2943,11 +2943,11 @@  discard block
 block discarded – undo
2943 2943
  */
2944 2944
 function geodir_action_geodir_sidebar_search_top()
2945 2945
 {
2946
-    if (get_option('geodir_show_search_top_section')) { ?>
2946
+	if (get_option('geodir_show_search_top_section')) { ?>
2947 2947
         <div
2948 2948
             class="<?php
2949
-            /** This action is documented in geodirectory_template_actions.php */
2950
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2949
+			/** This action is documented in geodirectory_template_actions.php */
2950
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2951 2951
             <?php dynamic_sidebar('geodir_search_top'); ?>
2952 2952
         </div><!-- clearfix ends here-->
2953 2953
     <?php }
@@ -2963,7 +2963,7 @@  discard block
 block discarded – undo
2963 2963
  */
2964 2964
 function geodir_search_left_section()
2965 2965
 {
2966
-    if (get_option('geodir_show_search_left_section')) { ?>
2966
+	if (get_option('geodir_show_search_left_section')) { ?>
2967 2967
         <div class="geodir-content-left geodir-sidebar-wrap">
2968 2968
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
2969 2969
         </div><!-- end geodir-content-left -->
@@ -2983,19 +2983,19 @@  discard block
 block discarded – undo
2983 2983
  */
2984 2984
 function geodir_action_search_sidebar_left()
2985 2985
 {
2986
-    if (get_option('geodir_show_search_left_section')) {
2986
+	if (get_option('geodir_show_search_left_section')) {
2987 2987
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2988
-        /** This action is documented in geodirectory_template_actions.php */
2989
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2990
-        /**
2991
-         * This is used to add the content to the search page left sidebar (if active).
2992
-         *
2993
-         * @since 1.0.0
2994
-         */
2995
-        do_action('geodir_search_sidebar_left_inside');
2996
-        /** This action is documented in geodirectory_template_actions.php */
2997
-        do_action('geodir_sidebar_left_close', 'search-page');
2998
-    }
2988
+		/** This action is documented in geodirectory_template_actions.php */
2989
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2990
+		/**
2991
+		 * This is used to add the content to the search page left sidebar (if active).
2992
+		 *
2993
+		 * @since 1.0.0
2994
+		 */
2995
+		do_action('geodir_search_sidebar_left_inside');
2996
+		/** This action is documented in geodirectory_template_actions.php */
2997
+		do_action('geodir_sidebar_left_close', 'search-page');
2998
+	}
2999 2999
 }
3000 3000
 
3001 3001
 /**
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
  */
3009 3009
 function geodir_search_right_section()
3010 3010
 {
3011
-    if (get_option('geodir_show_search_right_section')) { ?>
3011
+	if (get_option('geodir_show_search_right_section')) { ?>
3012 3012
         <div class="geodir-content-right geodir-sidebar-wrap">
3013 3013
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3014 3014
         </div><!-- end geodir-content-right -->
@@ -3028,18 +3028,18 @@  discard block
 block discarded – undo
3028 3028
  */
3029 3029
 function geodir_action_search_sidebar_right()
3030 3030
 {
3031
-    if (get_option('geodir_show_search_right_section')) {
3032
-        /** This action is documented in geodirectory_template_actions.php */
3033
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3034
-        /**
3035
-         * This is used to add the content to the search page right sidebar (if active).
3036
-         *
3037
-         * @since 1.0.0
3038
-         */
3039
-        do_action('geodir_search_sidebar_right_inside');
3040
-        /** This action is documented in geodirectory_template_actions.php */
3041
-        do_action('geodir_sidebar_right_close', 'search-page');
3042
-    }
3031
+	if (get_option('geodir_show_search_right_section')) {
3032
+		/** This action is documented in geodirectory_template_actions.php */
3033
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3034
+		/**
3035
+		 * This is used to add the content to the search page right sidebar (if active).
3036
+		 *
3037
+		 * @since 1.0.0
3038
+		 */
3039
+		do_action('geodir_search_sidebar_right_inside');
3040
+		/** This action is documented in geodirectory_template_actions.php */
3041
+		do_action('geodir_sidebar_right_close', 'search-page');
3042
+	}
3043 3043
 }
3044 3044
 
3045 3045
 
@@ -3054,11 +3054,11 @@  discard block
 block discarded – undo
3054 3054
  */
3055 3055
 function geodir_action_sidebar_search_bottom_section()
3056 3056
 {
3057
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3057
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3058 3058
         <div
3059 3059
             class="<?php
3060
-            /** This action is documented in geodirectory_template_actions.php */
3061
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3060
+			/** This action is documented in geodirectory_template_actions.php */
3061
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3062 3062
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3063 3063
         </div><!-- clearfix ends here-->
3064 3064
     <?php }
@@ -3073,14 +3073,14 @@  discard block
 block discarded – undo
3073 3073
  */
3074 3074
 function geodir_action_search_content_inside()
3075 3075
 {
3076
-    global $gridview_columns;
3077
-    $listing_view = get_option('geodir_search_view');
3078
-    if (strstr($listing_view, 'gridview')) {
3079
-        $gridview_columns = $listing_view;
3080
-        $listing_view_exp = explode('_', $listing_view);
3081
-        $listing_view = $listing_view_exp[0];
3082
-    }
3083
-    geodir_get_template_part('listing', 'listview');
3076
+	global $gridview_columns;
3077
+	$listing_view = get_option('geodir_search_view');
3078
+	if (strstr($listing_view, 'gridview')) {
3079
+		$gridview_columns = $listing_view;
3080
+		$listing_view_exp = explode('_', $listing_view);
3081
+		$listing_view = $listing_view_exp[0];
3082
+	}
3083
+	geodir_get_template_part('listing', 'listview');
3084 3084
 }
3085 3085
 
3086 3086
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3096,22 +3096,22 @@  discard block
 block discarded – undo
3096 3096
  */
3097 3097
 function geodir_action_search_content()
3098 3098
 {
3099
-    /** This action is documented in geodirectory_template_actions.php */
3100
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3101
-    echo '<div class="clearfix">';
3102
-    /** This action is documented in geodirectory_template_actions.php */
3103
-    do_action('geodir_before_listing');
3104
-    echo '</div>';
3105
-    /**
3106
-     * This is used to add the content to the search page main content.
3107
-     *
3108
-     * @since 1.0.0
3109
-     */
3110
-    do_action('geodir_search_content_inside');
3111
-    /** This action is documented in geodirectory_template_actions.php */
3112
-    do_action('geodir_after_listing');
3113
-    /** This action is documented in geodirectory_template_actions.php */
3114
-    do_action('geodir_main_content_close', 'search-page');
3099
+	/** This action is documented in geodirectory_template_actions.php */
3100
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3101
+	echo '<div class="clearfix">';
3102
+	/** This action is documented in geodirectory_template_actions.php */
3103
+	do_action('geodir_before_listing');
3104
+	echo '</div>';
3105
+	/**
3106
+	 * This is used to add the content to the search page main content.
3107
+	 *
3108
+	 * @since 1.0.0
3109
+	 */
3110
+	do_action('geodir_search_content_inside');
3111
+	/** This action is documented in geodirectory_template_actions.php */
3112
+	do_action('geodir_after_listing');
3113
+	/** This action is documented in geodirectory_template_actions.php */
3114
+	do_action('geodir_main_content_close', 'search-page');
3115 3115
 }
3116 3116
 
3117 3117
 ###############################################
@@ -3134,11 +3134,11 @@  discard block
 block discarded – undo
3134 3134
  */
3135 3135
 function geodir_action_geodir_sidebar_home_top()
3136 3136
 {
3137
-    if (get_option('geodir_show_home_top_section')) { ?>
3137
+	if (get_option('geodir_show_home_top_section')) { ?>
3138 3138
         <div
3139 3139
             class="<?php
3140
-            /** This action is documented in geodirectory_template_actions.php */
3141
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3140
+			/** This action is documented in geodirectory_template_actions.php */
3141
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3142 3142
             <?php dynamic_sidebar('geodir_home_top'); ?>
3143 3143
         </div><!-- clearfix ends here-->
3144 3144
     <?php }
@@ -3154,7 +3154,7 @@  discard block
 block discarded – undo
3154 3154
  */
3155 3155
 function geodir_home_left_section()
3156 3156
 {
3157
-    if (get_option('geodir_show_home_left_section')) { ?>
3157
+	if (get_option('geodir_show_home_left_section')) { ?>
3158 3158
         <div class="geodir-content-left geodir-sidebar-wrap">
3159 3159
             <?php dynamic_sidebar('geodir_home_left'); ?>
3160 3160
         </div><!-- end geodir-content-left -->
@@ -3176,19 +3176,19 @@  discard block
 block discarded – undo
3176 3176
  */
3177 3177
 function geodir_action_home_sidebar_left()
3178 3178
 {
3179
-    if (get_option('geodir_show_home_left_section')) {
3179
+	if (get_option('geodir_show_home_left_section')) {
3180 3180
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3181
-        /** This action is documented in geodirectory_template_actions.php */
3182
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3183
-        /**
3184
-         * This is used to add the content to the home page left sidebar (if active).
3185
-         *
3186
-         * @since 1.0.0
3187
-         */
3188
-        do_action('geodir_home_sidebar_left_inside');
3189
-        /** This action is documented in geodirectory_template_actions.php */
3190
-        do_action('geodir_sidebar_left_close', 'home-page');
3191
-    }
3181
+		/** This action is documented in geodirectory_template_actions.php */
3182
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3183
+		/**
3184
+		 * This is used to add the content to the home page left sidebar (if active).
3185
+		 *
3186
+		 * @since 1.0.0
3187
+		 */
3188
+		do_action('geodir_home_sidebar_left_inside');
3189
+		/** This action is documented in geodirectory_template_actions.php */
3190
+		do_action('geodir_sidebar_left_close', 'home-page');
3191
+	}
3192 3192
 }
3193 3193
 
3194 3194
 /**
@@ -3201,7 +3201,7 @@  discard block
 block discarded – undo
3201 3201
  */
3202 3202
 function geodir_home_right_section()
3203 3203
 {
3204
-    if (get_option('geodir_show_home_right_section')) { ?>
3204
+	if (get_option('geodir_show_home_right_section')) { ?>
3205 3205
         <div class="geodir-content-right geodir-sidebar-wrap">
3206 3206
             <?php dynamic_sidebar('geodir_home_right'); ?>
3207 3207
         </div><!-- end geodir-content-right -->
@@ -3222,18 +3222,18 @@  discard block
 block discarded – undo
3222 3222
  */
3223 3223
 function geodir_action_home_sidebar_right()
3224 3224
 {
3225
-    if (get_option('geodir_show_home_right_section')) {
3226
-        /** This action is documented in geodirectory_template_actions.php */
3227
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3228
-        /**
3229
-         * This is used to add the content to the home page right sidebar (if active).
3230
-         *
3231
-         * @since 1.0.0
3232
-         */
3233
-        do_action('geodir_home_sidebar_right_inside');
3234
-        /** This action is documented in geodirectory_template_actions.php */
3235
-        do_action('geodir_sidebar_right_close', 'home-page');
3236
-    }
3225
+	if (get_option('geodir_show_home_right_section')) {
3226
+		/** This action is documented in geodirectory_template_actions.php */
3227
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3228
+		/**
3229
+		 * This is used to add the content to the home page right sidebar (if active).
3230
+		 *
3231
+		 * @since 1.0.0
3232
+		 */
3233
+		do_action('geodir_home_sidebar_right_inside');
3234
+		/** This action is documented in geodirectory_template_actions.php */
3235
+		do_action('geodir_sidebar_right_close', 'home-page');
3236
+	}
3237 3237
 }
3238 3238
 
3239 3239
 /**
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
  */
3245 3245
 function geodir_action_home_content_inside()
3246 3246
 {
3247
-    dynamic_sidebar('geodir_home_content');
3247
+	dynamic_sidebar('geodir_home_content');
3248 3248
 }
3249 3249
 
3250 3250
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3259,28 +3259,28 @@  discard block
 block discarded – undo
3259 3259
  */
3260 3260
 function geodir_action_home_content()
3261 3261
 {
3262
-    /** This action is documented in geodirectory_template_actions.php */
3263
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3264
-    /**
3265
-     * This called before the home page main content.
3266
-     *
3267
-     * @since 1.0.0
3268
-     */
3269
-    do_action('geodir_before_home_content');
3270
-    /**
3271
-     * This is used to add the content to the home page main content.
3272
-     *
3273
-     * @since 1.0.0
3274
-     */
3275
-    do_action('geodir_home_content_inside');
3276
-    /**
3277
-     * This is called after the homepage main content.
3278
-     *
3279
-     * @since 1.0.0
3280
-     */
3281
-    do_action('geodir_after_home_content');
3282
-    /** This action is documented in geodirectory_template_actions.php */
3283
-    do_action('geodir_main_content_close', 'home-page');
3262
+	/** This action is documented in geodirectory_template_actions.php */
3263
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3264
+	/**
3265
+	 * This called before the home page main content.
3266
+	 *
3267
+	 * @since 1.0.0
3268
+	 */
3269
+	do_action('geodir_before_home_content');
3270
+	/**
3271
+	 * This is used to add the content to the home page main content.
3272
+	 *
3273
+	 * @since 1.0.0
3274
+	 */
3275
+	do_action('geodir_home_content_inside');
3276
+	/**
3277
+	 * This is called after the homepage main content.
3278
+	 *
3279
+	 * @since 1.0.0
3280
+	 */
3281
+	do_action('geodir_after_home_content');
3282
+	/** This action is documented in geodirectory_template_actions.php */
3283
+	do_action('geodir_main_content_close', 'home-page');
3284 3284
 }
3285 3285
 
3286 3286
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3295,11 +3295,11 @@  discard block
 block discarded – undo
3295 3295
  */
3296 3296
 function geodir_action_sidebar_home_bottom_section()
3297 3297
 {
3298
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3298
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3299 3299
         <div
3300 3300
             class="<?php
3301
-            /** This action is documented in geodirectory_template_actions.php */
3302
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3301
+			/** This action is documented in geodirectory_template_actions.php */
3302
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3303 3303
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3304 3304
         </div><!-- clearfix ends here-->
3305 3305
     <?php }
@@ -3327,13 +3327,13 @@  discard block
 block discarded – undo
3327 3327
  */
3328 3328
 function geodir_filter_listing_page_title($list_title)
3329 3329
 {
3330
-    if (is_search() && trim(get_search_query()) == '') {
3331
-        $gd_post_type = geodir_get_current_posttype();
3332
-        $post_type_info = get_post_type_object($gd_post_type);
3330
+	if (is_search() && trim(get_search_query()) == '') {
3331
+		$gd_post_type = geodir_get_current_posttype();
3332
+		$post_type_info = get_post_type_object($gd_post_type);
3333 3333
 
3334
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3335
-    }
3336
-    return $list_title;
3334
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3335
+	}
3336
+	return $list_title;
3337 3337
 }
3338 3338
 
3339 3339
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 3 patches
Indentation   +502 added lines, -502 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Contains all function for filtering listing.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Contains all function for filtering listing.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
  
9 9
 /**
10 10
  * Starts session if not started.
@@ -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,64 +230,64 @@  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);
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 273
 					$count++;
274
-                    if ($count < count($keywords)) {
275
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
274
+					if ($count < count($keywords)) {
275
+					   // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
276 276
 						$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
-                    } else {
278
-                        //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
277
+					} else {
278
+						//$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
279 279
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280
-                    }
281
-                }
282
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
-            }
284
-        } else {
285
-            $gd_titlematch_part = "";
286
-        }
287
-        //$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title=%s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN " . $wpdb->posts . ".post_content LIKE %s THEN 1 ELSE 0 END AS gd_content", array($s, '%' . $s . '%', '%' . $s . '%'));
280
+					}
281
+				}
282
+				$gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+			}
284
+		} else {
285
+			$gd_titlematch_part = "";
286
+		}
287
+		//$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title=%s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN " . $wpdb->posts . ".post_content LIKE %s THEN 1 ELSE 0 END AS gd_content", array($s, '%' . $s . '%', '%' . $s . '%'));
288 288
 		$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));
289
-    }
290
-    return $fields;
289
+	}
290
+	return $fields;
291 291
 }
292 292
 
293 293
 
@@ -304,26 +304,26 @@  discard block
 block discarded – undo
304 304
  */
305 305
 function geodir_posts_join($join)
306 306
 {
307
-    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
307
+	global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
308 308
 
309
-    ########### WPML ###########
309
+	########### WPML ###########
310 310
 
311
-    if (function_exists('icl_object_id')) {
312
-        global $sitepress;
313
-        $lang_code = ICL_LANGUAGE_CODE;
314
-        $default_lang_code = $sitepress->get_default_language();
315
-        if ($lang_code) {
316
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
317
-        }
311
+	if (function_exists('icl_object_id')) {
312
+		global $sitepress;
313
+		$lang_code = ICL_LANGUAGE_CODE;
314
+		$default_lang_code = $sitepress->get_default_language();
315
+		if ($lang_code) {
316
+			$join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
317
+		}
318 318
 
319
-    }
320
-    ########### WPML ###########
319
+	}
320
+	########### WPML ###########
321 321
 
322
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
323
-    //===old code start
324
-    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
322
+	$join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
323
+	//===old code start
324
+	//$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
325 325
 
326
-    return $join;
326
+	return $join;
327 327
 }
328 328
 
329 329
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function geodir_posts_orderby($orderby)
343 343
 {
344
-    global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
344
+	global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
345 345
 
346
-    $sort_by = '';
347
-    $orderby = ' ';
346
+	$sort_by = '';
347
+	$orderby = ' ';
348 348
 
349
-    if (get_query_var('order_by'))
350
-        $sort_by = get_query_var('order_by');
349
+	if (get_query_var('order_by'))
350
+		$sort_by = get_query_var('order_by');
351 351
 
352
-    /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
352
+	/*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
353 353
         $current_term = $wp_query->get_queried_object();
354 354
     }
355 355
 
@@ -363,116 +363,116 @@  discard block
 block discarded – undo
363 363
     }*/
364 364
 
365 365
 
366
-    if ($snear != '') {
367
-        $orderby .= " distance,";
368
-    }
366
+	if ($snear != '') {
367
+		$orderby .= " distance,";
368
+	}
369 369
 
370
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
371
-        $sort_by = esc_attr($_REQUEST['sort_by']);
370
+	if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
371
+		$sort_by = esc_attr($_REQUEST['sort_by']);
372 372
 
373 373
 
374
-    if ($sort_by == '') {
375
-        $default_sort = geodir_get_posts_default_sort($geodir_post_type);
376
-        if (!empty($default_sort))
377
-            $sort_by = $default_sort;
378
-    }
374
+	if ($sort_by == '') {
375
+		$default_sort = geodir_get_posts_default_sort($geodir_post_type);
376
+		if (!empty($default_sort))
377
+			$sort_by = $default_sort;
378
+	}
379 379
 
380
-    /*
380
+	/*
381 381
     if search by term & no location then order always "relevance"
382 382
     if search by location then order always "nearest"
383 383
     */
384
-    if (is_main_query() && geodir_is_page('search')) {
385
-        $search_term = get_query_var('s');
384
+	if (is_main_query() && geodir_is_page('search')) {
385
+		$search_term = get_query_var('s');
386 386
 
387
-        if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
388
-            $sort_by = 'az';
389
-        }
387
+		if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
388
+			$sort_by = 'az';
389
+		}
390 390
 
391
-        if ($snear != '') {
392
-            $sort_by = 'nearest';
393
-        }
394
-    }
391
+		if ($snear != '') {
392
+			$sort_by = 'nearest';
393
+		}
394
+	}
395 395
 
396
-    switch ($sort_by):
397
-        case 'newest':
398
-            $orderby = "$wpdb->posts.post_date desc, ";
399
-            break;
400
-        case 'oldest':
401
-            $orderby = "$wpdb->posts.post_date asc, ";
402
-            break;
403
-        case 'low_review':
404
-        case 'rating_count_asc':
405
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
406
-            break;
407
-        case 'high_review':
408
-        case 'rating_count_desc':
396
+	switch ($sort_by):
397
+		case 'newest':
398
+			$orderby = "$wpdb->posts.post_date desc, ";
399
+			break;
400
+		case 'oldest':
401
+			$orderby = "$wpdb->posts.post_date asc, ";
402
+			break;
403
+		case 'low_review':
404
+		case 'rating_count_asc':
405
+			$orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
406
+			break;
407
+		case 'high_review':
408
+		case 'rating_count_desc':
409 409
 			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
410
-            break;
411
-        case 'low_rating':
412
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
413
-            break;
414
-        case 'high_rating':
415
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
416
-            break;
417
-        case 'featured':
418
-            $orderby = $table . ".is_featured asc, ";
419
-            break;
420
-        case 'nearest':
421
-            $orderby = " distance asc, ";
422
-            break;
423
-        case 'farthest':
424
-            $orderby = " distance desc, ";
425
-            break;
426
-        case 'random':
427
-            $orderby = " rand(), ";
428
-            break;
429
-        case 'az':
430
-            $orderby = "$wpdb->posts.post_title asc, ";
431
-            break;
432
-        default:
433
-
434
-            break;
435
-    endswitch;
436
-
437
-    global $s;
438
-
439
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
440
-        $keywords = explode(" ", $s);
441
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
442
-            foreach($keywords as $kkey=>$kword){
443
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
444
-                    unset($keywords[$kkey]);
445
-                }
446
-            }
447
-        }
448
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
449
-            if (count($keywords) > 1) {
450
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
451
-            } else {
452
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
453
-            }
454
-        } else {
455
-            if (count($keywords) > 1) {
456
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
457
-            } else {
458
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
459
-            }
460
-        }
461
-    }
410
+			break;
411
+		case 'low_rating':
412
+			$orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
413
+			break;
414
+		case 'high_rating':
415
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
416
+			break;
417
+		case 'featured':
418
+			$orderby = $table . ".is_featured asc, ";
419
+			break;
420
+		case 'nearest':
421
+			$orderby = " distance asc, ";
422
+			break;
423
+		case 'farthest':
424
+			$orderby = " distance desc, ";
425
+			break;
426
+		case 'random':
427
+			$orderby = " rand(), ";
428
+			break;
429
+		case 'az':
430
+			$orderby = "$wpdb->posts.post_title asc, ";
431
+			break;
432
+		default:
433
+
434
+			break;
435
+	endswitch;
436
+
437
+	global $s;
438
+
439
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
440
+		$keywords = explode(" ", $s);
441
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
442
+			foreach($keywords as $kkey=>$kword){
443
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
444
+					unset($keywords[$kkey]);
445
+				}
446
+			}
447
+		}
448
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
449
+			if (count($keywords) > 1) {
450
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
451
+			} else {
452
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
453
+			}
454
+		} else {
455
+			if (count($keywords) > 1) {
456
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
457
+			} else {
458
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
459
+			}
460
+		}
461
+	}
462 462
 
463
-    /**
464
-     * Filter order by SQL.
465
-     *
466
-     * @since 1.0.0
467
-     * @param string $orderby The orderby query string.
468
-     * @param string $sort_by Sortby query string.
469
-     * @param string $table Listing table name.
470
-     */
471
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
463
+	/**
464
+	 * Filter order by SQL.
465
+	 *
466
+	 * @since 1.0.0
467
+	 * @param string $orderby The orderby query string.
468
+	 * @param string $sort_by Sortby query string.
469
+	 * @param string $table Listing table name.
470
+	 */
471
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
472 472
 
473
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
473
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
474 474
 
475
-    return $orderby;
475
+	return $orderby;
476 476
 }
477 477
 
478 478
 
@@ -490,53 +490,53 @@  discard block
 block discarded – undo
490 490
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
491 491
 {
492 492
 
493
-    global $wpdb;
493
+	global $wpdb;
494 494
 
495
-    if ($sort_by != '' && !is_search()) {
495
+	if ($sort_by != '' && !is_search()) {
496 496
 
497
-        $sort_array = explode('_', $sort_by);
497
+		$sort_array = explode('_', $sort_by);
498 498
 
499
-        $sort_by_count = count($sort_array);
499
+		$sort_by_count = count($sort_array);
500 500
 
501
-        $order = $sort_array[$sort_by_count - 1];
501
+		$order = $sort_array[$sort_by_count - 1];
502 502
 
503
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
503
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
504 504
 
505
-            $sort_by = str_replace('_' . $order, '', $sort_by);
505
+			$sort_by = str_replace('_' . $order, '', $sort_by);
506 506
 
507
-            switch ($sort_by):
507
+			switch ($sort_by):
508 508
 
509
-                case 'post_date':
510
-                case 'comment_count':
509
+				case 'post_date':
510
+				case 'comment_count':
511 511
 
512
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
513
-                    break;
512
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
513
+					break;
514 514
 
515
-                case 'distance':
516
-                    $orderby = $sort_by . " " . $order . ", ";
517
-                    break;
515
+				case 'distance':
516
+					$orderby = $sort_by . " " . $order . ", ";
517
+					break;
518 518
 
519 519
 
520
-                // sort by rating
521
-                case 'overall_rating':
522
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
520
+				// sort by rating
521
+				case 'overall_rating':
522
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
523 523
 
524
-                    break;
524
+					break;
525 525
 
526 526
 
527
-                default:
528
-                    if (geodir_column_exist($table, $sort_by)) {
527
+				default:
528
+					if (geodir_column_exist($table, $sort_by)) {
529 529
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
530 530
 					}
531
-                    break;
531
+					break;
532 532
 
533
-            endswitch;
533
+			endswitch;
534 534
 
535
-        }
535
+		}
536 536
 
537
-    }
537
+	}
538 538
 
539
-    return $orderby;
539
+	return $orderby;
540 540
 }
541 541
 
542 542
 /**
@@ -551,34 +551,34 @@  discard block
 block discarded – undo
551 551
 {
552 552
 
553 553
 
554
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
554
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
555 555
 
556
-    if (!is_admin()) {
556
+	if (!is_admin()) {
557 557
 
558
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
559
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
558
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
559
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
560 560
 
561
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
561
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
562 562
 
563
-            add_filter('posts_where', 'searching_filter_where', 1);
563
+			add_filter('posts_where', 'searching_filter_where', 1);
564 564
 
565
-            if ($snear != '')
566
-                add_filter('posts_where', 'searching_filter_where', 1);
565
+			if ($snear != '')
566
+				add_filter('posts_where', 'searching_filter_where', 1);
567 567
 
568
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
568
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
569 569
 
570
-        } elseif (geodir_is_page('author')) {
570
+		} elseif (geodir_is_page('author')) {
571 571
 
572
-            add_filter('posts_where', 'author_filter_where', 1);
572
+			add_filter('posts_where', 'author_filter_where', 1);
573 573
 
574
-        }
574
+		}
575 575
 
576
-        //if (!geodir_is_page('detail'))
577
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
576
+		//if (!geodir_is_page('detail'))
577
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
578 578
 
579
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
579
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
580 580
 
581
-    }
581
+	}
582 582
 }
583 583
 
584 584
 /**
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
  */
594 594
 function geodir_preview_post_cap($allcaps, $caps, $args)
595 595
 {
596
-    $user_id = get_current_user_id();
597
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
596
+	$user_id = get_current_user_id();
597
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
598 598
 
599
-        $allcaps['edit_posts'] = true;
600
-    }
601
-    //print_r($allcaps);
602
-    return $allcaps;
599
+		$allcaps['edit_posts'] = true;
600
+	}
601
+	//print_r($allcaps);
602
+	return $allcaps;
603 603
 }
604 604
 
605 605
 
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_edit_listing_where($where)
616 616
 {
617
-    global $wpdb;
618
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
619
-    return $where;
617
+	global $wpdb;
618
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
619
+	return $where;
620 620
 }
621 621
 
622 622
 
@@ -633,29 +633,29 @@  discard block
 block discarded – undo
633 633
  */
634 634
 function geodir_default_where($where)
635 635
 {
636
-    global $wp_query, $wpdb;
637
-
638
-    //print_r($wp_query);
639
-    ########### WPML ###########
640
-
641
-    if (function_exists('icl_object_id')) {
642
-        global $sitepress, $table_prefix;
643
-        $lang_code = ICL_LANGUAGE_CODE;
644
-        $default_lang_code = $sitepress->get_default_language();
645
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
646
-        //echo '##########'.$q_post_type;
647
-        if ($lang_code && $q_post_type) {
648
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
649
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
650
-        }
636
+	global $wp_query, $wpdb;
651 637
 
652
-    }
653
-    ########### WPML ###########
638
+	//print_r($wp_query);
639
+	########### WPML ###########
654 640
 
641
+	if (function_exists('icl_object_id')) {
642
+		global $sitepress, $table_prefix;
643
+		$lang_code = ICL_LANGUAGE_CODE;
644
+		$default_lang_code = $sitepress->get_default_language();
645
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
646
+		//echo '##########'.$q_post_type;
647
+		if ($lang_code && $q_post_type) {
648
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
649
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
650
+		}
651
+
652
+	}
653
+	########### WPML ###########
655 654
 
656
-    return $where = str_replace("0 = 1", "1=1", $where);
657 655
 
658
-    /* ====== old code start ===
656
+	return $where = str_replace("0 = 1", "1=1", $where);
657
+
658
+	/* ====== old code start ===
659 659
     $where = str_replace("0 = 1", "1=1", $where);
660 660
     $country = get_query_var('gd_country');
661 661
     $region = get_query_var('gd_region');
@@ -696,109 +696,109 @@  discard block
 block discarded – undo
696 696
  * @return string Modified where query string.
697 697
  */
698 698
 function searching_filter_where($where) {
699
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA, $search_term, $gd_session;
699
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA, $search_term, $gd_session;
700 700
 	
701
-    $search_term = 'OR';
702
-    $search_term = 'AND';
703
-    $geodir_custom_search = '';
704
-    $category_search_range = '';
701
+	$search_term = 'OR';
702
+	$search_term = 'AND';
703
+	$geodir_custom_search = '';
704
+	$category_search_range = '';
705 705
 
706
-    if (is_single() && get_query_var('post_type')) {
706
+	if (is_single() && get_query_var('post_type')) {
707 707
 		return $where;
708 708
 	}
709 709
 
710
-    if (is_tax()) {
710
+	if (is_tax()) {
711 711
 		return $where;
712 712
 	}
713 713
 	
714 714
 	$s = trim($s);
715 715
 
716
-    $where = '';
716
+	$where = '';
717 717
 
718
-    $better_search_terms = '';
719
-    $better_search = array();
718
+	$better_search_terms = '';
719
+	$better_search = array();
720 720
 
721
-    if (!empty($s_SA)) {
722
-        foreach ($s_SA as $s_term) {
723
-            //$s_term = esc_attr($s_term);
724
-            //$better_search[] = " OR $wpdb->posts.post_title LIKE\"%$s_term%\" ";
721
+	if (!empty($s_SA)) {
722
+		foreach ($s_SA as $s_term) {
723
+			//$s_term = esc_attr($s_term);
724
+			//$better_search[] = " OR $wpdb->posts.post_title LIKE\"%$s_term%\" ";
725 725
 			$better_search[] = " OR ( $wpdb->posts.post_title LIKE \"$s_term\" OR $wpdb->posts.post_title LIKE \"$s_term%\" OR $wpdb->posts.post_title LIKE \"% $s_term%\" ) ";
726
-        }
727
-    }
726
+		}
727
+	}
728 728
 
729
-    if (is_array($better_search)) {
730
-        $better_search_terms = implode(' ', $better_search);
731
-    }
729
+	if (is_array($better_search)) {
730
+		$better_search_terms = implode(' ', $better_search);
731
+	}
732 732
 
733
-    $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';
738
-
739
-    if ($s != '') {
740
-        $keywords = explode(" ", $s);
741
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
742
-            foreach($keywords as $kkey=>$kword){
743
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
744
-                    unset($keywords[$kkey]);
745
-                }
746
-            }
747
-        }
733
+	$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';
748 738
 
749
-        if (!empty($keywords)) {
750
-            foreach ($keywords as $keyword) {
751
-                $keyword = trim($keyword);
752
-                if ($keyword != '') {
753
-                    //$better_search_terms .= ' OR ' . $wpdb->posts . '.post_title LIKE "%' . $adv_search_val . '%"';
739
+	if ($s != '') {
740
+		$keywords = explode(" ", $s);
741
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
742
+			foreach($keywords as $kkey=>$kword){
743
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
744
+					unset($keywords[$kkey]);
745
+				}
746
+			}
747
+		}
748
+
749
+		if (!empty($keywords)) {
750
+			foreach ($keywords as $keyword) {
751
+				$keyword = trim($keyword);
752
+				if ($keyword != '') {
753
+					//$better_search_terms .= ' OR ' . $wpdb->posts . '.post_title LIKE "%' . $adv_search_val . '%"';
754 754
 					$better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )';
755
-                }
756
-            }
757
-        }
758
-    }
755
+				}
756
+			}
757
+		}
758
+	}
759 759
 
760
-    /* get taxonomy */
761
-    $taxonomies = geodir_get_taxonomies($post_types, true);
762
-    if($taxonomies) {
763
-        $taxonomies = implode("','", $taxonomies);
764
-        $taxonomies = "'" . $taxonomies . "'";
765
-    }else{$taxonomies='';}
760
+	/* get taxonomy */
761
+	$taxonomies = geodir_get_taxonomies($post_types, true);
762
+	if($taxonomies) {
763
+		$taxonomies = implode("','", $taxonomies);
764
+		$taxonomies = "'" . $taxonomies . "'";
765
+	}else{$taxonomies='';}
766 766
 
767
-    $content_where = $terms_where = '';
767
+	$content_where = $terms_where = '';
768 768
 	if ($s != '') {
769
-        /**
770
-         * Filter the search query content where values.
771
-         *
772
-         * @since 1.5.0
773
-         * @package GeoDirectory
774
-         * @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%\") ") "`.
775
-         */
769
+		/**
770
+		 * Filter the search query content where values.
771
+		 *
772
+		 * @since 1.5.0
773
+		 * @package GeoDirectory
774
+		 * @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%\") ") "`.
775
+		 */
776 776
 		$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%\") ");
777
-        /**
778
-         * Filter the search query term values.
779
-         *
780
-         * @since 1.5.0
781
-         * @package GeoDirectory
782
-         * @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)) "`.
783
-         */
784
-        $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)) ");
777
+		/**
778
+		 * Filter the search query term values.
779
+		 *
780
+		 * @since 1.5.0
781
+		 * @package GeoDirectory
782
+		 * @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)) "`.
783
+		 */
784
+		$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)) ");
785 785
 	}
786 786
 		
787
-    if ($snear != '') {
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
-
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
-
801
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
787
+	if ($snear != '') {
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
+
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
+
801
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
802 802
 			                    $content_where 
803 803
 								OR ($wpdb->posts.ID IN( 
804 804
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -815,13 +815,13 @@  discard block
 block discarded – undo
815 815
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
816 816
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
817 817
 
818
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
819
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
820
-            $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;
821
-        }
818
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
819
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
820
+			$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;
821
+		}
822 822
 
823
-    } else {
824
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
823
+	} else {
824
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
825 825
                             $content_where  
826 826
 							OR ( $wpdb->posts.ID IN(	
827 827
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -835,19 +835,19 @@  discard block
 block discarded – undo
835 835
 					) 
836 836
 				AND $wpdb->posts.post_type in ('$post_types')
837 837
 				AND ($wpdb->posts.post_status = 'publish') ";
838
-    }
838
+	}
839 839
 	
840 840
 	########### WPML ###########
841
-    if ( function_exists( 'icl_object_id' ) ) {       
841
+	if ( function_exists( 'icl_object_id' ) ) {       
842 842
 		$lang_code = ICL_LANGUAGE_CODE;
843 843
 		
844 844
 		if ($lang_code && $post_types) {
845
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
846
-        }
847
-    }
848
-    ########### WPML ###########
845
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
846
+		}
847
+	}
848
+	########### WPML ###########
849 849
 	
850
-    return $where;
850
+	return $where;
851 851
 }
852 852
 
853 853
 
@@ -862,45 +862,45 @@  discard block
 block discarded – undo
862 862
  * @return string Modified where query string.
863 863
  */
864 864
 function author_filter_where($where) {
865
-    global $wpdb, $geodir_post_type, $table, $curr;
865
+	global $wpdb, $geodir_post_type, $table, $curr;
866 866
 
867
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
868
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
867
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
868
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
869 869
     
870
-    if (isset($_REQUEST['stype'])) {
871
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
872
-    } else {
873
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
874
-    }
870
+	if (isset($_REQUEST['stype'])) {
871
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
872
+	} else {
873
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
874
+	}
875 875
 
876
-    if ($user_id > 0) {
877
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
878
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
879
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
880
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
881
-        } else
882
-            $where .= " AND $wpdb->posts.post_author = $user_id";
883
-
884
-        if ($user_id == (int)get_current_user_id()) {
885
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
886
-        } else {
887
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
888
-        }
889
-    } else {
890
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
891
-    }
876
+	if ($user_id > 0) {
877
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
878
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
879
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
880
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
881
+		} else
882
+			$where .= " AND $wpdb->posts.post_author = $user_id";
883
+
884
+		if ($user_id == (int)get_current_user_id()) {
885
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
886
+		} else {
887
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
888
+		}
889
+	} else {
890
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
891
+	}
892 892
 
893
-    ########### WPML ###########
894
-    if (function_exists('icl_object_id')) {
895
-        $lang_code = ICL_LANGUAGE_CODE;
896
-        if ($lang_code) {
897
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
898
-        }
893
+	########### WPML ###########
894
+	if (function_exists('icl_object_id')) {
895
+		$lang_code = ICL_LANGUAGE_CODE;
896
+		if ($lang_code) {
897
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
898
+		}
899 899
 
900
-    }
901
-    ########### WPML ###########
900
+	}
901
+	########### WPML ###########
902 902
     
903
-    return $where;
903
+	return $where;
904 904
 }
905 905
 
906 906
 /**
@@ -915,11 +915,11 @@  discard block
 block discarded – undo
915 915
  */
916 916
 function geodir_filter_widget_join($join)
917 917
 {
918
-    global $wp_query, $table;
919
-    if (!empty($wp_query->query['with_pics_only'])) {
920
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
921
-    }
922
-    return $join;
918
+	global $wp_query, $table;
919
+	if (!empty($wp_query->query['with_pics_only'])) {
920
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
921
+	}
922
+	return $join;
923 923
 }
924 924
 
925 925
 /**
@@ -934,18 +934,18 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_filter_widget_where($where)
936 936
 {
937
-    global $wp_query, $table;
938
-    if (!empty($wp_query->query['show_featured_only'])) {
939
-        $where .= " AND " . $table . ".is_featured = '1'";
940
-    }
941
-    if (!empty($wp_query->query['show_special_only'])) {
942
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
943
-    }
944
-    if (!empty($wp_query->query['with_pics_only'])) {
945
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
946
-    }
947
-    if (!empty($wp_query->query['with_videos_only'])) {
948
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
949
-    }
950
-    return $where;
937
+	global $wp_query, $table;
938
+	if (!empty($wp_query->query['show_featured_only'])) {
939
+		$where .= " AND " . $table . ".is_featured = '1'";
940
+	}
941
+	if (!empty($wp_query->query['show_special_only'])) {
942
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
943
+	}
944
+	if (!empty($wp_query->query['with_pics_only'])) {
945
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
946
+	}
947
+	if (!empty($wp_query->query['with_videos_only'])) {
948
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
949
+	}
950
+	return $where;
951 951
 }
952 952
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 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'])) {
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
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
             }
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 
439 439
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
440 440
         $keywords = explode(" ", $s);
441
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
442
-            foreach($keywords as $kkey=>$kword){
443
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
441
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
442
+            foreach ($keywords as $kkey=>$kword) {
443
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
444 444
                     unset($keywords[$kkey]);
445 445
                 }
446 446
             }
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 case 'post_date':
510 510
                 case 'comment_count':
511 511
 
512
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
512
+                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", " . $table . ".overall_rating " . $order . ", ";
513 513
                     break;
514 514
 
515 515
                 case 'distance':
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         }
575 575
 
576 576
         //if (!geodir_is_page('detail'))
577
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
577
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
578 578
 
579 579
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
580 580
 
@@ -738,9 +738,9 @@  discard block
 block discarded – undo
738 738
 
739 739
     if ($s != '') {
740 740
         $keywords = explode(" ", $s);
741
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
742
-            foreach($keywords as $kkey=>$kword){
743
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
741
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
742
+            foreach ($keywords as $kkey=>$kword) {
743
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
744 744
                     unset($keywords[$kkey]);
745 745
                 }
746 746
             }
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
 
760 760
     /* get taxonomy */
761 761
     $taxonomies = geodir_get_taxonomies($post_types, true);
762
-    if($taxonomies) {
762
+    if ($taxonomies) {
763 763
         $taxonomies = implode("','", $taxonomies);
764 764
         $taxonomies = "'" . $taxonomies . "'";
765
-    }else{$taxonomies='';}
765
+    } else {$taxonomies = ''; }
766 766
 
767 767
     $content_where = $terms_where = '';
768 768
 	if ($s != '') {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
          * @package GeoDirectory
774 774
          * @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%\") ") "`.
775 775
          */
776
-		$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%\") ");
776
+		$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%\") ");
777 777
         /**
778 778
          * Filter the search query term values.
779 779
          *
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
          * @package GeoDirectory
782 782
          * @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)) "`.
783 783
          */
784
-        $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)) ");
784
+        $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)) ");
785 785
 	}
786 786
 		
787 787
     if ($snear != '') {
@@ -838,11 +838,11 @@  discard block
 block discarded – undo
838 838
     }
839 839
 	
840 840
 	########### WPML ###########
841
-    if ( function_exists( 'icl_object_id' ) ) {       
841
+    if (function_exists('icl_object_id')) {       
842 842
 		$lang_code = ICL_LANGUAGE_CODE;
843 843
 		
844 844
 		if ($lang_code && $post_types) {
845
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
845
+            $where .= " AND icl_t.language_code = '" . $lang_code . "' AND icl_t.element_type IN('post_" . $post_types . "') ";
846 846
         }
847 847
     }
848 848
     ########### WPML ###########
@@ -865,10 +865,10 @@  discard block
 block discarded – undo
865 865
     global $wpdb, $geodir_post_type, $table, $curr;
866 866
 
867 867
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
868
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
868
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
869 869
     
870 870
     if (isset($_REQUEST['stype'])) {
871
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
871
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
872 872
     } else {
873 873
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
874 874
     }
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
         } else
882 882
             $where .= " AND $wpdb->posts.post_author = $user_id";
883 883
 
884
-        if ($user_id == (int)get_current_user_id()) {
884
+        if ($user_id == (int) get_current_user_id()) {
885 885
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
886 886
         } else {
887 887
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
Please login to merge, or discard this patch.
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.