Test Failed
Pull Request — master (#296)
by Viruthagiri
11:50
created
tests/lib/wordpress-tests-lib/wp-tests-config.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
4
-define( 'ABSPATH', getenv( 'WP_CORE_DIR' ) . '/' );
4
+define('ABSPATH', getenv('WP_CORE_DIR').'/');
5 5
 
6 6
 // Test with multisite enabled
7
-define( 'WP_TESTS_MULTISITE', (bool) getenv( 'WP_MULTISITE' ) );
7
+define('WP_TESTS_MULTISITE', (bool) getenv('WP_MULTISITE'));
8 8
 
9 9
 // Force known bugs
10 10
 // define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
11 11
 
12 12
 // Test with WordPress debug mode on
13
-define( 'WP_DEBUG', true );
13
+define('WP_DEBUG', true);
14 14
 
15 15
 // ** MySQL settings ** //
16 16
 
@@ -21,21 +21,21 @@  discard block
 block discarded – undo
21 21
 // These tests will DROP ALL TABLES in the database with the prefix named below.
22 22
 // DO NOT use a production database or one that is shared with something else.
23 23
 
24
-define( 'DB_NAME', 'wordpress_test' );
25
-define( 'DB_USER', 'root' );
26
-define( 'DB_PASSWORD', 'root' );
27
-define( 'DB_HOST', 'localhost' );
28
-define( 'DB_CHARSET', 'utf8' );
29
-define( 'DB_COLLATE', '' );
24
+define('DB_NAME', 'wordpress_test');
25
+define('DB_USER', 'root');
26
+define('DB_PASSWORD', 'root');
27
+define('DB_HOST', 'localhost');
28
+define('DB_CHARSET', 'utf8');
29
+define('DB_COLLATE', '');
30 30
 
31
-define( 'WP_TESTS_DOMAIN', 'example.org' );
32
-define( 'WP_TESTS_EMAIL', '[email protected]' );
33
-define( 'WP_TESTS_TITLE', 'Test Blog' );
31
+define('WP_TESTS_DOMAIN', 'example.org');
32
+define('WP_TESTS_EMAIL', '[email protected]');
33
+define('WP_TESTS_TITLE', 'Test Blog');
34 34
 
35
-define( 'WP_PHP_BINARY', 'php' );
35
+define('WP_PHP_BINARY', 'php');
36 36
 
37
-define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
38
-define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );
37
+define('FS_CHMOD_DIR', (0755 & ~ umask()));
38
+define('FS_CHMOD_FILE', (0644 & ~ umask()));
39 39
 
40
-define( 'WPLANG', '' );
41
-$table_prefix  = 'wptests_';
42 40
\ No newline at end of file
41
+define('WPLANG', '');
42
+$table_prefix = 'wptests_';
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Check_Shortcodes.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,141 +1,141 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckShortcodes extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-
9
-    }
10
-
11
-    public function testHomeMapShortcode()
12
-    {
13
-        $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
14
-        $this->assertContains( 'geodir-map-home-page', $output );
15
-    }
16
-
17
-    public function testListingMapShortcode()
18
-    {
19
-        $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
20
-        $this->assertContains( 'geodir-map-listing-page', $output );
21
-    }
22
-
23
-    public function testListingSliderShortcode()
24
-    {
25
-        $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
26
-        $this->assertContains( 'geodir_widget_carousel', $output );
27
-    }
28
-
29
-    public function testLoginBoxShortcode()
30
-    {
31
-        $output = do_shortcode('[gd_login_box]');
32
-        $this->assertContains( 'geodir-loginbox-list', $output );
33
-    }
34
-
35
-    public function testPopPostCatShortcode()
36
-    {
37
-        global $geodir_post_type;
38
-        $geodir_post_type = 'gd_place';
39
-        $output = do_shortcode('[gd_popular_post_category category_limit=30]');
40
-        $this->assertContains( 'geodir-popular-cat-list', $output );
41
-    }
42
-
43
-    public function testPopPostViewShortcode()
44
-    {
45
-        $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
46
-        $this->assertContains( 'geodir_category_list_view', $output );
47
-    }
48
-
49
-    public function testRecentReviewsShortcode()
50
-    {
51
-        $query_args = array(
52
-            'post_status' => 'publish',
53
-            'post_type' => 'gd_place',
54
-            'posts_per_page' => 1,
55
-        );
56
-
57
-        $all_posts = new WP_Query( $query_args );
58
-        $post_id = null;
59
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
60
-            $post_id = get_the_ID();
61
-        endwhile;
62
-
63
-        $this->assertTrue(is_int($post_id));
64
-
65
-        $time = current_time('mysql');
66
-
67
-        $data = array(
68
-            'comment_post_ID' => $post_id,
69
-            'comment_author' => 'admin',
70
-            'comment_author_email' => '[email protected]',
71
-            'comment_author_url' => 'http://wpgeodirectory.com',
72
-            'comment_content' => 'content here testtcc',
73
-            'comment_type' => '',
74
-            'comment_parent' => 0,
75
-            'user_id' => 1,
76
-            'comment_author_IP' => '127.0.0.1',
77
-            'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
78
-            'comment_date' => $time,
79
-            'comment_approved' => 1,
80
-        );
81
-
82
-        $comment_id = wp_insert_comment($data);
83
-
84
-        $_REQUEST['geodir_overallrating'] = 5.0;
85
-        geodir_save_rating($comment_id);
86
-
87
-        $output = do_shortcode('[gd_recent_reviews count=5]');
88
-        $this->assertContains( 'geodir_sc_recent_reviews', $output );
89
-    }
90
-
91
-    public function testRelatedListingsShortcode()
92
-    {
93
-        $query_args = array(
94
-            'post_status' => 'publish',
95
-            'post_type' => 'gd_place',
96
-            'posts_per_page' => 1,
97
-        );
98
-
99
-        $all_posts = new WP_Query( $query_args );
100
-        $post_id = null;
101
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
102
-            $post_id = get_the_ID();
103
-            global $post;
104
-            $post =  geodir_get_post_info($post_id);
105
-            setup_postdata($post);
106
-            $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
107
-            $this->assertContains( 'geodir_location_listing', $output );
108
-        endwhile;
109
-
110
-        $this->assertTrue(is_int($post_id));
111
-
112
-    }
113
-
114
-    public function testListingsShortcode()
115
-    {
116
-        $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
117
-        $this->assertContains( 'geodir-sc-gd-listings', $output );
118
-    }
119
-
120
-    public function texstBestOfWidgetShortcode()
121
-    {
122
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php';
123
-        include_once($template);
124
-
125
-        $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]');
126
-        $this->assertContains( 'geodir_bestof_widget', $output );
127
-    }
128
-
129
-    public function testAddListingShortcode()
130
-    {
131
-        $_REQUEST['listing_type'] = 'gd_place';
132
-        $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
133
-        $this->assertContains( 'geodir-add-listing-submit', $output );
134
-    }
135
-
136
-    public function tearDown()
137
-    {
138
-        parent::tearDown();
139
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+
9
+	}
10
+
11
+	public function testHomeMapShortcode()
12
+	{
13
+		$output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
14
+		$this->assertContains( 'geodir-map-home-page', $output );
15
+	}
16
+
17
+	public function testListingMapShortcode()
18
+	{
19
+		$output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
20
+		$this->assertContains( 'geodir-map-listing-page', $output );
21
+	}
22
+
23
+	public function testListingSliderShortcode()
24
+	{
25
+		$output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
26
+		$this->assertContains( 'geodir_widget_carousel', $output );
27
+	}
28
+
29
+	public function testLoginBoxShortcode()
30
+	{
31
+		$output = do_shortcode('[gd_login_box]');
32
+		$this->assertContains( 'geodir-loginbox-list', $output );
33
+	}
34
+
35
+	public function testPopPostCatShortcode()
36
+	{
37
+		global $geodir_post_type;
38
+		$geodir_post_type = 'gd_place';
39
+		$output = do_shortcode('[gd_popular_post_category category_limit=30]');
40
+		$this->assertContains( 'geodir-popular-cat-list', $output );
41
+	}
42
+
43
+	public function testPopPostViewShortcode()
44
+	{
45
+		$output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
46
+		$this->assertContains( 'geodir_category_list_view', $output );
47
+	}
48
+
49
+	public function testRecentReviewsShortcode()
50
+	{
51
+		$query_args = array(
52
+			'post_status' => 'publish',
53
+			'post_type' => 'gd_place',
54
+			'posts_per_page' => 1,
55
+		);
56
+
57
+		$all_posts = new WP_Query( $query_args );
58
+		$post_id = null;
59
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
60
+			$post_id = get_the_ID();
61
+		endwhile;
62
+
63
+		$this->assertTrue(is_int($post_id));
64
+
65
+		$time = current_time('mysql');
66
+
67
+		$data = array(
68
+			'comment_post_ID' => $post_id,
69
+			'comment_author' => 'admin',
70
+			'comment_author_email' => '[email protected]',
71
+			'comment_author_url' => 'http://wpgeodirectory.com',
72
+			'comment_content' => 'content here testtcc',
73
+			'comment_type' => '',
74
+			'comment_parent' => 0,
75
+			'user_id' => 1,
76
+			'comment_author_IP' => '127.0.0.1',
77
+			'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',
78
+			'comment_date' => $time,
79
+			'comment_approved' => 1,
80
+		);
81
+
82
+		$comment_id = wp_insert_comment($data);
83
+
84
+		$_REQUEST['geodir_overallrating'] = 5.0;
85
+		geodir_save_rating($comment_id);
86
+
87
+		$output = do_shortcode('[gd_recent_reviews count=5]');
88
+		$this->assertContains( 'geodir_sc_recent_reviews', $output );
89
+	}
90
+
91
+	public function testRelatedListingsShortcode()
92
+	{
93
+		$query_args = array(
94
+			'post_status' => 'publish',
95
+			'post_type' => 'gd_place',
96
+			'posts_per_page' => 1,
97
+		);
98
+
99
+		$all_posts = new WP_Query( $query_args );
100
+		$post_id = null;
101
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
102
+			$post_id = get_the_ID();
103
+			global $post;
104
+			$post =  geodir_get_post_info($post_id);
105
+			setup_postdata($post);
106
+			$output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
107
+			$this->assertContains( 'geodir_location_listing', $output );
108
+		endwhile;
109
+
110
+		$this->assertTrue(is_int($post_id));
111
+
112
+	}
113
+
114
+	public function testListingsShortcode()
115
+	{
116
+		$output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
117
+		$this->assertContains( 'geodir-sc-gd-listings', $output );
118
+	}
119
+
120
+	public function texstBestOfWidgetShortcode()
121
+	{
122
+		$template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php';
123
+		include_once($template);
124
+
125
+		$output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]');
126
+		$this->assertContains( 'geodir_bestof_widget', $output );
127
+	}
128
+
129
+	public function testAddListingShortcode()
130
+	{
131
+		$_REQUEST['listing_type'] = 'gd_place';
132
+		$output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
133
+		$this->assertContains( 'geodir-add-listing-submit', $output );
134
+	}
135
+
136
+	public function tearDown()
137
+	{
138
+		parent::tearDown();
139
+	}
140 140
 }
141 141
 ?>
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,25 +11,25 @@  discard block
 block discarded – undo
11 11
     public function testHomeMapShortcode()
12 12
     {
13 13
         $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
14
-        $this->assertContains( 'geodir-map-home-page', $output );
14
+        $this->assertContains('geodir-map-home-page', $output);
15 15
     }
16 16
 
17 17
     public function testListingMapShortcode()
18 18
     {
19 19
         $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
20
-        $this->assertContains( 'geodir-map-listing-page', $output );
20
+        $this->assertContains('geodir-map-listing-page', $output);
21 21
     }
22 22
 
23 23
     public function testListingSliderShortcode()
24 24
     {
25 25
         $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
26
-        $this->assertContains( 'geodir_widget_carousel', $output );
26
+        $this->assertContains('geodir_widget_carousel', $output);
27 27
     }
28 28
 
29 29
     public function testLoginBoxShortcode()
30 30
     {
31 31
         $output = do_shortcode('[gd_login_box]');
32
-        $this->assertContains( 'geodir-loginbox-list', $output );
32
+        $this->assertContains('geodir-loginbox-list', $output);
33 33
     }
34 34
 
35 35
     public function testPopPostCatShortcode()
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         global $geodir_post_type;
38 38
         $geodir_post_type = 'gd_place';
39 39
         $output = do_shortcode('[gd_popular_post_category category_limit=30]');
40
-        $this->assertContains( 'geodir-popular-cat-list', $output );
40
+        $this->assertContains('geodir-popular-cat-list', $output);
41 41
     }
42 42
 
43 43
     public function testPopPostViewShortcode()
44 44
     {
45 45
         $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
46
-        $this->assertContains( 'geodir_category_list_view', $output );
46
+        $this->assertContains('geodir_category_list_view', $output);
47 47
     }
48 48
 
49 49
     public function testRecentReviewsShortcode()
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
             'posts_per_page' => 1,
55 55
         );
56 56
 
57
-        $all_posts = new WP_Query( $query_args );
57
+        $all_posts = new WP_Query($query_args);
58 58
         $post_id = null;
59
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
59
+        while ($all_posts->have_posts()) : $all_posts->the_post();
60 60
             $post_id = get_the_ID();
61 61
         endwhile;
62 62
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         geodir_save_rating($comment_id);
86 86
 
87 87
         $output = do_shortcode('[gd_recent_reviews count=5]');
88
-        $this->assertContains( 'geodir_sc_recent_reviews', $output );
88
+        $this->assertContains('geodir_sc_recent_reviews', $output);
89 89
     }
90 90
 
91 91
     public function testRelatedListingsShortcode()
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
             'posts_per_page' => 1,
97 97
         );
98 98
 
99
-        $all_posts = new WP_Query( $query_args );
99
+        $all_posts = new WP_Query($query_args);
100 100
         $post_id = null;
101
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
101
+        while ($all_posts->have_posts()) : $all_posts->the_post();
102 102
             $post_id = get_the_ID();
103 103
             global $post;
104
-            $post =  geodir_get_post_info($post_id);
104
+            $post = geodir_get_post_info($post_id);
105 105
             setup_postdata($post);
106 106
             $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
107
-            $this->assertContains( 'geodir_location_listing', $output );
107
+            $this->assertContains('geodir_location_listing', $output);
108 108
         endwhile;
109 109
 
110 110
         $this->assertTrue(is_int($post_id));
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
     public function testListingsShortcode()
115 115
     {
116 116
         $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
117
-        $this->assertContains( 'geodir-sc-gd-listings', $output );
117
+        $this->assertContains('geodir-sc-gd-listings', $output);
118 118
     }
119 119
 
120 120
     public function texstBestOfWidgetShortcode()
121 121
     {
122
-        $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php';
122
+        $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_bestof_widget.php';
123 123
         include_once($template);
124 124
 
125 125
         $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]');
126
-        $this->assertContains( 'geodir_bestof_widget', $output );
126
+        $this->assertContains('geodir_bestof_widget', $output);
127 127
     }
128 128
 
129 129
     public function testAddListingShortcode()
130 130
     {
131 131
         $_REQUEST['listing_type'] = 'gd_place';
132 132
         $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
133
-        $this->assertContains( 'geodir-add-listing-submit', $output );
133
+        $this->assertContains('geodir-add-listing-submit', $output);
134 134
     }
135 135
 
136 136
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Author_Page.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,53 +1,53 @@
 block discarded – undo
1 1
 <?php
2 2
 class AuthorPage extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testAuthorPage()
10
-    {
11
-        global $current_user;
9
+	public function testAuthorPage()
10
+	{
11
+		global $current_user;
12 12
 
13
-        $user_id = $current_user->ID;
13
+		$user_id = $current_user->ID;
14 14
 
15 15
 
16 16
 
17
-        // Add listing
17
+		// Add listing
18 18
 
19
-        $args = array(
20
-            'listing_type' => 'gd_place',
21
-            'post_title' => 'Test Listing Title 2',
22
-            'post_desc' => 'Test Desc',
23
-            'post_tags' => 'test1,test2',
24
-            'post_address' => 'New York City Hall',
25
-            'post_zip' => '10007',
26
-            'post_mapview' => 'ROADMAP',
27
-            'post_mapzoom' => '10',
28
-            'geodir_timing' => '10.00 am to 6 pm every day',
29
-            'geodir_contact' => '1234567890',
30
-            'geodir_email' => '[email protected]',
31
-            'geodir_website' => 'http://test.com',
32
-            'geodir_twitter' => 'http://twitter.com/test',
33
-            'geodir_facebook' => 'http://facebook.com/test',
34
-            'geodir_special_offers' => 'Test offer'
35
-        );
36
-        $post_id = geodir_save_listing($args, true);
19
+		$args = array(
20
+			'listing_type' => 'gd_place',
21
+			'post_title' => 'Test Listing Title 2',
22
+			'post_desc' => 'Test Desc',
23
+			'post_tags' => 'test1,test2',
24
+			'post_address' => 'New York City Hall',
25
+			'post_zip' => '10007',
26
+			'post_mapview' => 'ROADMAP',
27
+			'post_mapzoom' => '10',
28
+			'geodir_timing' => '10.00 am to 6 pm every day',
29
+			'geodir_contact' => '1234567890',
30
+			'geodir_email' => '[email protected]',
31
+			'geodir_website' => 'http://test.com',
32
+			'geodir_twitter' => 'http://twitter.com/test',
33
+			'geodir_facebook' => 'http://facebook.com/test',
34
+			'geodir_special_offers' => 'Test offer'
35
+		);
36
+		$post_id = geodir_save_listing($args, true);
37 37
 
38
-        $this->assertTrue(is_int($post_id));
38
+		$this->assertTrue(is_int($post_id));
39 39
 
40
-        $count = count_user_posts( $user_id, "gd_place"  );
40
+		$count = count_user_posts( $user_id, "gd_place"  );
41 41
 
42
-        $this->assertTrue(is_int((int) $count));
42
+		$this->assertTrue(is_int((int) $count));
43 43
 
44 44
 
45 45
 
46
-    }
46
+	}
47 47
 
48
-    public function tearDown()
49
-    {
50
-        parent::tearDown();
51
-    }
48
+	public function tearDown()
49
+	{
50
+		parent::tearDown();
51
+	}
52 52
 }
53 53
 ?>
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
         $this->assertTrue(is_int($post_id));
39 39
 
40
-        $count = count_user_posts( $user_id, "gd_place"  );
40
+        $count = count_user_posts($user_id, "gd_place");
41 41
 
42 42
         $this->assertTrue(is_int((int) $count));
43 43
 
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
  * @global object $wpdb WordPress Database object.
2196 2196
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2197 2197
  * @param int $attachment_id Attachment ID.
2198
- * @return bool|void Returns false on failure.
2198
+ * @return false|null Returns false on failure.
2199 2199
  */
2200 2200
 function geodirectory_before_featured_image_delete($attachment_id)
2201 2201
 {
@@ -2368,6 +2368,7 @@  discard block
 block discarded – undo
2368 2368
  * @global object $wpdb WordPress Database object.
2369 2369
  * @global object $current_user Current user object.
2370 2370
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2371
+ * @param string $user_id
2371 2372
  * @return array User listing count for each post type.
2372 2373
  */
2373 2374
 function geodir_user_post_listing_count($user_id=null)
@@ -3176,7 +3177,7 @@  discard block
 block discarded – undo
3176 3177
  * @since 1.0.0
3177 3178
  * @package GeoDirectory
3178 3179
  * @param array $classes The class array of the HTML element.
3179
- * @return array Modified class array.
3180
+ * @return string[] Modified class array.
3180 3181
  */
3181 3182
 function geodir_body_class_no_rating($classes = array())
3182 3183
 {
Please login to merge, or discard this patch.
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
226 226
     if ($geodir_theme_location) {
227 227
         update_option('geodir_theme_location_nav', $geodir_theme_location);
228 228
     } else {
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
322 322
 
323
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
324
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
323
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
324
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
325 325
 
326 326
 // Detail page sidebar content 
327 327
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
     do_action('geodir_after_social_sharing_buttons');
422 422
     $content_html = ob_get_clean();
423 423
     if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
424
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
425
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
426 426
         /**
427 427
          * Filter the geodir_social_sharing_buttons() function content.
428 428
          *
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
             $post_id = $post->ID;
463 463
             
464 464
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
465
+                $post_id = (int) $_REQUEST['pid'];
466 466
             }
467 467
 
468 468
             $postlink = get_permalink(geodir_add_listing_page_id());
469 469
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
470
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
471 471
         }
472 472
     }// end of if, if its a preview or not
473 473
     /**
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
     do_action('geodir_after_edit_post_link');
479 479
     $content_html = ob_get_clean();
480 480
     if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
481
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
482
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
483 483
         /**
484 484
          * Filter the geodir_edit_post_link() function content.
485 485
          *
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
503
+    global $post, $preview;
504
+    if ($preview) {return ''; }
505 505
     $package_info = array();
506 506
     $package_info = geodir_post_package_info($package_info, $post);
507 507
 
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
     $hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535 535
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
536
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
537 537
         $page_url = urlencode($_SERVER['REQUEST_URI']);
538 538
         ?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
542
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
543
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
541
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
542
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
543
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
544 544
             ga_data1 = false;
545 545
             ga_data2 = false;
546 546
             ga_data3 = false;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             }
682 682
 
683 683
             function gdga_noResults() {
684
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
684
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
685 685
                 jQuery('#gdga-legend-container').html('');
686 686
             }
687 687
 
@@ -713,18 +713,18 @@  discard block
 block discarded – undo
713 713
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
714 714
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
715 715
 
716
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
717
-                        '<?php _e('Feb', 'geodirectory');?>',
718
-                        '<?php _e('Mar', 'geodirectory');?>',
719
-                        '<?php _e('Apr', 'geodirectory');?>',
720
-                        '<?php _e('May', 'geodirectory');?>',
721
-                        '<?php _e('Jun', 'geodirectory');?>',
722
-                        '<?php _e('Jul', 'geodirectory');?>',
723
-                        '<?php _e('Aug', 'geodirectory');?>',
724
-                        '<?php _e('Sep', 'geodirectory');?>',
725
-                        '<?php _e('Oct', 'geodirectory');?>',
726
-                        '<?php _e('Nov', 'geodirectory');?>',
727
-                        '<?php _e('Dec', 'geodirectory');?>'];
716
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
717
+                        '<?php _e('Feb', 'geodirectory'); ?>',
718
+                        '<?php _e('Mar', 'geodirectory'); ?>',
719
+                        '<?php _e('Apr', 'geodirectory'); ?>',
720
+                        '<?php _e('May', 'geodirectory'); ?>',
721
+                        '<?php _e('Jun', 'geodirectory'); ?>',
722
+                        '<?php _e('Jul', 'geodirectory'); ?>',
723
+                        '<?php _e('Aug', 'geodirectory'); ?>',
724
+                        '<?php _e('Sep', 'geodirectory'); ?>',
725
+                        '<?php _e('Oct', 'geodirectory'); ?>',
726
+                        '<?php _e('Nov', 'geodirectory'); ?>',
727
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
728 728
 
729 729
                     // Ensure the data arrays are at least as long as the labels array.
730 730
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
                         labels : labels,
738 738
                         datasets : [
739 739
                             {
740
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
740
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
741 741
                                 fillColor : "rgba(220,220,220,0.5)",
742 742
                                 strokeColor : "rgba(220,220,220,1)",
743 743
                                 data : data2
744 744
                             },
745 745
                             {
746
-                                label: '<?php _e('This Year', 'geodirectory');?>',
746
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
747 747
                                 fillColor : "rgba(151,187,205,0.5)",
748 748
                                 strokeColor : "rgba(151,187,205,1)",
749 749
                                 data : data1
@@ -788,30 +788,30 @@  discard block
 block discarded – undo
788 788
 
789 789
                     <?php
790 790
                     // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
791
+                    __("Mon", 'geodirectory');
792
+                    __("Tue", 'geodirectory');
793
+                    __("Wed", 'geodirectory');
794
+                    __("Thu", 'geodirectory');
795
+                    __("Fri", 'geodirectory');
796
+                    __("Sat", 'geodirectory');
797
+                    __("Sun", 'geodirectory');
798 798
                     ?>
799 799
 
800 800
                     labels = [
801
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
802
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
803
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
804
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
805
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
806
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
807
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
801
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
802
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
803
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
804
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
805
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
806
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
807
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
808 808
                     ];
809 809
 
810 810
                     var data = {
811 811
                         labels : labels,
812 812
                         datasets : [
813 813
                             {
814
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
814
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
815 815
                                 fillColor : "rgba(220,220,220,0.5)",
816 816
                                 strokeColor : "rgba(220,220,220,1)",
817 817
                                 pointColor : "rgba(220,220,220,1)",
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                                 data : data2
820 820
                             },
821 821
                             {
822
-                                label: '<?php _e('This Week', 'geodirectory');?>',
822
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
823 823
                                 fillColor : "rgba(151,187,205,0.5)",
824 824
                                 strokeColor : "rgba(151,187,205,1)",
825 825
                                 pointColor : "rgba(151,187,205,1)",
@@ -1026,18 +1026,18 @@  discard block
 block discarded – undo
1026 1026
         </style>
1027 1027
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1028 1028
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1029
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1029
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1030 1030
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1031
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1031
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1032 1032
             <div id="gd-active-users-container">
1033
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1033
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1034 1034
                     <b class="gd-ActiveUsers-value">0</b>
1035 1035
                 </div>
1036 1036
             </div>
1037 1037
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1038
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1039
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1040
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1038
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1039
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1040
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1041 1041
             </select>
1042 1042
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1043 1043
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
     do_action('geodir_after_google_analytics');
1054 1054
     $content_html = ob_get_clean();
1055 1055
     if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1056
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1057
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1058 1058
         /**
1059 1059
          * Filter the geodir_edit_post_link() function content.
1060 1060
          *
@@ -1110,10 +1110,10 @@  discard block
 block discarded – undo
1110 1110
        
1111 1111
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1112 1112
 	   
1113
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1113
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1114 1114
 
1115 1115
         $html .= '<span class="item">';
1116
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1116
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1117 1117
 
1118 1118
         if ($post_images) {
1119 1119
             foreach ($post_images as $img) {
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
         }
1124 1124
 
1125 1125
         if (isset($post_img) && $post_img) {
1126
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1126
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1127 1127
         }
1128 1128
 
1129 1129
         $html .= '</span>';
@@ -1150,9 +1150,9 @@  discard block
 block discarded – undo
1150 1150
     do_action('geodir_after_detail_page_review_rating');
1151 1151
     $content_html = ob_get_clean();
1152 1152
     if (trim($content_html) != '') {
1153
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1153
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1154 1154
     }
1155
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1155
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1156 1156
         /**
1157 1157
          * Filter the geodir_detail_page_review_rating() function content.
1158 1158
          *
@@ -1191,8 +1191,8 @@  discard block
 block discarded – undo
1191 1191
 
1192 1192
     $content_html = ob_get_clean();
1193 1193
     if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1194
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1195
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1196 1196
         /**
1197 1197
          * Filter the output html for function geodir_detail_page_more_info().
1198 1198
          *
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1292 1292
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1293 1293
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1294
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1294
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1295 1295
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1296 1296
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297 1297
         'geodir_map_name' => geodir_map_name(),
@@ -1313,10 +1313,10 @@  discard block
 block discarded – undo
1313 1313
     foreach ($arr_alert_msg as $key => $value) {
1314 1314
         if (!is_scalar($value))
1315 1315
             continue;
1316
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1316
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1317 1317
     }
1318 1318
 
1319
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1319
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1320 1320
     echo '<script>';
1321 1321
     echo $script;
1322 1322
     echo '</script>';
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
         $geodir_old_sidebars = get_option('geodir_sidebars');
1407 1407
         if (is_array($geodir_old_sidebars)) {
1408 1408
             foreach ($geodir_old_sidebars as $key => $val) {
1409
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1409
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1410 1410
                 {
1411 1411
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1412 1412
                 }
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
         global $post;
1486 1486
         $term_condition = '';
1487 1487
         if (isset($_REQUEST['backandedit'])) {
1488
-            $post = (object)$gd_session->get('listing');
1488
+            $post = (object) $gd_session->get('listing');
1489 1489
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1490 1490
         }
1491 1491
 
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
                     echo 'checked="checked"';
1500 1500
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1501 1501
                        class="geodir_textfield" value="1"
1502
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1502
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1503 1503
 				</span>
1504 1504
             </div>
1505 1505
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
         /** This action is documented in geodirectory_template_actions.php */
1540 1540
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1541 1541
         
1542
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1542
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1543 1543
             $is_display = false;
1544 1544
         }
1545 1545
     }
@@ -1587,16 +1587,16 @@  discard block
 block discarded – undo
1587 1587
     global $wpdb, $plugin_prefix;
1588 1588
 	
1589 1589
 	// Remove unused virtual page
1590
-	$listings_page_id = (int)get_option('geodir_listing_page');
1590
+	$listings_page_id = (int) get_option('geodir_listing_page');
1591 1591
 	if ($listings_page_id) {
1592
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1592
+		$wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1593 1593
         delete_option('geodir_listing_page');
1594 1594
 	}
1595 1595
 
1596 1596
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1597 1597
         $wpdb->query(
1598 1598
             $wpdb->prepare(
1599
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1599
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1600 1600
                 array('1', '1', 'admin')
1601 1601
             )
1602 1602
         );
@@ -1604,9 +1604,9 @@  discard block
 block discarded – undo
1604 1604
 
1605 1605
         /* --- terms meta value set --- */
1606 1606
 
1607
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1607
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1608 1608
 
1609
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1609
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1610 1610
 
1611 1611
         if (!empty($options_data)) {
1612 1612
 
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 
1615 1615
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1616 1616
 
1617
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1617
+                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1618 1618
 
1619 1619
                 if (!empty($taxonomies_data)) {
1620 1620
 
@@ -1623,17 +1623,17 @@  discard block
 block discarded – undo
1623 1623
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1624 1624
                         $post_type = $taxObject->object_type[0];
1625 1625
 
1626
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1626
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1627 1627
 
1628
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1628
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1629 1629
 
1630 1630
                         if ($duplicate_data) {
1631 1631
 
1632
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1632
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1633 1633
 
1634 1634
                         } else {
1635 1635
 
1636
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1636
+                            $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1637 1637
 
1638 1638
                         }
1639 1639
 
@@ -1667,14 +1667,14 @@  discard block
 block discarded – undo
1667 1667
 
1668 1668
     global $wpdb, $table_prefix;
1669 1669
 
1670
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1670
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1671 1671
 
1672 1672
     if ($slug_exists) {
1673 1673
 
1674 1674
         $suffix = 1;
1675 1675
         do {
1676
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1677
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1676
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1677
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1678 1678
             $suffix++;
1679 1679
         } while ($location_slug_check && $suffix < 100);
1680 1680
 
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 
1729 1729
         $suffix = 1;
1730 1730
         do {
1731
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1731
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1732 1732
 
1733 1733
             /** This action is documented in geodirectory_hooks_actions.php */
1734 1734
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 
1741 1741
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1742 1742
 
1743
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1743
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1744 1744
 
1745 1745
     }
1746 1746
 	
@@ -1749,18 +1749,18 @@  discard block
 block discarded – undo
1749 1749
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1750 1750
 	
1751 1751
 	$post_types = geodir_get_posttypes();
1752
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1753
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1752
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1753
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1754 1754
 		
1755 1755
 		if (!empty($posts_obj)) {
1756 1756
 			foreach ($posts_obj as $post_obj) {
1757 1757
 				$post_id = $post_obj->object_id;
1758 1758
 				
1759
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1759
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1760 1760
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1761 1761
 				
1762
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1763
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1762
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1763
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1764 1764
 			}
1765 1765
 		}
1766 1766
 	}
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1795 1795
         return $slug_exists = true;
1796 1796
 
1797
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1797
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1798 1798
         return $slug_exists = true;
1799 1799
 
1800 1800
     return $slug_exists;
@@ -1834,43 +1834,43 @@  discard block
 block discarded – undo
1834 1834
 
1835 1835
 
1836 1836
     $gd_page = '';
1837
-    if(geodir_is_page('home')){
1837
+    if (geodir_is_page('home')) {
1838 1838
         $gd_page = 'home';
1839 1839
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1840 1840
     }
1841
-    elseif(geodir_is_page('detail')){
1841
+    elseif (geodir_is_page('detail')) {
1842 1842
         $gd_page = 'detail';
1843 1843
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1844 1844
     }
1845
-    elseif(geodir_is_page('pt')){
1845
+    elseif (geodir_is_page('pt')) {
1846 1846
         $gd_page = 'pt';
1847 1847
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1848 1848
     }
1849
-    elseif(geodir_is_page('listing')){
1849
+    elseif (geodir_is_page('listing')) {
1850 1850
         $gd_page = 'listing';
1851 1851
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1852 1852
     }
1853
-    elseif(geodir_is_page('location')){
1853
+    elseif (geodir_is_page('location')) {
1854 1854
         $gd_page = 'location';
1855 1855
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1856 1856
     }
1857
-    elseif(geodir_is_page('search')){
1857
+    elseif (geodir_is_page('search')) {
1858 1858
         $gd_page = 'search';
1859 1859
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1860 1860
     }
1861
-    elseif(geodir_is_page('add-listing')){
1861
+    elseif (geodir_is_page('add-listing')) {
1862 1862
         $gd_page = 'add-listing';
1863 1863
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1864 1864
     }
1865
-    elseif(geodir_is_page('author')){
1865
+    elseif (geodir_is_page('author')) {
1866 1866
         $gd_page = 'author';
1867 1867
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1868 1868
     }
1869
-    elseif(geodir_is_page('login')){
1869
+    elseif (geodir_is_page('login')) {
1870 1870
         $gd_page = 'login';
1871 1871
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1872 1872
     }
1873
-    elseif(geodir_is_page('listing-success')){
1873
+    elseif (geodir_is_page('listing-success')) {
1874 1874
         $gd_page = 'listing-success';
1875 1875
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1876 1876
     }
@@ -1902,12 +1902,12 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
     if (!get_option('geodir_set_post_attachments')) {
1904 1904
 
1905
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1906
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1905
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1906
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1907 1907
 
1908 1908
         $all_postypes = geodir_get_posttypes();
1909 1909
 
1910
-        foreach($all_postypes as $post_type){
1910
+        foreach ($all_postypes as $post_type) {
1911 1911
             $args = array(
1912 1912
                 'posts_per_page' => -1,
1913 1913
                 'post_type' => $post_type,
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 {
2002 2002
     $user_id = get_current_user_id();
2003 2003
 
2004
-    if(!$user_id){return $post;}
2004
+    if (!$user_id) {return $post; }
2005 2005
 
2006 2006
     $gd_post_types = geodir_get_posttypes();
2007 2007
 
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 
2111 2111
         if (array_key_exists('post_video', $tabs_arr)) {
2112 2112
 
2113
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2113
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2114 2114
 
2115 2115
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2116 2116
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 
2119 2119
         if (array_key_exists('special_offers', $tabs_arr)) {
2120 2120
 
2121
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2121
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2122 2122
 
2123 2123
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2124 2124
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
  */
2140 2140
 function geodir_remove_template_redirect_actions()
2141 2141
 {
2142
-    if (geodir_is_page('login')){
2142
+    if (geodir_is_page('login')) {
2143 2143
         remove_all_actions('template_redirect');
2144 2144
         remove_action('init', 'avia_modify_front', 10);
2145 2145
     }
@@ -2186,25 +2186,25 @@  discard block
 block discarded – undo
2186 2186
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2187 2187
 
2188 2188
         $wpdb->query(
2189
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2189
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2190 2190
                 array($post_id, $split_img_file_path)
2191 2191
             )
2192 2192
         );
2193 2193
 
2194 2194
         $attachment_data = $wpdb->get_row(
2195
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2195
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2196 2196
                 array($post_id)
2197 2197
             )
2198 2198
         );
2199 2199
 
2200 2200
         if (!empty($attachment_data)) {
2201
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2201
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2202 2202
         }
2203 2203
 
2204 2204
 
2205
-        $table_name = $plugin_prefix . $post_type . '_detail';
2205
+        $table_name = $plugin_prefix.$post_type.'_detail';
2206 2206
 
2207
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2207
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2208 2208
 
2209 2209
         geodir_set_wp_featured_image($post_id);
2210 2210
 
@@ -2232,9 +2232,9 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
     foreach ($all_postypes as $posttype) {
2234 2234
 
2235
-        $tablename = $plugin_prefix . $posttype . '_detail';
2235
+        $tablename = $plugin_prefix.$posttype.'_detail';
2236 2236
 
2237
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2237
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2238 2238
 
2239 2239
         if (!empty($get_post_data)) {
2240 2240
 
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
                 $post_id = $data->post_id;
2244 2244
 
2245
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2245
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2246 2246
 
2247 2247
                 if (!empty($attachment_data)) {
2248 2248
 
@@ -2259,22 +2259,22 @@  discard block
 block discarded – undo
2259 2259
 
2260 2260
                         $file_name = $file_info['basename'];
2261 2261
 
2262
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2262
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2263 2263
 
2264 2264
                         if (!file_exists($img_arr['path'])) {
2265 2265
 
2266
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2266
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2267 2267
 
2268 2268
                         }
2269 2269
 
2270 2270
                     }
2271 2271
 
2272
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2272
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2273 2273
 
2274 2274
                     if (!empty($attachment_data)) {
2275 2275
 
2276 2276
                         if ($attachment_data->ID)
2277
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2277
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2278 2278
 
2279 2279
                     } else {
2280 2280
 
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
 
2289 2289
                     }
2290 2290
 
2291
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2291
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2292 2292
 
2293 2293
                     geodir_set_wp_featured_image($post_id);
2294 2294
 
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 {
2318 2318
 
2319 2319
     if (!get_option('geodir_default_rating_star_icon')) {
2320
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2320
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2321 2321
     }
2322 2322
 
2323 2323
 }
@@ -2334,10 +2334,10 @@  discard block
 block discarded – undo
2334 2334
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2335 2335
  * @return array User listing count for each post type.
2336 2336
  */
2337
-function geodir_user_post_listing_count($user_id=null)
2337
+function geodir_user_post_listing_count($user_id = null)
2338 2338
 {
2339 2339
     global $wpdb, $plugin_prefix, $current_user;
2340
-    if(!$user_id){
2340
+    if (!$user_id) {
2341 2341
         $user_id = $current_user->ID;
2342 2342
     }
2343 2343
 
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
     $user_listing = array();
2349 2349
     if (is_array($all_posts) && !empty($all_posts)) {
2350 2350
         foreach ($all_posts as $ptype) {
2351
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2351
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2352 2352
 
2353 2353
             if ($total_posts > 0) {
2354 2354
                 $user_listing[$ptype] = $total_posts;
@@ -2390,19 +2390,19 @@  discard block
 block discarded – undo
2390 2390
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2391 2391
 
2392 2392
         //remove video and special offers if it is already set to show
2393
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2393
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2394 2394
             $unset_video = true;
2395 2395
         }
2396 2396
 
2397
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2397
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2398 2398
             $unset_special_offers = true;
2399 2399
         }
2400
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2401
-            foreach($custom_fields as $key => $custom_field){
2402
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2400
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2401
+            foreach ($custom_fields as $key => $custom_field) {
2402
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2403 2403
                     unset($custom_fields[$key]);
2404 2404
                 }
2405
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2405
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2406 2406
                     unset($custom_fields[$key]);
2407 2407
                 }
2408 2408
             }
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
                     $post->{$field_name} = $_REQUEST[$field_name];
2422 2422
                 }
2423 2423
 
2424
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2424
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2425 2425
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2426 2426
                         continue;
2427 2427
                     }
@@ -2470,21 +2470,21 @@  discard block
 block discarded – undo
2470 2470
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2471 2471
                         $variables_array['value'] = '';
2472 2472
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2473
-                    }else{
2473
+                    } else {
2474 2474
                         $i = 0;
2475 2475
                         $fieldset_count++;
2476 2476
                         $field_set_start = 1;
2477
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2477
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2478 2478
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2479 2479
                     }
2480 2480
 
2481 2481
 
2482
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2482
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2483 2483
                     $type = stripslashes_deep($type); // strip slashes
2484
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2484
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2485 2485
                     $html = '';
2486 2486
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2487
-                    if($html_var=='post'){$html_var='post_address';}
2487
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2488 2488
                     $field_icon = geodir_field_icon_proccess($type);
2489 2489
                     $filed_type = $type['type'];
2490 2490
 
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
                      * @param string $fields_location The location the field is to be show.
2498 2498
                      * @param array $type The array of field values.
2499 2499
                      */
2500
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2500
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2501 2501
 
2502 2502
 
2503 2503
                     /**
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
                                  * @param string $htmlvar_name The field HTML var name.
2544 2544
                                  */
2545 2545
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2546
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2546
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2547 2547
                             );
2548 2548
                         }
2549 2549
                     } else {
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
             }
2604 2604
             $status .= ")</strong>";
2605 2605
 
2606
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2606
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2607 2607
         }
2608 2608
     }
2609 2609
 
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 function geodir_no_rating_comment_text($content, $comment = '')
2688 2688
 {
2689 2689
     if (!is_admin()) {
2690
-        return '<div class="description">' . $content . '</div>';
2690
+        return '<div class="description">'.$content.'</div>';
2691 2691
     } else {
2692 2692
         return $content;
2693 2693
     }
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
         $classes[] = 'gd-no-rating';
2766 2766
     }
2767 2767
     
2768
-    $classes[] = 'gd-map-' . geodir_map_name();
2768
+    $classes[] = 'gd-map-'.geodir_map_name();
2769 2769
 
2770 2770
     return $classes;
2771 2771
 }
@@ -2785,7 +2785,7 @@  discard block
 block discarded – undo
2785 2785
         $class .= ' gd-no-rating';
2786 2786
     }
2787 2787
     
2788
-    $class .= ' gd-map-' . geodir_map_name();
2788
+    $class .= ' gd-map-'.geodir_map_name();
2789 2789
 
2790 2790
     return $class;
2791 2791
 }
@@ -2820,7 +2820,7 @@  discard block
 block discarded – undo
2820 2820
  * @return array Translation texts.
2821 2821
  */
2822 2822
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2823
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2823
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2824 2824
 
2825 2825
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2826 2826
 
@@ -2886,14 +2886,14 @@  discard block
 block discarded – undo
2886 2886
  * @param array $args The array of menu arguments.
2887 2887
  * @return array The modified arguments.
2888 2888
  */
2889
-function geodir_add_nav_menu_class( $args )
2889
+function geodir_add_nav_menu_class($args)
2890 2890
 {
2891 2891
 
2892
-        if(isset($args['menu_class'])){
2892
+        if (isset($args['menu_class'])) {
2893 2893
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2894 2894
         }
2895 2895
     
2896 2896
     return $args;
2897 2897
 }
2898 2898
 
2899
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2900 2899
\ No newline at end of file
2900
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2901 2901
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +88 added lines, -71 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -420,8 +421,9 @@  discard block
 block discarded – undo
420 421
      */
421 422
     do_action('geodir_after_social_sharing_buttons');
422 423
     $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
424
+    if (trim($content_html) != '') {
425
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+    }
425 427
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426 428
         /**
427 429
          * Filter the geodir_social_sharing_buttons() function content.
@@ -477,8 +479,9 @@  discard block
 block discarded – undo
477 479
      */
478 480
     do_action('geodir_after_edit_post_link');
479 481
     $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+    if (trim($content_html) != '') {
483
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
484
+    }
482 485
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
483 486
         /**
484 487
          * Filter the geodir_edit_post_link() function content.
@@ -1052,8 +1055,9 @@  discard block
 block discarded – undo
1052 1055
      */
1053 1056
     do_action('geodir_after_google_analytics');
1054 1057
     $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1058
+    if (trim($content_html) != '') {
1059
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1060
+    }
1057 1061
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058 1062
         /**
1059 1063
          * Filter the geodir_edit_post_link() function content.
@@ -1190,8 +1194,9 @@  discard block
 block discarded – undo
1190 1194
     do_action('geodir_after_detail_page_more_info');
1191 1195
 
1192 1196
     $content_html = ob_get_clean();
1193
-    if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1197
+    if (trim($content_html) != '') {
1198
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1199
+    }
1195 1200
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196 1201
         /**
1197 1202
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1311,8 +1316,9 @@  discard block
 block discarded – undo
1311 1316
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1312 1317
 
1313 1318
     foreach ($arr_alert_msg as $key => $value) {
1314
-        if (!is_scalar($value))
1315
-            continue;
1319
+        if (!is_scalar($value)) {
1320
+                    continue;
1321
+        }
1316 1322
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1317 1323
     }
1318 1324
 
@@ -1368,17 +1374,19 @@  discard block
 block discarded – undo
1368 1374
     global $geodir_sidebars;
1369 1375
     global $sidebars_widgets;
1370 1376
 
1371
-    if (!is_array($sidebars_widgets))
1372
-        $sidebars_widgets = wp_get_sidebars_widgets();
1377
+    if (!is_array($sidebars_widgets)) {
1378
+            $sidebars_widgets = wp_get_sidebars_widgets();
1379
+    }
1373 1380
     $geodir_old_sidebars = array();
1374 1381
 
1375 1382
     if (is_array($geodir_sidebars)) {
1376 1383
         foreach ($geodir_sidebars as $val) {
1377 1384
             if (is_array($sidebars_widgets)) {
1378
-                if (array_key_exists($val, $sidebars_widgets))
1379
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1380
-                else
1381
-                    $geodir_old_sidebars[$val] = array();
1385
+                if (array_key_exists($val, $sidebars_widgets)) {
1386
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
+                } else {
1388
+                                    $geodir_old_sidebars[$val] = array();
1389
+                }
1382 1390
             }
1383 1391
         }
1384 1392
     }
@@ -1399,16 +1407,19 @@  discard block
 block discarded – undo
1399 1407
 {
1400 1408
     global $sidebars_widgets;
1401 1409
 
1402
-    if (!is_array($sidebars_widgets))
1403
-        $sidebars_widgets = wp_get_sidebars_widgets();
1410
+    if (!is_array($sidebars_widgets)) {
1411
+            $sidebars_widgets = wp_get_sidebars_widgets();
1412
+    }
1404 1413
 
1405 1414
     if (is_array($sidebars_widgets)) {
1406 1415
         $geodir_old_sidebars = get_option('geodir_sidebars');
1407 1416
         if (is_array($geodir_old_sidebars)) {
1408 1417
             foreach ($geodir_old_sidebars as $key => $val) {
1409
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1418
+                if(0 === strpos($key, 'geodir_')) {
1419
+                	// if gd widget
1410 1420
                 {
1411
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1421
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1422
+                }
1412 1423
                 }
1413 1424
 
1414 1425
 
@@ -1544,20 +1555,25 @@  discard block
 block discarded – undo
1544 1555
         }
1545 1556
     }
1546 1557
     
1547
-    if ($tab == 'post_info')
1548
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1558
+    if ($tab == 'post_info') {
1559
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1560
+    }
1549 1561
     
1550
-    if ($tab == 'post_images')
1551
-        $is_display = (!empty($post_images)) ? true : false;
1562
+    if ($tab == 'post_images') {
1563
+            $is_display = (!empty($post_images)) ? true : false;
1564
+    }
1552 1565
 
1553
-    if ($tab == 'post_video')
1554
-        $is_display = (!empty($video)) ? true : false;
1566
+    if ($tab == 'post_video') {
1567
+            $is_display = (!empty($video)) ? true : false;
1568
+    }
1555 1569
 
1556
-    if ($tab == 'special_offers')
1557
-        $is_display = (!empty($special_offers)) ? true : false;
1570
+    if ($tab == 'special_offers') {
1571
+            $is_display = (!empty($special_offers)) ? true : false;
1572
+    }
1558 1573
 
1559
-    if ($tab == 'reviews')
1560
-        $is_display = (geodir_is_page('detail')) ? true : false;
1574
+    if ($tab == 'reviews') {
1575
+            $is_display = (geodir_is_page('detail')) ? true : false;
1576
+    }
1561 1577
 
1562 1578
     if ($tab == 'related_listing') {
1563 1579
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1791,11 +1807,13 @@  discard block
 block discarded – undo
1791 1807
     $region_slug = $default_location->region_slug;
1792 1808
     $city_slug = $default_location->city_slug;
1793 1809
 
1794
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1795
-        return $slug_exists = true;
1810
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1811
+            return $slug_exists = true;
1812
+    }
1796 1813
 
1797
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1798
-        return $slug_exists = true;
1814
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1815
+            return $slug_exists = true;
1816
+    }
1799 1817
 
1800 1818
     return $slug_exists;
1801 1819
 }
@@ -1837,40 +1855,31 @@  discard block
 block discarded – undo
1837 1855
     if(geodir_is_page('home')){
1838 1856
         $gd_page = 'home';
1839 1857
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1840
-    }
1841
-    elseif(geodir_is_page('detail')){
1858
+    } elseif(geodir_is_page('detail')){
1842 1859
         $gd_page = 'detail';
1843 1860
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1844
-    }
1845
-    elseif(geodir_is_page('pt')){
1861
+    } elseif(geodir_is_page('pt')){
1846 1862
         $gd_page = 'pt';
1847 1863
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1848
-    }
1849
-    elseif(geodir_is_page('listing')){
1864
+    } elseif(geodir_is_page('listing')){
1850 1865
         $gd_page = 'listing';
1851 1866
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1852
-    }
1853
-    elseif(geodir_is_page('location')){
1867
+    } elseif(geodir_is_page('location')){
1854 1868
         $gd_page = 'location';
1855 1869
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1856
-    }
1857
-    elseif(geodir_is_page('search')){
1870
+    } elseif(geodir_is_page('search')){
1858 1871
         $gd_page = 'search';
1859 1872
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1860
-    }
1861
-    elseif(geodir_is_page('add-listing')){
1873
+    } elseif(geodir_is_page('add-listing')){
1862 1874
         $gd_page = 'add-listing';
1863 1875
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('author')){
1876
+    } elseif(geodir_is_page('author')){
1866 1877
         $gd_page = 'author';
1867 1878
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('login')){
1879
+    } elseif(geodir_is_page('login')){
1870 1880
         $gd_page = 'login';
1871 1881
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing-success')){
1882
+    } elseif(geodir_is_page('listing-success')){
1874 1883
         $gd_page = 'listing-success';
1875 1884
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1876 1885
     }
@@ -1948,11 +1957,13 @@  discard block
 block discarded – undo
1948 1957
 
1949 1958
     if (!get_option('geodir_remove_url_seperator')) {
1950 1959
 
1951
-        if (get_option('geodir_listingurl_separator'))
1952
-            delete_option('geodir_listingurl_separator');
1960
+        if (get_option('geodir_listingurl_separator')) {
1961
+                    delete_option('geodir_listingurl_separator');
1962
+        }
1953 1963
 
1954
-        if (get_option('geodir_detailurl_separator'))
1955
-            delete_option('geodir_detailurl_separator');
1964
+        if (get_option('geodir_detailurl_separator')) {
1965
+                    delete_option('geodir_detailurl_separator');
1966
+        }
1956 1967
 
1957 1968
         flush_rewrite_rules(false);
1958 1969
 
@@ -1976,8 +1987,9 @@  discard block
 block discarded – undo
1976 1987
 {
1977 1988
     foreach ($permalink_arr as $key => $value) {
1978 1989
 
1979
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1980
-            unset($permalink_arr[$key]);
1990
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
1991
+                    unset($permalink_arr[$key]);
1992
+        }
1981 1993
 
1982 1994
     }
1983 1995
 
@@ -2112,16 +2124,18 @@  discard block
 block discarded – undo
2112 2124
 
2113 2125
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2114 2126
 
2115
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2116
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2127
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2128
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2129
+            }
2117 2130
         }
2118 2131
 
2119 2132
         if (array_key_exists('special_offers', $tabs_arr)) {
2120 2133
 
2121 2134
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2122 2135
 
2123
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2124
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2136
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2137
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2138
+            }
2125 2139
         }
2126 2140
 
2127 2141
     }
@@ -2176,8 +2190,9 @@  discard block
 block discarded – undo
2176 2190
 
2177 2191
         $all_postypes = geodir_get_posttypes();
2178 2192
 
2179
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2180
-            return false;
2193
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2194
+                    return false;
2195
+        }
2181 2196
 
2182 2197
         $uploads = wp_upload_dir();
2183 2198
 
@@ -2251,8 +2266,9 @@  discard block
 block discarded – undo
2251 2266
                         $file_info = pathinfo($attach->file);
2252 2267
 
2253 2268
                         $sub_dir = '';
2254
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2255
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2269
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2270
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2271
+                        }
2256 2272
 
2257 2273
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2258 2274
                         $uploads_path = $uploads['basedir'];
@@ -2273,8 +2289,9 @@  discard block
 block discarded – undo
2273 2289
 
2274 2290
                     if (!empty($attachment_data)) {
2275 2291
 
2276
-                        if ($attachment_data->ID)
2277
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2292
+                        if ($attachment_data->ID) {
2293
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2294
+                        }
2278 2295
 
2279 2296
                     } else {
2280 2297
 
@@ -2470,7 +2487,7 @@  discard block
 block discarded – undo
2470 2487
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2471 2488
                         $variables_array['value'] = '';
2472 2489
                         $variables_array['value'] = $post->{$type['htmlvar_name']};
2473
-                    }else{
2490
+                    } else{
2474 2491
                         $i = 0;
2475 2492
                         $fieldset_count++;
2476 2493
                         $field_set_start = 1;
Please login to merge, or discard this patch.
Indentation   +1086 added lines, -1086 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -447,46 +447,46 @@  discard block
 block discarded – undo
447 447
  */
448 448
 function geodir_edit_post_link()
449 449
 {
450
-    global $post, $preview;
451
-    ob_start(); // Start buffering;
452
-    /**
453
-     * This is called before the edit post link html in the function geodir_edit_post_link()
454
-     *
455
-     * @since 1.0.0
456
-     */
457
-    do_action('geodir_before_edit_post_link');
458
-    if (!$preview) {
459
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
450
+	global $post, $preview;
451
+	ob_start(); // Start buffering;
452
+	/**
453
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
454
+	 *
455
+	 * @since 1.0.0
456
+	 */
457
+	do_action('geodir_before_edit_post_link');
458
+	if (!$preview) {
459
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
460 460
         
461
-        if ($is_current_user_owner) {
462
-            $post_id = $post->ID;
461
+		if ($is_current_user_owner) {
462
+			$post_id = $post->ID;
463 463
             
464
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
466
-            }
464
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
+				$post_id = (int)$_REQUEST['pid'];
466
+			}
467 467
 
468
-            $postlink = get_permalink(geodir_add_listing_page_id());
469
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
-        }
472
-    }// end of if, if its a preview or not
473
-    /**
474
-     * This is called after the edit post link html in the function geodir_edit_post_link()
475
-     *
476
-     * @since 1.0.0
477
-     */
478
-    do_action('geodir_after_edit_post_link');
479
-    $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
-        /**
484
-         * Filter the geodir_edit_post_link() function content.
485
-         *
486
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
487
-         */
488
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
-    }
468
+			$postlink = get_permalink(geodir_add_listing_page_id());
469
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
+		}
472
+	}// end of if, if its a preview or not
473
+	/**
474
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
475
+	 *
476
+	 * @since 1.0.0
477
+	 */
478
+	do_action('geodir_after_edit_post_link');
479
+	$content_html = ob_get_clean();
480
+	if (trim($content_html) != '')
481
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
+		/**
484
+		 * Filter the geodir_edit_post_link() function content.
485
+		 *
486
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
487
+		 */
488
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
+	}
490 490
 }
491 491
 
492 492
 /**
@@ -500,42 +500,42 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
505
-    $package_info = array();
506
-    $package_info = geodir_post_package_info($package_info, $post);
503
+	global $post,$preview;
504
+	if($preview){return '';}
505
+	$package_info = array();
506
+	$package_info = geodir_post_package_info($package_info, $post);
507 507
 
508
-    $id = trim(get_option('geodir_ga_account_id'));
508
+	$id = trim(get_option('geodir_ga_account_id'));
509 509
 
510
-    if (!$id) {
511
-        return; //if no Google Analytics ID then bail.
512
-    }
510
+	if (!$id) {
511
+		return; //if no Google Analytics ID then bail.
512
+	}
513 513
 
514
-    ob_start(); // Start buffering;
515
-    /**
516
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
-     *
518
-     * @since 1.0.0
519
-     */
520
-    do_action('geodir_before_google_analytics');
514
+	ob_start(); // Start buffering;
515
+	/**
516
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
+	 *
518
+	 * @since 1.0.0
519
+	 */
520
+	do_action('geodir_before_google_analytics');
521 521
     
522
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
523
-    /**
524
-     * Filter the time interval to check & refresh new users results.
525
-     *
526
-     * @since 1.5.9
527
-     *
528
-     * @param int $refresh_time Time interval to check & refresh new users results.
529
-     */
530
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
-    $refresh_time = absint($refresh_time * 1000);
522
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
523
+	/**
524
+	 * Filter the time interval to check & refresh new users results.
525
+	 *
526
+	 * @since 1.5.9
527
+	 *
528
+	 * @param int $refresh_time Time interval to check & refresh new users results.
529
+	 */
530
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
+	$refresh_time = absint($refresh_time * 1000);
532 532
     
533
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
533
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
537
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
538
-        ?>
535
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
537
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
538
+		?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541 541
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
788 788
 
789 789
                     <?php
790
-                    // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
798
-                    ?>
790
+					// Here we list the shorthand days of the week so it can be used in translation.
791
+					__("Mon",'geodirectory');
792
+					__("Tue",'geodirectory');
793
+					__("Wed",'geodirectory');
794
+					__("Thu",'geodirectory');
795
+					__("Fri",'geodirectory');
796
+					__("Sat",'geodirectory');
797
+					__("Sun",'geodirectory');
798
+					?>
799 799
 
800 800
                     labels = [
801 801
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1044,24 +1044,24 @@  discard block
 block discarded – undo
1044 1044
         </span>
1045 1045
 
1046 1046
     <?php
1047
-    }
1048
-    /**
1049
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
-     *
1051
-     * @since 1.0.0
1052
-     */
1053
-    do_action('geodir_after_google_analytics');
1054
-    $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
-        /**
1059
-         * Filter the geodir_edit_post_link() function content.
1060
-         *
1061
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
-         */
1063
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
-    }
1047
+	}
1048
+	/**
1049
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
+	 *
1051
+	 * @since 1.0.0
1052
+	 */
1053
+	do_action('geodir_after_google_analytics');
1054
+	$content_html = ob_get_clean();
1055
+	if (trim($content_html) != '')
1056
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
+		/**
1059
+		 * Filter the geodir_edit_post_link() function content.
1060
+		 *
1061
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
+		 */
1063
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
+	}
1065 1065
 }
1066 1066
 
1067 1067
 /**
@@ -1077,90 +1077,90 @@  discard block
 block discarded – undo
1077 1077
  */
1078 1078
 function geodir_detail_page_review_rating()
1079 1079
 {
1080
-    global $post, $preview, $post_images;
1081
-    ob_start(); // Start  buffering;
1082
-    /**
1083
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
-     *
1085
-     * This is called outside the check for an actual rating and the check for preview page.
1086
-     *
1087
-     * @since 1.0.0
1088
-     */
1089
-    do_action('geodir_before_detail_page_review_rating');
1090
-
1091
-    $comment_count = geodir_get_review_count_total($post->ID);
1092
-    $post_avgratings = geodir_get_post_rating($post->ID);
1093
-
1094
-    if ($post_avgratings != 0 && !$preview) {
1095
-        /**
1096
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
-         *
1098
-         * This is called inside the check for an actual rating and the check for preview page.
1099
-         *
1100
-         * @since 1.0.0
1101
-         * @param float $post_avgratings Average rating for the surrent post.
1102
-         * @param int $post->ID Current post ID.
1103
-         */
1104
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
-
1106
-        $html = '<p style=" float:left;">';
1107
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1080
+	global $post, $preview, $post_images;
1081
+	ob_start(); // Start  buffering;
1082
+	/**
1083
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
+	 *
1085
+	 * This is called outside the check for an actual rating and the check for preview page.
1086
+	 *
1087
+	 * @since 1.0.0
1088
+	 */
1089
+	do_action('geodir_before_detail_page_review_rating');
1090
+
1091
+	$comment_count = geodir_get_review_count_total($post->ID);
1092
+	$post_avgratings = geodir_get_post_rating($post->ID);
1093
+
1094
+	if ($post_avgratings != 0 && !$preview) {
1095
+		/**
1096
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
+		 *
1098
+		 * This is called inside the check for an actual rating and the check for preview page.
1099
+		 *
1100
+		 * @since 1.0.0
1101
+		 * @param float $post_avgratings Average rating for the surrent post.
1102
+		 * @param int $post->ID Current post ID.
1103
+		 */
1104
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
+
1106
+		$html = '<p style=" float:left;">';
1107
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1110 1110
        
1111 1111
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1112 1112
 	   
1113 1113
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1114 1114
 
1115
-        $html .= '<span class="item">';
1116
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1115
+		$html .= '<span class="item">';
1116
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1117 1117
 
1118
-        if ($post_images) {
1119
-            foreach ($post_images as $img) {
1120
-                $post_img = $img->src;
1121
-                break;
1122
-            }
1123
-        }
1124
-
1125
-        if (isset($post_img) && $post_img) {
1126
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
-        }
1128
-
1129
-        $html .= '</span>';
1130
-
1131
-        echo $html .= '</div>';
1132
-        /**
1133
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
-         *
1135
-         * This is called inside the check for an actual rating and the check for preview page.
1136
-         *
1137
-         * @since 1.0.0
1138
-         * @param float $post_avgratings Average rating for the surrent post.
1139
-         * @param int $post->ID Current post ID.
1140
-         */
1141
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
-    }
1143
-    /**
1144
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
-     *
1146
-     * This is called outside the check for an actual rating and the check for preview page.
1147
-     *
1148
-     * @since 1.0.0
1149
-     */
1150
-    do_action('geodir_after_detail_page_review_rating');
1151
-    $content_html = ob_get_clean();
1152
-    if (trim($content_html) != '') {
1153
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
-    }
1155
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
-        /**
1157
-         * Filter the geodir_detail_page_review_rating() function content.
1158
-         *
1159
-         * @since 1.0.0
1160
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
-         */
1162
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
-    }
1118
+		if ($post_images) {
1119
+			foreach ($post_images as $img) {
1120
+				$post_img = $img->src;
1121
+				break;
1122
+			}
1123
+		}
1124
+
1125
+		if (isset($post_img) && $post_img) {
1126
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
+		}
1128
+
1129
+		$html .= '</span>';
1130
+
1131
+		echo $html .= '</div>';
1132
+		/**
1133
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
+		 *
1135
+		 * This is called inside the check for an actual rating and the check for preview page.
1136
+		 *
1137
+		 * @since 1.0.0
1138
+		 * @param float $post_avgratings Average rating for the surrent post.
1139
+		 * @param int $post->ID Current post ID.
1140
+		 */
1141
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
+	}
1143
+	/**
1144
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
+	 *
1146
+	 * This is called outside the check for an actual rating and the check for preview page.
1147
+	 *
1148
+	 * @since 1.0.0
1149
+	 */
1150
+	do_action('geodir_after_detail_page_review_rating');
1151
+	$content_html = ob_get_clean();
1152
+	if (trim($content_html) != '') {
1153
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
+	}
1155
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
+		/**
1157
+		 * Filter the geodir_detail_page_review_rating() function content.
1158
+		 *
1159
+		 * @since 1.0.0
1160
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
+		 */
1162
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
+	}
1164 1164
 }
1165 1165
 
1166 1166
 /**
@@ -1172,35 +1172,35 @@  discard block
 block discarded – undo
1172 1172
  */
1173 1173
 function geodir_detail_page_more_info()
1174 1174
 {
1175
-    ob_start(); // Start  buffering;
1176
-    /**
1177
-     * This is called before the info section html.
1178
-     *
1179
-     * @since 1.0.0
1180
-     */
1181
-    do_action('geodir_before_detail_page_more_info');
1182
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
-        echo $geodir_post_detail_fields;
1184
-    }
1185
-    /**
1186
-     * This is called after the info section html.
1187
-     *
1188
-     * @since 1.0.0
1189
-     */
1190
-    do_action('geodir_after_detail_page_more_info');
1191
-
1192
-    $content_html = ob_get_clean();
1193
-    if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
-        /**
1197
-         * Filter the output html for function geodir_detail_page_more_info().
1198
-         *
1199
-         * @since 1.0.0
1200
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
-         */
1202
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
-    }
1175
+	ob_start(); // Start  buffering;
1176
+	/**
1177
+	 * This is called before the info section html.
1178
+	 *
1179
+	 * @since 1.0.0
1180
+	 */
1181
+	do_action('geodir_before_detail_page_more_info');
1182
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
+		echo $geodir_post_detail_fields;
1184
+	}
1185
+	/**
1186
+	 * This is called after the info section html.
1187
+	 *
1188
+	 * @since 1.0.0
1189
+	 */
1190
+	do_action('geodir_after_detail_page_more_info');
1191
+
1192
+	$content_html = ob_get_clean();
1193
+	if (trim($content_html) != '')
1194
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
+		/**
1197
+		 * Filter the output html for function geodir_detail_page_more_info().
1198
+		 *
1199
+		 * @since 1.0.0
1200
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
+		 */
1202
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
+	}
1204 1204
 }
1205 1205
 
1206 1206
 
@@ -1214,15 +1214,15 @@  discard block
 block discarded – undo
1214 1214
  */
1215 1215
 function geodir_localize_all_js_msg()
1216 1216
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1217
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
-        $ajax_url = admin_url('admin-ajax.php');
1219
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
-        $ajax_url = admin_url('admin-ajax.php');
1221
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
-    }
1217
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
+		$ajax_url = admin_url('admin-ajax.php');
1219
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
+		$ajax_url = admin_url('admin-ajax.php');
1221
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
+	}
1226 1226
 	
1227 1227
 	/**
1228 1228
 	 * Filter the allowed image type extensions for post images.
@@ -1232,60 +1232,60 @@  discard block
 block discarded – undo
1232 1232
 	 */
1233 1233
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1234 1234
 	
1235
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1236
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
-    $default_marker_width = $default_marker_size['w'];
1238
-    $default_marker_height = $default_marker_size['h'];
1235
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1236
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
+	$default_marker_width = $default_marker_size['w'];
1238
+	$default_marker_height = $default_marker_size['h'];
1239 1239
     
1240
-    $arr_alert_msg = array(
1241
-        'geodir_plugin_url' => geodir_plugin_url(),
1242
-        'geodir_admin_ajax_url' => $ajax_url,
1243
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
-        //start not show alert msg
1248
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
-        // end not show alert msg
1254
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1256
-        //start not show alert msg
1257
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
-        'geodir_default_marker_icon' => $default_marker_icon,
1270
-        'geodir_default_marker_w' => $default_marker_width,
1271
-        'geodir_default_marker_h' => $default_marker_height,
1272
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
-        /* on/off dragging for phone devices */
1281
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1240
+	$arr_alert_msg = array(
1241
+		'geodir_plugin_url' => geodir_plugin_url(),
1242
+		'geodir_admin_ajax_url' => $ajax_url,
1243
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
+		//start not show alert msg
1248
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
+		// end not show alert msg
1254
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1256
+		//start not show alert msg
1257
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
+		'geodir_default_marker_icon' => $default_marker_icon,
1270
+		'geodir_default_marker_w' => $default_marker_width,
1271
+		'geodir_default_marker_h' => $default_marker_height,
1272
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
+		/* on/off dragging for phone devices */
1281
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1289 1289
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1290 1290
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1291 1291
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1293,33 +1293,33 @@  discard block
 block discarded – undo
1293 1293
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1294 1294
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1295 1295
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1296
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
-        'geodir_map_name' => geodir_map_name(),
1298
-        'osmStart' => __('Start', 'geodirectory'),
1299
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
-    );
1302
-
1303
-    /**
1304
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1305
-     *
1306
-     * With this filter you can add, remove or change translated JS strings.
1307
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1308
-     *
1309
-     * @since 1.0.0
1310
-     */
1311
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1312
-
1313
-    foreach ($arr_alert_msg as $key => $value) {
1314
-        if (!is_scalar($value))
1315
-            continue;
1316
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1317
-    }
1296
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
+		'geodir_map_name' => geodir_map_name(),
1298
+		'osmStart' => __('Start', 'geodirectory'),
1299
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
+	);
1318 1302
 
1319
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1320
-    echo '<script>';
1321
-    echo $script;
1322
-    echo '</script>';
1303
+	/**
1304
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1305
+	 *
1306
+	 * With this filter you can add, remove or change translated JS strings.
1307
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1308
+	 *
1309
+	 * @since 1.0.0
1310
+	 */
1311
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1312
+
1313
+	foreach ($arr_alert_msg as $key => $value) {
1314
+		if (!is_scalar($value))
1315
+			continue;
1316
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1317
+	}
1318
+
1319
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1320
+	echo '<script>';
1321
+	echo $script;
1322
+	echo '</script>';
1323 1323
 }
1324 1324
 
1325 1325
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1335,11 +1335,11 @@  discard block
 block discarded – undo
1335 1335
  */
1336 1336
 function geodir_admin_bar_site_menu($wp_admin_bar)
1337 1337
 {
1338
-    if (get_option("geodir_installed")) {
1339
-        if (current_user_can('manage_options')) {
1340
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1341
-        }
1342
-    }
1338
+	if (get_option("geodir_installed")) {
1339
+		if (current_user_can('manage_options')) {
1340
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1341
+		}
1342
+	}
1343 1343
 }
1344 1344
 
1345 1345
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1365,25 +1365,25 @@  discard block
 block discarded – undo
1365 1365
  */
1366 1366
 function geodir_store_sidebars()
1367 1367
 {
1368
-    global $geodir_sidebars;
1369
-    global $sidebars_widgets;
1370
-
1371
-    if (!is_array($sidebars_widgets))
1372
-        $sidebars_widgets = wp_get_sidebars_widgets();
1373
-    $geodir_old_sidebars = array();
1374
-
1375
-    if (is_array($geodir_sidebars)) {
1376
-        foreach ($geodir_sidebars as $val) {
1377
-            if (is_array($sidebars_widgets)) {
1378
-                if (array_key_exists($val, $sidebars_widgets))
1379
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1380
-                else
1381
-                    $geodir_old_sidebars[$val] = array();
1382
-            }
1383
-        }
1384
-    }
1385
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1386
-    geodir_option_version_backup('geodir_sidebars');
1368
+	global $geodir_sidebars;
1369
+	global $sidebars_widgets;
1370
+
1371
+	if (!is_array($sidebars_widgets))
1372
+		$sidebars_widgets = wp_get_sidebars_widgets();
1373
+	$geodir_old_sidebars = array();
1374
+
1375
+	if (is_array($geodir_sidebars)) {
1376
+		foreach ($geodir_sidebars as $val) {
1377
+			if (is_array($sidebars_widgets)) {
1378
+				if (array_key_exists($val, $sidebars_widgets))
1379
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1380
+				else
1381
+					$geodir_old_sidebars[$val] = array();
1382
+			}
1383
+		}
1384
+	}
1385
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1386
+	geodir_option_version_backup('geodir_sidebars');
1387 1387
 
1388 1388
 }
1389 1389
 
@@ -1397,28 +1397,28 @@  discard block
 block discarded – undo
1397 1397
  */
1398 1398
 function geodir_restore_sidebars()
1399 1399
 {
1400
-    global $sidebars_widgets;
1401
-
1402
-    if (!is_array($sidebars_widgets))
1403
-        $sidebars_widgets = wp_get_sidebars_widgets();
1404
-
1405
-    if (is_array($sidebars_widgets)) {
1406
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1407
-        if (is_array($geodir_old_sidebars)) {
1408
-            foreach ($geodir_old_sidebars as $key => $val) {
1409
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1410
-                {
1411
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1412
-                }
1400
+	global $sidebars_widgets;
1413 1401
 
1402
+	if (!is_array($sidebars_widgets))
1403
+		$sidebars_widgets = wp_get_sidebars_widgets();
1414 1404
 
1415
-            }
1416
-        }
1405
+	if (is_array($sidebars_widgets)) {
1406
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1407
+		if (is_array($geodir_old_sidebars)) {
1408
+			foreach ($geodir_old_sidebars as $key => $val) {
1409
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1410
+				{
1411
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1412
+				}
1417 1413
 
1418
-    }
1419 1414
 
1420
-    update_option('sidebars_widgets', $sidebars_widgets);
1421
-    update_option('geodir_sidebars', '');
1415
+			}
1416
+		}
1417
+
1418
+	}
1419
+
1420
+	update_option('sidebars_widgets', $sidebars_widgets);
1421
+	update_option('geodir_sidebars', '');
1422 1422
 }
1423 1423
 
1424 1424
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1431,9 +1431,9 @@  discard block
 block discarded – undo
1431 1431
  */
1432 1432
 function geodir_after_listing_post_gridview()
1433 1433
 {
1434
-    global $gridview_columns;
1434
+	global $gridview_columns;
1435 1435
 
1436
-    $gridview_columns = '';
1436
+	$gridview_columns = '';
1437 1437
 
1438 1438
 }
1439 1439
 
@@ -1461,11 +1461,11 @@  discard block
 block discarded – undo
1461 1461
  */
1462 1462
 function so_handle_038($url, $original_url, $_context)
1463 1463
 {
1464
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1465
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1466
-    }
1464
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1465
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1466
+	}
1467 1467
 
1468
-    return $url;
1468
+	return $url;
1469 1469
 }
1470 1470
 
1471 1471
 
@@ -1481,34 +1481,34 @@  discard block
 block discarded – undo
1481 1481
 function geodir_after_main_form_fields() {
1482 1482
 	global $gd_session;
1483 1483
 	
1484
-    if (get_option('geodir_accept_term_condition')) {
1485
-        global $post;
1486
-        $term_condition = '';
1487
-        if (isset($_REQUEST['backandedit'])) {
1488
-            $post = (object)$gd_session->get('listing');
1489
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1490
-        }
1491
-
1492
-        ?>
1484
+	if (get_option('geodir_accept_term_condition')) {
1485
+		global $post;
1486
+		$term_condition = '';
1487
+		if (isset($_REQUEST['backandedit'])) {
1488
+			$post = (object)$gd_session->get('listing');
1489
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1490
+		}
1491
+
1492
+		?>
1493 1493
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1494 1494
             <label>&nbsp;</label>
1495 1495
 
1496 1496
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1497 1497
 				<span style="display:block"> 
1498 1498
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1499
-                    echo 'checked="checked"';
1500
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1499
+					echo 'checked="checked"';
1500
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1501 1501
                        class="geodir_textfield" value="1"
1502 1502
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1503 1503
 				</span>
1504 1504
             </div>
1505 1505
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1506
-                    _e($required_msg, 'geodirectory');
1507
-                } ?></span>
1506
+					_e($required_msg, 'geodirectory');
1507
+				} ?></span>
1508 1508
         </div>
1509 1509
     <?php
1510 1510
 
1511
-    }
1511
+	}
1512 1512
 }
1513 1513
 
1514 1514
 
@@ -1533,42 +1533,42 @@  discard block
 block discarded – undo
1533 1533
  */
1534 1534
 function geodir_detail_page_tab_is_display($is_display, $tab)
1535 1535
 {
1536
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1536
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1537 1537
 
1538
-    if ($tab == 'post_profile') {
1539
-        /** This action is documented in geodirectory_template_actions.php */
1540
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1538
+	if ($tab == 'post_profile') {
1539
+		/** This action is documented in geodirectory_template_actions.php */
1540
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1541 1541
         
1542
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1543
-            $is_display = false;
1544
-        }
1545
-    }
1542
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1543
+			$is_display = false;
1544
+		}
1545
+	}
1546 1546
     
1547
-    if ($tab == 'post_info')
1548
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1547
+	if ($tab == 'post_info')
1548
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1549 1549
     
1550
-    if ($tab == 'post_images')
1551
-        $is_display = (!empty($post_images)) ? true : false;
1550
+	if ($tab == 'post_images')
1551
+		$is_display = (!empty($post_images)) ? true : false;
1552 1552
 
1553
-    if ($tab == 'post_video')
1554
-        $is_display = (!empty($video)) ? true : false;
1553
+	if ($tab == 'post_video')
1554
+		$is_display = (!empty($video)) ? true : false;
1555 1555
 
1556
-    if ($tab == 'special_offers')
1557
-        $is_display = (!empty($special_offers)) ? true : false;
1556
+	if ($tab == 'special_offers')
1557
+		$is_display = (!empty($special_offers)) ? true : false;
1558 1558
 
1559
-    if ($tab == 'reviews')
1560
-        $is_display = (geodir_is_page('detail')) ? true : false;
1559
+	if ($tab == 'reviews')
1560
+		$is_display = (geodir_is_page('detail')) ? true : false;
1561 1561
 
1562
-    if ($tab == 'related_listing') {
1563
-       $message = __('No listings found which match your selection.', 'geodirectory');
1562
+	if ($tab == 'related_listing') {
1563
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1564 1564
        
1565
-       /** This action is documented in geodirectory-functions/template_functions.php */
1566
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1565
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1566
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1567 1567
        
1568
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1569
-    }
1568
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1569
+	}
1570 1570
 
1571
-    return $is_display;
1571
+	return $is_display;
1572 1572
 }
1573 1573
 
1574 1574
 
@@ -1584,69 +1584,69 @@  discard block
 block discarded – undo
1584 1584
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1585 1585
  */
1586 1586
 function geodir_changes_in_custom_fields_table() {
1587
-    global $wpdb, $plugin_prefix;
1587
+	global $wpdb, $plugin_prefix;
1588 1588
 	
1589 1589
 	// Remove unused virtual page
1590 1590
 	$listings_page_id = (int)get_option('geodir_listing_page');
1591 1591
 	if ($listings_page_id) {
1592 1592
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1593
-        delete_option('geodir_listing_page');
1593
+		delete_option('geodir_listing_page');
1594 1594
 	}
1595 1595
 
1596
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1597
-        $wpdb->query(
1598
-            $wpdb->prepare(
1599
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1600
-                array('1', '1', 'admin')
1601
-            )
1602
-        );
1596
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1597
+		$wpdb->query(
1598
+			$wpdb->prepare(
1599
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1600
+				array('1', '1', 'admin')
1601
+			)
1602
+		);
1603 1603
 
1604 1604
 
1605
-        /* --- terms meta value set --- */
1605
+		/* --- terms meta value set --- */
1606 1606
 
1607
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1607
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1608 1608
 
1609
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1609
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1610 1610
 
1611
-        if (!empty($options_data)) {
1611
+		if (!empty($options_data)) {
1612 1612
 
1613
-            foreach ($options_data as $optobj) {
1613
+			foreach ($options_data as $optobj) {
1614 1614
 
1615
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1615
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1616 1616
 
1617
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1617
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1618 1618
 
1619
-                if (!empty($taxonomies_data)) {
1619
+				if (!empty($taxonomies_data)) {
1620 1620
 
1621
-                    foreach ($taxonomies_data as $taxobj) {
1621
+					foreach ($taxonomies_data as $taxobj) {
1622 1622
 
1623
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1624
-                        $post_type = $taxObject->object_type[0];
1623
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1624
+						$post_type = $taxObject->object_type[0];
1625 1625
 
1626
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1626
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1627 1627
 
1628
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1628
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1629 1629
 
1630
-                        if ($duplicate_data) {
1630
+						if ($duplicate_data) {
1631 1631
 
1632
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1632
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1633 1633
 
1634
-                        } else {
1634
+						} else {
1635 1635
 
1636
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1636
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1637 1637
 
1638
-                        }
1638
+						}
1639 1639
 
1640
-                    }
1640
+					}
1641 1641
 
1642
-                }
1642
+				}
1643 1643
 
1644
-            }
1645
-        }
1644
+			}
1645
+		}
1646 1646
 
1647
-        update_option('geodir_changes_in_custom_fields_table', '1');
1647
+		update_option('geodir_changes_in_custom_fields_table', '1');
1648 1648
 
1649
-    }
1649
+	}
1650 1650
 
1651 1651
 }
1652 1652
 
@@ -1665,24 +1665,24 @@  discard block
 block discarded – undo
1665 1665
 function geodir_location_slug_check($slug)
1666 1666
 {
1667 1667
 
1668
-    global $wpdb, $table_prefix;
1668
+	global $wpdb, $table_prefix;
1669 1669
 
1670
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1670
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1671 1671
 
1672
-    if ($slug_exists) {
1672
+	if ($slug_exists) {
1673 1673
 
1674
-        $suffix = 1;
1675
-        do {
1676
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1677
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1678
-            $suffix++;
1679
-        } while ($location_slug_check && $suffix < 100);
1674
+		$suffix = 1;
1675
+		do {
1676
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1677
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1678
+			$suffix++;
1679
+		} while ($location_slug_check && $suffix < 100);
1680 1680
 
1681
-        $slug = $alt_location_name;
1681
+		$slug = $alt_location_name;
1682 1682
 
1683
-    }
1683
+	}
1684 1684
 
1685
-    return $slug;
1685
+	return $slug;
1686 1686
 
1687 1687
 }
1688 1688
 
@@ -1707,42 +1707,42 @@  discard block
 block discarded – undo
1707 1707
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1708 1708
 {
1709 1709
 
1710
-    global $wpdb, $plugin_prefix, $table_prefix;
1710
+	global $wpdb, $plugin_prefix, $table_prefix;
1711 1711
 
1712
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1712
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1713 1713
 
1714
-    $slug = $tern_data->slug;
1714
+	$slug = $tern_data->slug;
1715 1715
 
1716
-    /**
1717
-     * Filter if a term slug exists.
1718
-     *
1719
-     * @since 1.0.0
1720
-     * @package GeoDirectory
1721
-     * @param bool $bool Default: false.
1722
-     * @param string $slug The term slug.
1723
-     * @param int $term_id The term ID.
1724
-     */
1725
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1716
+	/**
1717
+	 * Filter if a term slug exists.
1718
+	 *
1719
+	 * @since 1.0.0
1720
+	 * @package GeoDirectory
1721
+	 * @param bool $bool Default: false.
1722
+	 * @param string $slug The term slug.
1723
+	 * @param int $term_id The term ID.
1724
+	 */
1725
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1726 1726
 
1727
-    if ($slug_exists) {
1727
+	if ($slug_exists) {
1728 1728
 
1729
-        $suffix = 1;
1730
-        do {
1731
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1729
+		$suffix = 1;
1730
+		do {
1731
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1732 1732
 
1733
-            /** This action is documented in geodirectory_hooks_actions.php */
1734
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1733
+			/** This action is documented in geodirectory_hooks_actions.php */
1734
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1735 1735
 
1736
-            $suffix++;
1737
-        } while ($term_slug_check && $suffix < 100);
1736
+			$suffix++;
1737
+		} while ($term_slug_check && $suffix < 100);
1738 1738
 
1739
-        $slug = $new_slug;
1739
+		$slug = $new_slug;
1740 1740
 
1741
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1741
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1742 1742
 
1743
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1743
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1744 1744
 
1745
-    }
1745
+	}
1746 1746
 	
1747 1747
 	// Update tag in detail table.
1748 1748
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1783,21 +1783,21 @@  discard block
 block discarded – undo
1783 1783
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1784 1784
 {
1785 1785
 
1786
-    global $wpdb, $table_prefix;
1786
+	global $wpdb, $table_prefix;
1787 1787
 
1788
-    $default_location = geodir_get_default_location();
1788
+	$default_location = geodir_get_default_location();
1789 1789
 
1790
-    $country_slug = $default_location->country_slug;
1791
-    $region_slug = $default_location->region_slug;
1792
-    $city_slug = $default_location->city_slug;
1790
+	$country_slug = $default_location->country_slug;
1791
+	$region_slug = $default_location->region_slug;
1792
+	$city_slug = $default_location->city_slug;
1793 1793
 
1794
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1795
-        return $slug_exists = true;
1794
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1795
+		return $slug_exists = true;
1796 1796
 
1797
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1798
-        return $slug_exists = true;
1797
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1798
+		return $slug_exists = true;
1799 1799
 
1800
-    return $slug_exists;
1800
+	return $slug_exists;
1801 1801
 }
1802 1802
 
1803 1803
 
@@ -1816,75 +1816,75 @@  discard block
 block discarded – undo
1816 1816
  */
1817 1817
 function geodir_custom_page_title($title = '', $sep = '')
1818 1818
 {
1819
-    global $wp;
1820
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1821
-        return $title;
1822
-    }
1819
+	global $wp;
1820
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1821
+		return $title;
1822
+	}
1823 1823
 
1824
-    if ($sep == '') {
1825
-        /**
1826
-         * Filter the page title separator.
1827
-         *
1828
-         * @since 1.0.0
1829
-         * @package GeoDirectory
1830
-         * @param string $sep The separator, default: `|`.
1831
-         */
1832
-        $sep = apply_filters('geodir_page_title_separator', '|');
1833
-    }
1824
+	if ($sep == '') {
1825
+		/**
1826
+		 * Filter the page title separator.
1827
+		 *
1828
+		 * @since 1.0.0
1829
+		 * @package GeoDirectory
1830
+		 * @param string $sep The separator, default: `|`.
1831
+		 */
1832
+		$sep = apply_filters('geodir_page_title_separator', '|');
1833
+	}
1834 1834
 
1835 1835
 
1836
-    $gd_page = '';
1837
-    if(geodir_is_page('home')){
1838
-        $gd_page = 'home';
1839
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1840
-    }
1841
-    elseif(geodir_is_page('detail')){
1842
-        $gd_page = 'detail';
1843
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1844
-    }
1845
-    elseif(geodir_is_page('pt')){
1846
-        $gd_page = 'pt';
1847
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1848
-    }
1849
-    elseif(geodir_is_page('listing')){
1850
-        $gd_page = 'listing';
1851
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1852
-    }
1853
-    elseif(geodir_is_page('location')){
1854
-        $gd_page = 'location';
1855
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1856
-    }
1857
-    elseif(geodir_is_page('search')){
1858
-        $gd_page = 'search';
1859
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1860
-    }
1861
-    elseif(geodir_is_page('add-listing')){
1862
-        $gd_page = 'add-listing';
1863
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('author')){
1866
-        $gd_page = 'author';
1867
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('login')){
1870
-        $gd_page = 'login';
1871
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing-success')){
1874
-        $gd_page = 'listing-success';
1875
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1876
-    }
1836
+	$gd_page = '';
1837
+	if(geodir_is_page('home')){
1838
+		$gd_page = 'home';
1839
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1840
+	}
1841
+	elseif(geodir_is_page('detail')){
1842
+		$gd_page = 'detail';
1843
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1844
+	}
1845
+	elseif(geodir_is_page('pt')){
1846
+		$gd_page = 'pt';
1847
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1848
+	}
1849
+	elseif(geodir_is_page('listing')){
1850
+		$gd_page = 'listing';
1851
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1852
+	}
1853
+	elseif(geodir_is_page('location')){
1854
+		$gd_page = 'location';
1855
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1856
+	}
1857
+	elseif(geodir_is_page('search')){
1858
+		$gd_page = 'search';
1859
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1860
+	}
1861
+	elseif(geodir_is_page('add-listing')){
1862
+		$gd_page = 'add-listing';
1863
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1864
+	}
1865
+	elseif(geodir_is_page('author')){
1866
+		$gd_page = 'author';
1867
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1868
+	}
1869
+	elseif(geodir_is_page('login')){
1870
+		$gd_page = 'login';
1871
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1872
+	}
1873
+	elseif(geodir_is_page('listing-success')){
1874
+		$gd_page = 'listing-success';
1875
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1876
+	}
1877 1877
 
1878 1878
 
1879
-    /**
1880
-     * Filter page meta title to replace variables.
1881
-     *
1882
-     * @since 1.5.4
1883
-     * @param string $title The page title including variables.
1884
-     * @param string $gd_page The GeoDirectory page type if any.
1885
-     * @param string $sep The title separator symbol.
1886
-     */
1887
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1879
+	/**
1880
+	 * Filter page meta title to replace variables.
1881
+	 *
1882
+	 * @since 1.5.4
1883
+	 * @param string $title The page title including variables.
1884
+	 * @param string $gd_page The GeoDirectory page type if any.
1885
+	 * @param string $sep The title separator symbol.
1886
+	 */
1887
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1888 1888
 
1889 1889
 }
1890 1890
 
@@ -1900,36 +1900,36 @@  discard block
 block discarded – undo
1900 1900
 function geodir_set_post_attachment()
1901 1901
 {
1902 1902
 
1903
-    if (!get_option('geodir_set_post_attachments')) {
1903
+	if (!get_option('geodir_set_post_attachments')) {
1904 1904
 
1905
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1906
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1905
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1906
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1907 1907
 
1908
-        $all_postypes = geodir_get_posttypes();
1908
+		$all_postypes = geodir_get_posttypes();
1909 1909
 
1910
-        foreach($all_postypes as $post_type){
1911
-            $args = array(
1912
-                'posts_per_page' => -1,
1913
-                'post_type' => $post_type,
1914
-                'post_status' => 'publish');
1910
+		foreach($all_postypes as $post_type){
1911
+			$args = array(
1912
+				'posts_per_page' => -1,
1913
+				'post_type' => $post_type,
1914
+				'post_status' => 'publish');
1915 1915
 
1916
-            $posts_array = get_posts($args);
1916
+			$posts_array = get_posts($args);
1917 1917
 
1918
-            if (!empty($posts_array)) {
1918
+			if (!empty($posts_array)) {
1919 1919
 
1920
-                foreach ($posts_array as $post) {
1920
+				foreach ($posts_array as $post) {
1921 1921
 
1922
-                    geodir_set_wp_featured_image($post->ID);
1922
+					geodir_set_wp_featured_image($post->ID);
1923 1923
 
1924
-                }
1924
+				}
1925 1925
 
1926
-            }
1927
-        }
1926
+			}
1927
+		}
1928 1928
 
1929 1929
 
1930
-        update_option('geodir_set_post_attachments', '1');
1930
+		update_option('geodir_set_post_attachments', '1');
1931 1931
 
1932
-    }
1932
+	}
1933 1933
 
1934 1934
 }
1935 1935
 
@@ -1946,19 +1946,19 @@  discard block
 block discarded – undo
1946 1946
 function geodir_remove_url_seperator()
1947 1947
 {
1948 1948
 
1949
-    if (!get_option('geodir_remove_url_seperator')) {
1949
+	if (!get_option('geodir_remove_url_seperator')) {
1950 1950
 
1951
-        if (get_option('geodir_listingurl_separator'))
1952
-            delete_option('geodir_listingurl_separator');
1951
+		if (get_option('geodir_listingurl_separator'))
1952
+			delete_option('geodir_listingurl_separator');
1953 1953
 
1954
-        if (get_option('geodir_detailurl_separator'))
1955
-            delete_option('geodir_detailurl_separator');
1954
+		if (get_option('geodir_detailurl_separator'))
1955
+			delete_option('geodir_detailurl_separator');
1956 1956
 
1957
-        flush_rewrite_rules(false);
1957
+		flush_rewrite_rules(false);
1958 1958
 
1959
-        update_option('geodir_remove_url_seperator', '1');
1959
+		update_option('geodir_remove_url_seperator', '1');
1960 1960
 
1961
-    }
1961
+	}
1962 1962
 
1963 1963
 }
1964 1964
 
@@ -1974,19 +1974,19 @@  discard block
 block discarded – undo
1974 1974
  */
1975 1975
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1976 1976
 {
1977
-    foreach ($permalink_arr as $key => $value) {
1977
+	foreach ($permalink_arr as $key => $value) {
1978 1978
 
1979
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1980
-            unset($permalink_arr[$key]);
1979
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1980
+			unset($permalink_arr[$key]);
1981 1981
 
1982
-    }
1982
+	}
1983 1983
 
1984
-    return $permalink_arr;
1984
+	return $permalink_arr;
1985 1985
 
1986 1986
 }
1987 1987
 
1988 1988
 if (!is_admin()) {
1989
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1989
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1990 1990
 }
1991 1991
 /**
1992 1992
  * Set status from draft to publish.
@@ -1999,16 +1999,16 @@  discard block
 block discarded – undo
1999 1999
  */
2000 2000
 function geodir_set_status_draft_to_publish_for_own_post($post)
2001 2001
 {
2002
-    $user_id = get_current_user_id();
2002
+	$user_id = get_current_user_id();
2003 2003
 
2004
-    if(!$user_id){return $post;}
2004
+	if(!$user_id){return $post;}
2005 2005
 
2006
-    $gd_post_types = geodir_get_posttypes();
2006
+	$gd_post_types = geodir_get_posttypes();
2007 2007
 
2008
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2009
-        $post[0]->post_status = 'publish';
2010
-    }
2011
-    return $post;
2008
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2009
+		$post[0]->post_status = 'publish';
2010
+	}
2011
+	return $post;
2012 2012
 }
2013 2013
 
2014 2014
 
@@ -2100,33 +2100,33 @@  discard block
 block discarded – undo
2100 2100
  */
2101 2101
 function geodir_detail_page_tab_headings_change($tabs_arr)
2102 2102
 {
2103
-    global $wpdb;
2103
+	global $wpdb;
2104 2104
 
2105
-    $post_type = geodir_get_current_posttype();
2105
+	$post_type = geodir_get_current_posttype();
2106 2106
 
2107
-    $all_postypes = geodir_get_posttypes();
2107
+	$all_postypes = geodir_get_posttypes();
2108 2108
 
2109
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2109
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2110 2110
 
2111
-        if (array_key_exists('post_video', $tabs_arr)) {
2111
+		if (array_key_exists('post_video', $tabs_arr)) {
2112 2112
 
2113
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2113
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2114 2114
 
2115
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2116
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2117
-        }
2115
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2116
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2117
+		}
2118 2118
 
2119
-        if (array_key_exists('special_offers', $tabs_arr)) {
2119
+		if (array_key_exists('special_offers', $tabs_arr)) {
2120 2120
 
2121
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2121
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2122 2122
 
2123
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2124
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2125
-        }
2123
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2124
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2125
+		}
2126 2126
 
2127
-    }
2127
+	}
2128 2128
 
2129
-    return $tabs_arr;
2129
+	return $tabs_arr;
2130 2130
 
2131 2131
 }
2132 2132
 
@@ -2139,10 +2139,10 @@  discard block
 block discarded – undo
2139 2139
  */
2140 2140
 function geodir_remove_template_redirect_actions()
2141 2141
 {
2142
-    if (geodir_is_page('login')){
2143
-        remove_all_actions('template_redirect');
2144
-        remove_action('init', 'avia_modify_front', 10);
2145
-    }
2142
+	if (geodir_is_page('login')){
2143
+		remove_all_actions('template_redirect');
2144
+		remove_action('init', 'avia_modify_front', 10);
2145
+	}
2146 2146
 }
2147 2147
 
2148 2148
 
@@ -2164,51 +2164,51 @@  discard block
 block discarded – undo
2164 2164
 function geodirectory_before_featured_image_delete($attachment_id)
2165 2165
 {
2166 2166
 
2167
-    global $wpdb, $plugin_prefix;
2167
+	global $wpdb, $plugin_prefix;
2168 2168
 
2169
-    $post_id = get_post_field('post_parent', $attachment_id);
2169
+	$post_id = get_post_field('post_parent', $attachment_id);
2170 2170
 
2171
-    $attachment_url = wp_get_attachment_url($attachment_id);
2171
+	$attachment_url = wp_get_attachment_url($attachment_id);
2172 2172
 
2173
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2173
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2174 2174
 
2175
-        $post_type = get_post_type($post_id);
2175
+		$post_type = get_post_type($post_id);
2176 2176
 
2177
-        $all_postypes = geodir_get_posttypes();
2177
+		$all_postypes = geodir_get_posttypes();
2178 2178
 
2179
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2180
-            return false;
2179
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2180
+			return false;
2181 2181
 
2182
-        $uploads = wp_upload_dir();
2182
+		$uploads = wp_upload_dir();
2183 2183
 
2184
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2184
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2185 2185
 
2186
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2186
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2187 2187
 
2188
-        $wpdb->query(
2189
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2190
-                array($post_id, $split_img_file_path)
2191
-            )
2192
-        );
2188
+		$wpdb->query(
2189
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2190
+				array($post_id, $split_img_file_path)
2191
+			)
2192
+		);
2193 2193
 
2194
-        $attachment_data = $wpdb->get_row(
2195
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2196
-                array($post_id)
2197
-            )
2198
-        );
2194
+		$attachment_data = $wpdb->get_row(
2195
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2196
+				array($post_id)
2197
+			)
2198
+		);
2199 2199
 
2200
-        if (!empty($attachment_data)) {
2201
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2202
-        }
2200
+		if (!empty($attachment_data)) {
2201
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2202
+		}
2203 2203
 
2204 2204
 
2205
-        $table_name = $plugin_prefix . $post_type . '_detail';
2205
+		$table_name = $plugin_prefix . $post_type . '_detail';
2206 2206
 
2207
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2207
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2208 2208
 
2209
-        geodir_set_wp_featured_image($post_id);
2209
+		geodir_set_wp_featured_image($post_id);
2210 2210
 
2211
-    }
2211
+	}
2212 2212
 
2213 2213
 }
2214 2214
 
@@ -2226,79 +2226,79 @@  discard block
 block discarded – undo
2226 2226
 function geodir_temp_set_post_attachment()
2227 2227
 {
2228 2228
 
2229
-    global $wpdb, $plugin_prefix;
2229
+	global $wpdb, $plugin_prefix;
2230 2230
 
2231
-    $all_postypes = geodir_get_posttypes();
2231
+	$all_postypes = geodir_get_posttypes();
2232 2232
 
2233
-    foreach ($all_postypes as $posttype) {
2233
+	foreach ($all_postypes as $posttype) {
2234 2234
 
2235
-        $tablename = $plugin_prefix . $posttype . '_detail';
2235
+		$tablename = $plugin_prefix . $posttype . '_detail';
2236 2236
 
2237
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2237
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2238 2238
 
2239
-        if (!empty($get_post_data)) {
2239
+		if (!empty($get_post_data)) {
2240 2240
 
2241
-            foreach ($get_post_data as $data) {
2241
+			foreach ($get_post_data as $data) {
2242 2242
 
2243
-                $post_id = $data->post_id;
2243
+				$post_id = $data->post_id;
2244 2244
 
2245
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2245
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2246 2246
 
2247
-                if (!empty($attachment_data)) {
2247
+				if (!empty($attachment_data)) {
2248 2248
 
2249
-                    foreach ($attachment_data as $attach) {
2249
+					foreach ($attachment_data as $attach) {
2250 2250
 
2251
-                        $file_info = pathinfo($attach->file);
2251
+						$file_info = pathinfo($attach->file);
2252 2252
 
2253
-                        $sub_dir = '';
2254
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2255
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2253
+						$sub_dir = '';
2254
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2255
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2256 2256
 
2257
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2258
-                        $uploads_path = $uploads['basedir'];
2257
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2258
+						$uploads_path = $uploads['basedir'];
2259 2259
 
2260
-                        $file_name = $file_info['basename'];
2260
+						$file_name = $file_info['basename'];
2261 2261
 
2262
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2262
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2263 2263
 
2264
-                        if (!file_exists($img_arr['path'])) {
2264
+						if (!file_exists($img_arr['path'])) {
2265 2265
 
2266
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2266
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2267 2267
 
2268
-                        }
2268
+						}
2269 2269
 
2270
-                    }
2270
+					}
2271 2271
 
2272
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2272
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2273 2273
 
2274
-                    if (!empty($attachment_data)) {
2274
+					if (!empty($attachment_data)) {
2275 2275
 
2276
-                        if ($attachment_data->ID)
2277
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2276
+						if ($attachment_data->ID)
2277
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2278 2278
 
2279
-                    } else {
2279
+					} else {
2280 2280
 
2281
-                        if (has_post_thumbnail($post_id)) {
2281
+						if (has_post_thumbnail($post_id)) {
2282 2282
 
2283
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2283
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2284 2284
 
2285
-                            wp_delete_attachment($post_thumbnail_id);
2285
+							wp_delete_attachment($post_thumbnail_id);
2286 2286
 
2287
-                        }
2287
+						}
2288 2288
 
2289
-                    }
2289
+					}
2290 2290
 
2291
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2291
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2292 2292
 
2293
-                    geodir_set_wp_featured_image($post_id);
2293
+					geodir_set_wp_featured_image($post_id);
2294 2294
 
2295
-                }
2295
+				}
2296 2296
 
2297
-            }
2297
+			}
2298 2298
 
2299
-        }
2299
+		}
2300 2300
 
2301
-    }
2301
+	}
2302 2302
 
2303 2303
 }
2304 2304
 
@@ -2316,9 +2316,9 @@  discard block
 block discarded – undo
2316 2316
 function geodir_default_rating_star_icon()
2317 2317
 {
2318 2318
 
2319
-    if (!get_option('geodir_default_rating_star_icon')) {
2320
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2321
-    }
2319
+	if (!get_option('geodir_default_rating_star_icon')) {
2320
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2321
+	}
2322 2322
 
2323 2323
 }
2324 2324
 
@@ -2336,27 +2336,27 @@  discard block
 block discarded – undo
2336 2336
  */
2337 2337
 function geodir_user_post_listing_count($user_id=null)
2338 2338
 {
2339
-    global $wpdb, $plugin_prefix, $current_user;
2340
-    if(!$user_id){
2341
-        $user_id = $current_user->ID;
2342
-    }
2339
+	global $wpdb, $plugin_prefix, $current_user;
2340
+	if(!$user_id){
2341
+		$user_id = $current_user->ID;
2342
+	}
2343 2343
 
2344
-    $user_id = $current_user->ID;
2345
-    $all_postypes = geodir_get_posttypes();
2346
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2344
+	$user_id = $current_user->ID;
2345
+	$all_postypes = geodir_get_posttypes();
2346
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2347 2347
 
2348
-    $user_listing = array();
2349
-    if (is_array($all_posts) && !empty($all_posts)) {
2350
-        foreach ($all_posts as $ptype) {
2351
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2348
+	$user_listing = array();
2349
+	if (is_array($all_posts) && !empty($all_posts)) {
2350
+		foreach ($all_posts as $ptype) {
2351
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2352 2352
 
2353
-            if ($total_posts > 0) {
2354
-                $user_listing[$ptype] = $total_posts;
2355
-            }
2356
-        }
2357
-    }
2353
+			if ($total_posts > 0) {
2354
+				$user_listing[$ptype] = $total_posts;
2355
+			}
2356
+		}
2357
+	}
2358 2358
 
2359
-    return $user_listing;
2359
+	return $user_listing;
2360 2360
 }
2361 2361
 
2362 2362
 
@@ -2376,192 +2376,192 @@  discard block
 block discarded – undo
2376 2376
  */
2377 2377
 function geodir_detail_page_custom_field_tab($tabs_arr)
2378 2378
 {
2379
-    global $post;
2380
-
2381
-    $post_type = geodir_get_current_posttype();
2382
-    $all_postypes = geodir_get_posttypes();
2383
-
2384
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2385
-        $package_info = array();
2386
-        $package_info = geodir_post_package_info($package_info, $post);
2387
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2388
-        $fields_location = 'owntab';
2389
-
2390
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2391
-
2392
-        //remove video and special offers if it is already set to show
2393
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2394
-            $unset_video = true;
2395
-        }
2396
-
2397
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2398
-            $unset_special_offers = true;
2399
-        }
2400
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2401
-            foreach($custom_fields as $key => $custom_field){
2402
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2403
-                    unset($custom_fields[$key]);
2404
-                }
2405
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2406
-                    unset($custom_fields[$key]);
2407
-                }
2408
-            }
2409
-        }
2410
-
2411
-
2379
+	global $post;
2412 2380
 
2413
-        if (!empty($custom_fields)) {
2414
-            $parse_custom_fields = array();
2415
-            foreach ($custom_fields as $field) {
2416
-                $field = stripslashes_deep($field); // strip slashes
2417
-                
2418
-                $type = $field;
2419
-                $field_name = $field['htmlvar_name'];
2420
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2421
-                    $post->{$field_name} = $_REQUEST[$field_name];
2422
-                }
2381
+	$post_type = geodir_get_current_posttype();
2382
+	$all_postypes = geodir_get_posttypes();
2423 2383
 
2424
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2425
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2426
-                        continue;
2427
-                    }
2428
-
2429
-                    $parse_custom_fields[] = $field;
2430
-                }
2431
-            }
2432
-            $custom_fields = $parse_custom_fields;
2433
-        }
2434
-        //print_r($custom_fields);
2435
-        if (!empty($custom_fields)) {
2384
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2385
+		$package_info = array();
2386
+		$package_info = geodir_post_package_info($package_info, $post);
2387
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2388
+		$fields_location = 'owntab';
2436 2389
 
2437
-            global $field_set_start;
2390
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2438 2391
 
2439
-            $post = stripslashes_deep($post); // strip slashes
2440
-            
2441
-            $field_set_start = 0;
2442
-            $fieldset_count = 0;
2443
-            $fieldset = '';
2444
-            $total_fields = count($custom_fields);
2445
-            $count_field = 0;
2446
-            $fieldset_arr = array();
2447
-            $i = 0;
2448
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2449
-
2450
-            foreach ($custom_fields as $field) {
2451
-                $count_field++;
2452
-                $field_name = $field['htmlvar_name'];
2453
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2454
-                    $post->{$field_name} = $_REQUEST[$field_name];
2455
-                }
2392
+		//remove video and special offers if it is already set to show
2393
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2394
+			$unset_video = true;
2395
+		}
2456 2396
 
2457
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2458
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2459
-                    $site_title = trim($field['site_title']);
2460
-                    $type = $field;
2461
-                    $variables_array = array();
2397
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2398
+			$unset_special_offers = true;
2399
+		}
2400
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2401
+			foreach($custom_fields as $key => $custom_field){
2402
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2403
+					unset($custom_fields[$key]);
2404
+				}
2405
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2406
+					unset($custom_fields[$key]);
2407
+				}
2408
+			}
2409
+		}
2462 2410
 
2463
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2464
-                        continue;
2465
-                    }
2466 2411
 
2467
-                    if ($type['type'] != 'fieldset') {
2468
-                        $i++;
2469
-                        $variables_array['post_id'] = $post->ID;
2470
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2471
-                        $variables_array['value'] = '';
2472
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2473
-                    }else{
2474
-                        $i = 0;
2475
-                        $fieldset_count++;
2476
-                        $field_set_start = 1;
2477
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2478
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2479
-                    }
2480 2412
 
2413
+		if (!empty($custom_fields)) {
2414
+			$parse_custom_fields = array();
2415
+			foreach ($custom_fields as $field) {
2416
+				$field = stripslashes_deep($field); // strip slashes
2417
+                
2418
+				$type = $field;
2419
+				$field_name = $field['htmlvar_name'];
2420
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2421
+					$post->{$field_name} = $_REQUEST[$field_name];
2422
+				}
2423
+
2424
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2425
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2426
+						continue;
2427
+					}
2428
+
2429
+					$parse_custom_fields[] = $field;
2430
+				}
2431
+			}
2432
+			$custom_fields = $parse_custom_fields;
2433
+		}
2434
+		//print_r($custom_fields);
2435
+		if (!empty($custom_fields)) {
2481 2436
 
2482
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2483
-                    $type = stripslashes_deep($type); // strip slashes
2484
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2485
-                    $html = '';
2486
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2487
-                    if($html_var=='post'){$html_var='post_address';}
2488
-                    $field_icon = geodir_field_icon_proccess($type);
2489
-                    $filed_type = $type['type'];
2490
-
2491
-                    /**
2492
-                     * Filter the output for custom fields.
2493
-                     *
2494
-                     * Here we can remove or add new functions depending on the field type.
2495
-                     *
2496
-                     * @param string $html The html to be filtered (blank).
2497
-                     * @param string $fields_location The location the field is to be show.
2498
-                     * @param array $type The array of field values.
2499
-                     */
2500
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2501
-
2502
-
2503
-                    /**
2504
-                     * Filter custom field output in tab.
2505
-                     *
2506
-                     * @since 1.5.6
2507
-                     *
2508
-                     * @param string $html_var The HTML variable name for the field.
2509
-                     * @param string $html Custom field unfiltered HTML.
2510
-                     * @param array $variables_array Custom field variables array.
2511
-                     */
2512
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2513
-
2514
-                    $fieldset_html = '';
2515
-                    if ($field_set_start == 1) {
2516
-                        $add_html = false;
2517
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2518
-                            if ($fieldset != '') {
2519
-                                $add_html = true;
2520
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2521
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2522
-                            }
2523
-                            $fieldset_html = $fieldset;
2524
-                            $fieldset = '';
2525
-                        } else {
2526
-                            $fieldset .= $html;
2527
-                            if ($total_fields == $count_field && $fieldset != '') {
2528
-                                $add_html = true;
2529
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2530
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2531
-                                $fieldset_html = $fieldset;
2532
-                            }
2533
-                        }
2437
+			global $field_set_start;
2534 2438
 
2535
-                        if ($add_html) {
2536
-                            $tabs_arr[$htmlvar_name] = array(
2537
-                                'heading_text' => __($label, 'geodirectory'),
2538
-                                'is_active_tab' => false,
2539
-                                /**
2540
-                                 * Filter if a custom field should be displayed on the details page tab.
2541
-                                 *
2542
-                                 * @since 1.0.0
2543
-                                 * @param string $htmlvar_name The field HTML var name.
2544
-                                 */
2545
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2546
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2547
-                            );
2548
-                        }
2549
-                    } else {
2550
-                        if ($html != '') {
2551
-                            $tabs_arr[$field['htmlvar_name']] = array(
2552
-                                'heading_text' => __($label, 'geodirectory'),
2553
-                                'is_active_tab' => false,
2554
-                                /** This action is documented in geodirectory_hooks_actions.php */
2555
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2556
-                                'tab_content' => $html
2557
-                            );
2558
-                        }
2559
-                    }
2560
-                }
2561
-            }
2562
-        }
2563
-    }
2564
-    return $tabs_arr;
2439
+			$post = stripslashes_deep($post); // strip slashes
2440
+            
2441
+			$field_set_start = 0;
2442
+			$fieldset_count = 0;
2443
+			$fieldset = '';
2444
+			$total_fields = count($custom_fields);
2445
+			$count_field = 0;
2446
+			$fieldset_arr = array();
2447
+			$i = 0;
2448
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2449
+
2450
+			foreach ($custom_fields as $field) {
2451
+				$count_field++;
2452
+				$field_name = $field['htmlvar_name'];
2453
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2454
+					$post->{$field_name} = $_REQUEST[$field_name];
2455
+				}
2456
+
2457
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2458
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2459
+					$site_title = trim($field['site_title']);
2460
+					$type = $field;
2461
+					$variables_array = array();
2462
+
2463
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2464
+						continue;
2465
+					}
2466
+
2467
+					if ($type['type'] != 'fieldset') {
2468
+						$i++;
2469
+						$variables_array['post_id'] = $post->ID;
2470
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2471
+						$variables_array['value'] = '';
2472
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2473
+					}else{
2474
+						$i = 0;
2475
+						$fieldset_count++;
2476
+						$field_set_start = 1;
2477
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2478
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2479
+					}
2480
+
2481
+
2482
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2483
+					$type = stripslashes_deep($type); // strip slashes
2484
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2485
+					$html = '';
2486
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2487
+					if($html_var=='post'){$html_var='post_address';}
2488
+					$field_icon = geodir_field_icon_proccess($type);
2489
+					$filed_type = $type['type'];
2490
+
2491
+					/**
2492
+					 * Filter the output for custom fields.
2493
+					 *
2494
+					 * Here we can remove or add new functions depending on the field type.
2495
+					 *
2496
+					 * @param string $html The html to be filtered (blank).
2497
+					 * @param string $fields_location The location the field is to be show.
2498
+					 * @param array $type The array of field values.
2499
+					 */
2500
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2501
+
2502
+
2503
+					/**
2504
+					 * Filter custom field output in tab.
2505
+					 *
2506
+					 * @since 1.5.6
2507
+					 *
2508
+					 * @param string $html_var The HTML variable name for the field.
2509
+					 * @param string $html Custom field unfiltered HTML.
2510
+					 * @param array $variables_array Custom field variables array.
2511
+					 */
2512
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2513
+
2514
+					$fieldset_html = '';
2515
+					if ($field_set_start == 1) {
2516
+						$add_html = false;
2517
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2518
+							if ($fieldset != '') {
2519
+								$add_html = true;
2520
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2521
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2522
+							}
2523
+							$fieldset_html = $fieldset;
2524
+							$fieldset = '';
2525
+						} else {
2526
+							$fieldset .= $html;
2527
+							if ($total_fields == $count_field && $fieldset != '') {
2528
+								$add_html = true;
2529
+								$label = $fieldset_arr[$fieldset_count]['label'];
2530
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2531
+								$fieldset_html = $fieldset;
2532
+							}
2533
+						}
2534
+
2535
+						if ($add_html) {
2536
+							$tabs_arr[$htmlvar_name] = array(
2537
+								'heading_text' => __($label, 'geodirectory'),
2538
+								'is_active_tab' => false,
2539
+								/**
2540
+								 * Filter if a custom field should be displayed on the details page tab.
2541
+								 *
2542
+								 * @since 1.0.0
2543
+								 * @param string $htmlvar_name The field HTML var name.
2544
+								 */
2545
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2546
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2547
+							);
2548
+						}
2549
+					} else {
2550
+						if ($html != '') {
2551
+							$tabs_arr[$field['htmlvar_name']] = array(
2552
+								'heading_text' => __($label, 'geodirectory'),
2553
+								'is_active_tab' => false,
2554
+								/** This action is documented in geodirectory_hooks_actions.php */
2555
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2556
+								'tab_content' => $html
2557
+							);
2558
+						}
2559
+					}
2560
+				}
2561
+			}
2562
+		}
2563
+	}
2564
+	return $tabs_arr;
2565 2565
 }
2566 2566
 
2567 2567
 /* display add listing page for wpml */
@@ -2585,39 +2585,39 @@  discard block
 block discarded – undo
2585 2585
  */
2586 2586
 function geodir_add_post_status_author_page()
2587 2587
 {
2588
-    global $wpdb, $post;
2589
-
2590
-    $html = '';
2591
-    if (get_current_user_id()) {
2592
-
2593
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2594
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2595
-
2596
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2597
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2598
-            $status = "<strong>(";
2599
-            $status_icon = '<i class="fa fa-play"></i>';
2600
-            if ($real_status == 'publish') {
2601
-                $status .= __('Published', 'geodirectory');
2602
-            } else {
2603
-                $status .= __('Not published', 'geodirectory');
2604
-                $status_icon = '<i class="fa fa-pause"></i>';
2605
-            }
2606
-            $status .= ")</strong>";
2588
+	global $wpdb, $post;
2589
+
2590
+	$html = '';
2591
+	if (get_current_user_id()) {
2592
+
2593
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2594
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2595
+
2596
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2597
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2598
+			$status = "<strong>(";
2599
+			$status_icon = '<i class="fa fa-play"></i>';
2600
+			if ($real_status == 'publish') {
2601
+				$status .= __('Published', 'geodirectory');
2602
+			} else {
2603
+				$status .= __('Not published', 'geodirectory');
2604
+				$status_icon = '<i class="fa fa-pause"></i>';
2605
+			}
2606
+			$status .= ")</strong>";
2607 2607
 
2608
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2609
-        }
2610
-    }
2608
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2609
+		}
2610
+	}
2611 2611
 
2612
-    if ($html != '') {
2613
-        /**
2614
-         * Filter the post status text on the author page.
2615
-         *
2616
-         * @since 1.0.0
2617
-         * @param string $html The HTML of the status.
2618
-         */
2619
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2620
-    }
2612
+	if ($html != '') {
2613
+		/**
2614
+		 * Filter the post status text on the author page.
2615
+		 *
2616
+		 * @since 1.0.0
2617
+		 * @param string $html The HTML of the status.
2618
+		 */
2619
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2620
+	}
2621 2621
 
2622 2622
 
2623 2623
 }
@@ -2631,21 +2631,21 @@  discard block
 block discarded – undo
2631 2631
  */
2632 2632
 function geodir_init_no_rating()
2633 2633
 {
2634
-    if (get_option('geodir_disable_rating')) {
2635
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2636
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2637
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2638
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2639
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2640
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2641
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2642
-
2643
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2644
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2645
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2646
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2647
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2648
-    }
2634
+	if (get_option('geodir_disable_rating')) {
2635
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2636
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2637
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2638
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2639
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2640
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2641
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2642
+
2643
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2644
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2645
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2646
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2647
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2648
+	}
2649 2649
 }
2650 2650
 
2651 2651
 /**
@@ -2657,24 +2657,24 @@  discard block
 block discarded – undo
2657 2657
  */
2658 2658
 function geodir_no_rating_rating_fields()
2659 2659
 {
2660
-    global $post;
2660
+	global $post;
2661 2661
 
2662
-    $post_types = geodir_get_posttypes();
2662
+	$post_types = geodir_get_posttypes();
2663 2663
 
2664
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2665
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2666
-            if (get_option('geodir_reviewrating_enable_rating')) {
2667
-                echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2668
-            } else {
2669
-                echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2670
-            }
2671
-            if (get_option('geodir_reviewrating_enable_images')) {
2672
-                geodir_reviewrating_rating_img_html();
2673
-            }
2674
-        } else {
2675
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2676
-        }
2677
-    }
2664
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2665
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2666
+			if (get_option('geodir_reviewrating_enable_rating')) {
2667
+				echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2668
+			} else {
2669
+				echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2670
+			}
2671
+			if (get_option('geodir_reviewrating_enable_images')) {
2672
+				geodir_reviewrating_rating_img_html();
2673
+			}
2674
+		} else {
2675
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2676
+		}
2677
+	}
2678 2678
 }
2679 2679
 
2680 2680
 /**
@@ -2688,11 +2688,11 @@  discard block
 block discarded – undo
2688 2688
  */
2689 2689
 function geodir_no_rating_comment_text($content, $comment = '')
2690 2690
 {
2691
-    if (!is_admin()) {
2692
-        return '<div class="description">' . $content . '</div>';
2693
-    } else {
2694
-        return $content;
2695
-    }
2691
+	if (!is_admin()) {
2692
+		return '<div class="description">' . $content . '</div>';
2693
+	} else {
2694
+		return $content;
2695
+	}
2696 2696
 }
2697 2697
 
2698 2698
 /**
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
  */
2706 2706
 function geodir_no_rating_review_rating_html($content = '')
2707 2707
 {
2708
-    return NULL;
2708
+	return NULL;
2709 2709
 }
2710 2710
 
2711 2711
 /**
@@ -2719,19 +2719,19 @@  discard block
 block discarded – undo
2719 2719
  */
2720 2720
 function geodir_no_rating_get_sort_options($options, $post_type = '')
2721 2721
 {
2722
-    $new_options = array();
2723
-    if (!empty($options)) {
2724
-        foreach ($options as $option) {
2725
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2726
-                continue;
2727
-            }
2728
-            $new_options[] = $option;
2729
-        }
2722
+	$new_options = array();
2723
+	if (!empty($options)) {
2724
+		foreach ($options as $option) {
2725
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2726
+				continue;
2727
+			}
2728
+			$new_options[] = $option;
2729
+		}
2730 2730
 
2731
-        $options = $new_options;
2732
-    }
2731
+		$options = $new_options;
2732
+	}
2733 2733
 
2734
-    return $options;
2734
+	return $options;
2735 2735
 }
2736 2736
 
2737 2737
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -2745,11 +2745,11 @@  discard block
 block discarded – undo
2745 2745
  */
2746 2746
 function geodir_all_js_msg_no_rating($msg = array())
2747 2747
 {
2748
-    if (get_option('geodir_disable_rating')) {
2749
-        $msg['gd_cmt_no_rating'] = true;
2750
-    }
2748
+	if (get_option('geodir_disable_rating')) {
2749
+		$msg['gd_cmt_no_rating'] = true;
2750
+	}
2751 2751
 
2752
-    return $msg;
2752
+	return $msg;
2753 2753
 }
2754 2754
 
2755 2755
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -2763,13 +2763,13 @@  discard block
 block discarded – undo
2763 2763
  */
2764 2764
 function geodir_body_class_no_rating($classes = array())
2765 2765
 {
2766
-    if (get_option('geodir_disable_rating')) {
2767
-        $classes[] = 'gd-no-rating';
2768
-    }
2766
+	if (get_option('geodir_disable_rating')) {
2767
+		$classes[] = 'gd-no-rating';
2768
+	}
2769 2769
     
2770
-    $classes[] = 'gd-map-' . geodir_map_name();
2770
+	$classes[] = 'gd-map-' . geodir_map_name();
2771 2771
 
2772
-    return $classes;
2772
+	return $classes;
2773 2773
 }
2774 2774
 
2775 2775
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -2783,13 +2783,13 @@  discard block
 block discarded – undo
2783 2783
  */
2784 2784
 function geodir_admin_body_class_no_rating($class = '')
2785 2785
 {
2786
-    if (get_option('geodir_disable_rating')) {
2787
-        $class .= ' gd-no-rating';
2788
-    }
2786
+	if (get_option('geodir_disable_rating')) {
2787
+		$class .= ' gd-no-rating';
2788
+	}
2789 2789
     
2790
-    $class .= ' gd-map-' . geodir_map_name();
2790
+	$class .= ' gd-map-' . geodir_map_name();
2791 2791
 
2792
-    return $class;
2792
+	return $class;
2793 2793
 }
2794 2794
 
2795 2795
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -2802,10 +2802,10 @@  discard block
 block discarded – undo
2802 2802
  */
2803 2803
 function geodir_wp_head_no_rating()
2804 2804
 {
2805
-    if (get_option('geodir_disable_rating')) {
2806
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2807
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2808
-    }
2805
+	if (get_option('geodir_disable_rating')) {
2806
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2807
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2808
+	}
2809 2809
 }
2810 2810
 
2811 2811
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -2822,36 +2822,36 @@  discard block
 block discarded – undo
2822 2822
  * @return array Translation texts.
2823 2823
  */
2824 2824
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2825
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2826
-
2827
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2828
-
2829
-    /**
2830
-     * Filters the geodirectory option names that requires to add for translation.
2831
-     *
2832
-     * @since 1.5.7
2833
-     * @package GeoDirectory
2834
-     *
2835
-     * @param  array $gd_options Array of option names.
2836
-     */
2837
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2838
-    $gd_options = array_unique($gd_options);
2839
-
2840
-    if (!empty($gd_options)) {
2841
-        foreach ($gd_options as $gd_option) {
2842
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2843
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2825
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2826
+
2827
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2828
+
2829
+	/**
2830
+	 * Filters the geodirectory option names that requires to add for translation.
2831
+	 *
2832
+	 * @since 1.5.7
2833
+	 * @package GeoDirectory
2834
+	 *
2835
+	 * @param  array $gd_options Array of option names.
2836
+	 */
2837
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2838
+	$gd_options = array_unique($gd_options);
2839
+
2840
+	if (!empty($gd_options)) {
2841
+		foreach ($gd_options as $gd_option) {
2842
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2843
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2844 2844
                 
2845
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2846
-                    $translation_texts[] = stripslashes_deep($option_value);
2847
-                }
2848
-            }
2849
-        }
2850
-    }
2845
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2846
+					$translation_texts[] = stripslashes_deep($option_value);
2847
+				}
2848
+			}
2849
+		}
2850
+	}
2851 2851
 
2852
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2852
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2853 2853
 
2854
-    return $translation_texts;
2854
+	return $translation_texts;
2855 2855
 }
2856 2856
 
2857 2857
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2865,15 +2865,15 @@  discard block
 block discarded – undo
2865 2865
 
2866 2866
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2867 2867
 function gd_get_comments_link($comments_link, $post_id) {
2868
-    $post_type = get_post_type($post_id);
2868
+	$post_type = get_post_type($post_id);
2869 2869
 
2870
-    $all_postypes = geodir_get_posttypes();
2871
-    if (in_array($post_type, $all_postypes)) {
2872
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2873
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2874
-    }
2870
+	$all_postypes = geodir_get_posttypes();
2871
+	if (in_array($post_type, $all_postypes)) {
2872
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2873
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2874
+	}
2875 2875
 
2876
-    return $comments_link;
2876
+	return $comments_link;
2877 2877
 }
2878 2878
 
2879 2879
 
@@ -2891,11 +2891,11 @@  discard block
 block discarded – undo
2891 2891
 function geodir_add_nav_menu_class( $args )
2892 2892
 {
2893 2893
 
2894
-        if(isset($args['menu_class'])){
2895
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2896
-        }
2894
+		if(isset($args['menu_class'])){
2895
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2896
+		}
2897 2897
     
2898
-    return $args;
2898
+	return $args;
2899 2899
 }
2900 2900
 
2901 2901
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2902 2902
\ No newline at end of file
Please login to merge, or discard this patch.
language.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 define('LISTING_DETAILS_TEXT', __('Enter Listing Details', 'geodirectory'));
42 42
 
43 43
 define('PLACE_TITLE_TEXT', __('Listing Title', 'geodirectory')); // depreciated @since 1.6.3
44
-define('PLACE_DESC_TEXT', __('Listing Description', 'geodirectory'));// depreciated @since 1.6.3
44
+define('PLACE_DESC_TEXT', __('Listing Description', 'geodirectory')); // depreciated @since 1.6.3
45 45
 
46 46
 define('LISTING_ADDRESS_TEXT', __('Listing Address:', 'geodirectory'));
47 47
 define('PLACE_ADDRESS', __('Address:', 'geodirectory'));
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204 204
         $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
205
+        if (get_option('geodir_marker_cluster_type')) {
206 206
             if ($map_args['autozoom']) {
207 207
                 $map_args['enable_marker_cluster_no_reposition'] = false;
208 208
             } else {
209 209
                 $map_args['enable_marker_cluster_no_reposition'] = true;
210 210
             }
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+            $map_args['enable_marker_cluster_server'] = true;
213 213
 
214 214
         }
215 215
 	} else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
     // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
220
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
221 221
         $map_args['enable_marker_cluster_no_reposition'] = true;
222 222
     }
223 223
 
@@ -890,20 +890,20 @@  discard block
 block discarded – undo
890 890
 	
891 891
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
892 892
 	
893
-	if ($show_adv_search != '' ) {
894
-		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
893
+	if ($show_adv_search != '') {
894
+		$show_adv_class = 'geodir-advance-search-'.$show_adv_search.' ';
895 895
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
896 896
 			$show_adv_search = 'search';
897 897
 		}
898
-		$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
898
+		$show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"';
899 899
 		
900
-		$params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']);
900
+		$params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']);
901 901
 	}
902 902
 	
903 903
 	ob_start();
904 904
 	
905 905
 	//geodir_get_template_part('listing', 'filter-form');
906
-	the_widget('geodir_advance_search_widget', $params, $params );
906
+	the_widget('geodir_advance_search_widget', $params, $params);
907 907
 	
908 908
 	$output = ob_get_contents();
909 909
     ob_end_clean();
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
     // Validate character_count
1105 1105
     //todo: is this necessary?
1106
-    $params['character_count']  = $params['character_count'];
1106
+    $params['character_count'] = $params['character_count'];
1107 1107
 
1108 1108
     // Validate our layout choice
1109 1109
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
     // Validate Listing width, used in the template widget-listing-listview.php
1117 1117
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1118
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1118
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1119 1119
 
1120 1120
     // Validate the checkboxes used on the widget
1121 1121
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
     if (!empty($params['tags'])) {
1132 1132
         if (!is_array($params['tags'])) {
1133 1133
             $comma = _x(',', 'tag delimiter');
1134
-            if ( ',' !== $comma ) {
1134
+            if (',' !== $comma) {
1135 1135
                 $params['tags'] = str_replace($comma, ',', $params['tags']);
1136 1136
             }
1137 1137
             $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
@@ -1153,13 +1153,13 @@  discard block
 block discarded – undo
1153 1153
         unset($atts['pageno']);
1154 1154
     }
1155 1155
 
1156
-    if ( !empty($atts['shortcode_content']) ) {
1156
+    if (!empty($atts['shortcode_content'])) {
1157 1157
         $content = $atts['shortcode_content'];
1158 1158
     }
1159 1159
     $params['shortcode_content'] = trim($content);
1160 1160
     $atts['shortcode_content'] = trim($content);
1161 1161
     
1162
-    $params['shortcode_atts']       = $atts;
1162
+    $params['shortcode_atts'] = $atts;
1163 1163
 
1164 1164
     $output = geodir_sc_gd_listings_output($params);
1165 1165
 
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
 	// Validate the checkboxes used on the widget
1227 1227
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1228 1228
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1229
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1230
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1229
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1230
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1231 1231
 	
1232 1232
 	if ($params['max_count'] != 'all') {
1233 1233
 		$params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
Indentation   +711 added lines, -711 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,43 +32,43 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -259,77 +259,77 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function geodir_sc_listing_map($atts)
261 261
 {
262
-    ob_start();
263
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
-
265
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
-
267
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
-
269
-    $defaults = array(
270
-        'width' => '294',
271
-        'height' => '370',
272
-        'zoom' => '13',
273
-        'autozoom' => '',
274
-        'sticky' => '',
275
-        'showall' => '0',
276
-        'scrollwheel' => '0',
277
-        'maptype' => 'ROADMAP',
278
-        'child_collapse' => 0,
262
+	ob_start();
263
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
264
+
265
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
266
+
267
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
268
+
269
+	$defaults = array(
270
+		'width' => '294',
271
+		'height' => '370',
272
+		'zoom' => '13',
273
+		'autozoom' => '',
274
+		'sticky' => '',
275
+		'showall' => '0',
276
+		'scrollwheel' => '0',
277
+		'maptype' => 'ROADMAP',
278
+		'child_collapse' => 0,
279 279
 		'marker_cluster' => false
280
-    );
281
-
282
-    $params = shortcode_atts($defaults, $atts);
283
-
284
-    $params = gdsc_validate_map_args($params);
285
-
286
-    $map_args = array(
287
-        'map_canvas_name' => 'gd_listing_map',
288
-        'width' => $params['width'],
289
-        'height' => $params['height'],
290
-        'zoom' => $params['zoom'],
291
-        'autozoom' => $params['autozoom'],
292
-        'sticky' => $params['sticky'],
293
-        'showall' => $params['showall'],
294
-        'scrollwheel' => $params['scrollwheel'],
295
-        'child_collapse' => 0,
296
-        'enable_cat_filters' => false,
297
-        'enable_text_search' => false,
298
-        'enable_post_type_filters' => false,
299
-        'enable_location_filters' => false,
300
-        'enable_jason_on_load' => true,
301
-    );
302
-
303
-    if (is_single()) {
304
-
305
-        global $post;
306
-        $map_default_lat = $address_latitude = $post->post_latitude;
307
-        $map_default_lng = $address_longitude = $post->post_longitude;
308
-        $mapview = $post->post_mapview;
309
-        $map_args['zoom'] = $post->post_mapzoom;
310
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
-
312
-    } else {
313
-        $default_location = geodir_get_default_location();
314
-
315
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
318
-    }
319
-
320
-    if (empty($mapview)) {
321
-        $mapview = 'ROADMAP';
322
-    }
323
-
324
-    // Set default map options
325
-    $map_args['ajax_url'] = geodir_get_ajax_url();
326
-    $map_args['latitude'] = $map_default_lat;
327
-    $map_args['longitude'] = $map_default_lng;
328
-    $map_args['streetViewControl'] = true;
329
-    $map_args['maptype'] = $mapview;
330
-    $map_args['showPreview'] = '0';
331
-    $map_args['maxZoom'] = 21;
332
-    $map_args['bubble_size'] = 'small';
280
+	);
281
+
282
+	$params = shortcode_atts($defaults, $atts);
283
+
284
+	$params = gdsc_validate_map_args($params);
285
+
286
+	$map_args = array(
287
+		'map_canvas_name' => 'gd_listing_map',
288
+		'width' => $params['width'],
289
+		'height' => $params['height'],
290
+		'zoom' => $params['zoom'],
291
+		'autozoom' => $params['autozoom'],
292
+		'sticky' => $params['sticky'],
293
+		'showall' => $params['showall'],
294
+		'scrollwheel' => $params['scrollwheel'],
295
+		'child_collapse' => 0,
296
+		'enable_cat_filters' => false,
297
+		'enable_text_search' => false,
298
+		'enable_post_type_filters' => false,
299
+		'enable_location_filters' => false,
300
+		'enable_jason_on_load' => true,
301
+	);
302
+
303
+	if (is_single()) {
304
+
305
+		global $post;
306
+		$map_default_lat = $address_latitude = $post->post_latitude;
307
+		$map_default_lng = $address_longitude = $post->post_longitude;
308
+		$mapview = $post->post_mapview;
309
+		$map_args['zoom'] = $post->post_mapzoom;
310
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
311
+
312
+	} else {
313
+		$default_location = geodir_get_default_location();
314
+
315
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
316
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
317
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
318
+	}
319
+
320
+	if (empty($mapview)) {
321
+		$mapview = 'ROADMAP';
322
+	}
323
+
324
+	// Set default map options
325
+	$map_args['ajax_url'] = geodir_get_ajax_url();
326
+	$map_args['latitude'] = $map_default_lat;
327
+	$map_args['longitude'] = $map_default_lng;
328
+	$map_args['streetViewControl'] = true;
329
+	$map_args['maptype'] = $mapview;
330
+	$map_args['showPreview'] = '0';
331
+	$map_args['maxZoom'] = 21;
332
+	$map_args['bubble_size'] = 'small';
333 333
 	
334 334
 	// Add marker cluster
335 335
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 		$map_args['enable_marker_cluster'] = false;
339 339
 	}
340 340
 
341
-    geodir_draw_map($map_args);
341
+	geodir_draw_map($map_args);
342 342
 
343
-    $output = ob_get_contents();
343
+	$output = ob_get_contents();
344 344
 
345
-    ob_end_clean();
345
+	ob_end_clean();
346 346
 
347
-    return $output;
347
+	return $output;
348 348
 }
349 349
 
350 350
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -377,120 +377,120 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function geodir_sc_listing_slider($atts)
379 379
 {
380
-    ob_start();
381
-    $defaults = array(
382
-        'post_type' => 'gd_place',
383
-        'category' => '0',
384
-        'post_number' => '5',
385
-        'slideshow' => '0',
386
-        'animation_loop' => 0,
387
-        'direction_nav' => 0,
388
-        'slideshow_speed' => 5000,
389
-        'animation_speed' => 600,
390
-        'animation' => 'slide',
391
-        'order_by' => 'latest',
392
-        'show_title' => '',
393
-        'show_featured_only' => '',
394
-        'title' => '',
395
-    );
396
-
397
-    $params = shortcode_atts($defaults, $atts);
398
-
399
-
400
-    /*
380
+	ob_start();
381
+	$defaults = array(
382
+		'post_type' => 'gd_place',
383
+		'category' => '0',
384
+		'post_number' => '5',
385
+		'slideshow' => '0',
386
+		'animation_loop' => 0,
387
+		'direction_nav' => 0,
388
+		'slideshow_speed' => 5000,
389
+		'animation_speed' => 600,
390
+		'animation' => 'slide',
391
+		'order_by' => 'latest',
392
+		'show_title' => '',
393
+		'show_featured_only' => '',
394
+		'title' => '',
395
+	);
396
+
397
+	$params = shortcode_atts($defaults, $atts);
398
+
399
+
400
+	/*
401 401
      *
402 402
      * Now we begin the validation of the attributes.
403 403
      */
404
-    // Check we have a valid post_type
405
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
-        $params['post_type'] = 'gd_place';
407
-    }
408
-
409
-    // Check we have a valid sort_order
410
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
-
412
-    // Match the chosen animation to our options
413
-    $animation_list = array('slide', 'fade');
414
-    if (!(in_array($params['animation'], $animation_list))) {
415
-        $params['animation'] = 'slide';
416
-    }
417
-
418
-    // Post_number needs to be a positive integer
419
-    $params['post_number'] = absint($params['post_number']);
420
-    if (0 == $params['post_number']) {
421
-        $params['post_number'] = 1;
422
-    }
423
-
424
-    // Manage the entered categories
425
-    if (0 != $params['category'] || '' != $params['category']) {
426
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
-    }
428
-    // Convert show_title to a bool
429
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
-
431
-    // Convert show_featured_only to a bool
432
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
-
434
-    /*
404
+	// Check we have a valid post_type
405
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
406
+		$params['post_type'] = 'gd_place';
407
+	}
408
+
409
+	// Check we have a valid sort_order
410
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
411
+
412
+	// Match the chosen animation to our options
413
+	$animation_list = array('slide', 'fade');
414
+	if (!(in_array($params['animation'], $animation_list))) {
415
+		$params['animation'] = 'slide';
416
+	}
417
+
418
+	// Post_number needs to be a positive integer
419
+	$params['post_number'] = absint($params['post_number']);
420
+	if (0 == $params['post_number']) {
421
+		$params['post_number'] = 1;
422
+	}
423
+
424
+	// Manage the entered categories
425
+	if (0 != $params['category'] || '' != $params['category']) {
426
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
427
+	}
428
+	// Convert show_title to a bool
429
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
430
+
431
+	// Convert show_featured_only to a bool
432
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
433
+
434
+	/*
435 435
      * Hopefully all attributes are now valid, and safe to pass forward
436 436
      */
437 437
 
438
-    // redeclare vars after validation
439
-
440
-    if (isset($params['direction_nav'])) {
441
-        $params['directionNav'] = $params['direction_nav'];
442
-    }
443
-    if (isset($params['animation_loop'])) {
444
-        $params['animationLoop'] = $params['animation_loop'];
445
-    }
446
-    if (isset($params['slideshow_speed'])) {
447
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
448
-    }
449
-    if (isset($params['animation_speed'])) {
450
-        $params['animationSpeed'] = $params['animation_speed'];
451
-    }
452
-    if (isset($params['order_by'])) {
453
-        $params['list_sort'] = $params['order_by'];
454
-    }
455
-
456
-    $query_args = array(
457
-        'post_number' => $params['post_number'],
458
-        'is_geodir_loop' => true,
459
-        'post_type' => $params['post_type'],
460
-        'order_by' => $params['order_by']
461
-    );
462
-
463
-    if (1 == $params['show_featured_only']) {
464
-        $query_args['show_featured_only'] = 1;
465
-    }
466
-
467
-    if (0 != $params['category'] && '' != $params['category']) {
468
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
-        $tax_query = array(
470
-            'taxonomy' => $category_taxonomy[0],
471
-            'field' => 'id',
472
-            'terms' => $params['category'],
473
-        );
474
-
475
-        $query_args['tax_query'] = array($tax_query);
476
-    }
477
-
478
-    $defaults = array(
479
-        'before_widget' => '',
480
-        'after_widget' => '',
481
-        'before_title' => '',
482
-        'after_title' => '',
483
-    );
484
-
485
-    $query_args = array_merge($query_args, $params);
486
-
487
-    geodir_listing_slider_widget_output($defaults, $query_args);
488
-
489
-    $output = ob_get_contents();
490
-
491
-    ob_end_clean();
492
-
493
-    return $output;
438
+	// redeclare vars after validation
439
+
440
+	if (isset($params['direction_nav'])) {
441
+		$params['directionNav'] = $params['direction_nav'];
442
+	}
443
+	if (isset($params['animation_loop'])) {
444
+		$params['animationLoop'] = $params['animation_loop'];
445
+	}
446
+	if (isset($params['slideshow_speed'])) {
447
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
448
+	}
449
+	if (isset($params['animation_speed'])) {
450
+		$params['animationSpeed'] = $params['animation_speed'];
451
+	}
452
+	if (isset($params['order_by'])) {
453
+		$params['list_sort'] = $params['order_by'];
454
+	}
455
+
456
+	$query_args = array(
457
+		'post_number' => $params['post_number'],
458
+		'is_geodir_loop' => true,
459
+		'post_type' => $params['post_type'],
460
+		'order_by' => $params['order_by']
461
+	);
462
+
463
+	if (1 == $params['show_featured_only']) {
464
+		$query_args['show_featured_only'] = 1;
465
+	}
466
+
467
+	if (0 != $params['category'] && '' != $params['category']) {
468
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
469
+		$tax_query = array(
470
+			'taxonomy' => $category_taxonomy[0],
471
+			'field' => 'id',
472
+			'terms' => $params['category'],
473
+		);
474
+
475
+		$query_args['tax_query'] = array($tax_query);
476
+	}
477
+
478
+	$defaults = array(
479
+		'before_widget' => '',
480
+		'after_widget' => '',
481
+		'before_title' => '',
482
+		'after_title' => '',
483
+	);
484
+
485
+	$query_args = array_merge($query_args, $params);
486
+
487
+	geodir_listing_slider_widget_output($defaults, $query_args);
488
+
489
+	$output = ob_get_contents();
490
+
491
+	ob_end_clean();
492
+
493
+	return $output;
494 494
 }
495 495
 
496 496
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -514,22 +514,22 @@  discard block
 block discarded – undo
514 514
  */
515 515
 function geodir_sc_login_box($atts)
516 516
 {
517
-    ob_start();
517
+	ob_start();
518 518
 
519
-    $defaults = array(
520
-        'before_widget' => '',
521
-        'after_widget' => '',
522
-        'before_title' => '',
523
-        'after_title' => '',
524
-    );
519
+	$defaults = array(
520
+		'before_widget' => '',
521
+		'after_widget' => '',
522
+		'before_title' => '',
523
+		'after_title' => '',
524
+	);
525 525
 
526
-    geodir_loginwidget_output($defaults, $defaults);
526
+	geodir_loginwidget_output($defaults, $defaults);
527 527
 
528
-    $output = ob_get_contents();
528
+	$output = ob_get_contents();
529 529
 
530
-    ob_end_clean();
530
+	ob_end_clean();
531 531
 
532
-    return $output;
532
+	return $output;
533 533
 }
534 534
 
535 535
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -560,30 +560,30 @@  discard block
 block discarded – undo
560 560
  */
561 561
 function geodir_sc_popular_post_category($atts)
562 562
 {
563
-    ob_start();
564
-    global $geodir_post_category_str;
565
-    $defaults = array(
566
-        'category_limit' => 15,
567
-        'before_widget' => '',
568
-        'after_widget' => '',
569
-        'before_title' => '',
570
-        'after_title' => '',
571
-        'title' => '',
572
-        'default_post_type' => '',
573
-        'parent_only' => false,
574
-    );
575
-
576
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
577
-    $params['category_limit'] = absint($params['category_limit']);
578
-    $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
579
-    $params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
580
-    geodir_popular_post_category_output($params, $params);
581
-
582
-    $output = ob_get_contents();
583
-
584
-    ob_end_clean();
585
-
586
-    return $output;
563
+	ob_start();
564
+	global $geodir_post_category_str;
565
+	$defaults = array(
566
+		'category_limit' => 15,
567
+		'before_widget' => '',
568
+		'after_widget' => '',
569
+		'before_title' => '',
570
+		'after_title' => '',
571
+		'title' => '',
572
+		'default_post_type' => '',
573
+		'parent_only' => false,
574
+	);
575
+
576
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
577
+	$params['category_limit'] = absint($params['category_limit']);
578
+	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
579
+	$params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
580
+	geodir_popular_post_category_output($params, $params);
581
+
582
+	$output = ob_get_contents();
583
+
584
+	ob_end_clean();
585
+
586
+	return $output;
587 587
 }
588 588
 
589 589
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -623,97 +623,97 @@  discard block
 block discarded – undo
623 623
  */
624 624
 function geodir_sc_popular_post_view($atts)
625 625
 {
626
-    ob_start();
627
-    $defaults = array(
628
-        'post_type' => 'gd_place',
629
-        'category' => '0',
630
-        'post_number' => '5',
631
-        'layout' => 'gridview_onehalf',
632
-        'add_location_filter' => '0',
633
-        'list_sort' => 'latest',
634
-        'use_viewing_post_type' => '1',
635
-        'character_count' => '20',
636
-        'listing_width' => '',
637
-        'show_featured_only' => '0',
638
-        'show_special_only' => '0',
639
-        'with_pics_only' => '0',
640
-        'with_videos_only' => '0',
641
-        'before_widget' => '',
642
-        'after_widget' => '',
643
-        'before_title' => '<h3 class="widget-title">',
644
-        'after_title' => '</h3>',
645
-        'title' => '',
646
-        'category_title' => '',
647
-    );
648
-
649
-    $params = shortcode_atts($defaults, $atts);
650
-
651
-    /**
652
-     * Validate our incoming params
653
-     */
626
+	ob_start();
627
+	$defaults = array(
628
+		'post_type' => 'gd_place',
629
+		'category' => '0',
630
+		'post_number' => '5',
631
+		'layout' => 'gridview_onehalf',
632
+		'add_location_filter' => '0',
633
+		'list_sort' => 'latest',
634
+		'use_viewing_post_type' => '1',
635
+		'character_count' => '20',
636
+		'listing_width' => '',
637
+		'show_featured_only' => '0',
638
+		'show_special_only' => '0',
639
+		'with_pics_only' => '0',
640
+		'with_videos_only' => '0',
641
+		'before_widget' => '',
642
+		'after_widget' => '',
643
+		'before_title' => '<h3 class="widget-title">',
644
+		'after_title' => '</h3>',
645
+		'title' => '',
646
+		'category_title' => '',
647
+	);
654 648
 
655
-    // Validate the selected post type, default to gd_place on fail
656
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
657
-        $params['post_type'] = 'gd_place';
658
-    }
659
-
660
-    // Validate the selected category/ies - Grab the current list based on post_type
661
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
662
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
663
-
664
-    // Make sure we have an array
665
-    if (!(is_array($params['category']))) {
666
-        $params['category'] = explode(',', $params['category']);
667
-    }
668
-
669
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
670
-    // Otherwise it becomes empty and later on that will mean "All"
671
-    $params['category'] = array_intersect($params['category'], $categories);
672
-
673
-    // Post_number needs to be a positive integer
674
-    $params['post_number'] = absint($params['post_number']);
675
-    if (0 == $params['post_number']) {
676
-        $params['post_number'] = 1;
677
-    }
678
-
679
-    // Validate our layout choice
680
-    // Outside of the norm, I added some more simple terms to match the existing
681
-    // So now I just run the switch to set it properly.
682
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
683
-
684
-    // Validate our sorting choice
685
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
686
-
687
-    // Validate character_count
688
-    $params['character_count'] = absint($params['character_count']);
689
-    if (20 > $params['character_count']) {
690
-        $params['character_count'] = 20;
691
-    }
692
-
693
-    // Validate Listing width, used in the template widget-listing-listview.php
694
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
695
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
696
-
697
-    // Validate the checkboxes used on the widget
698
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
699
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
700
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
701
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
702
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
703
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
704
-
705
-    /**
706
-     * End of validation
707
-     */
649
+	$params = shortcode_atts($defaults, $atts);
650
+
651
+	/**
652
+	 * Validate our incoming params
653
+	 */
654
+
655
+	// Validate the selected post type, default to gd_place on fail
656
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
657
+		$params['post_type'] = 'gd_place';
658
+	}
659
+
660
+	// Validate the selected category/ies - Grab the current list based on post_type
661
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
662
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
708 663
 
709
-    geodir_popular_postview_output($params, $params);
664
+	// Make sure we have an array
665
+	if (!(is_array($params['category']))) {
666
+		$params['category'] = explode(',', $params['category']);
667
+	}
668
+
669
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
670
+	// Otherwise it becomes empty and later on that will mean "All"
671
+	$params['category'] = array_intersect($params['category'], $categories);
672
+
673
+	// Post_number needs to be a positive integer
674
+	$params['post_number'] = absint($params['post_number']);
675
+	if (0 == $params['post_number']) {
676
+		$params['post_number'] = 1;
677
+	}
710 678
 
679
+	// Validate our layout choice
680
+	// Outside of the norm, I added some more simple terms to match the existing
681
+	// So now I just run the switch to set it properly.
682
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
711 683
 
712
-    $output = ob_get_contents();
684
+	// Validate our sorting choice
685
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
713 686
 
714
-    ob_end_clean();
687
+	// Validate character_count
688
+	$params['character_count'] = absint($params['character_count']);
689
+	if (20 > $params['character_count']) {
690
+		$params['character_count'] = 20;
691
+	}
715 692
 
716
-    return $output;
693
+	// Validate Listing width, used in the template widget-listing-listview.php
694
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
695
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
696
+
697
+	// Validate the checkboxes used on the widget
698
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
699
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
700
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
701
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
702
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
703
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
704
+
705
+	/**
706
+	 * End of validation
707
+	 */
708
+
709
+	geodir_popular_postview_output($params, $params);
710
+
711
+
712
+	$output = ob_get_contents();
713
+
714
+	ob_end_clean();
715
+
716
+	return $output;
717 717
 }
718 718
 
719 719
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -735,37 +735,37 @@  discard block
 block discarded – undo
735 735
  * @return string Recent reviews HTML.
736 736
  */
737 737
 function geodir_sc_recent_reviews($atts) {
738
-    ob_start();
739
-    $defaults = array(
738
+	ob_start();
739
+	$defaults = array(
740 740
 		'title' => '',
741 741
 		'count' => 5,
742
-    );
742
+	);
743 743
 
744
-    $params = shortcode_atts($defaults, $atts);
744
+	$params = shortcode_atts($defaults, $atts);
745 745
 
746
-    $count = absint($params['count']);
747
-    if (0 == $count) {
748
-        $count = 1;
749
-    }
746
+	$count = absint($params['count']);
747
+	if (0 == $count) {
748
+		$count = 1;
749
+	}
750 750
 	
751 751
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
752 752
 
753
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
753
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
754 754
 
755
-    if ($comments_li) {
756
-        if ($title != '') { ?>
755
+	if ($comments_li) {
756
+		if ($title != '') { ?>
757 757
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
758 758
 		<?php } ?>
759 759
         <div class="geodir_sc_recent_reviews_section">
760 760
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
761 761
         </div>
762 762
     <?php
763
-    }
764
-    $output = ob_get_contents();
763
+	}
764
+	$output = ob_get_contents();
765 765
 
766
-    ob_end_clean();
766
+	ob_end_clean();
767 767
 
768
-    return $output;
768
+	return $output;
769 769
 }
770 770
 
771 771
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -795,64 +795,64 @@  discard block
 block discarded – undo
795 795
  */
796 796
 function geodir_sc_related_listings($atts)
797 797
 {
798
-    ob_start();
799
-    $defaults = array(
800
-        'post_number' => 5,
801
-        'relate_to' => 'category',
802
-        'layout' => 'gridview_onehalf',
803
-        'add_location_filter' => 0,
804
-        'listing_width' => '',
805
-        'list_sort' => 'latest',
806
-        'character_count' => 20,
807
-        'is_widget' => 1,
808
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
809
-    );
810
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
811
-
812
-    $params = shortcode_atts($defaults, $atts);
813
-
814
-    /**
815
-     * Begin validating parameters
816
-     */
798
+	ob_start();
799
+	$defaults = array(
800
+		'post_number' => 5,
801
+		'relate_to' => 'category',
802
+		'layout' => 'gridview_onehalf',
803
+		'add_location_filter' => 0,
804
+		'listing_width' => '',
805
+		'list_sort' => 'latest',
806
+		'character_count' => 20,
807
+		'is_widget' => 1,
808
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
809
+	);
810
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
811
+
812
+	$params = shortcode_atts($defaults, $atts);
813
+
814
+	/**
815
+	 * Begin validating parameters
816
+	 */
817 817
 
818
-    // Validate that post_number is a number and is 1 or higher
819
-    $params['post_number'] = absint($params['post_number']);
820
-    if (0 === $params['post_number']) {
821
-        $params['post_number'] = 1;
822
-    }
818
+	// Validate that post_number is a number and is 1 or higher
819
+	$params['post_number'] = absint($params['post_number']);
820
+	if (0 === $params['post_number']) {
821
+		$params['post_number'] = 1;
822
+	}
823 823
 
824
-    // Validate relate_to - only category or tags
825
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
826
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
827
-        $params['relate_to'] = 'category';
828
-    }
824
+	// Validate relate_to - only category or tags
825
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
826
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
827
+		$params['relate_to'] = 'category';
828
+	}
829 829
 
830
-    // Validate layout selection
831
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
830
+	// Validate layout selection
831
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
832 832
 
833
-    // Validate sorting option
834
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
833
+	// Validate sorting option
834
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
835 835
 
836
-    // Validate add_location_filter
837
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
836
+	// Validate add_location_filter
837
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
838 838
 
839
-    // Validate listing_width
840
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
839
+	// Validate listing_width
840
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
841 841
 
842
-    // Validate character_count
843
-    $params['character_count'] = absint($params['character_count']);
844
-    if (20 > $params['character_count']) {
845
-        $params['character_count'] = 20;
846
-    }
842
+	// Validate character_count
843
+	$params['character_count'] = absint($params['character_count']);
844
+	if (20 > $params['character_count']) {
845
+		$params['character_count'] = 20;
846
+	}
847 847
 
848
-    if ($related_display = geodir_related_posts_display($params)) {
849
-        echo $related_display;
850
-    }
851
-    $output = ob_get_contents();
848
+	if ($related_display = geodir_related_posts_display($params)) {
849
+		echo $related_display;
850
+	}
851
+	$output = ob_get_contents();
852 852
 
853
-    ob_end_clean();
853
+	ob_end_clean();
854 854
 
855
-    return $output;
855
+	return $output;
856 856
 }
857 857
 
858 858
 /**
@@ -876,13 +876,13 @@  discard block
 block discarded – undo
876 876
  * @return string Advanced search widget HTML.
877 877
  */
878 878
 function geodir_sc_advanced_search($atts) {
879
-    $defaults = array(
879
+	$defaults = array(
880 880
 		'title' => '',
881 881
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
882
-        'after_widget' => '</section>',
883
-        'before_title' => '<h3 class="widget-title">',
884
-        'after_title' => '</h3>',
885
-        'show_adv_search' => 'default',
882
+		'after_widget' => '</section>',
883
+		'before_title' => '<h3 class="widget-title">',
884
+		'after_title' => '</h3>',
885
+		'show_adv_search' => 'default',
886 886
 		'post_type' => ''
887 887
 	);
888 888
 	
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 	the_widget('geodir_advance_search_widget', $params, $params );
907 907
 	
908 908
 	$output = ob_get_contents();
909
-    ob_end_clean();
909
+	ob_end_clean();
910 910
 
911
-    return $output;
911
+	return $output;
912 912
 }
913 913
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
914 914
 
@@ -954,48 +954,48 @@  discard block
 block discarded – undo
954 954
 		'add_location_filter' => '1',
955 955
 		'tab_layout' => 'bestof-tabs-on-top',
956 956
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
957
-        'after_widget' => '</section>',
958
-        'before_title' => '<h3 class="widget-title">',
959
-        'after_title' => '</h3>',
957
+		'after_widget' => '</section>',
958
+		'before_title' => '<h3 class="widget-title">',
959
+		'after_title' => '</h3>',
960 960
 	);
961 961
 	$params = shortcode_atts($defaults, $atts);
962 962
 
963
-    /**
964
-     * Validate our incoming params
965
-     */
963
+	/**
964
+	 * Validate our incoming params
965
+	 */
966 966
 
967
-    // Validate the selected post type, default to gd_place on fail
968
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
-        $params['post_type'] = 'gd_place';
970
-    }
967
+	// Validate the selected post type, default to gd_place on fail
968
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
+		$params['post_type'] = 'gd_place';
970
+	}
971 971
 	
972 972
 	// Post limit needs to be a positive integer
973
-    $params['post_limit'] = absint($params['post_limit']);
974
-    if (0 == $params['post_limit']) {
975
-        $params['post_limit'] = 5;
976
-    }
973
+	$params['post_limit'] = absint($params['post_limit']);
974
+	if (0 == $params['post_limit']) {
975
+		$params['post_limit'] = 5;
976
+	}
977 977
 	
978 978
 	// Category limit needs to be a positive integer
979
-    $params['categ_limit'] = absint($params['categ_limit']);
980
-    if (0 == $params['categ_limit']) {
981
-        $params['categ_limit'] = 3;
982
-    }
979
+	$params['categ_limit'] = absint($params['categ_limit']);
980
+	if (0 == $params['categ_limit']) {
981
+		$params['categ_limit'] = 3;
982
+	}
983 983
 	
984 984
 	// Tab layout validation
985
-    $params['tab_layout'] = $params['tab_layout'];
986
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
-        $params['tab_layout'] = 'bestof-tabs-on-top';
988
-    }
985
+	$params['tab_layout'] = $params['tab_layout'];
986
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
+		$params['tab_layout'] = 'bestof-tabs-on-top';
988
+	}
989 989
 	
990 990
 	// Validate character_count
991
-    $params['character_count'] = $params['character_count'];
991
+	$params['character_count'] = $params['character_count'];
992 992
 
993 993
 	ob_start();
994 994
 	the_widget('geodir_bestof_widget', $params, $params);
995
-    $output = ob_get_contents();
996
-    ob_end_clean();
995
+	$output = ob_get_contents();
996
+	ob_end_clean();
997 997
 
998
-    return $output;
998
+	return $output;
999 999
 }
1000 1000
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1001 1001
 
@@ -1043,127 +1043,127 @@  discard block
 block discarded – undo
1043 1043
  * @return string HTML content to display geodirectory listings.
1044 1044
  */
1045 1045
 function geodir_sc_gd_listings($atts, $content = '') {
1046
-    global $post;
1047
-    $defaults = array(
1048
-        'title'                 => '',
1049
-        'post_type'             => 'gd_place',
1050
-        'category'              => 0,
1051
-        'list_sort'             => 'latest',
1052
-        'event_type'            => '',
1053
-        'post_number'           => 10,
1054
-        'post_author'           => '',
1055
-        'layout'                => 'gridview_onehalf',
1056
-        'listing_width'         => '',
1057
-        'character_count'       => 20,
1058
-        'add_location_filter'   => 1,
1059
-        'show_featured_only'    => '',
1060
-        'show_special_only'     => '',
1061
-        'with_pics_only'        => '',
1062
-        'with_videos_only'      => '',
1063
-        'with_pagination'       => '1',
1064
-        'top_pagination'        => '0',
1065
-        'bottom_pagination'     => '1',
1066
-        'without_no_results'    => 0,
1067
-        'tags'                  => ''
1068
-    );
1069
-    $params = shortcode_atts($defaults, $atts);
1070
-
1071
-    $params['title']        = wp_strip_all_tags($params['title']);
1072
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1073
-
1074
-    // Validate the selected category/ies - Grab the current list based on post_type
1075
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1076
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1077
-
1078
-    // Make sure we have an array
1079
-    if (!(is_array($params['category']))) {
1080
-        $params['category'] = explode(',', $params['category']);
1081
-    }
1082
-
1083
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1084
-    // Otherwise it becomes empty and later on that will mean "All"
1085
-    $params['category']     = array_intersect($params['category'], $categories);
1086
-
1087
-    // Post_number needs to be a positive integer
1088
-    $params['post_number']  = absint($params['post_number']);
1089
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1046
+	global $post;
1047
+	$defaults = array(
1048
+		'title'                 => '',
1049
+		'post_type'             => 'gd_place',
1050
+		'category'              => 0,
1051
+		'list_sort'             => 'latest',
1052
+		'event_type'            => '',
1053
+		'post_number'           => 10,
1054
+		'post_author'           => '',
1055
+		'layout'                => 'gridview_onehalf',
1056
+		'listing_width'         => '',
1057
+		'character_count'       => 20,
1058
+		'add_location_filter'   => 1,
1059
+		'show_featured_only'    => '',
1060
+		'show_special_only'     => '',
1061
+		'with_pics_only'        => '',
1062
+		'with_videos_only'      => '',
1063
+		'with_pagination'       => '1',
1064
+		'top_pagination'        => '0',
1065
+		'bottom_pagination'     => '1',
1066
+		'without_no_results'    => 0,
1067
+		'tags'                  => ''
1068
+	);
1069
+	$params = shortcode_atts($defaults, $atts);
1070
+
1071
+	$params['title']        = wp_strip_all_tags($params['title']);
1072
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1073
+
1074
+	// Validate the selected category/ies - Grab the current list based on post_type
1075
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1076
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1077
+
1078
+	// Make sure we have an array
1079
+	if (!(is_array($params['category']))) {
1080
+		$params['category'] = explode(',', $params['category']);
1081
+	}
1082
+
1083
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1084
+	// Otherwise it becomes empty and later on that will mean "All"
1085
+	$params['category']     = array_intersect($params['category'], $categories);
1086
+
1087
+	// Post_number needs to be a positive integer
1088
+	$params['post_number']  = absint($params['post_number']);
1089
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1090 1090
     
1091
-    // Post_number needs to be a positive integer
1092
-    if (!empty($atts['post_author'])) {
1093
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1094
-            $params['post_author'] = $post->post_author;
1095
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1096
-            $params['post_author'] = absint($atts['post_author']);
1097
-        } else {
1098
-            unset($params['post_author']);
1099
-        }
1100
-    } else {
1101
-        unset($params['post_author']);
1102
-    }
1103
-
1104
-    // Validate character_count
1105
-    //todo: is this necessary?
1106
-    $params['character_count']  = $params['character_count'];
1107
-
1108
-    // Validate our layout choice
1109
-    // Outside of the norm, I added some more simple terms to match the existing
1110
-    // So now I just run the switch to set it properly.
1111
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1112
-
1113
-    // Validate our sorting choice
1114
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1115
-
1116
-    // Validate Listing width, used in the template widget-listing-listview.php
1117
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1118
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1119
-
1120
-    // Validate the checkboxes used on the widget
1121
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1122
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1123
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1124
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1125
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1126
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1127
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1128
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1129
-
1130
-    // Clean tags
1131
-    if (!empty($params['tags'])) {
1132
-        if (!is_array($params['tags'])) {
1133
-            $comma = _x(',', 'tag delimiter');
1134
-            if ( ',' !== $comma ) {
1135
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1136
-            }
1137
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1138
-            $params['tags'] = array_map('trim', $params['tags']);
1139
-        }
1140
-    } else {
1141
-        $params['tags'] = array();
1142
-    }
1143
-
1144
-    /**
1145
-     * End of validation
1146
-     */
1147
-    if (isset($atts['geodir_ajax'])) {
1148
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1149
-        unset($atts['geodir_ajax']);
1150
-    }
1151
-    if (isset($atts['pageno'])) {
1152
-        $params['pageno'] = $atts['pageno'];
1153
-        unset($atts['pageno']);
1154
-    }
1155
-
1156
-    if ( !empty($atts['shortcode_content']) ) {
1157
-        $content = $atts['shortcode_content'];
1158
-    }
1159
-    $params['shortcode_content'] = trim($content);
1160
-    $atts['shortcode_content'] = trim($content);
1091
+	// Post_number needs to be a positive integer
1092
+	if (!empty($atts['post_author'])) {
1093
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1094
+			$params['post_author'] = $post->post_author;
1095
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1096
+			$params['post_author'] = absint($atts['post_author']);
1097
+		} else {
1098
+			unset($params['post_author']);
1099
+		}
1100
+	} else {
1101
+		unset($params['post_author']);
1102
+	}
1103
+
1104
+	// Validate character_count
1105
+	//todo: is this necessary?
1106
+	$params['character_count']  = $params['character_count'];
1107
+
1108
+	// Validate our layout choice
1109
+	// Outside of the norm, I added some more simple terms to match the existing
1110
+	// So now I just run the switch to set it properly.
1111
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1112
+
1113
+	// Validate our sorting choice
1114
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1115
+
1116
+	// Validate Listing width, used in the template widget-listing-listview.php
1117
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1118
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1119
+
1120
+	// Validate the checkboxes used on the widget
1121
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1122
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1123
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1124
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1125
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1126
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1127
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1128
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1129
+
1130
+	// Clean tags
1131
+	if (!empty($params['tags'])) {
1132
+		if (!is_array($params['tags'])) {
1133
+			$comma = _x(',', 'tag delimiter');
1134
+			if ( ',' !== $comma ) {
1135
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1136
+			}
1137
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1138
+			$params['tags'] = array_map('trim', $params['tags']);
1139
+		}
1140
+	} else {
1141
+		$params['tags'] = array();
1142
+	}
1143
+
1144
+	/**
1145
+	 * End of validation
1146
+	 */
1147
+	if (isset($atts['geodir_ajax'])) {
1148
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1149
+		unset($atts['geodir_ajax']);
1150
+	}
1151
+	if (isset($atts['pageno'])) {
1152
+		$params['pageno'] = $atts['pageno'];
1153
+		unset($atts['pageno']);
1154
+	}
1155
+
1156
+	if ( !empty($atts['shortcode_content']) ) {
1157
+		$content = $atts['shortcode_content'];
1158
+	}
1159
+	$params['shortcode_content'] = trim($content);
1160
+	$atts['shortcode_content'] = trim($content);
1161 1161
     
1162
-    $params['shortcode_atts']       = $atts;
1162
+	$params['shortcode_atts']       = $atts;
1163 1163
 
1164
-    $output = geodir_sc_gd_listings_output($params);
1164
+	$output = geodir_sc_gd_listings_output($params);
1165 1165
 
1166
-    return $output;
1166
+	return $output;
1167 1167
 }
1168 1168
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1169 1169
 
@@ -1203,56 +1203,56 @@  discard block
 block discarded – undo
1203 1203
  * @return string HTML content to display CPT categories.
1204 1204
  */
1205 1205
 function geodir_sc_cpt_categories_widget($atts, $content = '') {
1206
-    $defaults = array(
1207
-        'title' => '',
1208
-        'post_type' => '', // NULL for all
1209
-        'hide_empty' => '',
1210
-        'show_count' => '',
1211
-        'hide_icon' => '',
1212
-        'cpt_left' => '',
1213
-        'sort_by' => 'count',
1214
-        'max_count' => 'all',
1215
-        'max_level' => '1',
1216
-        'no_cpt_filter' => '',
1217
-        'no_cat_filter' => '',
1218
-        'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1219
-        'after_widget' => '</section>',
1220
-        'before_title' => '<h3 class="widget-title">',
1221
-        'after_title' => '</h3>',
1222
-    );
1223
-    $params = shortcode_atts($defaults, $atts);
1224
-
1225
-    /**
1226
-     * Validate our incoming params
1227
-     */
1228
-    // Make sure we have an array
1229
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1230
-     
1231
-    // Validate the checkboxes used on the widget
1232
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1233
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1234
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1235
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1206
+	$defaults = array(
1207
+		'title' => '',
1208
+		'post_type' => '', // NULL for all
1209
+		'hide_empty' => '',
1210
+		'show_count' => '',
1211
+		'hide_icon' => '',
1212
+		'cpt_left' => '',
1213
+		'sort_by' => 'count',
1214
+		'max_count' => 'all',
1215
+		'max_level' => '1',
1216
+		'no_cpt_filter' => '',
1217
+		'no_cat_filter' => '',
1218
+		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1219
+		'after_widget' => '</section>',
1220
+		'before_title' => '<h3 class="widget-title">',
1221
+		'after_title' => '</h3>',
1222
+	);
1223
+	$params = shortcode_atts($defaults, $atts);
1236 1224
 
1237
-    if ($params['max_count'] != 'all') {
1238
-        $params['max_count'] = absint($params['max_count']);
1239
-    }
1225
+	/**
1226
+	 * Validate our incoming params
1227
+	 */
1228
+	// Make sure we have an array
1229
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1230
+     
1231
+	// Validate the checkboxes used on the widget
1232
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1233
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1234
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1235
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1236
+
1237
+	if ($params['max_count'] != 'all') {
1238
+		$params['max_count'] = absint($params['max_count']);
1239
+	}
1240 1240
 
1241
-    if ($params['max_level'] != 'all') {
1242
-        $params['max_level'] = absint($params['max_level']);
1243
-    }
1241
+	if ($params['max_level'] != 'all') {
1242
+		$params['max_level'] = absint($params['max_level']);
1243
+	}
1244 1244
 
1245
-    $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1246
-    $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1245
+	$params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1246
+	$params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1247 1247
 
1248
-    $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1248
+	$params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1249 1249
 
1250
-    ob_start();
1251
-    the_widget('geodir_cpt_categories_widget', $params, $params);
1252
-    $output = ob_get_contents();
1253
-    ob_end_clean();
1250
+	ob_start();
1251
+	the_widget('geodir_cpt_categories_widget', $params, $params);
1252
+	$output = ob_get_contents();
1253
+	ob_end_clean();
1254 1254
 
1255
-    return $output;
1255
+	return $output;
1256 1256
 }
1257 1257
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1258 1258
 
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
  * @return string HTML code.
1268 1268
  */
1269 1269
 function geodir_sc_responsive_videos($atts, $content) {
1270
-    return '<div class="geodir-video-wrapper">'.$content.'</div>';
1270
+	return '<div class="geodir-video-wrapper">'.$content.'</div>';
1271 1271
 }
1272 1272
 add_shortcode('gd_video', 'geodir_sc_responsive_videos');
1273 1273
 ?>
1274 1274
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-templates/listing-detail.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 // We are submitting iframes etc so we turn this off to allow them to show on preview.
13 13
 if(geodir_is_page('preview')){
14
-    header("X-XSS-Protection: 0");
14
+	header("X-XSS-Protection: 0");
15 15
 }
16 16
 
17 17
 
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 
39 39
 ###### SIDEBAR ON LEFT ######
40 40
 if (get_option('geodir_detail_sidebar_left_section')) {
41
-    /**
42
-     * Adds the details page sidebar to the details template page.
43
-     *
44
-     * @since 1.1.0
45
-     */
46
-    do_action('geodir_detail_sidebar');
41
+	/**
42
+	 * Adds the details page sidebar to the details template page.
43
+	 *
44
+	 * @since 1.1.0
45
+	 */
46
+	do_action('geodir_detail_sidebar');
47 47
 }
48 48
 
49 49
 ###### MAIN CONTENT WRAPPERS OPEN ######
@@ -72,29 +72,29 @@  discard block
 block discarded – undo
72 72
 // this call the main page content
73 73
 global $preview;
74 74
 if (have_posts() && !$preview) {
75
-    the_post();
76
-    global $post, $post_images;
77
-    /**
78
-     * Calls the details page main content on the details template page.
79
-     *
80
-     * @since 1.1.0
81
-     * @param object $post The current post object.
82
-     */
83
-    do_action('geodir_details_main_content', $post);
75
+	the_post();
76
+	global $post, $post_images;
77
+	/**
78
+	 * Calls the details page main content on the details template page.
79
+	 *
80
+	 * @since 1.1.0
81
+	 * @param object $post The current post object.
82
+	 */
83
+	do_action('geodir_details_main_content', $post);
84 84
 } elseif ($preview) {
85
-    /**
86
-     * Called on the details page if the page is being previewed.
87
-     *
88
-     * This sets the value of `$post` to the preview values before the main content is called.
89
-     *
90
-     * @since 1.1.0
91
-     */
92
-    do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
93
-    if (defined( 'GD_TESTING_MODE' )) {
94
-        global $post;
95
-    }
96
-    /** This action is documented in geodirectory-templates/listing-detail.php */
97
-    do_action('geodir_details_main_content', $post);
85
+	/**
86
+	 * Called on the details page if the page is being previewed.
87
+	 *
88
+	 * This sets the value of `$post` to the preview values before the main content is called.
89
+	 *
90
+	 * @since 1.1.0
91
+	 */
92
+	do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
93
+	if (defined( 'GD_TESTING_MODE' )) {
94
+		global $post;
95
+	}
96
+	/** This action is documented in geodirectory-templates/listing-detail.php */
97
+	do_action('geodir_details_main_content', $post);
98 98
 }
99 99
 
100 100
 /** This action is documented in geodirectory-templates/geodir-home.php */
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 
119 119
 ###### SIDEBAR ON RIGHT ######
120 120
 if (!get_option('geodir_detail_sidebar_left_section')) {
121
-    /** This action is documented in geodirectory-templates/listing-detail.php */
122
-    do_action('geodir_detail_sidebar');
121
+	/** This action is documented in geodirectory-templates/listing-detail.php */
122
+	do_action('geodir_detail_sidebar');
123 123
 }
124 124
 
125 125
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // We are submitting iframes etc so we turn this off to allow them to show on preview.
13
-if(geodir_is_page('preview')){
13
+if (geodir_is_page('preview')) {
14 14
     header("X-XSS-Protection: 0");
15 15
 }
16 16
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
  * @param string $itemtype The itemtype value of the HTML element.
64 64
  * @see 'geodir_article_close'
65 65
  */
66
-do_action('geodir_article_open', 'details-page', 'post-' . get_the_ID(), get_post_class(), '');
66
+do_action('geodir_article_open', 'details-page', 'post-'.get_the_ID(), get_post_class(), '');
67 67
 
68 68
 ###### MAIN CONTENT ######
69 69
 /** This action is documented in geodirectory-templates/geodir-home.php */
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @since 1.1.0
91 91
      */
92 92
     do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
93
-    if (defined( 'GD_TESTING_MODE' )) {
93
+    if (defined('GD_TESTING_MODE')) {
94 94
         global $post;
95 95
     }
96 96
     /** This action is documented in geodirectory-templates/listing-detail.php */
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
  * @global string $table_prefix  WordPress Database Table prefix.
2302 2302
  *
2303 2303
  * @param array $query_args      The query array.
2304
- * @param  int|bool $count_only  If true returns listings count only, otherwise returns array
2304
+ * @param  boolean $count_only  If true returns listings count only, otherwise returns array
2305 2305
  *
2306 2306
  * @return mixed Result object.
2307 2307
  */
@@ -3958,7 +3958,7 @@  discard block
 block discarded – undo
3958 3958
  * @since   1.0.0
3959 3959
  * @since   1.6.1 Fixed add listing page load time.
3960 3960
  * @package GeoDirectory
3961
- * @return bool
3961
+ * @return null|boolean
3962 3962
  */
3963 3963
 function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3964 3964
 	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			break;
302 302
 		case 'preview':
303 303
 			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
304
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
304
+				 && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
305 305
 			) {
306 306
 				return true;
307 307
 			}
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
 
506 506
 //check if homepage
507 507
 		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
508
-		     && ! isset( $wp->query_vars['page_id'] )
509
-		     && ! isset( $wp->query_vars['pagename'] )
510
-		     && is_page_geodir_home()
508
+			 && ! isset( $wp->query_vars['page_id'] )
509
+			 && ! isset( $wp->query_vars['pagename'] )
510
+			 && is_page_geodir_home()
511 511
 		) {
512 512
 			$wp->query_vars['gd_is_geodir_page'] = true;
513 513
 		}
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
693 693
 		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
694 694
 		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
695
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
695
+						  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
+						  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
697 697
 		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
698 698
 		$distance       = $earthMeanRadius * $c;
699 699
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,8 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
 	if ( is_ssl() ) :
31 31
 		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
-	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
+	else {
33
+		:
34
+		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
35
+	}
34 36
 	endif;
35 37
 }
36 38
 
@@ -764,7 +766,7 @@  discard block
 block discarded – undo
764 766
 			$post_author = get_post_field( 'post_author', $post_id );
765 767
 			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
766 768
 				$toEmailName = __('Business Owner','geodirectory');
767
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
769
+			} elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
768 770
 				$toEmailName = __('Business Owner','geodirectory');
769 771
 			}
770 772
 
@@ -1569,12 +1571,14 @@  discard block
 block discarded – undo
1569 1571
 	 */
1570 1572
 	function geodir_allow_wpadmin() {
1571 1573
 		global $wpdb;
1572
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1574
+		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) {
1575
+			// checking action in request to allow ajax request go through
1573 1576
 		{
1574 1577
 			if ( current_user_can( 'administrator' ) ) {
1575 1578
 			} else {
1576 1579
 
1577
-				wp_redirect( home_url() );
1580
+				wp_redirect( home_url() );
1581
+		}
1578 1582
 				exit;
1579 1583
 			}
1580 1584
 
Please login to merge, or discard this patch.
Spacing   +1344 added lines, -1344 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function geodir_plugin_url() {
29 29
 
30
-	if ( is_ssl() ) :
31
-		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
30
+	if (is_ssl()) :
31
+		return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
32 32
 	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
33
+		return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
34 34
 	endif;
35 35
 }
36 36
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
46 46
  */
47 47
 function geodir_plugin_path() {
48
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
49
-		return dirname( dirname( __FILE__ ) );
48
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
49
+		return dirname(dirname(__FILE__));
50 50
 	} else {
51
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
51
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
52 52
 	}
53 53
 }
54 54
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  * @return bool true or false.
64 64
  * @todo    check if this is faster than normal WP check and remove if not.
65 65
  */
66
-function geodir_is_plugin_active( $plugin ) {
67
-	$active_plugins = get_option( 'active_plugins' );
68
-	foreach ( $active_plugins as $key => $active_plugin ) {
69
-		if ( strstr( $active_plugin, $plugin ) ) {
66
+function geodir_is_plugin_active($plugin) {
67
+	$active_plugins = get_option('active_plugins');
68
+	foreach ($active_plugins as $key => $active_plugin) {
69
+		if (strstr($active_plugin, $plugin)) {
70 70
 			return true;
71 71
 		}
72 72
 	}
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool|int|string the formatted date.
90 90
  */
91
-function geodir_get_formated_date( $date ) {
92
-	return mysql2date( get_option( 'date_format' ), $date );
91
+function geodir_get_formated_date($date) {
92
+	return mysql2date(get_option('date_format'), $date);
93 93
 }
94 94
 
95 95
 /**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return bool|int|string the formatted time.
107 107
  */
108
-function geodir_get_formated_time( $time ) {
109
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
108
+function geodir_get_formated_time($time) {
109
+	return mysql2date(get_option('time_format'), $time, $translate = true);
110 110
 }
111 111
 
112 112
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return string Formatted link.
126 126
  */
127
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
128
-	if ( $use_existing_arguments ) {
127
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
128
+	if ($use_existing_arguments) {
129 129
 		$params = $params + $_GET;
130 130
 	}
131
-	if ( ! $params ) {
131
+	if (!$params) {
132 132
 		return $url;
133 133
 	}
134 134
 	$link = $url;
135
-	if ( strpos( $link, '?' ) === false ) {
135
+	if (strpos($link, '?') === false) {
136 136
 		$link .= '?';
137 137
 	} //If there is no '?' add one at the end
138
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
138
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
139 139
 		$link .= '&amp;';
140 140
 	} //If there is no '&' at the END, add one.
141
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
141
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
142 142
 		$link .= '&';
143 143
 	} //If there is no '&' at the END, add one.
144 144
 
145 145
 	$params_arr = array();
146
-	foreach ( $params as $key => $value ) {
147
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
148
-			foreach ( $value as $val ) {
149
-				$params_arr[] = $key . '[]=' . urlencode( $val );
146
+	foreach ($params as $key => $value) {
147
+		if (gettype($value) == 'array') { //Handle array data properly
148
+			foreach ($value as $val) {
149
+				$params_arr[] = $key.'[]='.urlencode($val);
150 150
 			}
151 151
 		} else {
152
-			$params_arr[] = $key . '=' . urlencode( $value );
152
+			$params_arr[] = $key.'='.urlencode($value);
153 153
 		}
154 154
 	}
155
-	$link .= implode( '&', $params_arr );
155
+	$link .= implode('&', $params_arr);
156 156
 
157 157
 	return $link;
158 158
 }
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @return string Listing page url if valid. Otherwise home url will be returned.
171 171
  */
172
-function geodir_get_addlisting_link( $post_type = '' ) {
172
+function geodir_get_addlisting_link($post_type = '') {
173 173
 	global $wpdb;
174 174
 
175 175
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
176 176
 	$check_pkg = 1;
177
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
177
+	if (post_type_exists($post_type) && $check_pkg) {
178 178
 
179
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
179
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
180 180
 
181
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
181
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
182 182
 	} else {
183
-		return get_bloginfo( 'url' );
183
+		return get_bloginfo('url');
184 184
 	}
185 185
 }
186 186
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
209 209
 		// To build the entire URI we need to prepend the protocol, and the http host
210 210
 		// to the URI string.
211
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
211
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
212 212
 	} else {
213 213
 		/*
214 214
 		 * Since we do not have REQUEST_URI to work with, we will assume we are
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		 *
218 218
 		 * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
219 219
 		 */
220
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
220
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
221 221
 		
222 222
 		// If the query string exists append it to the URI string
223 223
 		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
224
-			$pageURL .= '?' . $_SERVER['QUERY_STRING'];
224
+			$pageURL .= '?'.$_SERVER['QUERY_STRING'];
225 225
 		}
226 226
 	}
227 227
 	
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param string $pageURL The URL of the current page.
234 234
 	 */
235
-	return apply_filters( 'geodir_curPageURL', $pageURL );
235
+	return apply_filters('geodir_curPageURL', $pageURL);
236 236
 }
237 237
 
238 238
 /**
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return string Cleaned variable.
249 249
  */
250
-function geodir_clean( $string ) {
250
+function geodir_clean($string) {
251 251
 
252
-	$string = trim( strip_tags( stripslashes( $string ) ) );
253
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
254
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
255
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
252
+	$string = trim(strip_tags(stripslashes($string)));
253
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
254
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
255
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
256 256
 
257 257
 	return $string;
258 258
 }
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_get_weekday() {
268 268
 	return array(
269
-		__( 'Sunday', 'geodirectory' ),
270
-		__( 'Monday', 'geodirectory' ),
271
-		__( 'Tuesday', 'geodirectory' ),
272
-		__( 'Wednesday', 'geodirectory' ),
273
-		__( 'Thursday', 'geodirectory' ),
274
-		__( 'Friday', 'geodirectory' ),
275
-		__( 'Saturday', 'geodirectory' )
269
+		__('Sunday', 'geodirectory'),
270
+		__('Monday', 'geodirectory'),
271
+		__('Tuesday', 'geodirectory'),
272
+		__('Wednesday', 'geodirectory'),
273
+		__('Thursday', 'geodirectory'),
274
+		__('Friday', 'geodirectory'),
275
+		__('Saturday', 'geodirectory')
276 276
 	);
277 277
 }
278 278
 
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
  */
286 286
 function geodir_get_weeks() {
287 287
 	return array(
288
-		__( 'First', 'geodirectory' ),
289
-		__( 'Second', 'geodirectory' ),
290
-		__( 'Third', 'geodirectory' ),
291
-		__( 'Fourth', 'geodirectory' ),
292
-		__( 'Last', 'geodirectory' )
288
+		__('First', 'geodirectory'),
289
+		__('Second', 'geodirectory'),
290
+		__('Third', 'geodirectory'),
291
+		__('Fourth', 'geodirectory'),
292
+		__('Last', 'geodirectory')
293 293
 	);
294 294
 }
295 295
 
@@ -308,112 +308,112 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return bool If valid returns true. Otherwise false.
310 310
  */
311
-function geodir_is_page( $gdpage = '' ) {
311
+function geodir_is_page($gdpage = '') {
312 312
 
313 313
 	global $wp_query, $post, $wp;
314 314
 	//if(!is_admin()):
315 315
 
316
-	switch ( $gdpage ):
316
+	switch ($gdpage):
317 317
 		case 'add-listing':
318 318
 
319
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
319
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
320 320
 				return true;
321
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
321
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
322 322
 				return true;
323 323
 			}
324 324
 
325 325
 			break;
326 326
 		case 'preview':
327
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
328
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
327
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
328
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
329 329
 			) {
330 330
 				return true;
331 331
 			}
332 332
 			break;
333 333
 		case 'listing-success':
334
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
334
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
335 335
 				return true;
336 336
 			}
337 337
 			break;
338 338
 		case 'detail':
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 			break;
347 347
 		case 'pt':
348
-			$post_type = get_query_var( 'post_type' );
349
-			if ( is_array( $post_type ) ) {
350
-				$post_type = reset( $post_type );
348
+			$post_type = get_query_var('post_type');
349
+			if (is_array($post_type)) {
350
+				$post_type = reset($post_type);
351 351
 			}
352
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
352
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
353 353
 				return true;
354 354
 			}
355 355
 
356 356
 			break;
357 357
 		case 'listing':
358
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
358
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
359 359
 				global $current_term, $taxonomy, $term;
360 360
 
361 361
 				return true;
362 362
 			}
363
-			$post_type = get_query_var( 'post_type' );
364
-			if ( is_array( $post_type ) ) {
365
-				$post_type = reset( $post_type );
363
+			$post_type = get_query_var('post_type');
364
+			if (is_array($post_type)) {
365
+				$post_type = reset($post_type);
366 366
 			}
367
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
367
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
368 368
 				return true;
369 369
 			}
370 370
 
371 371
 			break;
372 372
 		case 'home':
373 373
 
374
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
374
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
375 375
 				return true;
376 376
 			}
377 377
 
378 378
 			break;
379 379
 		case 'location':
380
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
380
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
381 381
 				return true;
382 382
 			}
383 383
 			break;
384 384
 		case 'author':
385
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
385
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
386 386
 				return true;
387 387
 			}
388 388
 
389
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
390
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
389
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
390
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
391 391
 					return true;
392 392
 				}
393 393
 			}
394 394
 			break;
395 395
 		case 'search':
396
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
396
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
397 397
 				return true;
398 398
 			}
399 399
 			break;
400 400
 		case 'info':
401
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
401
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
402 402
 				return true;
403 403
 			}
404 404
 			break;
405 405
 		case 'login':
406
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
406
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
407 407
 				return true;
408 408
 			}
409 409
 			break;
410 410
 		case 'checkout':
411
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
411
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
412 412
 				return true;
413 413
 			}
414 414
 			break;
415 415
 		case 'invoices':
416
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
416
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
417 417
 				return true;
418 418
 			}
419 419
 			break;
@@ -438,25 +438,25 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @param object $wp WordPress object.
440 440
  */
441
-function geodir_set_is_geodir_page( $wp ) {
442
-	if ( ! is_admin() ) {
441
+function geodir_set_is_geodir_page($wp) {
442
+	if (!is_admin()) {
443 443
 		//$wp->query_vars['gd_is_geodir_page'] = false;
444 444
 		//print_r()
445
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
445
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
446 446
 				'preview',
447 447
 				'page',
448 448
 				'paged',
449 449
 				'cpage'
450
-			) )
450
+			))
451 451
 		) {
452
-			if ( geodir_is_page( 'home' ) ) {
452
+			if (geodir_is_page('home')) {
453 453
 				$wp->query_vars['gd_is_geodir_page'] = true;
454 454
 			}
455 455
 
456 456
 
457 457
 		}
458 458
 
459
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
459
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
460 460
 			if (
461 461
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
462 462
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
466 466
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
467 467
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
468
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
469
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
468
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
469
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
470 470
 			) {
471 471
 				$wp->query_vars['gd_is_geodir_page'] = true;
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
476
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
475
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
476
+			$page = get_page_by_path($wp->query_vars['pagename']);
477 477
 
478
-			if ( ! empty( $page ) && (
478
+			if (!empty($page) && (
479 479
 					$page->ID == geodir_add_listing_page_id()
480 480
 					|| $page->ID == geodir_preview_page_id()
481 481
 					|| $page->ID == geodir_success_page_id()
482 482
 					|| $page->ID == geodir_location_page_id()
483
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
484
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
485
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
486
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
483
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
484
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
485
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
486
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
488 488
 				)
489 489
 			) {
490 490
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 
495
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
495
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
496 496
 			$requested_post_type = $wp->query_vars['post_type'];
497 497
 			// check if this post type is geodirectory post types
498 498
 			$post_type_array = geodir_get_posttypes();
499
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
499
+			if (in_array($requested_post_type, $post_type_array)) {
500 500
 				$wp->query_vars['gd_is_geodir_page'] = true;
501 501
 			}
502 502
 		}
503 503
 
504
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
505
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
506
-			if ( ! empty( $geodir_taxonomis ) ) {
507
-				foreach ( $geodir_taxonomis as $taxonomy ) {
508
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
504
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
505
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
506
+			if (!empty($geodir_taxonomis)) {
507
+				foreach ($geodir_taxonomis as $taxonomy) {
508
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
509 509
 						$wp->query_vars['gd_is_geodir_page'] = true;
510 510
 						break;
511 511
 					}
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 
515 515
 		}
516 516
 
517
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
517
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
518 518
 			$wp->query_vars['gd_is_geodir_page'] = true;
519 519
 		}
520 520
 
521 521
 
522
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
522
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
523 523
 			$wp->query_vars['gd_is_geodir_page'] = true;
524 524
 		}
525 525
 
526 526
 
527 527
 //check if homepage
528
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
529
-		     && ! isset( $wp->query_vars['page_id'] )
530
-		     && ! isset( $wp->query_vars['pagename'] )
528
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
529
+		     && !isset($wp->query_vars['page_id'])
530
+		     && !isset($wp->query_vars['pagename'])
531 531
 		     && is_page_geodir_home()
532 532
 		) {
533 533
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function geodir_is_geodir_page() {
553 553
 	global $wp;
554
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
554
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
555 555
 		return true;
556 556
 	} else {
557 557
 		return false;
558 558
 	}
559 559
 }
560 560
 
561
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
561
+if (!function_exists('geodir_get_imagesize')) {
562 562
 	/**
563 563
 	 * Get image size using the size key .
564 564
 	 *
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
571 571
 	 */
572
-	function geodir_get_imagesize( $size = '' ) {
572
+	function geodir_get_imagesize($size = '') {
573 573
 
574 574
 		$imagesizes = array(
575
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
576
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
577
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
578
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
575
+			'list-thumb'   => array('w' => 283, 'h' => 188),
576
+			'thumbnail'    => array('w' => 125, 'h' => 125),
577
+			'widget-thumb' => array('w' => 50, 'h' => 50),
578
+			'slider-thumb' => array('w' => 100, 'h' => 100)
579 579
 		);
580 580
 
581 581
 		/**
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 		 *
586 586
 		 * @param array $imagesizes Image size array.
587 587
 		 */
588
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
588
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
589 589
 
590
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
590
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
591 591
 			/**
592 592
 			 * Filters image size of the passed key.
593 593
 			 *
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 			 *
596 596
 			 * @param array $imagesizes [$size] Image size array of the passed key.
597 597
 			 */
598
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
598
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
599 599
 
600
-		} elseif ( ! empty( $size ) ) {
600
+		} elseif (!empty($size)) {
601 601
 
602
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
602
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
603 603
 
604 604
 		}
605 605
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 */
624 624
 
625 625
 
626
-if ( ! function_exists( 'createRandomString' ) ) {
626
+if (!function_exists('createRandomString')) {
627 627
 	/**
628 628
 	 * Creates random string.
629 629
 	 *
@@ -633,21 +633,21 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	function createRandomString() {
635 635
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
636
-		srand( (double) microtime() * 1000000 );
636
+		srand((double) microtime() * 1000000);
637 637
 		$i       = 0;
638 638
 		$rstring = '';
639
-		while ( $i <= 25 ) {
639
+		while ($i <= 25) {
640 640
 			$num     = rand() % 33;
641
-			$tmp     = substr( $chars, $num, 1 );
642
-			$rstring = $rstring . $tmp;
643
-			$i ++;
641
+			$tmp     = substr($chars, $num, 1);
642
+			$rstring = $rstring.$tmp;
643
+			$i++;
644 644
 		}
645 645
 
646 646
 		return $rstring;
647 647
 	}
648 648
 }
649 649
 
650
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
650
+if (!function_exists('geodir_getDistanceRadius')) {
651 651
 	/**
652 652
 	 * Calculates the distance radius.
653 653
 	 *
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @return float The mean radius.
660 660
 	 */
661
-	function geodir_getDistanceRadius( $uom = 'km' ) {
661
+	function geodir_getDistanceRadius($uom = 'km') {
662 662
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
663
-		switch ( geodir_strtolower( $uom ) ):
663
+		switch (geodir_strtolower($uom)):
664 664
 			case 'km'    :
665 665
 				$earthMeanRadius = 6371.009; // km
666 666
 				break;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 }
693 693
 
694 694
 
695
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
695
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
696 696
 	/**
697 697
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
698 698
 	 *
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 	 *
706 706
 	 * @return float The distance.
707 707
 	 */
708
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
708
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
709 709
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
710 710
 
711
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
711
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
712 712
 
713
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
714
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
715
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
716
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
717
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
718
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
713
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
714
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
715
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
716
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
717
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
718
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
719 719
 		$distance       = $earthMeanRadius * $c;
720 720
 
721 721
 		return $distance;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 }
725 725
 
726 726
 
727
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
727
+if (!function_exists('geodir_sendEmail')) {
728 728
 	/**
729 729
 	 * The main function that send transactional emails using the args provided.
730 730
 	 *
@@ -743,93 +743,93 @@  discard block
 block discarded – undo
743 743
 	 * @param string $post_id       The post ID.
744 744
 	 * @param string $user_id       The user ID.
745 745
 	 */
746
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
746
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
747 747
 		$login_details = '';
748 748
 
749 749
 		// strip slashes from subject & message text
750
-		$to_subject = stripslashes_deep( $to_subject );
751
-		$to_message = stripslashes_deep( $to_message );
750
+		$to_subject = stripslashes_deep($to_subject);
751
+		$to_message = stripslashes_deep($to_message);
752 752
 
753
-		if ( $message_type == 'send_friend' ) {
754
-			$subject = get_option( 'geodir_email_friend_subject' );
755
-			$message = get_option( 'geodir_email_friend_content' );
756
-		} elseif ( $message_type == 'send_enquiry' ) {
757
-			$subject = get_option( 'geodir_email_enquiry_subject' );
758
-			$message = get_option( 'geodir_email_enquiry_content' );
753
+		if ($message_type == 'send_friend') {
754
+			$subject = get_option('geodir_email_friend_subject');
755
+			$message = get_option('geodir_email_friend_content');
756
+		} elseif ($message_type == 'send_enquiry') {
757
+			$subject = get_option('geodir_email_enquiry_subject');
758
+			$message = get_option('geodir_email_enquiry_content');
759 759
 
760 760
 			// change to name in some cases
761
-			$post_author = get_post_field( 'post_author', $post_id );
762
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
763
-				$toEmailName = __('Business Owner','geodirectory');
764
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
765
-				$toEmailName = __('Business Owner','geodirectory');
761
+			$post_author = get_post_field('post_author', $post_id);
762
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
763
+				$toEmailName = __('Business Owner', 'geodirectory');
764
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
765
+				$toEmailName = __('Business Owner', 'geodirectory');
766 766
 			}
767 767
 
768 768
 
769
-		} elseif ( $message_type == 'forgot_password' ) {
770
-			$subject       = get_option( 'geodir_forgot_password_subject' );
771
-			$message       = get_option( 'geodir_forgot_password_content' );
769
+		} elseif ($message_type == 'forgot_password') {
770
+			$subject       = get_option('geodir_forgot_password_subject');
771
+			$message       = get_option('geodir_forgot_password_content');
772 772
 			$login_details = $to_message;
773
-		} elseif ( $message_type == 'registration' ) {
774
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
775
-			$message       = get_option( 'geodir_registration_success_email_content' );
773
+		} elseif ($message_type == 'registration') {
774
+			$subject       = get_option('geodir_registration_success_email_subject');
775
+			$message       = get_option('geodir_registration_success_email_content');
776 776
 			$login_details = $to_message;
777
-		} elseif ( $message_type == 'post_submit' ) {
778
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
779
-			$message = get_option( 'geodir_post_submited_success_email_content' );
780
-		} elseif ( $message_type == 'listing_published' ) {
781
-			$subject = get_option( 'geodir_post_published_email_subject' );
782
-			$message = get_option( 'geodir_post_published_email_content' );
783
-		} elseif ( $message_type == 'listing_edited' ) {
784
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
785
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
777
+		} elseif ($message_type == 'post_submit') {
778
+			$subject = get_option('geodir_post_submited_success_email_subject');
779
+			$message = get_option('geodir_post_submited_success_email_content');
780
+		} elseif ($message_type == 'listing_published') {
781
+			$subject = get_option('geodir_post_published_email_subject');
782
+			$message = get_option('geodir_post_published_email_content');
783
+		} elseif ($message_type == 'listing_edited') {
784
+			$subject = get_option('geodir_post_edited_email_subject_admin');
785
+			$message = get_option('geodir_post_edited_email_content_admin');
786 786
 		}
787 787
 
788
-		if ( ! empty( $subject ) ) {
789
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
788
+		if (!empty($subject)) {
789
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
790 790
 		}
791 791
 
792
-		if ( ! empty( $message ) ) {
793
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
792
+		if (!empty($message)) {
793
+			$message = __(stripslashes_deep($message), 'geodirectory');
794 794
 		}
795 795
 
796
-		$to_message        = nl2br( $to_message );
797
-		$sitefromEmail     = get_option( 'site_email' );
796
+		$to_message        = nl2br($to_message);
797
+		$sitefromEmail     = get_option('site_email');
798 798
 		$sitefromEmailName = get_site_emailName();
799
-		$productlink       = get_permalink( $post_id );
799
+		$productlink       = get_permalink($post_id);
800 800
 
801 801
 		$user_login = '';
802
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
802
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
803 803
 			$user_login = $user_info->user_login;
804 804
 		}
805 805
 
806 806
 		$posted_date = '';
807 807
 		$listingLink = '';
808 808
 
809
-		$post_info = get_post( $post_id );
809
+		$post_info = get_post($post_id);
810 810
 
811
-		if ( $post_info ) {
811
+		if ($post_info) {
812 812
 			$posted_date = $post_info->post_date;
813
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
813
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
814 814
 		}
815 815
 		$siteurl       = home_url();
816
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
816
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
817 817
 		$loginurl      = geodir_login_url();
818
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
818
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
819 819
 
820
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
821
-		$post_author_name = geodir_get_client_name( $post_author_id );
822
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
820
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
821
+		$post_author_name = geodir_get_client_name($post_author_id);
822
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
823 823
 
824
-		if ( $fromEmail == '' ) {
825
-			$fromEmail = get_option( 'site_email' );
824
+		if ($fromEmail == '') {
825
+			$fromEmail = get_option('site_email');
826 826
 		}
827 827
 
828
-		if ( $fromEmailName == '' ) {
829
-			$fromEmailName = get_option( 'site_email_name' );
828
+		if ($fromEmailName == '') {
829
+			$fromEmailName = get_option('site_email_name');
830 830
 		}
831 831
 
832
-		$search_array  = array(
832
+		$search_array = array(
833 833
 			'[#listing_link#]',
834 834
 			'[#site_name_url#]',
835 835
 			'[#post_id#]',
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 			$post_author_name,
870 870
 			$current_date
871 871
 		);
872
-		$message       = str_replace( $search_array, $replace_array, $message );
872
+		$message       = str_replace($search_array, $replace_array, $message);
873 873
 
874 874
 		$search_array  = array(
875 875
 			'[#listing_link#]',
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 			$post_author_name,
906 906
 			$current_date
907 907
 		);
908
-		$subject       = str_replace( $search_array, $replace_array, $subject );
908
+		$subject = str_replace($search_array, $replace_array, $subject);
909 909
 
910
-		$headers =  array();
910
+		$headers = array();
911 911
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
912
-		$headers[] = "Reply-To: " . $fromEmail;
913
-		$headers[] = 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>';
912
+		$headers[] = "Reply-To: ".$fromEmail;
913
+		$headers[] = 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>';
914 914
 
915 915
 		$to = $toEmail;
916 916
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		 * @param string $post_id       The post ID.
933 933
 		 * @param string $user_id       The user ID.
934 934
 		 */
935
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
935
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
936 936
 		/**
937 937
 		 * Filter the client email subject.
938 938
 		 *
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 		 * @param string $post_id       The post ID.
952 952
 		 * @param string $user_id       The user ID.
953 953
 		 */
954
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
954
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
955 955
 		/**
956 956
 		 * Filter the client email message.
957 957
 		 *
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 		 * @param string $post_id       The post ID.
971 971
 		 * @param string $user_id       The user ID.
972 972
 		 */
973
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
973
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
974 974
 		/**
975 975
 		 * Filter the client email headers.
976 976
 		 *
@@ -989,39 +989,39 @@  discard block
 block discarded – undo
989 989
 		 * @param string $post_id       The post ID.
990 990
 		 * @param string $user_id       The user ID.
991 991
 		 */
992
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
992
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
993 993
 
994
-		$sent = wp_mail( $to, $subject, $message, $headers );
994
+		$sent = wp_mail($to, $subject, $message, $headers);
995 995
 
996
-		if ( ! $sent ) {
997
-			if ( is_array( $to ) ) {
998
-				$to = implode( ',', $to );
996
+		if (!$sent) {
997
+			if (is_array($to)) {
998
+				$to = implode(',', $to);
999 999
 			}
1000 1000
 			$log_message = sprintf(
1001
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1001
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1002 1002
 				$message_type,
1003
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1003
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1004 1004
 				$to,
1005 1005
 				$subject
1006 1006
 			);
1007
-			geodir_error_log( $log_message );
1007
+			geodir_error_log($log_message);
1008 1008
 		}
1009 1009
 
1010 1010
 		///////// ADMIN BCC EMIALS
1011
-		$adminEmail = get_bloginfo( 'admin_email' );
1011
+		$adminEmail = get_bloginfo('admin_email');
1012 1012
 		$to         = $adminEmail;
1013 1013
 
1014 1014
 		$admin_bcc = false;
1015
-		if ( $message_type == 'registration' ) {
1016
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1017
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1018
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1015
+		if ($message_type == 'registration') {
1016
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1017
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1018
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1019 1019
 		}
1020
-		if ( $message_type == 'post_submit' ) {
1021
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1022
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1020
+		if ($message_type == 'post_submit') {
1021
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1022
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1023 1023
 
1024
-			$search_array  = array(
1024
+			$search_array = array(
1025 1025
 				'[#listing_link#]',
1026 1026
 				'[#site_name_url#]',
1027 1027
 				'[#post_id#]',
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 				$user_login,
1054 1054
 				$user_login
1055 1055
 			);
1056
-			$message       = str_replace( $search_array, $replace_array, $message );
1056
+			$message       = str_replace($search_array, $replace_array, $message);
1057 1057
 
1058 1058
 			$search_array  = array(
1059 1059
 				'[#listing_link#]',
@@ -1081,40 +1081,40 @@  discard block
 block discarded – undo
1081 1081
 				$user_login,
1082 1082
 				$user_login
1083 1083
 			);
1084
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1084
+			$subject = str_replace($search_array, $replace_array, $subject);
1085 1085
 
1086 1086
 			$subject .= ' - ADMIN BCC COPY';
1087 1087
 			$admin_bcc = true;
1088 1088
 
1089
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1089
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1090 1090
 			$subject .= ' - ADMIN BCC COPY';
1091 1091
 			$admin_bcc = true;
1092
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1092
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1093 1093
 			$subject .= ' - ADMIN BCC COPY';
1094 1094
 			$admin_bcc = true;
1095
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1095
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1096 1096
 			$subject .= ' - ADMIN BCC COPY';
1097 1097
 			$admin_bcc = true;
1098
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1098
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1099 1099
 			$subject .= ' - ADMIN BCC COPY';
1100 1100
 			$admin_bcc = true;
1101 1101
 		}
1102 1102
 
1103
-		if ( $admin_bcc === true ) {
1104
-			$sent = wp_mail( $to, $subject, $message, $headers );
1103
+		if ($admin_bcc === true) {
1104
+			$sent = wp_mail($to, $subject, $message, $headers);
1105 1105
 
1106
-			if ( ! $sent ) {
1107
-				if ( is_array( $to ) ) {
1108
-					$to = implode( ',', $to );
1106
+			if (!$sent) {
1107
+				if (is_array($to)) {
1108
+					$to = implode(',', $to);
1109 1109
 				}
1110 1110
 				$log_message = sprintf(
1111
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1111
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1112 1112
 					$message_type,
1113
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1113
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1114 1114
 					$to,
1115 1115
 					$subject
1116 1116
 				);
1117
-				geodir_error_log( $log_message );
1117
+				geodir_error_log($log_message);
1118 1118
 			}
1119 1119
 		}
1120 1120
 
@@ -1130,52 +1130,52 @@  discard block
 block discarded – undo
1130 1130
  */
1131 1131
 function geodir_taxonomy_breadcrumb() {
1132 1132
 
1133
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1133
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1134 1134
 	$parent = $term->parent;
1135 1135
 
1136
-	while ( $parent ):
1136
+	while ($parent):
1137 1137
 		$parents[]  = $parent;
1138
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1138
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1139 1139
 		$parent     = $new_parent->parent;
1140 1140
 	endwhile;
1141 1141
 
1142
-	if ( ! empty( $parents ) ):
1143
-		$parents = array_reverse( $parents );
1142
+	if (!empty($parents)):
1143
+		$parents = array_reverse($parents);
1144 1144
 
1145
-		foreach ( $parents as $parent ):
1146
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1147
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1148
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1145
+		foreach ($parents as $parent):
1146
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1147
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1148
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1149 1149
 		endforeach;
1150 1150
 
1151 1151
 	endif;
1152 1152
 
1153
-	echo '<li> > ' . $term->name . '</li>';
1153
+	echo '<li> > '.$term->name.'</li>';
1154 1154
 }
1155 1155
 
1156
-function geodir_wpml_post_type_archive_link($link, $post_type){
1156
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1157 1157
 
1158
-	if(function_exists('icl_object_id')) {
1159
-		$post_types   = get_option( 'geodir_post_types' );
1160
-		$slug         = $post_types[ $post_type ]['rewrite']['slug'];
1158
+	if (function_exists('icl_object_id')) {
1159
+		$post_types   = get_option('geodir_post_types');
1160
+		$slug         = $post_types[$post_type]['rewrite']['slug'];
1161 1161
 
1162 1162
 		//echo $link.'###'.gd_wpml_get_lang_from_url( $link) ;
1163 1163
 
1164 1164
 		// Alter the CPT slug if WPML is set to do so
1165
-		if ( function_exists( 'icl_object_id' ) ) {
1166
-			if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1165
+		if (function_exists('icl_object_id')) {
1166
+			if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1167 1167
 
1168 1168
 				$org_slug = $slug;
1169
-				$slug     = apply_filters( 'wpml_translate_single_string',
1169
+				$slug     = apply_filters('wpml_translate_single_string',
1170 1170
 					$slug,
1171 1171
 					'WordPress',
1172
-					'URL slug: ' . $slug,
1173
-					$language_code );
1172
+					'URL slug: '.$slug,
1173
+					$language_code);
1174 1174
 
1175
-				if ( ! $slug ) {
1175
+				if (!$slug) {
1176 1176
 					$slug = $org_slug;
1177 1177
 				} else {
1178
-					$link = str_replace( $org_slug, $slug, $link );
1178
+					$link = str_replace($org_slug, $slug, $link);
1179 1179
 				}
1180 1180
 
1181 1181
 			}
@@ -1206,9 +1206,9 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @since 1.0.0
1208 1208
 	 */
1209
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1209
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1210 1210
 
1211
-	if ( ! geodir_is_page( 'home' ) ) {
1211
+	if (!geodir_is_page('home')) {
1212 1212
 		$breadcrumb    = '';
1213 1213
 		$url_categoris = '';
1214 1214
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1217,162 +1217,162 @@  discard block
 block discarded – undo
1217 1217
 		 *
1218 1218
 		 * @since 1.0.0
1219 1219
 		 */
1220
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1220
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1221 1221
 
1222 1222
 		$gd_post_type   = geodir_get_current_posttype();
1223
-		$post_type_info = get_post_type_object( $gd_post_type );
1223
+		$post_type_info = get_post_type_object($gd_post_type);
1224 1224
 
1225
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1225
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1226 1226
 
1227
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1227
+		$listing_link = get_post_type_archive_link($gd_post_type);
1228 1228
 
1229
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1230
-		$listing_link = rtrim( $listing_link, '/' );
1229
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1230
+		$listing_link = rtrim($listing_link, '/');
1231 1231
 		$listing_link .= '/';
1232 1232
 
1233 1233
 		$post_type_for_location_link = $listing_link;
1234
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1234
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1235 1235
 
1236 1236
 		global $wp, $gd_session;
1237 1237
 		$location_link = $post_type_for_location_link;
1238 1238
 
1239
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1239
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1240 1240
 			global $post;
1241
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1242
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1241
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1242
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1243 1243
 
1244
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1244
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1245 1245
 				$location_terms = array(
1246 1246
 					'gd_country' => $post->country_slug,
1247 1247
 					'gd_region'  => $post->region_slug,
1248 1248
 					'gd_city'    => $post->city_slug
1249 1249
 				);
1250 1250
 
1251
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1251
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1252 1252
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1253 1253
 				}
1254 1254
 			}
1255 1255
 
1256
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1256
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1257 1257
 
1258 1258
 			$hide_url_part = array();
1259
-			if ( $location_manager ) {
1260
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1261
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1262
-
1263
-				if ( $hide_region_part && $hide_country_part ) {
1264
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1265
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1266
-					$hide_url_part = array( 'gd_region' );
1267
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1268
-					$hide_url_part = array( 'gd_country' );
1259
+			if ($location_manager) {
1260
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1261
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1262
+
1263
+				if ($hide_region_part && $hide_country_part) {
1264
+					$hide_url_part = array('gd_country', 'gd_region');
1265
+				} else if ($hide_region_part && !$hide_country_part) {
1266
+					$hide_url_part = array('gd_region');
1267
+				} else if (!$hide_region_part && $hide_country_part) {
1268
+					$hide_url_part = array('gd_country');
1269 1269
 				}
1270 1270
 			}
1271 1271
 
1272 1272
 			$hide_text_part = array();
1273
-			if ( $geodir_show_location_url == 'country_city' ) {
1274
-				$hide_text_part = array( 'gd_region' );
1273
+			if ($geodir_show_location_url == 'country_city') {
1274
+				$hide_text_part = array('gd_region');
1275 1275
 
1276
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1277
-					unset( $location_terms['gd_region'] );
1276
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1277
+					unset($location_terms['gd_region']);
1278 1278
 				}
1279
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1280
-				$hide_text_part = array( 'gd_country' );
1279
+			} else if ($geodir_show_location_url == 'region_city') {
1280
+				$hide_text_part = array('gd_country');
1281 1281
 
1282
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1283
-					unset( $location_terms['gd_country'] );
1282
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1283
+					unset($location_terms['gd_country']);
1284 1284
 				}
1285
-			} else if ( $geodir_show_location_url == 'city' ) {
1286
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1285
+			} else if ($geodir_show_location_url == 'city') {
1286
+				$hide_text_part = array('gd_country', 'gd_region');
1287 1287
 
1288
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1289
-					unset( $location_terms['gd_country'] );
1288
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1289
+					unset($location_terms['gd_country']);
1290 1290
 				}
1291
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1292
-					unset( $location_terms['gd_region'] );
1291
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1292
+					unset($location_terms['gd_region']);
1293 1293
 				}
1294 1294
 			}
1295 1295
 
1296 1296
 			$is_location_last = '';
1297 1297
 			$is_taxonomy_last = '';
1298 1298
 			$breadcrumb .= '<li>';
1299
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1300
-				$gd_taxonomy = $gd_post_type . 'category';
1301
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1302
-				$gd_taxonomy = $gd_post_type . '_tags';
1299
+			if (get_query_var($gd_post_type.'category')) {
1300
+				$gd_taxonomy = $gd_post_type.'category';
1301
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1302
+				$gd_taxonomy = $gd_post_type.'_tags';
1303 1303
 			}
1304 1304
 
1305
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1306
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1305
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1306
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1307 1307
 				$is_location_last = false;
1308 1308
 			} else {
1309 1309
 				$is_location_last = true;
1310 1310
 			}
1311 1311
 
1312
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1312
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1313 1313
 				$is_taxonomy_last = true;
1314 1314
 			} else {
1315 1315
 				$is_taxonomy_last = false;
1316 1316
 			}
1317 1317
 
1318
-			if ( ! empty( $location_terms ) ) {
1319
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1318
+			if (!empty($location_terms)) {
1319
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1320 1320
 
1321
-				foreach ( $location_terms as $key => $location_term ) {
1322
-					if ( $location_term != '' ) {
1323
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1321
+				foreach ($location_terms as $key => $location_term) {
1322
+					if ($location_term != '') {
1323
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1324 1324
 							continue;
1325 1325
 						}
1326 1326
 
1327
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1328
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1329
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1327
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1328
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1329
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1330 1330
 
1331 1331
 						$location_term_actual_country = '';
1332 1332
 						$location_term_actual_region  = '';
1333 1333
 						$location_term_actual_city    = '';
1334
-						if ( $geodir_get_locations ) {
1335
-							if ( $key == 'gd_country' ) {
1336
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1337
-							} else if ( $key == 'gd_region' ) {
1338
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1339
-							} else if ( $key == 'gd_city' ) {
1340
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1334
+						if ($geodir_get_locations) {
1335
+							if ($key == 'gd_country') {
1336
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1337
+							} else if ($key == 'gd_region') {
1338
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1339
+							} else if ($key == 'gd_city') {
1340
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1341 1341
 							}
1342 1342
 						} else {
1343 1343
 							$location_info = geodir_get_location();
1344 1344
 
1345
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1346
-								if ( $key == 'gd_country' ) {
1347
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1348
-								} else if ( $key == 'gd_region' ) {
1349
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1350
-								} else if ( $key == 'gd_city' ) {
1351
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1345
+							if (!empty($location_info) && isset($location_info->location_id)) {
1346
+								if ($key == 'gd_country') {
1347
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1348
+								} else if ($key == 'gd_region') {
1349
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1350
+								} else if ($key == 'gd_city') {
1351
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1352 1352
 								}
1353 1353
 							}
1354 1354
 						}
1355 1355
 
1356
-						if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1357
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1358
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1359
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1360
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1361
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1362
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1363
-							$breadcrumb .= $separator . $gd_location_link_text;
1356
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1357
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1358
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1359
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1360
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1361
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1362
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1363
+							$breadcrumb .= $separator.$gd_location_link_text;
1364 1364
 						} else {
1365
-							if ( get_option( 'permalink_structure' ) != '' ) {
1366
-								$location_link .= $location_term . '/';
1365
+							if (get_option('permalink_structure') != '') {
1366
+								$location_link .= $location_term.'/';
1367 1367
 							} else {
1368
-								$location_link .= "&$key=" . $location_term;
1368
+								$location_link .= "&$key=".$location_term;
1369 1369
 							}
1370 1370
 
1371
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1371
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1372 1372
 								$gd_location_link_text = $location_term_actual_country;
1373
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1373
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1374 1374
 								$gd_location_link_text = $location_term_actual_region;
1375
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1375
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1376 1376
 								$gd_location_link_text = $location_term_actual_city;
1377 1377
 							}
1378 1378
 
@@ -1382,76 +1382,76 @@  discard block
 block discarded – undo
1382 1382
                             }
1383 1383
                             */
1384 1384
 
1385
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1385
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1386 1386
 						}
1387 1387
 					}
1388 1388
 				}
1389 1389
 			}
1390 1390
 
1391
-			if ( ! empty( $gd_taxonomy ) ) {
1391
+			if (!empty($gd_taxonomy)) {
1392 1392
 				$term_index = 1;
1393 1393
 
1394 1394
 				//if(get_option('geodir_add_categories_url'))
1395 1395
 				{
1396
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1397
-						$cat_link = $listing_link . 'tags/';
1396
+					if (get_query_var($gd_post_type.'_tags')) {
1397
+						$cat_link = $listing_link.'tags/';
1398 1398
 					} else {
1399 1399
 						$cat_link = $listing_link;
1400 1400
 					}
1401 1401
 
1402
-					foreach ( $location_terms as $key => $location_term ) {
1403
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1402
+					foreach ($location_terms as $key => $location_term) {
1403
+						if ($location_manager && in_array($key, $hide_url_part)) {
1404 1404
 							continue;
1405 1405
 						}
1406 1406
 
1407
-						if ( $location_term != '' ) {
1408
-							if ( get_option( 'permalink_structure' ) != '' ) {
1409
-								$cat_link .= $location_term . '/';
1407
+						if ($location_term != '') {
1408
+							if (get_option('permalink_structure') != '') {
1409
+								$cat_link .= $location_term.'/';
1410 1410
 							}
1411 1411
 						}
1412 1412
 					}
1413 1413
 
1414
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1415
-					foreach ( $term_array as $term ) {
1416
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1417
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1414
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1415
+					foreach ($term_array as $term) {
1416
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1417
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1418 1418
 
1419 1419
 						// get term actual name
1420
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1421
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1422
-							$term_link_text = urldecode( $term_info['name'] );
1420
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1421
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1422
+							$term_link_text = urldecode($term_info['name']);
1423 1423
 						} else {
1424 1424
 							continue;
1425 1425
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1426 1426
 						}
1427 1427
 
1428
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1429
-							$breadcrumb .= $separator . $term_link_text;
1428
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1429
+							$breadcrumb .= $separator.$term_link_text;
1430 1430
 						} else {
1431
-							$cat_link .= $term . '/';
1432
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1431
+							$cat_link .= $term.'/';
1432
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1433 1433
 						}
1434
-						$term_index ++;
1434
+						$term_index++;
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438 1438
 
1439 1439
 			}
1440 1440
 
1441
-			if ( geodir_is_page( 'detail' ) ) {
1442
-				$breadcrumb .= $separator . get_the_title();
1441
+			if (geodir_is_page('detail')) {
1442
+				$breadcrumb .= $separator.get_the_title();
1443 1443
 			}
1444 1444
 
1445 1445
 			$breadcrumb .= '</li>';
1446 1446
 
1447 1447
 
1448
-		} elseif ( geodir_is_page( 'author' ) ) {
1448
+		} elseif (geodir_is_page('author')) {
1449 1449
 			$user_id             = get_current_user_id();
1450
-			$author_link         = get_author_posts_url( $user_id );
1451
-			$default_author_link = geodir_getlink( $author_link, array(
1450
+			$author_link         = get_author_posts_url($user_id);
1451
+			$default_author_link = geodir_getlink($author_link, array(
1452 1452
 				'geodir_dashbord' => 'true',
1453 1453
 				'stype'           => 'gd_place'
1454
-			), false );
1454
+			), false);
1455 1455
 
1456 1456
 			/**
1457 1457
 			 * Filter author page link.
@@ -1461,16 +1461,16 @@  discard block
 block discarded – undo
1461 1461
 			 * @param string $default_author_link Default author link.
1462 1462
 			 * @param int $user_id                Author ID.
1463 1463
 			 */
1464
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1464
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1465 1465
 
1466 1466
 			$breadcrumb .= '<li>';
1467
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1467
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1468 1468
 
1469
-			if ( isset( $_REQUEST['list'] ) ) {
1470
-				$author_link = geodir_getlink( $author_link, array(
1469
+			if (isset($_REQUEST['list'])) {
1470
+				$author_link = geodir_getlink($author_link, array(
1471 1471
 					'geodir_dashbord' => 'true',
1472 1472
 					'stype'           => $_REQUEST['stype']
1473
-				), false );
1473
+				), false);
1474 1474
 
1475 1475
 				/**
1476 1476
 				 * Filter author page link.
@@ -1481,61 +1481,61 @@  discard block
 block discarded – undo
1481 1481
 				 * @param int $user_id        Author ID.
1482 1482
 				 * @param string $_REQUEST    ['stype'] Post type.
1483 1483
 				 */
1484
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1484
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1485 1485
 
1486
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1487
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1486
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1487
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1488 1488
 			} else {
1489
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1489
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1490 1490
 			}
1491 1491
 
1492 1492
 			$breadcrumb .= '</li>';
1493
-		} elseif ( is_category() || is_single() ) {
1493
+		} elseif (is_category() || is_single()) {
1494 1494
 			$category = get_the_category();
1495
-			if ( is_category() ) {
1496
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1495
+			if (is_category()) {
1496
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1497 1497
 			}
1498
-			if ( is_single() ) {
1499
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1500
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1498
+			if (is_single()) {
1499
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1500
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1501 1501
 			}
1502 1502
 			/* End of my version ##################################################### */
1503
-		} else if ( is_page() ) {
1503
+		} else if (is_page()) {
1504 1504
 			$page_title = get_the_title();
1505 1505
 
1506
-			if ( geodir_is_page( 'location' ) ) {
1506
+			if (geodir_is_page('location')) {
1507 1507
 				$location_page_id = geodir_location_page_id();
1508
-				$loc_post         = get_post( $location_page_id );
1508
+				$loc_post         = get_post($location_page_id);
1509 1509
 				$post_name        = $loc_post->post_name;
1510
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1511
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1510
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1511
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1512 1512
 			}
1513 1513
 
1514
-			$breadcrumb .= '<li>' . $separator;
1515
-			$breadcrumb .= stripslashes_deep( $page_title );
1514
+			$breadcrumb .= '<li>'.$separator;
1515
+			$breadcrumb .= stripslashes_deep($page_title);
1516 1516
 			$breadcrumb .= '</li>';
1517
-		} else if ( is_tag() ) {
1518
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1519
-		} else if ( is_day() ) {
1520
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1521
-			the_time( 'F jS, Y' );
1517
+		} else if (is_tag()) {
1518
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1519
+		} else if (is_day()) {
1520
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1521
+			the_time('F jS, Y');
1522 1522
 			$breadcrumb .= '</li>';
1523
-		} else if ( is_month() ) {
1524
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1525
-			the_time( 'F, Y' );
1523
+		} else if (is_month()) {
1524
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1525
+			the_time('F, Y');
1526 1526
 			$breadcrumb .= '</li>';
1527
-		} else if ( is_year() ) {
1528
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1529
-			the_time( 'Y' );
1527
+		} else if (is_year()) {
1528
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1529
+			the_time('Y');
1530 1530
 			$breadcrumb .= '</li>';
1531
-		} else if ( is_author() ) {
1532
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1531
+		} else if (is_author()) {
1532
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1533 1533
 			$breadcrumb .= '</li>';
1534
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1535
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1534
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1535
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1536 1536
 			$breadcrumb .= '</li>';
1537
-		} else if ( is_search() ) {
1538
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1537
+		} else if (is_search()) {
1538
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1539 1539
 			$breadcrumb .= '</li>';
1540 1540
 		}
1541 1541
 		$breadcrumb .= '</ul></div>';
@@ -1548,13 +1548,13 @@  discard block
 block discarded – undo
1548 1548
 		 * @param string $breadcrumb Breadcrumb HTML.
1549 1549
 		 * @param string $separator  Breadcrumb separator.
1550 1550
 		 */
1551
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1551
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1552 1552
 	}
1553 1553
 }
1554 1554
 
1555 1555
 
1556
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1557
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1556
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1557
+if (!function_exists('geodir_allow_wpadmin')) {
1558 1558
 	/**
1559 1559
 	 * Allow only admins to access wp-admin.
1560 1560
 	 *
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
 	 */
1567 1567
 	function geodir_allow_wpadmin() {
1568 1568
 		global $wpdb;
1569
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1569
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1570 1570
 		{
1571
-			if ( current_user_can( 'administrator' ) ) {
1571
+			if (current_user_can('administrator')) {
1572 1572
 			} else {
1573 1573
 
1574
-				wp_redirect( home_url() );
1574
+				wp_redirect(home_url());
1575 1575
 				exit;
1576 1576
 			}
1577 1577
 
@@ -1590,23 +1590,23 @@  discard block
 block discarded – undo
1590 1590
  *
1591 1591
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1592 1592
  */
1593
-function fetch_remote_file( $url ) {
1593
+function fetch_remote_file($url) {
1594 1594
 	// extract the file name and extension from the url
1595
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1596
-	$file_name = basename( $url );
1597
-	if ( strpos( $file_name, '?' ) !== false ) {
1598
-		list( $file_name ) = explode( '?', $file_name );
1595
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1596
+	$file_name = basename($url);
1597
+	if (strpos($file_name, '?') !== false) {
1598
+		list($file_name) = explode('?', $file_name);
1599 1599
 	}
1600 1600
 	$dummy        = false;
1601 1601
 	$add_to_cache = false;
1602 1602
 	$key          = null;
1603
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1603
+	if (strpos($url, '/dummy/') !== false) {
1604 1604
 		$dummy = true;
1605
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1606
-		$value = get_transient( 'cached_dummy_images' );
1607
-		if ( $value ) {
1608
-			if ( isset( $value[ $key ] ) ) {
1609
-				return $value[ $key ];
1605
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1606
+		$value = get_transient('cached_dummy_images');
1607
+		if ($value) {
1608
+			if (isset($value[$key])) {
1609
+				return $value[$key];
1610 1610
 			} else {
1611 1611
 				$add_to_cache = true;
1612 1612
 			}
@@ -1617,58 +1617,58 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 	// get placeholder file in the upload dir with a unique, sanitized filename
1619 1619
 
1620
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1620
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1621 1621
 
1622
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1623
-	if ( $upload['error'] ) {
1624
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1622
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1623
+	if ($upload['error']) {
1624
+		return new WP_Error('upload_dir_error', $upload['error']);
1625 1625
 	}
1626 1626
 
1627 1627
 
1628
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1628
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1629 1629
 
1630 1630
 	// fetch the remote url and write it to the placeholder file
1631
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1631
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1632 1632
 
1633 1633
 	$log_message = '';
1634
-	if ( is_wp_error( $headers ) ) {
1635
-		echo 'file: ' . $url;
1634
+	if (is_wp_error($headers)) {
1635
+		echo 'file: '.$url;
1636 1636
 
1637
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1637
+		return new WP_Error('import_file_error', $headers->get_error_message());
1638 1638
 	}
1639 1639
 
1640
-	$filesize = filesize( $upload['file'] );
1640
+	$filesize = filesize($upload['file']);
1641 1641
 	// request failed
1642
-	if ( ! $headers ) {
1643
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1642
+	if (!$headers) {
1643
+		$log_message = __('Remote server did not respond', 'geodirectory');
1644 1644
 	} // make sure the fetch was successful
1645
-	elseif ( $headers['response']['code'] != '200' ) {
1646
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1647
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1648
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1649
-	} elseif ( 0 == $filesize ) {
1650
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1651
-	}
1652
-
1653
-	if ( $log_message ) {
1654
-		$del = unlink( $upload['file'] );
1655
-		if ( ! $del ) {
1656
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1645
+	elseif ($headers['response']['code'] != '200') {
1646
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1647
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1648
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1649
+	} elseif (0 == $filesize) {
1650
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1651
+	}
1652
+
1653
+	if ($log_message) {
1654
+		$del = unlink($upload['file']);
1655
+		if (!$del) {
1656
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1657 1657
 		}
1658 1658
 
1659
-		return new WP_Error( 'import_file_error', $log_message );
1659
+		return new WP_Error('import_file_error', $log_message);
1660 1660
 	}
1661 1661
 
1662
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1663
-		$images = get_transient( 'cached_dummy_images' );
1664
-		if ( is_array( $images ) ) {
1665
-			$images[ $key ] = $upload;
1662
+	if ($dummy && $add_to_cache && is_array($upload)) {
1663
+		$images = get_transient('cached_dummy_images');
1664
+		if (is_array($images)) {
1665
+			$images[$key] = $upload;
1666 1666
 		} else {
1667
-			$images = array( $key => $upload );
1667
+			$images = array($key => $upload);
1668 1668
 		}
1669 1669
 
1670 1670
 		//setting the cache using the WP Transient API
1671
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1671
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1672 1672
 	}
1673 1673
 
1674 1674
 	return $upload;
@@ -1682,12 +1682,12 @@  discard block
 block discarded – undo
1682 1682
  * @return string|void Max upload size.
1683 1683
  */
1684 1684
 function geodir_max_upload_size() {
1685
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1685
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1686 1686
 
1687
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1688
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1687
+	if ($max_filesize > 0 && $max_filesize < 1) {
1688
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1689 1689
 	} else {
1690
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1690
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1691 1691
 	}
1692 1692
 
1693 1693
 	/**
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 	 *
1698 1698
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1699 1699
 	 */
1700
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1700
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1701 1701
 }
1702 1702
 
1703 1703
 /**
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
  * @return bool If dummy folder exists returns true, else false.
1711 1711
  */
1712 1712
 function geodir_dummy_folder_exists() {
1713
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1714
-	if ( ! is_dir( $path ) ) {
1713
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1714
+	if (!is_dir($path)) {
1715 1715
 		return false;
1716 1716
 	} else {
1717 1717
 		return true;
@@ -1730,17 +1730,17 @@  discard block
 block discarded – undo
1730 1730
  *
1731 1731
  * @return object Author info.
1732 1732
  */
1733
-function geodir_get_author_info( $aid ) {
1733
+function geodir_get_author_info($aid) {
1734 1734
 	global $wpdb;
1735 1735
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1736
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1737
-	$info    = $wpdb->get_results( $infosql );
1738
-	if ( $info ) {
1736
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1737
+	$info    = $wpdb->get_results($infosql);
1738
+	if ($info) {
1739 1739
 		return $info[0];
1740 1740
 	}
1741 1741
 }
1742 1742
 
1743
-if ( ! function_exists( 'adminEmail' ) ) {
1743
+if (!function_exists('adminEmail')) {
1744 1744
 	/**
1745 1745
 	 * Send emails to client on post submission, renew etc.
1746 1746
 	 *
@@ -1753,67 +1753,67 @@  discard block
 block discarded – undo
1753 1753
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1754 1754
 	 * @param string $custom_1     Custom data to be sent.
1755 1755
 	 */
1756
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1756
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1757 1757
 		global $wpdb;
1758
-		if ( $message_type == 'expiration' ) {
1759
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1760
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1761
-		} elseif ( $message_type == 'post_submited' ) {
1762
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1763
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1764
-		} elseif ( $message_type == 'renew' ) {
1765
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1766
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1767
-		} elseif ( $message_type == 'upgrade' ) {
1768
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1769
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1770
-		} elseif ( $message_type == 'claim_approved' ) {
1771
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1772
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1773
-		} elseif ( $message_type == 'claim_rejected' ) {
1774
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1775
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1776
-		} elseif ( $message_type == 'claim_requested' ) {
1777
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1778
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1779
-		} elseif ( $message_type == 'auto_claim' ) {
1780
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1781
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1782
-		} elseif ( $message_type == 'payment_success' ) {
1783
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1784
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1785
-		} elseif ( $message_type == 'payment_fail' ) {
1786
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1787
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1758
+		if ($message_type == 'expiration') {
1759
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1760
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1761
+		} elseif ($message_type == 'post_submited') {
1762
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1763
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1764
+		} elseif ($message_type == 'renew') {
1765
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1766
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1767
+		} elseif ($message_type == 'upgrade') {
1768
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1769
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1770
+		} elseif ($message_type == 'claim_approved') {
1771
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1772
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1773
+		} elseif ($message_type == 'claim_rejected') {
1774
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1775
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1776
+		} elseif ($message_type == 'claim_requested') {
1777
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1778
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1779
+		} elseif ($message_type == 'auto_claim') {
1780
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1781
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1782
+		} elseif ($message_type == 'payment_success') {
1783
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1784
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1785
+		} elseif ($message_type == 'payment_fail') {
1786
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1787
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1788 1788
 		}
1789 1789
 		$transaction_details = $custom_1;
1790
-		$fromEmail           = get_option( 'site_email' );
1790
+		$fromEmail           = get_option('site_email');
1791 1791
 		$fromEmailName       = get_site_emailName();
1792 1792
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1793
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1793
+		$pkg_limit            = get_property_price_info_listing($page_id);
1794 1794
 		$alivedays            = $pkg_limit['days'];
1795
-		$productlink          = get_permalink( $page_id );
1796
-		$post_info            = get_post( $page_id );
1797
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1798
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1795
+		$productlink          = get_permalink($page_id);
1796
+		$post_info            = get_post($page_id);
1797
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1798
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1799 1799
 		$loginurl             = geodir_login_url();
1800
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1800
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1801 1801
 		$siteurl              = home_url();
1802
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1803
-		$user_info            = get_userdata( $user_id );
1802
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1803
+		$user_info            = get_userdata($user_id);
1804 1804
 		$user_email           = $user_info->user_email;
1805
-		$display_name         = geodir_get_client_name( $user_id );
1805
+		$display_name         = geodir_get_client_name($user_id);
1806 1806
 		$user_login           = $user_info->user_login;
1807
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1808
-		if ( $number_of_grace_days == '' ) {
1807
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1808
+		if ($number_of_grace_days == '') {
1809 1809
 			$number_of_grace_days = 1;
1810 1810
 		}
1811
-		if ( $post_info->post_type == 'event' ) {
1811
+		if ($post_info->post_type == 'event') {
1812 1812
 			$post_type = 'event';
1813 1813
 		} else {
1814 1814
 			$post_type = 'listing';
1815 1815
 		}
1816
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1816
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1817 1817
 		$search_array   = array(
1818 1818
 			'[#client_name#]',
1819 1819
 			'[#listing_link#]',
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
 			'[#site_name#]',
1830 1830
 			'[#transaction_details#]'
1831 1831
 		);
1832
-		$replace_array  = array(
1832
+		$replace_array = array(
1833 1833
 			$display_name,
1834 1834
 			$listingLink,
1835 1835
 			$post_date,
@@ -1844,13 +1844,13 @@  discard block
 block discarded – undo
1844 1844
 			$fromEmailName,
1845 1845
 			$transaction_details
1846 1846
 		);
1847
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1848
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1847
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1848
+		$subject        = str_replace($search_array, $replace_array, $subject);
1849 1849
 		
1850 1850
 		
1851
-		$headers  = array();
1851
+		$headers = array();
1852 1852
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
1853
-		$headers[] = 'From: ' . $fromEmailName . ' <' . $fromEmail . '>';
1853
+		$headers[] = 'From: '.$fromEmailName.' <'.$fromEmail.'>';
1854 1854
 
1855 1855
 		$to      = $fromEmail;
1856 1856
 		$message = $client_message;
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1869 1869
 		 * @param string $custom_1     Custom data to be sent.
1870 1870
 		 */
1871
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1871
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1872 1872
 		/**
1873 1873
 		 * Filter the admin email subject.
1874 1874
 		 *
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1882 1882
 		 * @param string $custom_1     Custom data to be sent.
1883 1883
 		 */
1884
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1884
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1885 1885
 		/**
1886 1886
 		 * Filter the admin email message.
1887 1887
 		 *
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1895 1895
 		 * @param string $custom_1     Custom data to be sent.
1896 1896
 		 */
1897
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1897
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1898 1898
 		/**
1899 1899
 		 * Filter the admin email headers.
1900 1900
 		 *
@@ -1907,22 +1907,22 @@  discard block
 block discarded – undo
1907 1907
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1908 1908
 		 * @param string $custom_1     Custom data to be sent.
1909 1909
 		 */
1910
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1910
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1911 1911
 
1912 1912
 
1913
-		$sent = wp_mail( $to, $subject, $message, $headers );
1914
-		if ( ! $sent ) {
1915
-			if ( is_array( $to ) ) {
1916
-				$to = implode( ',', $to );
1913
+		$sent = wp_mail($to, $subject, $message, $headers);
1914
+		if (!$sent) {
1915
+			if (is_array($to)) {
1916
+				$to = implode(',', $to);
1917 1917
 			}
1918 1918
 			$log_message = sprintf(
1919
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1919
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1920 1920
 				$message_type,
1921
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1921
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1922 1922
 				$to,
1923 1923
 				$subject
1924 1924
 			);
1925
-			geodir_error_log( $log_message );
1925
+			geodir_error_log($log_message);
1926 1926
 		}
1927 1927
 	}
1928 1928
 }
@@ -1942,12 +1942,12 @@  discard block
 block discarded – undo
1942 1942
  *
1943 1943
  * @return array Category IDs.
1944 1944
  */
1945
-function gd_lang_object_ids( $ids_array, $type ) {
1946
-	if ( function_exists( 'icl_object_id' ) ) {
1945
+function gd_lang_object_ids($ids_array, $type) {
1946
+	if (function_exists('icl_object_id')) {
1947 1947
 		$res = array();
1948
-		foreach ( $ids_array as $id ) {
1949
-			$xlat = icl_object_id( $id, $type, false );
1950
-			if ( ! is_null( $xlat ) ) {
1948
+		foreach ($ids_array as $id) {
1949
+			$xlat = icl_object_id($id, $type, false);
1950
+			if (!is_null($xlat)) {
1951 1951
 				$res[] = $xlat;
1952 1952
 			}
1953 1953
 		}
@@ -1971,20 +1971,20 @@  discard block
 block discarded – undo
1971 1971
  *
1972 1972
  * @return array Modified Body CSS classes.
1973 1973
  */
1974
-function geodir_custom_posts_body_class( $classes ) {
1974
+function geodir_custom_posts_body_class($classes) {
1975 1975
 	global $wpdb, $wp;
1976
-	$post_types = geodir_get_posttypes( 'object' );
1977
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
1976
+	$post_types = geodir_get_posttypes('object');
1977
+	if (!empty($post_types) && count((array) $post_types) > 1) {
1978 1978
 		$classes[] = 'geodir_custom_posts';
1979 1979
 	}
1980 1980
 
1981 1981
 	// fix body class for signup page
1982
-	if ( geodir_is_page( 'login' ) ) {
1982
+	if (geodir_is_page('login')) {
1983 1983
 		$new_classes   = array();
1984 1984
 		$new_classes[] = 'signup page-geodir-signup';
1985
-		if ( ! empty( $classes ) ) {
1986
-			foreach ( $classes as $class ) {
1987
-				if ( $class && $class != 'home' && $class != 'blog' ) {
1985
+		if (!empty($classes)) {
1986
+			foreach ($classes as $class) {
1987
+				if ($class && $class != 'home' && $class != 'blog') {
1988 1988
 					$new_classes[] = $class;
1989 1989
 				}
1990 1990
 			}
@@ -1992,14 +1992,14 @@  discard block
 block discarded – undo
1992 1992
 		$classes = $new_classes;
1993 1993
 	}
1994 1994
 
1995
-	if ( geodir_is_geodir_page() ) {
1995
+	if (geodir_is_geodir_page()) {
1996 1996
 		$classes[] = 'geodir-page';
1997 1997
 	}
1998 1998
 
1999 1999
 	return $classes;
2000 2000
 }
2001 2001
 
2002
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2002
+add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
2003 2003
 
2004 2004
 
2005 2005
 /**
@@ -2015,7 +2015,7 @@  discard block
 block discarded – undo
2015 2015
 	 *
2016 2016
 	 * @since 1.0.0
2017 2017
 	 */
2018
-	return apply_filters( 'geodir_map_zoom_level', array(
2018
+	return apply_filters('geodir_map_zoom_level', array(
2019 2019
 		1,
2020 2020
 		2,
2021 2021
 		3,
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
 		17,
2036 2036
 		18,
2037 2037
 		19
2038
-	) );
2038
+	));
2039 2039
 
2040 2040
 }
2041 2041
 
@@ -2048,12 +2048,12 @@  discard block
 block discarded – undo
2048 2048
  *
2049 2049
  * @param string $geodir_option_name Option key.
2050 2050
  */
2051
-function geodir_option_version_backup( $geodir_option_name ) {
2051
+function geodir_option_version_backup($geodir_option_name) {
2052 2052
 	$version_date  = time();
2053
-	$geodir_option = get_option( $geodir_option_name );
2053
+	$geodir_option = get_option($geodir_option_name);
2054 2054
 
2055
-	if ( ! empty( $geodir_option ) ) {
2056
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2055
+	if (!empty($geodir_option)) {
2056
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2057 2057
 	}
2058 2058
 }
2059 2059
 
@@ -2067,10 +2067,10 @@  discard block
 block discarded – undo
2067 2067
  *
2068 2068
  * @return int Page ID.
2069 2069
  */
2070
-function get_page_id_geodir_add_listing_page( $page_id ) {
2071
-	if ( geodir_wpml_multilingual_status() ) {
2070
+function get_page_id_geodir_add_listing_page($page_id) {
2071
+	if (geodir_wpml_multilingual_status()) {
2072 2072
 		$post_type = 'post_page';
2073
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2073
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2074 2074
 	}
2075 2075
 
2076 2076
 	return $page_id;
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2085 2085
  */
2086 2086
 function geodir_wpml_multilingual_status() {
2087
-	if ( function_exists( 'icl_object_id' ) ) {
2087
+	if (function_exists('icl_object_id')) {
2088 2088
 		return true;
2089 2089
 	}
2090 2090
 
@@ -2102,19 +2102,19 @@  discard block
 block discarded – undo
2102 2102
  *
2103 2103
  * @return int Element ID when exists. Else the page id.
2104 2104
  */
2105
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2105
+function geodir_get_wpml_element_id($page_id, $post_type) {
2106 2106
 	global $sitepress;
2107
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2108
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2107
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2108
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2109 2109
 
2110
-		if ( $trid > 0 ) {
2111
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2110
+		if ($trid > 0) {
2111
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2112 2112
 
2113 2113
 			$lang = $sitepress->get_current_language();
2114 2114
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2115 2115
 
2116
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2117
-				$page_id = $translations[ $lang ]->element_id;
2116
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2117
+				$page_id = $translations[$lang]->element_id;
2118 2118
 			}
2119 2119
 		}
2120 2120
 	}
@@ -2131,15 +2131,15 @@  discard block
 block discarded – undo
2131 2131
  */
2132 2132
 function geodir_wpml_check_element_id() {
2133 2133
 	global $sitepress;
2134
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2134
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2135 2135
 		$el_type      = 'post_page';
2136
-		$el_id        = get_option( 'geodir_add_listing_page' );
2136
+		$el_id        = get_option('geodir_add_listing_page');
2137 2137
 		$default_lang = $sitepress->get_default_language();
2138
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2138
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2139 2139
 
2140
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2141
-			if ( ! $el_details->source_language_code ) {
2142
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2140
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2141
+			if (!$el_details->source_language_code) {
2142
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2143 2143
 				$sitepress->icl_translations_cache->clear();
2144 2144
 			}
2145 2145
 		}
@@ -2158,41 +2158,41 @@  discard block
 block discarded – undo
2158 2158
  *
2159 2159
  * @return string Orderby SQL.
2160 2160
  */
2161
-function geodir_widget_listings_get_order( $query_args ) {
2161
+function geodir_widget_listings_get_order($query_args) {
2162 2162
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2163 2163
 
2164 2164
 	$query_args = $gd_query_args_widgets;
2165
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2166
-		return $wpdb->posts . ".post_date DESC, ";
2165
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2166
+		return $wpdb->posts.".post_date DESC, ";
2167 2167
 	}
2168 2168
 
2169
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2170
-	$table     = $plugin_prefix . $post_type . '_detail';
2169
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2170
+	$table     = $plugin_prefix.$post_type.'_detail';
2171 2171
 
2172
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2172
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2173 2173
 
2174
-	switch ( $sort_by ) {
2174
+	switch ($sort_by) {
2175 2175
 		case 'latest':
2176 2176
 		case 'newest':
2177
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2177
+			$orderby = $wpdb->posts.".post_date DESC, ";
2178 2178
 			break;
2179 2179
 		case 'featured':
2180
-			$orderby = $table . ".is_featured ASC, ";
2180
+			$orderby = $table.".is_featured ASC, ";
2181 2181
 			break;
2182 2182
 		case 'az':
2183
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2183
+			$orderby = $wpdb->posts.".post_title ASC, ";
2184 2184
 			break;
2185 2185
 		case 'high_review':
2186
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2186
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2187 2187
 			break;
2188 2188
 		case 'high_rating':
2189
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2189
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2190 2190
 			break;
2191 2191
 		case 'random':
2192 2192
 			$orderby = "RAND(), ";
2193 2193
 			break;
2194 2194
 		default:
2195
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2195
+			$orderby = $wpdb->posts.".post_title ASC, ";
2196 2196
 			break;
2197 2197
 	}
2198 2198
 
@@ -2215,15 +2215,15 @@  discard block
 block discarded – undo
2215 2215
  *
2216 2216
  * @return mixed Result object.
2217 2217
  */
2218
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2218
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2219 2219
 	global $wpdb, $plugin_prefix, $table_prefix;
2220 2220
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2221 2221
 	$gd_query_args_widgets            = $query_args;
2222 2222
 
2223
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2224
-	$table     = $plugin_prefix . $post_type . '_detail';
2223
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2224
+	$table     = $plugin_prefix.$post_type.'_detail';
2225 2225
 
2226
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2226
+	$fields = $wpdb->posts.".*, ".$table.".*";
2227 2227
 	/**
2228 2228
 	 * Filter widget listing fields string part that is being used for query.
2229 2229
 	 *
@@ -2233,17 +2233,17 @@  discard block
 block discarded – undo
2233 2233
 	 * @param string $table     Table name.
2234 2234
 	 * @param string $post_type Post type.
2235 2235
 	 */
2236
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2236
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2237 2237
 
2238
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2238
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2239 2239
 
2240 2240
 	########### WPML ###########
2241 2241
 
2242
-	if ( function_exists( 'icl_object_id' ) ) {
2242
+	if (function_exists('icl_object_id')) {
2243 2243
 		global $sitepress;
2244 2244
 		$lang_code = ICL_LANGUAGE_CODE;
2245
-		if ( $lang_code ) {
2246
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2245
+		if ($lang_code) {
2246
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2247 2247
 		}
2248 2248
 	}
2249 2249
 
@@ -2257,15 +2257,15 @@  discard block
 block discarded – undo
2257 2257
 	 * @param string $join      Join clause string.
2258 2258
 	 * @param string $post_type Post type.
2259 2259
 	 */
2260
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2260
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2261 2261
 
2262
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2262
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2263 2263
 
2264
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2264
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2265 2265
 
2266 2266
 	########### WPML ###########
2267
-	if ( function_exists( 'icl_object_id' ) ) {
2268
-		if ( $lang_code ) {
2267
+	if (function_exists('icl_object_id')) {
2268
+		if ($lang_code) {
2269 2269
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2270 2270
 		}
2271 2271
 	}
@@ -2278,8 +2278,8 @@  discard block
 block discarded – undo
2278 2278
 	 * @param string $where     Where clause string.
2279 2279
 	 * @param string $post_type Post type.
2280 2280
 	 */
2281
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2282
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2281
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2282
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2283 2283
 
2284 2284
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2285 2285
 	/**
@@ -2290,15 +2290,15 @@  discard block
 block discarded – undo
2290 2290
 	 * @param string $groupby   Group by clause string.
2291 2291
 	 * @param string $post_type Post type.
2292 2292
 	 */
2293
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2293
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2294 2294
 
2295
-	if ( $count_only ) {
2296
-		$sql  = "SELECT COUNT(DISTINCT " . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2297
-			" . $join . "
2295
+	if ($count_only) {
2296
+		$sql  = "SELECT COUNT(DISTINCT ".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2297
+			" . $join."
2298 2298
 			" . $where;
2299
-		$rows = (int) $wpdb->get_var( $sql );
2299
+		$rows = (int) $wpdb->get_var($sql);
2300 2300
 	} else {
2301
-		$orderby = geodir_widget_listings_get_order( $query_args );
2301
+		$orderby = geodir_widget_listings_get_order($query_args);
2302 2302
 		/**
2303 2303
 		 * Filter widget listing orderby clause string part that is being used for query.
2304 2304
 		 *
@@ -2308,11 +2308,11 @@  discard block
 block discarded – undo
2308 2308
 		 * @param string $table     Table name.
2309 2309
 		 * @param string $post_type Post type.
2310 2310
 		 */
2311
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2312
-		$orderby .= $wpdb->posts . ".post_title ASC";
2313
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2311
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2312
+		$orderby .= $wpdb->posts.".post_title ASC";
2313
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2314 2314
 
2315
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2315
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2316 2316
 		/**
2317 2317
 		 * Filter widget listing limit that is being used for query.
2318 2318
 		 *
@@ -2321,26 +2321,26 @@  discard block
 block discarded – undo
2321 2321
 		 * @param int $limit        Query results limit.
2322 2322
 		 * @param string $post_type Post type.
2323 2323
 		 */
2324
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2324
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2325 2325
 
2326
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2327
-		if ( ! $page ) {
2326
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2327
+		if (!$page) {
2328 2328
 			$page = 1;
2329 2329
 		}
2330 2330
 
2331
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2331
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2332 2332
 
2333
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2334
-			" . $join . "
2335
-			" . $where . "
2336
-			" . $groupby . "
2337
-			" . $orderby . "
2333
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2334
+			" . $join."
2335
+			" . $where."
2336
+			" . $groupby."
2337
+			" . $orderby."
2338 2338
 			" . $limit;
2339
-		$rows = $wpdb->get_results( $sql );
2339
+		$rows = $wpdb->get_results($sql);
2340 2340
 	}
2341 2341
 
2342
-	unset( $GLOBALS['gd_query_args_widgets'] );
2343
-	unset( $gd_query_args_widgets );
2342
+	unset($GLOBALS['gd_query_args_widgets']);
2343
+	unset($gd_query_args_widgets);
2344 2344
 
2345 2345
 	return $rows;
2346 2346
 }
@@ -2357,11 +2357,11 @@  discard block
 block discarded – undo
2357 2357
  *
2358 2358
  * @return string Modified fields SQL.
2359 2359
  */
2360
-function geodir_function_widget_listings_fields( $fields ) {
2360
+function geodir_function_widget_listings_fields($fields) {
2361 2361
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2362 2362
 
2363 2363
 	$query_args = $gd_query_args_widgets;
2364
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2364
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2365 2365
 		return $fields;
2366 2366
 	}
2367 2367
 
@@ -2380,24 +2380,24 @@  discard block
 block discarded – undo
2380 2380
  *
2381 2381
  * @return string Modified join clause SQL.
2382 2382
  */
2383
-function geodir_function_widget_listings_join( $join ) {
2383
+function geodir_function_widget_listings_join($join) {
2384 2384
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2385 2385
 
2386 2386
 	$query_args = $gd_query_args_widgets;
2387
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2387
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2388 2388
 		return $join;
2389 2389
 	}
2390 2390
 
2391
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2392
-	$table     = $plugin_prefix . $post_type . '_detail';
2391
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2392
+	$table     = $plugin_prefix.$post_type.'_detail';
2393 2393
 
2394
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2395
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2394
+	if (!empty($query_args['with_pics_only'])) {
2395
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2396 2396
 	}
2397 2397
 
2398
-	if ( ! empty( $query_args['tax_query'] ) ) {
2399
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2400
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2398
+	if (!empty($query_args['tax_query'])) {
2399
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2400
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2401 2401
 			$join .= $tax_queries['join'];
2402 2402
 		}
2403 2403
 	}
@@ -2417,49 +2417,49 @@  discard block
 block discarded – undo
2417 2417
  *
2418 2418
  * @return string Modified where clause SQL.
2419 2419
  */
2420
-function geodir_function_widget_listings_where( $where ) {
2420
+function geodir_function_widget_listings_where($where) {
2421 2421
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2422 2422
 
2423 2423
 	$query_args = $gd_query_args_widgets;
2424
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2424
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2425 2425
 		return $where;
2426 2426
 	}
2427
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2428
-	$table     = $plugin_prefix . $post_type . '_detail';
2427
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2428
+	$table     = $plugin_prefix.$post_type.'_detail';
2429 2429
 
2430
-	if ( ! empty( $query_args ) ) {
2431
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2432
-			$where = geodir_default_location_where( $where, $table );
2430
+	if (!empty($query_args)) {
2431
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2432
+			$where = geodir_default_location_where($where, $table);
2433 2433
 		}
2434 2434
 
2435
-		if ( ! empty( $query_args['post_author'] ) ) {
2436
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2435
+		if (!empty($query_args['post_author'])) {
2436
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2437 2437
 		}
2438 2438
 
2439
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2440
-			$where .= " AND " . $table . ".is_featured = '1'";
2439
+		if (!empty($query_args['show_featured_only'])) {
2440
+			$where .= " AND ".$table.".is_featured = '1'";
2441 2441
 		}
2442 2442
 
2443
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2444
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2443
+		if (!empty($query_args['show_special_only'])) {
2444
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2445 2445
 		}
2446 2446
 
2447
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2448
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2447
+		if (!empty($query_args['with_pics_only'])) {
2448
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2449 2449
 		}
2450 2450
 
2451
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2452
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2451
+		if (!empty($query_args['featured_image_only'])) {
2452
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2453 2453
 		}
2454 2454
 
2455
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2456
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2455
+		if (!empty($query_args['with_videos_only'])) {
2456
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2457 2457
 		}
2458 2458
 
2459
-		if ( ! empty( $query_args['tax_query'] ) ) {
2460
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2459
+		if (!empty($query_args['tax_query'])) {
2460
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2461 2461
 
2462
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2462
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2463 2463
 				$where .= $tax_queries['where'];
2464 2464
 			}
2465 2465
 		}
@@ -2480,11 +2480,11 @@  discard block
 block discarded – undo
2480 2480
  *
2481 2481
  * @return string Modified orderby clause SQL.
2482 2482
  */
2483
-function geodir_function_widget_listings_orderby( $orderby ) {
2483
+function geodir_function_widget_listings_orderby($orderby) {
2484 2484
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2485 2485
 
2486 2486
 	$query_args = $gd_query_args_widgets;
2487
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2487
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2488 2488
 		return $orderby;
2489 2489
 	}
2490 2490
 
@@ -2503,15 +2503,15 @@  discard block
 block discarded – undo
2503 2503
  *
2504 2504
  * @return int Query limit.
2505 2505
  */
2506
-function geodir_function_widget_listings_limit( $limit ) {
2506
+function geodir_function_widget_listings_limit($limit) {
2507 2507
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2508 2508
 
2509 2509
 	$query_args = $gd_query_args_widgets;
2510
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2510
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2511 2511
 		return $limit;
2512 2512
 	}
2513 2513
 
2514
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2514
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2515 2515
 		$limit = (int) $query_args['posts_per_page'];
2516 2516
 	}
2517 2517
 
@@ -2529,12 +2529,12 @@  discard block
 block discarded – undo
2529 2529
  *
2530 2530
  * @return int Large size width.
2531 2531
  */
2532
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2533
-	$large_size_w = get_option( 'large_size_w' );
2532
+function geodir_media_image_large_width($default = 800, $params = '') {
2533
+	$large_size_w = get_option('large_size_w');
2534 2534
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2535
-	$large_size_w = absint( $large_size_w );
2535
+	$large_size_w = absint($large_size_w);
2536 2536
 
2537
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2537
+	if (!get_option('geodir_use_wp_media_large_size')) {
2538 2538
 		$large_size_w = 800;
2539 2539
 	}
2540 2540
 
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
 	 * @param int $default         Default width.
2548 2548
 	 * @param string|array $params Image parameters.
2549 2549
 	 */
2550
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2550
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2551 2551
 
2552 2552
 	return $large_size_w;
2553 2553
 }
@@ -2563,12 +2563,12 @@  discard block
 block discarded – undo
2563 2563
  *
2564 2564
  * @return int Large size height.
2565 2565
  */
2566
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2567
-	$large_size_h = get_option( 'large_size_h' );
2566
+function geodir_media_image_large_height($default = 800, $params = '') {
2567
+	$large_size_h = get_option('large_size_h');
2568 2568
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2569
-	$large_size_h = absint( $large_size_h );
2569
+	$large_size_h = absint($large_size_h);
2570 2570
 
2571
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2571
+	if (!get_option('geodir_use_wp_media_large_size')) {
2572 2572
 		$large_size_h = 800;
2573 2573
 	}
2574 2574
 
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
 	 * @param int $default         Default height.
2582 2582
 	 * @param string|array $params Image parameters.
2583 2583
 	 */
2584
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2584
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2585 2585
 
2586 2586
 	return $large_size_h;
2587 2587
 }
@@ -2598,8 +2598,8 @@  discard block
 block discarded – undo
2598 2598
  *
2599 2599
  * @return string Sanitized name.
2600 2600
  */
2601
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2602
-	if ( $name == '' ) {
2601
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2602
+	if ($name == '') {
2603 2603
 		return null;
2604 2604
 	}
2605 2605
 
@@ -2608,13 +2608,13 @@  discard block
 block discarded – undo
2608 2608
 	$type = $type == 'gd_city' ? 'city' : $type;
2609 2609
 
2610 2610
 	$return = $name;
2611
-	if ( function_exists( 'get_actual_location_name' ) ) {
2612
-		$return = get_actual_location_name( $type, $name, $translate );
2611
+	if (function_exists('get_actual_location_name')) {
2612
+		$return = get_actual_location_name($type, $name, $translate);
2613 2613
 	} else {
2614
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2615
-		$return = preg_replace( '/[_-]/', ' ', $return );
2616
-		$return = geodir_ucwords( $return );
2617
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2614
+		$return = preg_replace('/-(\d+)$/', '', $return);
2615
+		$return = preg_replace('/[_-]/', ' ', $return);
2616
+		$return = geodir_ucwords($return);
2617
+		$return = $translate ? __($return, 'geodirectory') : $return;
2618 2618
 	}
2619 2619
 
2620 2620
 	return $return;
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
  *
2630 2630
  * @param int $number Comments number.
2631 2631
  */
2632
-function geodir_comments_number( $number ) {
2632
+function geodir_comments_number($number) {
2633 2633
 
2634
-	if ( $number > 1 ) {
2635
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2636
-	} elseif ( $number == 0 || $number == '' ) {
2637
-		$output = __( 'No Reviews', 'geodirectory' );
2634
+	if ($number > 1) {
2635
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2636
+	} elseif ($number == 0 || $number == '') {
2637
+		$output = __('No Reviews', 'geodirectory');
2638 2638
 	} else { // must be one
2639
-		$output = __( '1 Review', 'geodirectory' );
2639
+		$output = __('1 Review', 'geodirectory');
2640 2640
 	}
2641 2641
 	echo $output;
2642 2642
 }
@@ -2651,18 +2651,18 @@  discard block
 block discarded – undo
2651 2651
  */
2652 2652
 function is_page_geodir_home() {
2653 2653
 	global $wpdb;
2654
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2655
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2656
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2654
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2655
+	if (function_exists('geodir_location_geo_home_link')) {
2656
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2657 2657
 	}
2658
-	$home_url = home_url( '', 'http' );
2659
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2660
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2658
+	$home_url = home_url('', 'http');
2659
+	if (function_exists('geodir_location_geo_home_link')) {
2660
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2661 2661
 	}
2662
-	$home_url = str_replace( "www.", "", $home_url );
2663
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2662
+	$home_url = str_replace("www.", "", $home_url);
2663
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2664 2664
 		return true;
2665
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2665
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2666 2666
 		return true;
2667 2667
 	} else {
2668 2668
 		return false;
@@ -2682,18 +2682,18 @@  discard block
 block discarded – undo
2682 2682
  *
2683 2683
  * @return string The canonical URL.
2684 2684
  */
2685
-function geodir_wpseo_homepage_canonical( $url ) {
2685
+function geodir_wpseo_homepage_canonical($url) {
2686 2686
 	global $post;
2687 2687
 
2688
-	if ( is_page_geodir_home() ) {
2688
+	if (is_page_geodir_home()) {
2689 2689
 		return home_url();
2690 2690
 	}
2691 2691
 
2692 2692
 	return $url;
2693 2693
 }
2694 2694
 
2695
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2696
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2695
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2696
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2697 2697
 
2698 2698
 /**
2699 2699
  * Add extra fields to google maps script call.
@@ -2706,20 +2706,20 @@  discard block
 block discarded – undo
2706 2706
  *
2707 2707
  * @return string Modified extra string.
2708 2708
  */
2709
-function geodir_googlemap_script_extra_details_page( $extra ) {
2709
+function geodir_googlemap_script_extra_details_page($extra) {
2710 2710
 	global $post;
2711 2711
 	$add_google_places_api = false;
2712
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2712
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2713 2713
 		$add_google_places_api = true;
2714 2714
 	}
2715
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2715
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2716 2716
 		$extra .= "&amp;libraries=places";
2717 2717
 	}
2718 2718
 
2719 2719
 	return $extra;
2720 2720
 }
2721 2721
 
2722
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2722
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2723 2723
 
2724 2724
 
2725 2725
 /**
@@ -2737,99 +2737,99 @@  discard block
 block discarded – undo
2737 2737
  *                                          after_widget.
2738 2738
  * @param array|string $instance            The settings for the particular instance of the widget.
2739 2739
  */
2740
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2740
+function geodir_popular_post_category_output($args = '', $instance = '') {
2741 2741
 	// prints the widget
2742 2742
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2743
-	extract( $args, EXTR_SKIP );
2743
+	extract($args, EXTR_SKIP);
2744 2744
 
2745 2745
 	echo $before_widget;
2746 2746
 
2747 2747
 	/** This filter is documented in geodirectory_widgets.php */
2748
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2748
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2749 2749
 
2750 2750
 	$gd_post_type = geodir_get_current_posttype();
2751 2751
 
2752
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
-	if ( ! empty( $gd_post_type ) ) {
2752
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
+	if (!empty($gd_post_type)) {
2754 2754
 		$default_post_type = $gd_post_type;
2755
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2755
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2756 2756
 		$default_post_type = $instance['default_post_type'];
2757 2757
 	} else {
2758 2758
 		$all_gd_post_type  = geodir_get_posttypes();
2759
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2759
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2760 2760
 	}
2761
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2761
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2762 2762
 
2763 2763
 	$taxonomy = array();
2764
-	if ( ! empty( $gd_post_type ) ) {
2765
-		$taxonomy[] = $gd_post_type . "category";
2764
+	if (!empty($gd_post_type)) {
2765
+		$taxonomy[] = $gd_post_type."category";
2766 2766
 	} else {
2767
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2767
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2768 2768
 	}
2769 2769
     
2770
-	$term_args = array( 'taxonomy' => $taxonomy );
2771
-	if ( $parent_only ) {
2770
+	$term_args = array('taxonomy' => $taxonomy);
2771
+	if ($parent_only) {
2772 2772
 		$term_args['parent'] = 0;
2773 2773
 	}
2774 2774
 
2775
-	$terms   = get_terms( $term_args );
2775
+	$terms   = get_terms($term_args);
2776 2776
 	$a_terms = array();
2777 2777
 	$b_terms = array();
2778 2778
 
2779
-	foreach ( $terms as $term ) {
2780
-		if ( $term->count > 0 ) {
2781
-			$a_terms[ $term->taxonomy ][] = $term;
2779
+	foreach ($terms as $term) {
2780
+		if ($term->count > 0) {
2781
+			$a_terms[$term->taxonomy][] = $term;
2782 2782
 		}
2783 2783
 	}
2784 2784
 
2785
-	if ( ! empty( $a_terms ) ) {
2786
-		foreach ( $a_terms as $b_key => $b_val ) {
2787
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2785
+	if (!empty($a_terms)) {
2786
+		foreach ($a_terms as $b_key => $b_val) {
2787
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2788 2788
 		}
2789 2789
 
2790
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2790
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2791 2791
 
2792 2792
 		$tax_change_output = '';
2793
-		if ( count( $b_terms ) > 1 ) {
2794
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
-			foreach ( $b_terms as $key => $val ) {
2796
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2797
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2798
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2793
+		if (count($b_terms) > 1) {
2794
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
+			foreach ($b_terms as $key => $val) {
2796
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2797
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2798
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2799 2799
 			}
2800 2800
 			$tax_change_output .= "</select>";
2801 2801
 		}
2802 2802
 
2803
-		if ( ! empty( $b_terms ) ) {
2804
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2805
-			global $cat_count;//make global so we can change via function
2803
+		if (!empty($b_terms)) {
2804
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2805
+			global $cat_count; //make global so we can change via function
2806 2806
 			$cat_count = 0;
2807 2807
 			?>
2808 2808
 			<div class="geodir-category-list-in clearfix">
2809 2809
 				<div class="geodir-cat-list clearfix">
2810 2810
 					<?php
2811
-					echo $before_title . __( $title ) . $after_title;
2811
+					echo $before_title.__($title).$after_title;
2812 2812
 
2813 2813
 					echo $tax_change_output;
2814 2814
 
2815 2815
 					echo '<ul class="geodir-popular-cat-list">';
2816 2816
 
2817
-					geodir_helper_cat_list_output( $terms, $category_limit );
2817
+					geodir_helper_cat_list_output($terms, $category_limit);
2818 2818
 
2819 2819
 					echo '</ul>';
2820 2820
 					?>
2821 2821
 				</div>
2822 2822
 				<?php
2823 2823
 				$hide = '';
2824
-				if ( $cat_count < $category_limit ) {
2824
+				if ($cat_count < $category_limit) {
2825 2825
 					$hide = 'style="display:none;"';
2826 2826
 				}
2827 2827
 				echo "<div class='geodir-cat-list-more' $hide >";
2828
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2829
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2828
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2829
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2830 2830
 				echo "</div>";
2831 2831
 				/* add scripts */
2832
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2832
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2833 2833
 				?>
2834 2834
 			</div>
2835 2835
 			<?php
@@ -2848,25 +2848,25 @@  discard block
 block discarded – undo
2848 2848
  * @param array $terms                      An array of term objects.
2849 2849
  * @param int $category_limit               Number of categories to display by default.
2850 2850
  */
2851
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2851
+function geodir_helper_cat_list_output($terms, $category_limit) {
2852 2852
 	global $geodir_post_category_str, $cat_count;
2853 2853
 	$term_icons = geodir_get_term_icon();
2854 2854
 
2855 2855
 	$geodir_post_category_str = array();
2856 2856
 
2857 2857
 
2858
-	foreach ( $terms as $cat ) {
2859
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2860
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2858
+	foreach ($terms as $cat) {
2859
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2860
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2861 2861
 
2862
-		$cat_count ++;
2862
+		$cat_count++;
2863 2863
 
2864
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2864
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2865 2865
 
2866 2866
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2867 2867
 		$total_post = $cat->count;
2868 2868
 
2869
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2869
+		$term_link = get_term_link($cat, $cat->taxonomy);
2870 2870
 		/**
2871 2871
 		 * Filer the category term link.
2872 2872
 		 *
@@ -2876,11 +2876,11 @@  discard block
 block discarded – undo
2876 2876
 		 * @param int $cat          ->term_id The term id.
2877 2877
 		 * @param string $post_type Wordpress post type.
2878 2878
 		 */
2879
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2879
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2880 2880
 
2881
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2882
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2883
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2881
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2882
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2883
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2884 2884
 		echo '</a></li>';
2885 2885
 	}
2886 2886
 }
@@ -2895,14 +2895,14 @@  discard block
 block discarded – undo
2895 2895
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2896 2896
  * @param array|string $instance The settings for the particular instance of the widget.
2897 2897
  */
2898
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2898
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2899 2899
 	// prints the widget
2900
-	extract( $args, EXTR_SKIP );
2900
+	extract($args, EXTR_SKIP);
2901 2901
 
2902 2902
 	echo $before_widget;
2903 2903
 
2904 2904
 	/** This filter is documented in geodirectory_widgets.php */
2905
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2905
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2906 2906
 	/**
2907 2907
 	 * Filter the widget post type.
2908 2908
 	 *
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
 	 *
2911 2911
 	 * @param string $instance ['post_type'] Post type of listing.
2912 2912
 	 */
2913
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2913
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2914 2914
 	/**
2915 2915
 	 * Filter the widget's term.
2916 2916
 	 *
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 	 *
2919 2919
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
2920 2920
 	 */
2921
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
2921
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2922 2922
 	/**
2923 2923
 	 * Filter widget's "add_location_filter" value.
2924 2924
 	 *
@@ -2926,7 +2926,7 @@  discard block
 block discarded – undo
2926 2926
 	 *
2927 2927
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2928 2928
 	 */
2929
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
2929
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2930 2930
 	/**
2931 2931
 	 * Filter the widget listings limit.
2932 2932
 	 *
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 	 *
2935 2935
 	 * @param string $instance ['post_number'] Number of listings to display.
2936 2936
 	 */
2937
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
2937
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2938 2938
 	/**
2939 2939
 	 * Filter the widget listings limit shown at one time.
2940 2940
 	 *
@@ -2942,7 +2942,7 @@  discard block
 block discarded – undo
2942 2942
 	 *
2943 2943
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
2944 2944
 	 */
2945
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
2945
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2946 2946
 	/**
2947 2947
 	 * Filter the widget slide width.
2948 2948
 	 *
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 	 *
2951 2951
 	 * @param string $instance ['slide_width'] Width of the slides shown.
2952 2952
 	 */
2953
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
2953
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2954 2954
 	/**
2955 2955
 	 * Filter widget's "show title" value.
2956 2956
 	 *
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 	 *
2959 2959
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
2960 2960
 	 */
2961
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
2961
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2962 2962
 	/**
2963 2963
 	 * Filter widget's "slideshow" value.
2964 2964
 	 *
@@ -2966,7 +2966,7 @@  discard block
 block discarded – undo
2966 2966
 	 *
2967 2967
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
2968 2968
 	 */
2969
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
2969
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2970 2970
 	/**
2971 2971
 	 * Filter widget's "animationLoop" value.
2972 2972
 	 *
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
 	 *
2975 2975
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
2976 2976
 	 */
2977
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
2977
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2978 2978
 	/**
2979 2979
 	 * Filter widget's "directionNav" value.
2980 2980
 	 *
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 	 *
2983 2983
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2984 2984
 	 */
2985
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
2985
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2986 2986
 	/**
2987 2987
 	 * Filter widget's "slideshowSpeed" value.
2988 2988
 	 *
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
 	 *
2991 2991
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2992 2992
 	 */
2993
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
2993
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2994 2994
 	/**
2995 2995
 	 * Filter widget's "animationSpeed" value.
2996 2996
 	 *
@@ -2998,7 +2998,7 @@  discard block
 block discarded – undo
2998 2998
 	 *
2999 2999
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3000 3000
 	 */
3001
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3001
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3002 3002
 	/**
3003 3003
 	 * Filter widget's "animation" value.
3004 3004
 	 *
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
 	 *
3007 3007
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3008 3008
 	 */
3009
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3009
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3010 3010
 	/**
3011 3011
 	 * Filter widget's "list_sort" type.
3012 3012
 	 *
@@ -3014,10 +3014,10 @@  discard block
 block discarded – undo
3014 3014
 	 *
3015 3015
 	 * @param string $instance ['list_sort'] Listing sort by type.
3016 3016
 	 */
3017
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3018
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3017
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3018
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3019 3019
 
3020
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3020
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3021 3021
 	?>
3022 3022
 	<script type="text/javascript">
3023 3023
 		jQuery(window).load(function () {
@@ -3035,23 +3035,23 @@  discard block
 block discarded – undo
3035 3035
 				itemWidth: 75,
3036 3036
 				itemMargin: 5,
3037 3037
 				asNavFor: '#geodir_widget_slider',
3038
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3038
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3039 3039
 			});
3040 3040
 
3041 3041
 			jQuery('#geodir_widget_slider').flexslider({
3042
-				animation: "<?php echo $animation;?>",
3042
+				animation: "<?php echo $animation; ?>",
3043 3043
 				selector: ".geodir-slides > li",
3044 3044
 				namespace: "geodir-",
3045 3045
 				controlNav: true,
3046
-				animationLoop: <?php echo $animationLoop;?>,
3047
-				slideshow: <?php echo $slideshow;?>,
3048
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3049
-				animationSpeed: <?php echo $animationSpeed;?>,
3050
-				directionNav: <?php echo $directionNav;?>,
3051
-				maxItems: <?php echo $max_show;?>,
3046
+				animationLoop: <?php echo $animationLoop; ?>,
3047
+				slideshow: <?php echo $slideshow; ?>,
3048
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3049
+				animationSpeed: <?php echo $animationSpeed; ?>,
3050
+				directionNav: <?php echo $directionNav; ?>,
3051
+				maxItems: <?php echo $max_show; ?>,
3052 3052
 				move: 1,
3053
-				<?php if ( $slide_width ) {
3054
-				echo "itemWidth: " . $slide_width . ",";
3053
+				<?php if ($slide_width) {
3054
+				echo "itemWidth: ".$slide_width.",";
3055 3055
 			}?>
3056 3056
 				sync: "#geodir_widget_carousel",
3057 3057
 				start: function (slider) {
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3064 3064
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3065 3065
 				},
3066
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3066
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3067 3067
 			});
3068 3068
 		});
3069 3069
 	</script>
@@ -3076,62 +3076,62 @@  discard block
 block discarded – undo
3076 3076
 		'order_by'       => $list_sort
3077 3077
 	);
3078 3078
 
3079
-	if ( $show_featured_only ) {
3079
+	if ($show_featured_only) {
3080 3080
 		$query_args['show_featured_only'] = 1;
3081 3081
 	}
3082 3082
 
3083
-	if ( $category != 0 || $category != '' ) {
3084
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3083
+	if ($category != 0 || $category != '') {
3084
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3085 3085
 		$tax_query         = array(
3086 3086
 			'taxonomy' => $category_taxonomy[0],
3087 3087
 			'field'    => 'id',
3088 3088
 			'terms'    => $category
3089 3089
 		);
3090 3090
 
3091
-		$query_args['tax_query'] = array( $tax_query );
3091
+		$query_args['tax_query'] = array($tax_query);
3092 3092
 	}
3093 3093
 
3094 3094
 	// we want listings with featured image only
3095 3095
 	$query_args['featured_image_only'] = 1;
3096 3096
 
3097
-	if ( $post_type == 'gd_event' ) {
3097
+	if ($post_type == 'gd_event') {
3098 3098
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3099 3099
 	}// show only upcoming events
3100 3100
 
3101
-	$widget_listings = geodir_get_widget_listings( $query_args );
3102
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3103
-		if ( $title ) {
3104
-			echo $before_title . $title . $after_title;
3101
+	$widget_listings = geodir_get_widget_listings($query_args);
3102
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3103
+		if ($title) {
3104
+			echo $before_title.$title.$after_title;
3105 3105
 		}
3106 3106
 
3107 3107
 		global $post;
3108 3108
 
3109
-		$current_post = $post;// keep current post info
3109
+		$current_post = $post; // keep current post info
3110 3110
 
3111 3111
 		$widget_main_slides = '';
3112 3112
 		$nav_slides         = '';
3113 3113
 		$widget_slides      = 0;
3114 3114
 
3115
-		foreach ( $widget_listings as $widget_listing ) {
3115
+		foreach ($widget_listings as $widget_listing) {
3116 3116
 			global $gd_widget_listing_type;
3117 3117
 			$post         = $widget_listing;
3118
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3118
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3119 3119
 
3120
-			if ( ! empty( $widget_image ) ) {
3121
-				if ( $widget_image->height >= 200 ) {
3120
+			if (!empty($widget_image)) {
3121
+				if ($widget_image->height >= 200) {
3122 3122
 					$widget_spacer_height = 0;
3123 3123
 				} else {
3124
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3124
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3125 3125
 				}
3126 3126
 
3127
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3127
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3128 3128
 
3129 3129
 				$title = '';
3130
-				if ( $show_title ) {
3131
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3130
+				if ($show_title) {
3131
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3132 3132
 					$post_id        = $post->ID;
3133
-					$post_permalink = get_permalink( $post->ID );
3134
-					$post_title     = get_the_title( $post->ID );
3133
+					$post_permalink = get_permalink($post->ID);
3134
+					$post_title     = get_the_title($post->ID);
3135 3135
 					/**
3136 3136
 					 * Filter the listing slider widget title.
3137 3137
 					 *
@@ -3142,12 +3142,12 @@  discard block
 block discarded – undo
3142 3142
 					 * @param string $post_permalink The post permalink url.
3143 3143
 					 * @param string $post_title     The post title text.
3144 3144
 					 */
3145
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3145
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3146 3146
 				}
3147 3147
 
3148
-				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
3149
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3150
-				$widget_slides ++;
3148
+				$widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
3149
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3150
+				$widget_slides++;
3151 3151
 			}
3152 3152
 		}
3153 3153
 		?>
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3157 3157
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3158 3158
 			</div>
3159
-			<?php if ( $widget_slides > 1 ) { ?>
3159
+			<?php if ($widget_slides > 1) { ?>
3160 3160
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3161 3161
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3162 3162
 				</div>
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 		</div>
3165 3165
 		<?php
3166 3166
 		$GLOBALS['post'] = $current_post;
3167
-		setup_postdata( $current_post );
3167
+		setup_postdata($current_post);
3168 3168
 	}
3169 3169
 	echo $after_widget;
3170 3170
 }
@@ -3180,46 +3180,46 @@  discard block
 block discarded – undo
3180 3180
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3181 3181
  * @param array|string $instance The settings for the particular instance of the widget.
3182 3182
  */
3183
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3183
+function geodir_loginwidget_output($args = '', $instance = '') {
3184 3184
 	//print_r($args);
3185 3185
 	//print_r($instance);
3186 3186
 	// prints the widget
3187
-	extract( $args, EXTR_SKIP );
3187
+	extract($args, EXTR_SKIP);
3188 3188
 
3189 3189
 	/** This filter is documented in geodirectory_widgets.php */
3190
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3190
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3191 3191
 
3192 3192
 	echo $before_widget;
3193
-	echo $before_title . $title . $after_title;
3193
+	echo $before_title.$title.$after_title;
3194 3194
 
3195
-	if ( is_user_logged_in() ) {
3195
+	if (is_user_logged_in()) {
3196 3196
 		global $current_user;
3197 3197
 
3198
-		$author_link = get_author_posts_url( $current_user->data->ID );
3199
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3198
+		$author_link = get_author_posts_url($current_user->data->ID);
3199
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3200 3200
 
3201 3201
 		echo '<ul class="geodir-loginbox-list">';
3202 3202
 		ob_start();
3203 3203
 		?>
3204 3204
 		<li><a class="signin"
3205
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3205
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3206 3206
 		<?php
3207
-		$post_types                           = geodir_get_posttypes( 'object' );
3208
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3209
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3207
+		$post_types                           = geodir_get_posttypes('object');
3208
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3209
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3210 3210
 
3211
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3211
+		if (!empty($show_add_listing_post_types_main_nav)) {
3212 3212
 			$addlisting_links = '';
3213
-			foreach ( $post_types as $key => $postobj ) {
3213
+			foreach ($post_types as $key => $postobj) {
3214 3214
 
3215
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3215
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3216 3216
 
3217
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3217
+					if ($add_link = geodir_get_addlisting_link($key)) {
3218 3218
 
3219 3219
 						$name = $postobj->labels->name;
3220 3220
 
3221 3221
 						$selected = '';
3222
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3222
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3223 3223
 							$selected = 'selected="selected"';
3224 3224
 						}
3225 3225
 
@@ -3232,22 +3232,22 @@  discard block
 block discarded – undo
3232 3232
 						 * @param string $key       Add listing array key.
3233 3233
 						 * @param int $current_user ->ID Current user ID.
3234 3234
 						 */
3235
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3235
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3236 3236
 
3237
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3237
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3238 3238
 
3239 3239
 					}
3240 3240
 				}
3241 3241
 
3242 3242
 			}
3243 3243
 
3244
-			if ( $addlisting_links != '' ) { ?>
3244
+			if ($addlisting_links != '') { ?>
3245 3245
 
3246 3246
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3247 3247
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3248
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3248
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3249 3249
 						<option value="" disabled="disabled" selected="selected"
3250
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3250
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3251 3251
 						<?php echo $addlisting_links; ?>
3252 3252
 					</select></li> <?php
3253 3253
 
@@ -3255,23 +3255,23 @@  discard block
 block discarded – undo
3255 3255
 
3256 3256
 		}
3257 3257
 		// My Favourites in Dashboard
3258
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3258
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3259 3259
 		$user_favourite                    = geodir_user_favourite_listing_count();
3260 3260
 
3261
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3261
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3262 3262
 			$favourite_links = '';
3263 3263
 
3264
-			foreach ( $post_types as $key => $postobj ) {
3265
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3264
+			foreach ($post_types as $key => $postobj) {
3265
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3266 3266
 					$name           = $postobj->labels->name;
3267
-					$post_type_link = geodir_getlink( $author_link, array(
3267
+					$post_type_link = geodir_getlink($author_link, array(
3268 3268
 						'stype' => $key,
3269 3269
 						'list'  => 'favourite'
3270
-					), false );
3270
+					), false);
3271 3271
 
3272 3272
 					$selected = '';
3273 3273
 
3274
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3274
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3275 3275
 						$selected = 'selected="selected"';
3276 3276
 					}
3277 3277
 					/**
@@ -3283,20 +3283,20 @@  discard block
 block discarded – undo
3283 3283
 					 * @param string $key            Favorite listing array key.
3284 3284
 					 * @param int $current_user      ->ID Current user ID.
3285 3285
 					 */
3286
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3286
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3287 3287
 
3288
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3288
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3289 3289
 				}
3290 3290
 			}
3291 3291
 
3292
-			if ( $favourite_links != '' ) {
3292
+			if ($favourite_links != '') {
3293 3293
 				?>
3294 3294
 				<li>
3295 3295
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3296 3296
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3297
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3297
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3298 3298
 						<option value="" disabled="disabled" selected="selected"
3299
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3299
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3300 3300
 						<?php echo $favourite_links; ?>
3301 3301
 					</select>
3302 3302
 				</li>
@@ -3305,19 +3305,19 @@  discard block
 block discarded – undo
3305 3305
 		}
3306 3306
 
3307 3307
 
3308
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3308
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3309 3309
 		$user_listing                     = geodir_user_post_listing_count();
3310 3310
 
3311
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3311
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3312 3312
 			$listing_links = '';
3313 3313
 
3314
-			foreach ( $post_types as $key => $postobj ) {
3315
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3314
+			foreach ($post_types as $key => $postobj) {
3315
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3316 3316
 					$name         = $postobj->labels->name;
3317
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3317
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3318 3318
 
3319 3319
 					$selected = '';
3320
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3320
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3321 3321
 						$selected = 'selected="selected"';
3322 3322
 					}
3323 3323
 
@@ -3330,20 +3330,20 @@  discard block
 block discarded – undo
3330 3330
 					 * @param string $key          My listing array key.
3331 3331
 					 * @param int $current_user    ->ID Current user ID.
3332 3332
 					 */
3333
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3333
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3334 3334
 
3335
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3335
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3336 3336
 				}
3337 3337
 			}
3338 3338
 
3339
-			if ( $listing_links != '' ) {
3339
+			if ($listing_links != '') {
3340 3340
 				?>
3341 3341
 				<li>
3342 3342
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3343 3343
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3344
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3344
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3345 3345
 						<option value="" disabled="disabled" selected="selected"
3346
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3346
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3347 3347
 						<?php echo $listing_links; ?>
3348 3348
 					</select>
3349 3349
 				</li>
@@ -3359,7 +3359,7 @@  discard block
 block discarded – undo
3359 3359
 		 *
3360 3360
 		 * @param string $dashboard_link Dashboard links HTML.
3361 3361
 		 */
3362
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3362
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3363 3363
 		echo '</ul>';
3364 3364
 
3365 3365
 		/**
@@ -3367,7 +3367,7 @@  discard block
 block discarded – undo
3367 3367
 		 *
3368 3368
 		 * @since 1.6.6
3369 3369
 		 */
3370
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3370
+		do_action('geodir_after_loginwidget_form_logged_in');
3371 3371
 
3372 3372
 
3373 3373
 	} else {
@@ -3382,18 +3382,18 @@  discard block
 block discarded – undo
3382 3382
 		<form name="loginform" class="loginform1"
3383 3383
 		      action="<?php echo geodir_login_url(); ?>"
3384 3384
 		      method="post">
3385
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3385
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3386 3386
 			                                    type="text" class="textfield user_login1"/> <span
3387 3387
 					class="user_loginInfo"></span></div>
3388
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3388
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3389 3389
 			                                    name="pwd" type="password"
3390 3390
 			                                    class="textfield user_pass1 input-text"/><span
3391 3391
 					class="user_passInfo"></span></div>
3392 3392
 
3393
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3393
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3394 3394
 			<input type="hidden" name="testcookie" value="1"/>
3395 3395
 
3396
-				<?php do_action( 'login_form' ); ?>
3396
+				<?php do_action('login_form'); ?>
3397 3397
 
3398 3398
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3399 3399
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
 					 * @since 1.0.0
3407 3407
 					 */
3408 3408
 					?>
3409
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3409
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3410 3410
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3411 3411
 
3412 3412
 					<?php
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 					 * @since 1.0.0
3417 3417
 					 */
3418 3418
 					?>
3419
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3419
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3420 3420
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3421 3421
 		</form>
3422 3422
 		<?php
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		 *
3426 3426
 		 * @since 1.6.6
3427 3427
 		 */
3428
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3428
+		do_action('geodir_after_loginwidget_form_logged_out');
3429 3429
 	}
3430 3430
 
3431 3431
 	echo $after_widget;
@@ -3447,16 +3447,16 @@  discard block
 block discarded – undo
3447 3447
  *                                         after_widget.
3448 3448
  * @param array|string $instance           The settings for the particular instance of the widget.
3449 3449
  */
3450
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3450
+function geodir_popular_postview_output($args = '', $instance = '') {
3451 3451
 	global $gd_session;
3452 3452
 
3453 3453
 	// prints the widget
3454
-	extract( $args, EXTR_SKIP );
3454
+	extract($args, EXTR_SKIP);
3455 3455
 
3456 3456
 	echo $before_widget;
3457 3457
 
3458 3458
 	/** This filter is documented in geodirectory_widgets.php */
3459
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3459
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3460 3460
 	/**
3461 3461
 	 * Filter the widget post type.
3462 3462
 	 *
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
 	 *
3465 3465
 	 * @param string $instance ['post_type'] Post type of listing.
3466 3466
 	 */
3467
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3467
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3468 3468
 	/**
3469 3469
 	 * Filter the widget's term.
3470 3470
 	 *
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 	 *
3473 3473
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3474 3474
 	 */
3475
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3475
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3476 3476
 	/**
3477 3477
 	 * Filter the widget listings limit.
3478 3478
 	 *
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
 	 *
3481 3481
 	 * @param string $instance ['post_number'] Number of listings to display.
3482 3482
 	 */
3483
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3483
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3484 3484
 	/**
3485 3485
 	 * Filter widget's "layout" type.
3486 3486
 	 *
@@ -3488,7 +3488,7 @@  discard block
 block discarded – undo
3488 3488
 	 *
3489 3489
 	 * @param string $instance ['layout'] Widget layout type.
3490 3490
 	 */
3491
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3491
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3492 3492
 	/**
3493 3493
 	 * Filter widget's "add_location_filter" value.
3494 3494
 	 *
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
 	 *
3497 3497
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3498 3498
 	 */
3499
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3499
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3500 3500
 	/**
3501 3501
 	 * Filter widget's listing width.
3502 3502
 	 *
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
 	 *
3505 3505
 	 * @param string $instance ['listing_width'] Listing width.
3506 3506
 	 */
3507
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3507
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3508 3508
 	/**
3509 3509
 	 * Filter widget's "list_sort" type.
3510 3510
 	 *
@@ -3512,25 +3512,25 @@  discard block
 block discarded – undo
3512 3512
 	 *
3513 3513
 	 * @param string $instance ['list_sort'] Listing sort by type.
3514 3514
 	 */
3515
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3516
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3515
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3516
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3517 3517
 
3518 3518
 	// set post type to current viewing post type
3519
-	if ( $use_viewing_post_type ) {
3519
+	if ($use_viewing_post_type) {
3520 3520
 		$current_post_type = geodir_get_current_posttype();
3521
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3521
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3522 3522
 			$post_type = $current_post_type;
3523 3523
 			$category  = array(); // old post type category will not work for current changed post type
3524 3524
 		}
3525 3525
 	}
3526 3526
 	// replace widget title dynamically
3527
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3528
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3527
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3528
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3529 3529
 
3530
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3531
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3530
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3531
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3532 3532
 
3533
-	if ( isset( $instance['character_count'] ) ) {
3533
+	if (isset($instance['character_count'])) {
3534 3534
 		/**
3535 3535
 		 * Filter the widget's excerpt character count.
3536 3536
 		 *
@@ -3538,37 +3538,37 @@  discard block
 block discarded – undo
3538 3538
 		 *
3539 3539
 		 * @param int $instance ['character_count'] Excerpt character count.
3540 3540
 		 */
3541
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3541
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3542 3542
 	} else {
3543 3543
 		$character_count = '';
3544 3544
 	}
3545 3545
 
3546
-	if ( empty( $title ) || $title == 'All' ) {
3547
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3546
+	if (empty($title) || $title == 'All') {
3547
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3548 3548
 	}
3549 3549
 
3550 3550
 	$location_url = array();
3551
-	$city         = get_query_var( 'gd_city' );
3552
-	if ( ! empty( $city ) ) {
3553
-		$country = get_query_var( 'gd_country' );
3554
-		$region  = get_query_var( 'gd_region' );
3551
+	$city         = get_query_var('gd_city');
3552
+	if (!empty($city)) {
3553
+		$country = get_query_var('gd_country');
3554
+		$region  = get_query_var('gd_region');
3555 3555
 
3556
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3556
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3557 3557
 
3558
-		if ( $geodir_show_location_url == 'all' ) {
3559
-			if ( $country != '' ) {
3558
+		if ($geodir_show_location_url == 'all') {
3559
+			if ($country != '') {
3560 3560
 				$location_url[] = $country;
3561 3561
 			}
3562 3562
 
3563
-			if ( $region != '' ) {
3563
+			if ($region != '') {
3564 3564
 				$location_url[] = $region;
3565 3565
 			}
3566
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3567
-			if ( $country != '' ) {
3566
+		} else if ($geodir_show_location_url == 'country_city') {
3567
+			if ($country != '') {
3568 3568
 				$location_url[] = $country;
3569 3569
 			}
3570
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3571
-			if ( $region != '' ) {
3570
+		} else if ($geodir_show_location_url == 'region_city') {
3571
+			if ($region != '') {
3572 3572
 				$location_url[] = $region;
3573 3573
 			}
3574 3574
 		}
@@ -3576,37 +3576,37 @@  discard block
 block discarded – undo
3576 3576
 		$location_url[] = $city;
3577 3577
 	}
3578 3578
 
3579
-	$location_url  = implode( '/', $location_url );
3579
+	$location_url  = implode('/', $location_url);
3580 3580
 	$skip_location = false;
3581
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3581
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3582 3582
 		$skip_location = true;
3583
-		$gd_session->un_set( 'gd_multi_location' );
3583
+		$gd_session->un_set('gd_multi_location');
3584 3584
 	}
3585 3585
 
3586
-	if ( get_option( 'permalink_structure' ) ) {
3587
-		$viewall_url = get_post_type_archive_link( $post_type );
3586
+	if (get_option('permalink_structure')) {
3587
+		$viewall_url = get_post_type_archive_link($post_type);
3588 3588
 	} else {
3589
-		$viewall_url = get_post_type_archive_link( $post_type );
3589
+		$viewall_url = get_post_type_archive_link($post_type);
3590 3590
 	}
3591 3591
 
3592
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3592
+	if (!empty($category) && $category[0] != '0') {
3593 3593
 		global $geodir_add_location_url;
3594 3594
 
3595 3595
 		$geodir_add_location_url = '0';
3596 3596
 
3597
-		if ( $add_location_filter != '0' ) {
3597
+		if ($add_location_filter != '0') {
3598 3598
 			$geodir_add_location_url = '1';
3599 3599
 		}
3600 3600
 
3601
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3601
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3602 3602
 
3603 3603
 		$geodir_add_location_url = null;
3604 3604
 	}
3605
-	if ( $skip_location ) {
3606
-		$gd_session->set( 'gd_multi_location', 1 );
3605
+	if ($skip_location) {
3606
+		$gd_session->set('gd_multi_location', 1);
3607 3607
 	}
3608 3608
 
3609
-	if ( is_wp_error( $viewall_url ) ) {
3609
+	if (is_wp_error($viewall_url)) {
3610 3610
 		$viewall_url = '';
3611 3611
 	}
3612 3612
 
@@ -3618,34 +3618,34 @@  discard block
 block discarded – undo
3618 3618
 		'order_by'       => $list_sort
3619 3619
 	);
3620 3620
 
3621
-	if ( $character_count ) {
3621
+	if ($character_count) {
3622 3622
 		$query_args['excerpt_length'] = $character_count;
3623 3623
 	}
3624 3624
 
3625
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3625
+	if (!empty($instance['show_featured_only'])) {
3626 3626
 		$query_args['show_featured_only'] = 1;
3627 3627
 	}
3628 3628
 
3629
-	if ( ! empty( $instance['show_special_only'] ) ) {
3629
+	if (!empty($instance['show_special_only'])) {
3630 3630
 		$query_args['show_special_only'] = 1;
3631 3631
 	}
3632 3632
 
3633
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3633
+	if (!empty($instance['with_pics_only'])) {
3634 3634
 		$query_args['with_pics_only']      = 0;
3635 3635
 		$query_args['featured_image_only'] = 1;
3636 3636
 	}
3637 3637
 
3638
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3638
+	if (!empty($instance['with_videos_only'])) {
3639 3639
 		$query_args['with_videos_only'] = 1;
3640 3640
 	}
3641
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3641
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3642 3642
 
3643
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3644
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3643
+	if (!empty($category) && $category[0] != '0') {
3644
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3645 3645
 
3646 3646
 		######### WPML #########
3647
-		if ( function_exists( 'icl_object_id' ) ) {
3648
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3647
+		if (function_exists('icl_object_id')) {
3648
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3649 3649
 		}
3650 3650
 		######### WPML #########
3651 3651
 
@@ -3655,14 +3655,14 @@  discard block
 block discarded – undo
3655 3655
 			'terms'    => $category
3656 3656
 		);
3657 3657
 
3658
-		$query_args['tax_query'] = array( $tax_query );
3658
+		$query_args['tax_query'] = array($tax_query);
3659 3659
 	}
3660 3660
 
3661 3661
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3662 3662
 
3663
-	$widget_listings = geodir_get_widget_listings( $query_args );
3663
+	$widget_listings = geodir_get_widget_listings($query_args);
3664 3664
 
3665
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3665
+	if (!empty($widget_listings) || $with_no_results) {
3666 3666
 		?>
3667 3667
 		<div class="geodir_locations geodir_location_listing">
3668 3668
 
@@ -3672,11 +3672,11 @@  discard block
 block discarded – undo
3672 3672
 			 *
3673 3673
 			 * @since 1.0.0
3674 3674
 			 */
3675
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3675
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3676 3676
 			<div class="geodir_list_heading clearfix">
3677
-				<?php echo $before_title . $title . $after_title; ?>
3677
+				<?php echo $before_title.$title.$after_title; ?>
3678 3678
 				<a href="<?php echo $viewall_url; ?>"
3679
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3679
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3680 3680
 			</div>
3681 3681
 			<?php
3682 3682
 			/**
@@ -3684,10 +3684,10 @@  discard block
 block discarded – undo
3684 3684
 			 *
3685 3685
 			 * @since 1.0.0
3686 3686
 			 */
3687
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3687
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3688 3688
 			<?php
3689
-			if ( strstr( $layout, 'gridview' ) ) {
3690
-				$listing_view_exp        = explode( '_', $layout );
3689
+			if (strstr($layout, 'gridview')) {
3690
+				$listing_view_exp        = explode('_', $layout);
3691 3691
 				$gridview_columns_widget = $layout;
3692 3692
 				$layout                  = $listing_view_exp[0];
3693 3693
 			} else {
@@ -3699,8 +3699,8 @@  discard block
 block discarded – undo
3699 3699
 			 *
3700 3700
 			 * @since 1.0.0
3701 3701
 			 */
3702
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3703
-			if ( ! isset( $character_count ) ) {
3702
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3703
+			if (!isset($character_count)) {
3704 3704
 				/**
3705 3705
 				 * Filter the widget's excerpt character count.
3706 3706
 				 *
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
 				 *
3709 3709
 				 * @param int $instance ['character_count'] Excerpt character count.
3710 3710
 				 */
3711
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3711
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3712 3712
 			}
3713 3713
 
3714 3714
 			global $post, $map_jason, $map_canvas_arr;
@@ -3723,13 +3723,13 @@  discard block
 block discarded – undo
3723 3723
 			 *
3724 3724
 			 * @since 1.0.0
3725 3725
 			 */
3726
-			include( $template );
3726
+			include($template);
3727 3727
 
3728 3728
 			$geodir_is_widget_listing = false;
3729 3729
 
3730 3730
 			$GLOBALS['post'] = $current_post;
3731
-			if ( ! empty( $current_post ) ) {
3732
-				setup_postdata( $current_post );
3731
+			if (!empty($current_post)) {
3732
+				setup_postdata($current_post);
3733 3733
 			}
3734 3734
 			$map_jason      = $current_map_jason;
3735 3735
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3760,12 +3760,12 @@  discard block
 block discarded – undo
3760 3760
  *
3761 3761
  * @return int Reviews count.
3762 3762
  */
3763
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3763
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3764 3764
 	global $wpdb, $plugin_prefix;
3765 3765
 
3766
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3766
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3767 3767
 
3768
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3768
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3769 3769
 
3770 3770
 	/**
3771 3771
 	 * Filter count review sql query.
@@ -3777,9 +3777,9 @@  discard block
 block discarded – undo
3777 3777
 	 * @param int $taxonomy     The taxonomy Id.
3778 3778
 	 * @param string $post_type The post type.
3779 3779
 	 */
3780
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3780
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3781 3781
 
3782
-	$count = $wpdb->get_var( $sql );
3782
+	$count = $wpdb->get_var($sql);
3783 3783
 
3784 3784
 	return $count;
3785 3785
 }
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
  *
3798 3798
  * @return array Term array data.
3799 3799
  */
3800
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3800
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3801 3801
 	/**
3802 3802
 	 * Filter review count option data.
3803 3803
 	 *
@@ -3807,78 +3807,78 @@  discard block
 block discarded – undo
3807 3807
 	 * @param bool $force_update Force update option value?. Default.false.
3808 3808
 	 * @param int $post_ID       The post id to update if any.
3809 3809
 	 */
3810
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3811
-	if ( ! empty( $option_data ) ) {
3810
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3811
+	if (!empty($option_data)) {
3812 3812
 		return $option_data;
3813 3813
 	}
3814 3814
 
3815
-	$option_data = get_option( 'geodir_global_review_count' );
3815
+	$option_data = get_option('geodir_global_review_count');
3816 3816
 
3817
-	if ( ! $option_data || $force_update ) {
3818
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3817
+	if (!$option_data || $force_update) {
3818
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3819 3819
 			global $gd_session;
3820 3820
 			$term_array = (array) $option_data;
3821
-			$post_type  = get_post_type( $post_ID );
3822
-			$taxonomy   = $post_type . 'category';
3823
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3824
-
3825
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3826
-				foreach ( $terms as $term_id ) {
3827
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3828
-					$children               = get_term_children( $term_id, $taxonomy );
3829
-					$term_array[ $term_id ] = $count;
3821
+			$post_type  = get_post_type($post_ID);
3822
+			$taxonomy   = $post_type.'category';
3823
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3824
+
3825
+			if (!empty($terms) && !is_wp_error($terms)) {
3826
+				foreach ($terms as $term_id) {
3827
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3828
+					$children               = get_term_children($term_id, $taxonomy);
3829
+					$term_array[$term_id] = $count;
3830 3830
 				}
3831 3831
 			}
3832 3832
 
3833
-			$session_listing = $gd_session->get( 'listing' );
3833
+			$session_listing = $gd_session->get('listing');
3834 3834
 
3835 3835
 			$terms = array();
3836
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3837
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3838
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3839
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3836
+			if (isset($_POST['post_category'][$taxonomy])) {
3837
+				$terms = (array) $_POST['post_category'][$taxonomy];
3838
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3839
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3840 3840
 			}
3841 3841
 
3842
-			if ( ! empty( $terms ) ) {
3843
-				foreach ( $terms as $term_id ) {
3844
-					if ( $term_id > 0 ) {
3845
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3846
-						$children               = get_term_children( $term_id, $taxonomy );
3847
-						$term_array[ $term_id ] = $count;
3842
+			if (!empty($terms)) {
3843
+				foreach ($terms as $term_id) {
3844
+					if ($term_id > 0) {
3845
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3846
+						$children               = get_term_children($term_id, $taxonomy);
3847
+						$term_array[$term_id] = $count;
3848 3848
 					}
3849 3849
 				}
3850 3850
 			}
3851 3851
 		} else { // Update reviews count for all post categories.
3852 3852
 			$term_array = array();
3853 3853
 			$post_types = geodir_get_posttypes();
3854
-			foreach ( $post_types as $post_type ) {
3854
+			foreach ($post_types as $post_type) {
3855 3855
 
3856
-				$taxonomy = geodir_get_taxonomies( $post_type );
3856
+				$taxonomy = geodir_get_taxonomies($post_type);
3857 3857
 				$taxonomy = $taxonomy[0];
3858 3858
 
3859 3859
 				$args = array(
3860 3860
 					'hide_empty' => false
3861 3861
 				);
3862 3862
 
3863
-				$terms = get_terms( $taxonomy, $args );
3863
+				$terms = get_terms($taxonomy, $args);
3864 3864
 
3865
-				foreach ( $terms as $term ) {
3866
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3867
-					$children = get_term_children( $term->term_id, $taxonomy );
3865
+				foreach ($terms as $term) {
3866
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3867
+					$children = get_term_children($term->term_id, $taxonomy);
3868 3868
 					/*if ( is_array( $children ) ) {
3869 3869
                         foreach ( $children as $child_id ) {
3870 3870
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3871 3871
                             $count = $count + $child_count;
3872 3872
                         }
3873 3873
                     }*/
3874
-					$term_array[ $term->term_id ] = $count;
3874
+					$term_array[$term->term_id] = $count;
3875 3875
 				}
3876 3876
 			}
3877 3877
 		}
3878 3878
 
3879
-		update_option( 'geodir_global_review_count', $term_array );
3879
+		update_option('geodir_global_review_count', $term_array);
3880 3880
 		//clear cache
3881
-		wp_cache_delete( 'geodir_global_review_count' );
3881
+		wp_cache_delete('geodir_global_review_count');
3882 3882
 
3883 3883
 		return $term_array;
3884 3884
 	} else {
@@ -3894,39 +3894,39 @@  discard block
 block discarded – undo
3894 3894
  * @package GeoDirectory
3895 3895
  * @return bool
3896 3896
  */
3897
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3898
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3897
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3898
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3899 3899
 		return; // do not run if importing listings
3900 3900
 	}
3901 3901
 
3902
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3902
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3903 3903
 		return;
3904 3904
 	}
3905 3905
 
3906 3906
 	$post_ID = 0;
3907
-	if ( ! empty( $post ) ) {
3908
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3907
+	if (!empty($post)) {
3908
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3909 3909
 			return;
3910 3910
 		}
3911 3911
 
3912
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3912
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3913 3913
 			return;
3914 3914
 		}
3915 3915
 
3916
-		if ( ! empty( $post->ID ) ) {
3916
+		if (!empty($post->ID)) {
3917 3917
 			$post_ID = $post->ID;
3918 3918
 		}
3919 3919
 	}
3920 3920
 
3921
-	if ( $new_status != $old_status ) {
3922
-		geodir_count_reviews_by_terms( true, $post_ID );
3921
+	if ($new_status != $old_status) {
3922
+		geodir_count_reviews_by_terms(true, $post_ID);
3923 3923
 	}
3924 3924
 
3925 3925
 	return true;
3926 3926
 }
3927 3927
 
3928
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3929
-	geodir_count_reviews_by_terms( true, $post_id );
3928
+function geodir_term_review_count_force_update_single_post($post_id) {
3929
+	geodir_count_reviews_by_terms(true, $post_id);
3930 3930
 }
3931 3931
 
3932 3932
 /*-----------------------------------------------------------------------------------*/
@@ -3943,11 +3943,11 @@  discard block
 block discarded – undo
3943 3943
  *
3944 3944
  * @return int Post count.
3945 3945
  */
3946
-function geodir_count_posts_by_term( $data, $term ) {
3946
+function geodir_count_posts_by_term($data, $term) {
3947 3947
 
3948
-	if ( $data ) {
3949
-		if ( isset( $data[ $term->term_id ] ) ) {
3950
-			return $data[ $term->term_id ];
3948
+	if ($data) {
3949
+		if (isset($data[$term->term_id])) {
3950
+			return $data[$term->term_id];
3951 3951
 		} else {
3952 3952
 			return 0;
3953 3953
 		}
@@ -3964,8 +3964,8 @@  discard block
 block discarded – undo
3964 3964
  * param array $terms An array of term objects.
3965 3965
  * @return array Sorted terms array.
3966 3966
  */
3967
-function geodir_sort_terms_by_count( $terms ) {
3968
-	usort( $terms, "geodir_sort_by_count_obj" );
3967
+function geodir_sort_terms_by_count($terms) {
3968
+	usort($terms, "geodir_sort_by_count_obj");
3969 3969
 
3970 3970
 	return $terms;
3971 3971
 }
@@ -3980,8 +3980,8 @@  discard block
 block discarded – undo
3980 3980
  *
3981 3981
  * @return array Sorted terms array.
3982 3982
  */
3983
-function geodir_sort_terms_by_review_count( $terms ) {
3984
-	usort( $terms, "geodir_sort_by_review_count_obj" );
3983
+function geodir_sort_terms_by_review_count($terms) {
3984
+	usort($terms, "geodir_sort_by_review_count_obj");
3985 3985
 
3986 3986
 	return $terms;
3987 3987
 }
@@ -3997,12 +3997,12 @@  discard block
 block discarded – undo
3997 3997
  *
3998 3998
  * @return array Sorted terms array.
3999 3999
  */
4000
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4001
-	if ( $sort == 'count' ) {
4002
-		return geodir_sort_terms_by_count( $terms );
4000
+function geodir_sort_terms($terms, $sort = 'count') {
4001
+	if ($sort == 'count') {
4002
+		return geodir_sort_terms_by_count($terms);
4003 4003
 	}
4004
-	if ( $sort == 'review_count' ) {
4005
-		return geodir_sort_terms_by_review_count( $terms );
4004
+	if ($sort == 'review_count') {
4005
+		return geodir_sort_terms_by_review_count($terms);
4006 4006
 	}
4007 4007
 }
4008 4008
 
@@ -4020,7 +4020,7 @@  discard block
 block discarded – undo
4020 4020
  *
4021 4021
  * @return bool
4022 4022
  */
4023
-function geodir_sort_by_count( $a, $b ) {
4023
+function geodir_sort_by_count($a, $b) {
4024 4024
 	return $a['count'] < $b['count'];
4025 4025
 }
4026 4026
 
@@ -4035,7 +4035,7 @@  discard block
 block discarded – undo
4035 4035
  *
4036 4036
  * @return bool
4037 4037
  */
4038
-function geodir_sort_by_count_obj( $a, $b ) {
4038
+function geodir_sort_by_count_obj($a, $b) {
4039 4039
 	return $a->count < $b->count;
4040 4040
 }
4041 4041
 
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
  *
4051 4051
  * @return bool
4052 4052
  */
4053
-function geodir_sort_by_review_count_obj( $a, $b ) {
4053
+function geodir_sort_by_review_count_obj($a, $b) {
4054 4054
 	return $a->review_count < $b->review_count;
4055 4055
 }
4056 4056
 
@@ -4067,35 +4067,35 @@  discard block
 block discarded – undo
4067 4067
 	 * @since   1.4.2
4068 4068
 	 * @package GeoDirectory
4069 4069
 	 */
4070
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4070
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4071 4071
 
4072
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4073
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4072
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4073
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4074 4074
 
4075 4075
 	/**
4076 4076
 	 * Define language constants.
4077 4077
 	 *
4078 4078
 	 * @since 1.0.0
4079 4079
 	 */
4080
-	require_once( geodir_plugin_path() . '/language.php' );
4080
+	require_once(geodir_plugin_path().'/language.php');
4081 4081
 
4082
-	$language_file = geodir_plugin_path() . '/db-language.php';
4082
+	$language_file = geodir_plugin_path().'/db-language.php';
4083 4083
 
4084 4084
 	// Load language string file if not created yet
4085
-	if ( ! file_exists( $language_file ) ) {
4085
+	if (!file_exists($language_file)) {
4086 4086
 		geodirectory_load_db_language();
4087 4087
 	}
4088 4088
 
4089
-	if ( file_exists( $language_file ) ) {
4089
+	if (file_exists($language_file)) {
4090 4090
 		/**
4091 4091
 		 * Language strings from database.
4092 4092
 		 *
4093 4093
 		 * @since 1.4.2
4094 4094
 		 */
4095 4095
 		try {
4096
-			require_once( $language_file );
4097
-		} catch ( Exception $e ) {
4098
-			error_log( 'Language Error: ' . $e->getMessage() );
4096
+			require_once($language_file);
4097
+		} catch (Exception $e) {
4098
+			error_log('Language Error: '.$e->getMessage());
4099 4099
 		}
4100 4100
 	}
4101 4101
 }
@@ -4112,19 +4112,19 @@  discard block
 block discarded – undo
4112 4112
  */
4113 4113
 function geodirectory_load_db_language() {
4114 4114
 	global $wp_filesystem;
4115
-	if ( empty( $wp_filesystem ) ) {
4116
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4115
+	if (empty($wp_filesystem)) {
4116
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4117 4117
 		WP_Filesystem();
4118 4118
 		global $wp_filesystem;
4119 4119
 	}
4120 4120
 
4121
-	$language_file = geodir_plugin_path() . '/db-language.php';
4121
+	$language_file = geodir_plugin_path().'/db-language.php';
4122 4122
 
4123
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4123
+	if (is_file($language_file) && !is_writable($language_file)) {
4124 4124
 		return false;
4125 4125
 	} // Not possible to create.
4126 4126
 
4127
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4127
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4128 4128
 		return false;
4129 4129
 	} // Not possible to create.
4130 4130
 
@@ -4137,9 +4137,9 @@  discard block
 block discarded – undo
4137 4137
 	 *
4138 4138
 	 * @param array $contents_strings Array of strings.
4139 4139
 	 */
4140
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4140
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4141 4141
 
4142
-	$contents_strings = array_unique( $contents_strings );
4142
+	$contents_strings = array_unique($contents_strings);
4143 4143
 
4144 4144
 	$contents_head   = array();
4145 4145
 	$contents_head[] = "<?php";
@@ -4156,20 +4156,20 @@  discard block
 block discarded – undo
4156 4156
 	$contents_foot[] = "";
4157 4157
 	$contents_foot[] = "";
4158 4158
 
4159
-	$contents = implode( PHP_EOL, $contents_head );
4159
+	$contents = implode(PHP_EOL, $contents_head);
4160 4160
 
4161
-	if ( ! empty( $contents_strings ) ) {
4162
-		foreach ( $contents_strings as $string ) {
4163
-			if ( is_scalar( $string ) && $string != '' ) {
4164
-				$string = str_replace( "'", "\'", $string );
4165
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4161
+	if (!empty($contents_strings)) {
4162
+		foreach ($contents_strings as $string) {
4163
+			if (is_scalar($string) && $string != '') {
4164
+				$string = str_replace("'", "\'", $string);
4165
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4166 4166
 			}
4167 4167
 		}
4168 4168
 	}
4169 4169
 
4170
-	$contents .= implode( PHP_EOL, $contents_foot );
4170
+	$contents .= implode(PHP_EOL, $contents_foot);
4171 4171
 
4172
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4172
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4173 4173
 		return false;
4174 4174
 	} // Failure; could not write file.
4175 4175
 
@@ -4190,49 +4190,49 @@  discard block
 block discarded – undo
4190 4190
  *
4191 4191
  * @return array Translation texts.
4192 4192
  */
4193
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4193
+function geodir_load_custom_field_translation($translation_texts = array()) {
4194 4194
 	global $wpdb;
4195 4195
 
4196 4196
 	// Custom fields table
4197
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4198
-	$rows = $wpdb->get_results( $sql );
4197
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4198
+	$rows = $wpdb->get_results($sql);
4199 4199
 
4200
-	if ( ! empty( $rows ) ) {
4201
-		foreach ( $rows as $row ) {
4202
-			if ( ! empty( $row->admin_title ) ) {
4203
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4200
+	if (!empty($rows)) {
4201
+		foreach ($rows as $row) {
4202
+			if (!empty($row->admin_title)) {
4203
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4204 4204
 			}
4205 4205
 
4206
-			if ( ! empty( $row->admin_desc ) ) {
4207
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4206
+			if (!empty($row->admin_desc)) {
4207
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4208 4208
 			}
4209 4209
 
4210
-			if ( ! empty( $row->site_title ) ) {
4211
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4210
+			if (!empty($row->site_title)) {
4211
+				$translation_texts[] = stripslashes_deep($row->site_title);
4212 4212
 			}
4213 4213
 
4214
-			if ( ! empty( $row->clabels ) ) {
4215
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4214
+			if (!empty($row->clabels)) {
4215
+				$translation_texts[] = stripslashes_deep($row->clabels);
4216 4216
 			}
4217 4217
 
4218
-			if ( ! empty( $row->required_msg ) ) {
4219
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4218
+			if (!empty($row->required_msg)) {
4219
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4220 4220
 			}
4221 4221
             
4222
-			if ( ! empty( $row->validation_msg ) ) {
4223
-				$translation_texts[] = stripslashes_deep( $row->validation_msg );
4222
+			if (!empty($row->validation_msg)) {
4223
+				$translation_texts[] = stripslashes_deep($row->validation_msg);
4224 4224
 			}
4225 4225
 
4226
-			if ( ! empty( $row->default_value ) ) {
4227
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4226
+			if (!empty($row->default_value)) {
4227
+				$translation_texts[] = stripslashes_deep($row->default_value);
4228 4228
 			}
4229 4229
 
4230
-			if ( ! empty( $row->option_values ) ) {
4231
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4230
+			if (!empty($row->option_values)) {
4231
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4232 4232
 
4233
-				if ( ! empty( $option_values ) ) {
4234
-					foreach ( $option_values as $option_value ) {
4235
-						if ( ! empty( $option_value['label'] ) ) {
4233
+				if (!empty($option_values)) {
4234
+					foreach ($option_values as $option_value) {
4235
+						if (!empty($option_value['label'])) {
4236 4236
 							$translation_texts[] = $option_value['label'];
4237 4237
 						}
4238 4238
 					}
@@ -4242,56 +4242,56 @@  discard block
 block discarded – undo
4242 4242
 	}
4243 4243
 
4244 4244
 	// Custom sorting fields table
4245
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4246
-	$rows = $wpdb->get_results( $sql );
4245
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4246
+	$rows = $wpdb->get_results($sql);
4247 4247
 
4248
-	if ( ! empty( $rows ) ) {
4249
-		foreach ( $rows as $row ) {
4250
-			if ( ! empty( $row->site_title ) ) {
4251
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4248
+	if (!empty($rows)) {
4249
+		foreach ($rows as $row) {
4250
+			if (!empty($row->site_title)) {
4251
+				$translation_texts[] = stripslashes_deep($row->site_title);
4252 4252
 			}
4253 4253
 
4254
-			if ( ! empty( $row->asc_title ) ) {
4255
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4254
+			if (!empty($row->asc_title)) {
4255
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4256 4256
 			}
4257 4257
 
4258
-			if ( ! empty( $row->desc_title ) ) {
4259
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4258
+			if (!empty($row->desc_title)) {
4259
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4260 4260
 			}
4261 4261
 		}
4262 4262
 	}
4263 4263
 
4264 4264
 	// Advance search filter fields table
4265
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4266
-		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4267
-		$rows = $wpdb->get_results( $sql );
4268
-
4269
-		if ( ! empty( $rows ) ) {
4270
-			foreach ( $rows as $row ) {
4271
-				if ( ! empty( $row->field_site_name ) ) {
4272
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4265
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4266
+		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4267
+		$rows = $wpdb->get_results($sql);
4268
+
4269
+		if (!empty($rows)) {
4270
+			foreach ($rows as $row) {
4271
+				if (!empty($row->field_site_name)) {
4272
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4273 4273
 				}
4274 4274
 
4275
-				if ( ! empty( $row->front_search_title ) ) {
4276
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4275
+				if (!empty($row->front_search_title)) {
4276
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4277 4277
 				}
4278 4278
 
4279
-				if ( ! empty( $row->first_search_text ) ) {
4280
-					$translation_texts[] = stripslashes_deep( $row->first_search_text );
4279
+				if (!empty($row->first_search_text)) {
4280
+					$translation_texts[] = stripslashes_deep($row->first_search_text);
4281 4281
 				}
4282 4282
 
4283
-				if ( ! empty( $row->last_search_text ) ) {
4284
-					$translation_texts[] = stripslashes_deep( $row->last_search_text );
4283
+				if (!empty($row->last_search_text)) {
4284
+					$translation_texts[] = stripslashes_deep($row->last_search_text);
4285 4285
 				}
4286 4286
 
4287
-				if ( ! empty( $row->field_desc ) ) {
4288
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4287
+				if (!empty($row->field_desc)) {
4288
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4289 4289
 				}
4290 4290
 			}
4291 4291
 		}
4292 4292
 	}
4293 4293
 
4294
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4294
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4295 4295
 
4296 4296
 	return $translation_texts;
4297 4297
 }
@@ -4313,7 +4313,7 @@  discard block
 block discarded – undo
4313 4313
 	 *
4314 4314
 	 * @param array $geodir_allowed_mime_types and file extensions.
4315 4315
 	 */
4316
-	return apply_filters( 'geodir_allowed_mime_types', array(
4316
+	return apply_filters('geodir_allowed_mime_types', array(
4317 4317
 			'Image'       => array( // Image formats.
4318 4318
 				'jpg'  => 'image/jpeg',
4319 4319
 				'jpe'  => 'image/jpeg',
@@ -4381,18 +4381,18 @@  discard block
 block discarded – undo
4381 4381
  *
4382 4382
  * @return string User display name.
4383 4383
  */
4384
-function geodir_get_client_name( $user_id ) {
4384
+function geodir_get_client_name($user_id) {
4385 4385
 	$client_name = '';
4386 4386
 
4387
-	$user_data = get_userdata( $user_id );
4387
+	$user_data = get_userdata($user_id);
4388 4388
 
4389
-	if ( ! empty( $user_data ) ) {
4390
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4391
-			$client_name = trim( $user_data->display_name );
4392
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4393
-			$client_name = trim( $user_data->user_nicename );
4389
+	if (!empty($user_data)) {
4390
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4391
+			$client_name = trim($user_data->display_name);
4392
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4393
+			$client_name = trim($user_data->user_nicename);
4394 4394
 		} else {
4395
-			$client_name = trim( $user_data->user_login );
4395
+			$client_name = trim($user_data->user_login);
4396 4396
 		}
4397 4397
 	}
4398 4398
 
@@ -4400,19 +4400,19 @@  discard block
 block discarded – undo
4400 4400
 }
4401 4401
 
4402 4402
 
4403
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4403
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4404 4404
 /*
4405 4405
  * Add location variables to wpseo replacements.
4406 4406
  *
4407 4407
  * @since 1.5.4
4408 4408
  */
4409
-function geodir_wpseo_replacements( $vars ) {
4409
+function geodir_wpseo_replacements($vars) {
4410 4410
 
4411 4411
 	global $wp;
4412 4412
 	$title = '';
4413 4413
 	// location variables
4414 4414
 	$gd_post_type   = geodir_get_current_posttype();
4415
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4415
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4416 4416
 	/**
4417 4417
 	 * Filter the title variables location variables array
4418 4418
 	 *
@@ -4422,105 +4422,105 @@  discard block
 block discarded – undo
4422 4422
 	 * @param array $location_array The array of location variables.
4423 4423
 	 * @param array $vars           The page title variables.
4424 4424
 	 */
4425
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4425
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4426 4426
 	$location_titles = array();
4427
-	if ( get_query_var( 'gd_country_full' ) ) {
4428
-		if ( get_query_var( 'gd_country_full' ) ) {
4429
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4427
+	if (get_query_var('gd_country_full')) {
4428
+		if (get_query_var('gd_country_full')) {
4429
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4430 4430
 		}
4431
-		if ( get_query_var( 'gd_region_full' ) ) {
4432
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4431
+		if (get_query_var('gd_region_full')) {
4432
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4433 4433
 		}
4434
-		if ( get_query_var( 'gd_city_full' ) ) {
4435
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4434
+		if (get_query_var('gd_city_full')) {
4435
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4436 4436
 		}
4437 4437
 	}
4438 4438
 	$location_single = '';
4439
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4440
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4441
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4439
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4440
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4441
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4442 4442
 
4443 4443
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4444 4444
 
4445
-	if ( function_exists( 'get_actual_location_name' ) ) {
4446
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4447
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4448
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4445
+	if (function_exists('get_actual_location_name')) {
4446
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4447
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4448
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4449 4449
 	}
4450 4450
 
4451
-	if ( $gd_city != '' ) {
4452
-		if ( $gd_city_actual != '' ) {
4451
+	if ($gd_city != '') {
4452
+		if ($gd_city_actual != '') {
4453 4453
 			$gd_city = $gd_city_actual;
4454 4454
 		} else {
4455
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4456
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4457
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4455
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4456
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4457
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4458 4458
 		}
4459 4459
 		$location_single = $gd_city;
4460 4460
 
4461
-	} else if ( $gd_region != '' ) {
4462
-		if ( $gd_region_actual != '' ) {
4461
+	} else if ($gd_region != '') {
4462
+		if ($gd_region_actual != '') {
4463 4463
 			$gd_region = $gd_region_actual;
4464 4464
 		} else {
4465
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4466
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4467
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4465
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4466
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4467
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4468 4468
 		}
4469 4469
 
4470 4470
 		$location_single = $gd_region;
4471
-	} else if ( $gd_country != '' ) {
4472
-		if ( $gd_country_actual != '' ) {
4471
+	} else if ($gd_country != '') {
4472
+		if ($gd_country_actual != '') {
4473 4473
 			$gd_country = $gd_country_actual;
4474 4474
 		} else {
4475
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4476
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4477
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4475
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4476
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4477
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4478 4478
 		}
4479 4479
 
4480 4480
 		$location_single = $gd_country;
4481 4481
 	}
4482 4482
 
4483
-	if ( ! empty( $location_array ) ) {
4483
+	if (!empty($location_array)) {
4484 4484
 
4485
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4486
-		$location_array       = array_reverse( $location_array );
4485
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4486
+		$location_array       = array_reverse($location_array);
4487 4487
 
4488
-		foreach ( $location_array as $location_type => $location ) {
4489
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4490
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4488
+		foreach ($location_array as $location_type => $location) {
4489
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4490
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4491 4491
 
4492
-			$location_name = geodir_ucwords( $gd_location_link_text );
4493
-			$location_name = __( $location_name, 'geodirectory' );
4492
+			$location_name = geodir_ucwords($gd_location_link_text);
4493
+			$location_name = __($location_name, 'geodirectory');
4494 4494
 
4495
-			if ( $actual_location_name ) {
4496
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4497
-				$location_name = get_actual_location_name( $location_type, $location, true );
4495
+			if ($actual_location_name) {
4496
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4497
+				$location_name = get_actual_location_name($location_type, $location, true);
4498 4498
 			}
4499 4499
 
4500 4500
 			$location_titles[] = $location_name;
4501 4501
 		}
4502
-		if ( ! empty( $location_titles ) ) {
4503
-			$location_titles = array_unique( $location_titles );
4502
+		if (!empty($location_titles)) {
4503
+			$location_titles = array_unique($location_titles);
4504 4504
 		}
4505 4505
 	}
4506 4506
 
4507 4507
 
4508
-	if ( ! empty( $location_titles ) ) {
4509
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4508
+	if (!empty($location_titles)) {
4509
+		$vars['%%location%%'] = implode(", ", $location_titles);
4510 4510
 	}
4511 4511
 
4512 4512
 
4513
-	if ( ! empty( $location_titles ) ) {
4514
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4513
+	if (!empty($location_titles)) {
4514
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4515 4515
 	}
4516 4516
 
4517 4517
 
4518
-	if ( $location_single ) {
4519
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4518
+	if ($location_single) {
4519
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4520 4520
 	}
4521 4521
 
4522 4522
 
4523
-	if ( $location_single ) {
4523
+	if ($location_single) {
4524 4524
 		$vars['%%location_single%%'] = $location_single;
4525 4525
 	}
4526 4526
 
@@ -4533,13 +4533,13 @@  discard block
 block discarded – undo
4533 4533
 	 * @param string $vars          The title with variables.
4534 4534
 	 * @param array $location_array The array of location variables.
4535 4535
 	 */
4536
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4536
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4537 4537
 }
4538 4538
 
4539 4539
 
4540
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4541
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4542
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4540
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4541
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4542
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4543 4543
 
4544 4544
 /**
4545 4545
  * Filter the title variables.
@@ -4581,14 +4581,14 @@  discard block
 block discarded – undo
4581 4581
  *
4582 4582
  * @return string Title after filtered variables.
4583 4583
  */
4584
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4584
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4585 4585
 	global $wp, $post;
4586 4586
 
4587
-	if ( ! $gd_page || ! $title ) {
4587
+	if (!$gd_page || !$title) {
4588 4588
 		return $title; // if no a GD page then bail.
4589 4589
 	}
4590 4590
 
4591
-	if ( $sep == '' ) {
4591
+	if ($sep == '') {
4592 4592
 		/**
4593 4593
 		 * Filter the page title separator.
4594 4594
 		 *
@@ -4597,100 +4597,100 @@  discard block
 block discarded – undo
4597 4597
 		 *
4598 4598
 		 * @param string $sep The separator, default: `|`.
4599 4599
 		 */
4600
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4600
+		$sep = apply_filters('geodir_page_title_separator', '|');
4601 4601
 	}
4602 4602
 
4603
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4604
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4603
+	if (strpos($title, '%%title%%') !== false) {
4604
+		$title = str_replace("%%title%%", $post->post_title, $title);
4605 4605
 	}
4606 4606
 
4607
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4608
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4607
+	if (strpos($title, '%%sitename%%') !== false) {
4608
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4609 4609
 	}
4610 4610
 
4611
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4612
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4611
+	if (strpos($title, '%%sitedesc%%') !== false) {
4612
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4613 4613
 	}
4614 4614
 
4615
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4616
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4615
+	if (strpos($title, '%%excerpt%%') !== false) {
4616
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4617 4617
 	}
4618 4618
 
4619
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4620
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4621
-	} else if ( $gd_page == 'add-listing' ) {
4622
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4623
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4624
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4619
+	if ($gd_page == 'search' || $gd_page == 'author') {
4620
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4621
+	} else if ($gd_page == 'add-listing') {
4622
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4623
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4624
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4625 4625
 		$post_type = $post->post_type;
4626 4626
 	} else {
4627
-		$post_type = get_query_var( 'post_type' );
4627
+		$post_type = get_query_var('post_type');
4628 4628
 	}
4629 4629
 
4630
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4630
+	if (strpos($title, '%%pt_single%%') !== false) {
4631 4631
 		$singular_name = '';
4632
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4633
-			$singular_name = __( $singular_name, 'geodirectory' );
4632
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4633
+			$singular_name = __($singular_name, 'geodirectory');
4634 4634
 		}
4635 4635
 
4636
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4636
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4637 4637
 	}
4638 4638
 
4639
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4639
+	if (strpos($title, '%%pt_plural%%') !== false) {
4640 4640
 		$plural_name = '';
4641
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4642
-			$plural_name = __( $plural_name, 'geodirectory' );
4641
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4642
+			$plural_name = __($plural_name, 'geodirectory');
4643 4643
 		}
4644 4644
 
4645
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4645
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4646 4646
 	}
4647 4647
 
4648
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4648
+	if (strpos($title, '%%category%%') !== false) {
4649 4649
 		$cat_name = '';
4650 4650
 
4651
-		if ( $gd_page == 'detail' ) {
4652
-			if ( $post->default_category ) {
4653
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4654
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4651
+		if ($gd_page == 'detail') {
4652
+			if ($post->default_category) {
4653
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4654
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4655 4655
 			}
4656
-		} else if ( $gd_page == 'listing' ) {
4656
+		} else if ($gd_page == 'listing') {
4657 4657
 			$queried_object = get_queried_object();
4658
-			if ( isset( $queried_object->name ) ) {
4658
+			if (isset($queried_object->name)) {
4659 4659
 				$cat_name = $queried_object->name;
4660 4660
 			}
4661 4661
 		}
4662
-		$title = str_replace( "%%category%%", $cat_name, $title );
4662
+		$title = str_replace("%%category%%", $cat_name, $title);
4663 4663
 	}
4664 4664
 
4665
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4665
+	if (strpos($title, '%%tag%%') !== false) {
4666 4666
 		$cat_name = '';
4667 4667
 
4668
-		if ( $gd_page == 'detail' ) {
4669
-			if ( $post->default_category ) {
4670
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4671
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4668
+		if ($gd_page == 'detail') {
4669
+			if ($post->default_category) {
4670
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4671
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4672 4672
 			}
4673
-		} else if ( $gd_page == 'listing' ) {
4673
+		} else if ($gd_page == 'listing') {
4674 4674
 			$queried_object = get_queried_object();
4675
-			if ( isset( $queried_object->name ) ) {
4675
+			if (isset($queried_object->name)) {
4676 4676
 				$cat_name = $queried_object->name;
4677 4677
 			}
4678 4678
 		}
4679
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4679
+		$title = str_replace("%%tag%%", $cat_name, $title);
4680 4680
 	}
4681 4681
 
4682
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4683
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4684
-		$title = str_replace( "%%id%%", $ID, $title );
4682
+	if (strpos($title, '%%id%%') !== false) {
4683
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4684
+		$title = str_replace("%%id%%", $ID, $title);
4685 4685
 	}
4686 4686
 
4687
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4688
-		$title = str_replace( "%%sep%%", $sep, $title );
4687
+	if (strpos($title, '%%sep%%') !== false) {
4688
+		$title = str_replace("%%sep%%", $sep, $title);
4689 4689
 	}
4690 4690
 
4691 4691
 	// location variables
4692 4692
 	$gd_post_type   = geodir_get_current_posttype();
4693
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4693
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4694 4694
 	/**
4695 4695
 	 * Filter the title variables location variables array
4696 4696
 	 *
@@ -4702,166 +4702,166 @@  discard block
 block discarded – undo
4702 4702
 	 * @param string $gd_page       The page being filtered.
4703 4703
 	 * @param string $sep           The separator, default: `|`.
4704 4704
 	 */
4705
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4705
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4706 4706
 	$location_titles = array();
4707
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4708
-		if ( get_query_var( 'gd_country_full' ) ) {
4709
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4707
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4708
+		if (get_query_var('gd_country_full')) {
4709
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4710 4710
 		}
4711
-		if ( get_query_var( 'gd_region_full' ) ) {
4712
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4711
+		if (get_query_var('gd_region_full')) {
4712
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4713 4713
 		}
4714
-		if ( get_query_var( 'gd_city_full' ) ) {
4715
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4714
+		if (get_query_var('gd_city_full')) {
4715
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4716 4716
 		}
4717 4717
 	}
4718 4718
 	$location_single = '';
4719
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4720
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4721
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4719
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4720
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4721
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4722 4722
 
4723 4723
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4724 4724
 
4725
-	if ( function_exists( 'get_actual_location_name' ) ) {
4726
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4727
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4728
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4725
+	if (function_exists('get_actual_location_name')) {
4726
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4727
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4728
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4729 4729
 	}
4730 4730
 
4731
-	if ( $gd_city != '' ) {
4732
-		if ( $gd_city_actual != '' ) {
4731
+	if ($gd_city != '') {
4732
+		if ($gd_city_actual != '') {
4733 4733
 			$gd_city = $gd_city_actual;
4734 4734
 		} else {
4735
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4736
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4737
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4735
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4736
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4737
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4738 4738
 		}
4739 4739
 		$location_single = $gd_city;
4740 4740
 
4741
-	} else if ( $gd_region != '' ) {
4742
-		if ( $gd_region_actual != '' ) {
4741
+	} else if ($gd_region != '') {
4742
+		if ($gd_region_actual != '') {
4743 4743
 			$gd_region = $gd_region_actual;
4744 4744
 		} else {
4745
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4746
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4747
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4745
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4746
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4747
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4748 4748
 		}
4749 4749
 
4750 4750
 		$location_single = $gd_region;
4751
-	} else if ( $gd_country != '' ) {
4752
-		if ( $gd_country_actual != '' ) {
4751
+	} else if ($gd_country != '') {
4752
+		if ($gd_country_actual != '') {
4753 4753
 			$gd_country = $gd_country_actual;
4754 4754
 		} else {
4755
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4756
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4757
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4755
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4756
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4757
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4758 4758
 		}
4759 4759
 
4760 4760
 		$location_single = $gd_country;
4761 4761
 	}
4762 4762
 
4763
-	if ( ! empty( $location_array ) ) {
4763
+	if (!empty($location_array)) {
4764 4764
 
4765
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4766
-		$location_array       = array_reverse( $location_array );
4765
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4766
+		$location_array       = array_reverse($location_array);
4767 4767
 
4768
-		foreach ( $location_array as $location_type => $location ) {
4769
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4770
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4768
+		foreach ($location_array as $location_type => $location) {
4769
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4770
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4771 4771
 
4772
-			$location_name = geodir_ucwords( $gd_location_link_text );
4773
-			$location_name = __( $location_name, 'geodirectory' );
4772
+			$location_name = geodir_ucwords($gd_location_link_text);
4773
+			$location_name = __($location_name, 'geodirectory');
4774 4774
 
4775
-			if ( $actual_location_name ) {
4776
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4777
-				$location_name = get_actual_location_name( $location_type, $location, true );
4775
+			if ($actual_location_name) {
4776
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4777
+				$location_name = get_actual_location_name($location_type, $location, true);
4778 4778
 			}
4779 4779
 
4780 4780
 			$location_titles[] = $location_name;
4781 4781
 		}
4782
-		if ( ! empty( $location_titles ) ) {
4783
-			$location_titles = array_unique( $location_titles );
4782
+		if (!empty($location_titles)) {
4783
+			$location_titles = array_unique($location_titles);
4784 4784
 		}
4785 4785
 	}
4786 4786
 
4787 4787
 
4788
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4788
+	if (strpos($title, '%%location%%') !== false) {
4789 4789
 		$location = '';
4790
-		if ( $location_titles ) {
4791
-			$location = implode( ", ", $location_titles );
4790
+		if ($location_titles) {
4791
+			$location = implode(", ", $location_titles);
4792 4792
 		}
4793
-		$title = str_replace( "%%location%%", $location, $title );
4793
+		$title = str_replace("%%location%%", $location, $title);
4794 4794
 	}
4795 4795
 
4796
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4796
+	if (strpos($title, '%%in_location%%') !== false) {
4797 4797
 		$location = '';
4798
-		if ( $location_titles ) {
4799
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4798
+		if ($location_titles) {
4799
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4800 4800
 		}
4801
-		$title = str_replace( "%%in_location%%", $location, $title );
4801
+		$title = str_replace("%%in_location%%", $location, $title);
4802 4802
 	}
4803 4803
 
4804
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4805
-		if ( $location_single ) {
4806
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4804
+	if (strpos($title, '%%in_location_single%%') !== false) {
4805
+		if ($location_single) {
4806
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4807 4807
 		}
4808
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4808
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4809 4809
 	}
4810 4810
 
4811
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4812
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4811
+	if (strpos($title, '%%location_single%%') !== false) {
4812
+		$title = str_replace("%%location_single%%", $location_single, $title);
4813 4813
 	}
4814 4814
 
4815 4815
 
4816
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4816
+	if (strpos($title, '%%search_term%%') !== false) {
4817 4817
 		$search_term = '';
4818
-		if ( isset( $_REQUEST['s'] ) ) {
4819
-			$search_term = esc_attr( $_REQUEST['s'] );
4818
+		if (isset($_REQUEST['s'])) {
4819
+			$search_term = esc_attr($_REQUEST['s']);
4820 4820
 		}
4821
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4821
+		$title = str_replace("%%search_term%%", $search_term, $title);
4822 4822
 	}
4823 4823
 
4824
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4824
+	if (strpos($title, '%%search_near%%') !== false) {
4825 4825
 		$search_term = '';
4826
-		if ( isset( $_REQUEST['snear'] ) ) {
4827
-			$search_term = esc_attr( $_REQUEST['snear'] );
4826
+		if (isset($_REQUEST['snear'])) {
4827
+			$search_term = esc_attr($_REQUEST['snear']);
4828 4828
 		}
4829
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4829
+		$title = str_replace("%%search_near%%", $search_term, $title);
4830 4830
 	}
4831 4831
 
4832
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4833
-		if ( is_author() ) {
4834
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4832
+	if (strpos($title, '%%name%%') !== false) {
4833
+		if (is_author()) {
4834
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4835 4835
 			$author_name = $curauth->display_name;
4836 4836
 		} else {
4837 4837
 			$author_name = get_the_author();
4838 4838
 		}
4839
-		if ( ! $author_name || $author_name === '' ) {
4839
+		if (!$author_name || $author_name === '') {
4840 4840
 			$queried_object = get_queried_object();
4841 4841
 
4842
-			if ( isset( $queried_object->data->user_nicename ) ) {
4842
+			if (isset($queried_object->data->user_nicename)) {
4843 4843
 				$author_name = $queried_object->data->display_name;
4844 4844
 			}
4845 4845
 		}
4846
-		$title = str_replace( "%%name%%", $author_name, $title );
4846
+		$title = str_replace("%%name%%", $author_name, $title);
4847 4847
 	}
4848 4848
 
4849
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4850
-		$page  = geodir_title_meta_page( $sep );
4851
-		$title = str_replace( "%%page%%", $page, $title );
4849
+	if (strpos($title, '%%page%%') !== false) {
4850
+		$page  = geodir_title_meta_page($sep);
4851
+		$title = str_replace("%%page%%", $page, $title);
4852 4852
 	}
4853
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4853
+	if (strpos($title, '%%pagenumber%%') !== false) {
4854 4854
 		$pagenumber = geodir_title_meta_pagenumber();
4855
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4855
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4856 4856
 	}
4857
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4857
+	if (strpos($title, '%%pagetotal%%') !== false) {
4858 4858
 		$pagetotal = geodir_title_meta_pagetotal();
4859
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4859
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4860 4860
 	}
4861 4861
 
4862
-	$title = wptexturize( $title );
4863
-	$title = convert_chars( $title );
4864
-	$title = esc_html( $title );
4862
+	$title = wptexturize($title);
4863
+	$title = convert_chars($title);
4864
+	$title = esc_html($title);
4865 4865
 
4866 4866
 	/**
4867 4867
 	 * Filter the title variables after standard ones have been filtered.
@@ -4875,7 +4875,7 @@  discard block
 block discarded – undo
4875 4875
 	 * @param string $sep           The separator, default: `|`.
4876 4876
 	 */
4877 4877
 
4878
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4878
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4879 4879
 }
4880 4880
 
4881 4881
 /**
@@ -4888,82 +4888,82 @@  discard block
 block discarded – undo
4888 4888
  *
4889 4889
  * @return array Translation texts.
4890 4890
  */
4891
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4892
-	$gd_post_types = geodir_get_posttypes( 'array' );
4891
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4892
+	$gd_post_types = geodir_get_posttypes('array');
4893 4893
 
4894
-	if ( ! empty( $gd_post_types ) ) {
4895
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4896
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4897
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4898
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4894
+	if (!empty($gd_post_types)) {
4895
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4896
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4897
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4898
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4899 4899
 
4900
-			if ( ! empty( $labels ) ) {
4901
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4900
+			if (!empty($labels)) {
4901
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4902 4902
 					$translation_texts[] = $labels['name'];
4903 4903
 				}
4904
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4904
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4905 4905
 					$translation_texts[] = $labels['singular_name'];
4906 4906
 				}
4907
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4907
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4908 4908
 					$translation_texts[] = $labels['add_new'];
4909 4909
 				}
4910
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4910
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4911 4911
 					$translation_texts[] = $labels['add_new_item'];
4912 4912
 				}
4913
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4913
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4914 4914
 					$translation_texts[] = $labels['edit_item'];
4915 4915
 				}
4916
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4916
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4917 4917
 					$translation_texts[] = $labels['new_item'];
4918 4918
 				}
4919
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4919
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4920 4920
 					$translation_texts[] = $labels['view_item'];
4921 4921
 				}
4922
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4922
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4923 4923
 					$translation_texts[] = $labels['search_items'];
4924 4924
 				}
4925
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4925
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4926 4926
 					$translation_texts[] = $labels['not_found'];
4927 4927
 				}
4928
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4928
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4929 4929
 					$translation_texts[] = $labels['not_found_in_trash'];
4930 4930
 				}
4931
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4931
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4932 4932
 					$translation_texts[] = $labels['label_post_profile'];
4933 4933
 				}
4934
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4934
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4935 4935
 					$translation_texts[] = $labels['label_post_info'];
4936 4936
 				}
4937
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4937
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4938 4938
 					$translation_texts[] = $labels['label_post_images'];
4939 4939
 				}
4940
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4940
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4941 4941
 					$translation_texts[] = $labels['label_post_map'];
4942 4942
 				}
4943
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4943
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4944 4944
 					$translation_texts[] = $labels['label_reviews'];
4945 4945
 				}
4946
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4946
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4947 4947
 					$translation_texts[] = $labels['label_related_listing'];
4948 4948
 				}
4949 4949
 			}
4950 4950
 
4951
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4952
-				$translation_texts[] = normalize_whitespace( $description );
4951
+			if ($description != '' && !in_array($description, $translation_texts)) {
4952
+				$translation_texts[] = normalize_whitespace($description);
4953 4953
 			}
4954 4954
 
4955
-			if ( ! empty( $seo ) ) {
4956
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4957
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4955
+			if (!empty($seo)) {
4956
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4957
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4958 4958
 				}
4959 4959
 
4960
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4961
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4960
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4961
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4962 4962
 				}
4963 4963
 			}
4964 4964
 		}
4965 4965
 	}
4966
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4966
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4967 4967
 
4968 4968
 	return $translation_texts;
4969 4969
 }
@@ -4978,27 +4978,27 @@  discard block
 block discarded – undo
4978 4978
  *
4979 4979
  * @return array Location terms.
4980 4980
  */
4981
-function geodir_remove_location_terms( $location_terms = array() ) {
4982
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4981
+function geodir_remove_location_terms($location_terms = array()) {
4982
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4983 4983
 
4984
-	if ( ! empty( $location_terms ) && $location_manager ) {
4985
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4986
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4984
+	if (!empty($location_terms) && $location_manager) {
4985
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4986
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4987 4987
 
4988
-		if ( $hide_region_part && $hide_country_part ) {
4989
-			if ( isset( $location_terms['gd_country'] ) ) {
4990
-				unset( $location_terms['gd_country'] );
4988
+		if ($hide_region_part && $hide_country_part) {
4989
+			if (isset($location_terms['gd_country'])) {
4990
+				unset($location_terms['gd_country']);
4991 4991
 			}
4992
-			if ( isset( $location_terms['gd_region'] ) ) {
4993
-				unset( $location_terms['gd_region'] );
4992
+			if (isset($location_terms['gd_region'])) {
4993
+				unset($location_terms['gd_region']);
4994 4994
 			}
4995
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4996
-			if ( isset( $location_terms['gd_region'] ) ) {
4997
-				unset( $location_terms['gd_region'] );
4995
+		} else if ($hide_region_part && !$hide_country_part) {
4996
+			if (isset($location_terms['gd_region'])) {
4997
+				unset($location_terms['gd_region']);
4998 4998
 			}
4999
-		} else if ( ! $hide_region_part && $hide_country_part ) {
5000
-			if ( isset( $location_terms['gd_country'] ) ) {
5001
-				unset( $location_terms['gd_country'] );
4999
+		} else if (!$hide_region_part && $hide_country_part) {
5000
+			if (isset($location_terms['gd_country'])) {
5001
+				unset($location_terms['gd_country']);
5002 5002
 			}
5003 5003
 		}
5004 5004
 	}
@@ -5016,33 +5016,33 @@  discard block
 block discarded – undo
5016 5016
  * @param WP_Post $post Post object.
5017 5017
  * @param bool $update  Whether this is an existing listing being updated or not.
5018 5018
  */
5019
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5020
-	if ( ! $update ) {
5019
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5020
+	if (!$update) {
5021 5021
 		return;
5022 5022
 	}
5023 5023
 
5024
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5025
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5024
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5025
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5026 5026
 	$inline_save = $action == 'inline-save' ? true : false;
5027 5027
 
5028
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5028
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5029 5029
 		return;
5030 5030
 	}
5031 5031
 
5032
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5032
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5033 5033
 		return;
5034 5034
 	}
5035 5035
 
5036 5036
 	$user_id = (int) get_current_user_id();
5037 5037
 
5038
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5039
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5038
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5039
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5040 5040
 
5041
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5042
-			$from_email   = get_option( 'site_email' );
5041
+		if ($user_id == $author_id && !is_super_admin()) {
5042
+			$from_email   = get_option('site_email');
5043 5043
 			$from_name    = get_site_emailName();
5044
-			$to_email     = get_option( 'admin_email' );
5045
-			$to_name      = get_option( 'name' );
5044
+			$to_email     = get_option('admin_email');
5045
+			$to_name      = get_option('name');
5046 5046
 			$message_type = 'listing_edited';
5047 5047
 
5048 5048
 			$notify_edited = true;
@@ -5054,9 +5054,9 @@  discard block
 block discarded – undo
5054 5054
 			 * @param bool $notify_edited Notify on listing edited by author?
5055 5055
 			 * @param object $post        The current post object.
5056 5056
 			 */
5057
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5057
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5058 5058
 
5059
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5059
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5060 5060
 		}
5061 5061
 	}
5062 5062
 }
@@ -5071,14 +5071,14 @@  discard block
 block discarded – undo
5071 5071
  *
5072 5072
  * @return string|null The current page start & end numbering.
5073 5073
  */
5074
-function geodir_title_meta_page( $sep ) {
5074
+function geodir_title_meta_page($sep) {
5075 5075
 	$replacement = null;
5076 5076
 
5077
-	$max = geodir_title_meta_pagenumbering( 'max' );
5078
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5077
+	$max = geodir_title_meta_pagenumbering('max');
5078
+	$nr  = geodir_title_meta_pagenumbering('nr');
5079 5079
 
5080
-	if ( $max > 1 && $nr > 1 ) {
5081
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5080
+	if ($max > 1 && $nr > 1) {
5081
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5082 5082
 	}
5083 5083
 
5084 5084
 	return $replacement;
@@ -5095,8 +5095,8 @@  discard block
 block discarded – undo
5095 5095
 function geodir_title_meta_pagenumber() {
5096 5096
 	$replacement = null;
5097 5097
 
5098
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5099
-	if ( isset( $nr ) && $nr > 0 ) {
5098
+	$nr = geodir_title_meta_pagenumbering('nr');
5099
+	if (isset($nr) && $nr > 0) {
5100 5100
 		$replacement = (string) $nr;
5101 5101
 	}
5102 5102
 
@@ -5114,8 +5114,8 @@  discard block
 block discarded – undo
5114 5114
 function geodir_title_meta_pagetotal() {
5115 5115
 	$replacement = null;
5116 5116
 
5117
-	$max = geodir_title_meta_pagenumbering( 'max' );
5118
-	if ( isset( $max ) && $max > 0 ) {
5117
+	$max = geodir_title_meta_pagenumbering('max');
5118
+	if (isset($max) && $max > 0) {
5119 5119
 		$replacement = (string) $max;
5120 5120
 	}
5121 5121
 
@@ -5135,36 +5135,36 @@  discard block
 block discarded – undo
5135 5135
  *
5136 5136
  * @return int|null The current page numbering.
5137 5137
  */
5138
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5138
+function geodir_title_meta_pagenumbering($request = 'nr') {
5139 5139
 	global $wp_query, $post;
5140 5140
 	$max_num_pages = null;
5141 5141
 	$page_number   = null;
5142 5142
 
5143 5143
 	$max_num_pages = 1;
5144 5144
 
5145
-	if ( ! is_singular() ) {
5146
-		$page_number = get_query_var( 'paged' );
5147
-		if ( $page_number === 0 || $page_number === '' ) {
5145
+	if (!is_singular()) {
5146
+		$page_number = get_query_var('paged');
5147
+		if ($page_number === 0 || $page_number === '') {
5148 5148
 			$page_number = 1;
5149 5149
 		}
5150 5150
 
5151
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5151
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5152 5152
 			$max_num_pages = $wp_query->max_num_pages;
5153 5153
 		}
5154 5154
 	} else {
5155
-		$page_number = get_query_var( 'page' );
5156
-		if ( $page_number === 0 || $page_number === '' ) {
5155
+		$page_number = get_query_var('page');
5156
+		if ($page_number === 0 || $page_number === '') {
5157 5157
 			$page_number = 1;
5158 5158
 		}
5159 5159
 
5160
-		if ( isset( $post->post_content ) ) {
5161
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5160
+		if (isset($post->post_content)) {
5161
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5162 5162
 		}
5163 5163
 	}
5164 5164
 
5165 5165
 	$return = null;
5166 5166
 
5167
-	switch ( $request ) {
5167
+	switch ($request) {
5168 5168
 		case 'nr':
5169 5169
 			$return = $page_number;
5170 5170
 			break;
@@ -5185,14 +5185,14 @@  discard block
 block discarded – undo
5185 5185
  *
5186 5186
  * @return array Terms.
5187 5187
  */
5188
-function geodir_filter_empty_terms( $terms ) {
5189
-	if ( empty( $terms ) ) {
5188
+function geodir_filter_empty_terms($terms) {
5189
+	if (empty($terms)) {
5190 5190
 		return $terms;
5191 5191
 	}
5192 5192
 
5193 5193
 	$return = array();
5194
-	foreach ( $terms as $term ) {
5195
-		if ( isset( $term->count ) && $term->count > 0 ) {
5194
+	foreach ($terms as $term) {
5195
+		if (isset($term->count) && $term->count > 0) {
5196 5196
 			$return[] = $term;
5197 5197
 		} else {
5198 5198
 			/**
@@ -5203,7 +5203,7 @@  discard block
 block discarded – undo
5203 5203
 			 * @param array $return The array of terms to return.
5204 5204
 			 * @param object $term  The term object.
5205 5205
 			 */
5206
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5206
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5207 5207
 		}
5208 5208
 	}
5209 5209
 
@@ -5220,12 +5220,12 @@  discard block
 block discarded – undo
5220 5220
  *
5221 5221
  * @return array
5222 5222
  */
5223
-function geodir_remove_hentry( $class ) {
5224
-	if ( geodir_is_page( 'detail' ) ) {
5225
-		$class = array_diff( $class, array( 'hentry' ) );
5223
+function geodir_remove_hentry($class) {
5224
+	if (geodir_is_page('detail')) {
5225
+		$class = array_diff($class, array('hentry'));
5226 5226
 	}
5227 5227
 
5228 5228
 	return $class;
5229 5229
 }
5230 5230
 
5231
-add_filter( 'post_class', 'geodir_remove_hentry' );
5232 5231
\ No newline at end of file
5232
+add_filter('post_class', 'geodir_remove_hentry');
5233 5233
\ No newline at end of file
Please login to merge, or discard this patch.
upgrade.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@
 block discarded – undo
324 324
 
325 325
             if(!empty($show_in_arr )){
326 326
                 $show_in_arr = implode(',',$show_in_arr);
327
-            }else{
327
+            } else{
328 328
                 $show_in_arr = '';
329 329
             }
330 330
 
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $wpdb;
11 11
 
12
-if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
12
+if (get_option('geodirectory'.'_db_version') != GEODIRECTORY_VERSION) {
13 13
     /**
14 14
      * Include custom database table related functions.
15 15
      *
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 
51
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
51
+    add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
52 52
 
53
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
53
+    update_option('geodirectory'.'_db_version', GEODIRECTORY_VERSION);
54 54
 
55 55
 }
56 56
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  * @since 1.0.0
87 87
  * @package GeoDirectory
88 88
  */
89
-function geodir_upgrade_146(){
89
+function geodir_upgrade_146() {
90 90
     gd_convert_virtual_pages();
91 91
 }
92 92
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * @since 1.5.0
97 97
  * @package GeoDirectory
98 98
  */
99
-function geodir_upgrade_150(){
99
+function geodir_upgrade_150() {
100 100
     gd_fix_cpt_rewrite_slug();
101 101
 }
102 102
 
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
  * @since 1.4.8
109 109
  * @package GeoDirectory
110 110
  */
111
-function geodir_upgrade_148(){
111
+function geodir_upgrade_148() {
112 112
     /*
113 113
      * Blank the users google password if present as we now use oAuth 2.0
114 114
      */
115
-    update_option('geodir_ga_pass','');
116
-    update_option('geodir_ga_user','');
115
+    update_option('geodir_ga_pass', '');
116
+    update_option('geodir_ga_user', '');
117 117
 
118 118
 }
119 119
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
  * @since 1.5.3
125 125
  * @package GeoDirectory
126 126
  */
127
-function geodir_upgrade_153(){
127
+function geodir_upgrade_153() {
128 128
     geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
129 129
     geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
130 130
 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @since 1.5.3
136 136
  * @package GeoDirectory
137 137
  */
138
-function geodir_upgrade_154(){
138
+function geodir_upgrade_154() {
139 139
     geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
140 140
 }
141 141
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
  * @since 1.5.2
146 146
  * @package GeoDirectory
147 147
  */
148
-function geodir_upgrade_152(){
148
+function geodir_upgrade_152() {
149 149
     gd_fix_address_detail_table_limit();
150 150
 }
151 151
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 function geodir_fix_review_date()
182 182
 {
183 183
     global $wpdb;
184
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
184
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
185 185
 }
186 186
 
187 187
 /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 function geodir_fix_review_post_status()
195 195
 {
196 196
     global $wpdb;
197
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
197
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
198 198
 }
199 199
 
200 200
 /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 function geodir_fix_review_content()
209 209
 {
210 210
     global $wpdb;
211
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
211
+    if ($wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
212 212
         return true;
213 213
     } else {
214 214
         return false;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         foreach ($all_postypes as $key) {
234 234
             // update each GD CTP
235 235
 
236
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
236
+            $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN ".$wpdb->prefix."geodir_".$key."_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
237 237
 
238 238
         }
239 239
         return true;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     if (!empty($all_postypes)) {
258 258
         foreach ($all_postypes as $key) {
259 259
             // update each GD CTP
260
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
260
+            $reviews = $wpdb->get_results("SELECT post_id FROM ".$wpdb->prefix."geodir_".$key."_detail d");
261 261
 
262 262
             if (!empty($reviews)) {
263 263
                 foreach ($reviews as $post_id) {
@@ -272,51 +272,51 @@  discard block
 block discarded – undo
272 272
 }
273 273
 
274 274
 
275
-function gd_convert_custom_field_display(){
275
+function gd_convert_custom_field_display() {
276 276
     global $wpdb;
277 277
 
278
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
278
+    $field_info = $wpdb->get_results("select * from ".GEODIR_CUSTOM_FIELDS_TABLE);
279 279
 
280 280
     $has_run = get_option('gd_convert_custom_field_display');
281
-    if($has_run){return;}
281
+    if ($has_run) {return; }
282 282
 
283 283
     // set the field_type_key for standard fields
284 284
     $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
285 285
 
286 286
 
287
-    if(is_array( $field_info)){
287
+    if (is_array($field_info)) {
288 288
 
289
-        foreach( $field_info as $cf){
289
+        foreach ($field_info as $cf) {
290 290
 
291 291
             $id = $cf->id;
292 292
 
293
-            if(!property_exists($cf,'show_in') || !$id){return;}
293
+            if (!property_exists($cf, 'show_in') || !$id) {return; }
294 294
 
295 295
             $show_in_arr = array();
296 296
 
297
-            if($cf->is_default){
297
+            if ($cf->is_default) {
298 298
                 $show_in_arr[] = "[detail]";
299 299
             }
300 300
 
301
-            if($cf->show_on_detail){
301
+            if ($cf->show_on_detail) {
302 302
                 $show_in_arr[] = "[moreinfo]";
303 303
             }
304 304
 
305
-            if($cf->show_on_listing){
305
+            if ($cf->show_on_listing) {
306 306
                 $show_in_arr[] = "[listing]";
307 307
             }
308 308
 
309
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
309
+            if ($cf->show_as_tab || $cf->htmlvar_name == 'geodir_video' || $cf->htmlvar_name == 'geodir_special_offers') {
310 310
                 $show_in_arr[] = "[owntab]";
311 311
             }
312 312
 
313
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
313
+            if ($cf->htmlvar_name == 'post' || $cf->htmlvar_name == 'geodir_contact' || $cf->htmlvar_name == 'geodir_timing') {
314 314
                 $show_in_arr[] = "[mapbubble]";
315 315
             }
316 316
 
317
-            if(!empty($show_in_arr )){
318
-                $show_in_arr = implode(',',$show_in_arr);
319
-            }else{
317
+            if (!empty($show_in_arr)) {
318
+                $show_in_arr = implode(',', $show_in_arr);
319
+            } else {
320 320
                 $show_in_arr = '';
321 321
             }
322 322
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
         }
326 326
 
327
-        update_option('gd_convert_custom_field_display',1);
327
+        update_option('gd_convert_custom_field_display', 1);
328 328
     }
329 329
 }
330 330
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
     update_option('gd_theme_compats', $theme_compat);
703 703
 
704
-    gd_set_theme_compat();// set the compat pack if avail
704
+    gd_set_theme_compat(); // set the compat pack if avail
705 705
 }
706 706
 
707 707
 
@@ -712,61 +712,61 @@  discard block
 block discarded – undo
712 712
  * @package GeoDirectory
713 713
  * @global object $wpdb WordPress Database object.
714 714
  */
715
-function gd_convert_virtual_pages(){
715
+function gd_convert_virtual_pages() {
716 716
     global $wpdb;
717 717
 
718 718
     // Update the add listing page settings
719 719
     $add_listing_page = $wpdb->get_var(
720 720
         $wpdb->prepare(
721
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
721
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
722 722
             array('add-listing')
723 723
         )
724 724
     );
725 725
 
726
-    if($add_listing_page){
727
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
728
-        update_option( 'geodir_add_listing_page', $add_listing_page);
726
+    if ($add_listing_page) {
727
+        wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
728
+        update_option('geodir_add_listing_page', $add_listing_page);
729 729
     }
730 730
 
731 731
     // Update the listing preview page settings
732 732
     $listing_preview_page = $wpdb->get_var(
733 733
         $wpdb->prepare(
734
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
734
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
735 735
             array('listing-preview')
736 736
         )
737 737
     );
738 738
 
739
-    if($listing_preview_page){
740
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
741
-        update_option( 'geodir_preview_page', $listing_preview_page);
739
+    if ($listing_preview_page) {
740
+        wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
741
+        update_option('geodir_preview_page', $listing_preview_page);
742 742
     }
743 743
 
744 744
     // Update the listing success page settings
745 745
     $listing_success_page = $wpdb->get_var(
746 746
         $wpdb->prepare(
747
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
747
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
748 748
             array('listing-success')
749 749
         )
750 750
     );
751 751
 
752
-    if($listing_success_page){
753
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
754
-        update_option( 'geodir_success_page', $listing_success_page);
752
+    if ($listing_success_page) {
753
+        wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
754
+        update_option('geodir_success_page', $listing_success_page);
755 755
     }
756 756
 
757 757
     // Update the listing success page settings
758 758
     $location_page = $wpdb->get_var(
759 759
         $wpdb->prepare(
760
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
760
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
761 761
             array('location')
762 762
         )
763 763
     );
764 764
 
765
-    if($location_page){
765
+    if ($location_page) {
766 766
         $location_slug = get_option('geodir_location_prefix');
767
-        if(!$location_slug ){$location_slug  = 'location';}
768
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
769
-        update_option( 'geodir_location_page', $location_page);
767
+        if (!$location_slug) {$location_slug = 'location'; }
768
+        wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
769
+        update_option('geodir_location_page', $location_page);
770 770
     }
771 771
 
772 772
 }
@@ -785,13 +785,13 @@  discard block
 block discarded – undo
785 785
     $post_types = get_option('geodir_post_types');
786 786
 
787 787
 
788
-    if (is_array($post_types)){
788
+    if (is_array($post_types)) {
789 789
 
790 790
         foreach ($post_types as $post_type => $args) {
791 791
 
792 792
 
793
-            if(isset($args['rewrite']['slug'])){
794
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
793
+            if (isset($args['rewrite']['slug'])) {
794
+                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
795 795
             }
796 796
 
797 797
                 $alt_post_types[$post_type] = $args;
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
         }
800 800
     }
801 801
 
802
-    if(!empty($alt_post_types)) {
803
-        update_option('geodir_post_types',$alt_post_types);
802
+    if (!empty($alt_post_types)) {
803
+        update_option('geodir_post_types', $alt_post_types);
804 804
         }
805 805
 
806 806
 
@@ -826,9 +826,9 @@  discard block
 block discarded – undo
826 826
         foreach ($all_postypes as $key) {
827 827
             // update each GD CTP
828 828
             try {
829
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
830
-            } catch(Exception $e) {
831
-                error_log( 'Error: ' . $e->getMessage() );
829
+                $wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_".$key."_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
830
+            } catch (Exception $e) {
831
+                error_log('Error: '.$e->getMessage());
832 832
             }
833 833
         }
834 834
     }
Please login to merge, or discard this patch.
Indentation   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -10,47 +10,47 @@  discard block
 block discarded – undo
10 10
 global $wpdb;
11 11
 
12 12
 if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
13
-    /**
14
-     * Include custom database table related functions.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     */
19
-    include_once('geodirectory-admin/admin_db_install.php');
20
-    add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
-    if (GEODIRECTORY_VERSION <= '1.3.6') {
22
-        add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
-    }
13
+	/**
14
+	 * Include custom database table related functions.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 */
19
+	include_once('geodirectory-admin/admin_db_install.php');
20
+	add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
+	if (GEODIRECTORY_VERSION <= '1.3.6') {
22
+		add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
+	}
24 24
 
25
-    if (GEODIRECTORY_VERSION <= '1.4.6') {
26
-        add_action('init', 'geodir_upgrade_146', 11);
27
-    }
25
+	if (GEODIRECTORY_VERSION <= '1.4.6') {
26
+		add_action('init', 'geodir_upgrade_146', 11);
27
+	}
28 28
 
29
-    if (GEODIRECTORY_VERSION <= '1.4.8') {
30
-        add_action('init', 'geodir_upgrade_148', 11);
31
-    }
29
+	if (GEODIRECTORY_VERSION <= '1.4.8') {
30
+		add_action('init', 'geodir_upgrade_148', 11);
31
+	}
32 32
 
33
-    if (GEODIRECTORY_VERSION <= '1.5.0') {
34
-        add_action('init', 'geodir_upgrade_150', 11);
35
-    }
33
+	if (GEODIRECTORY_VERSION <= '1.5.0') {
34
+		add_action('init', 'geodir_upgrade_150', 11);
35
+	}
36 36
 
37
-    if (GEODIRECTORY_VERSION <= '1.5.2') {
38
-        add_action('init', 'geodir_upgrade_152', 11);
39
-    }
37
+	if (GEODIRECTORY_VERSION <= '1.5.2') {
38
+		add_action('init', 'geodir_upgrade_152', 11);
39
+	}
40 40
 
41
-    if (GEODIRECTORY_VERSION <= '1.5.3') {
42
-        add_action('init', 'geodir_upgrade_153', 11);
43
-    }
41
+	if (GEODIRECTORY_VERSION <= '1.5.3') {
42
+		add_action('init', 'geodir_upgrade_153', 11);
43
+	}
44 44
 
45
-    if (GEODIRECTORY_VERSION <= '1.5.4') {
46
-        add_action('init', 'geodir_upgrade_154', 11);
47
-    }
45
+	if (GEODIRECTORY_VERSION <= '1.5.4') {
46
+		add_action('init', 'geodir_upgrade_154', 11);
47
+	}
48 48
 
49 49
 
50 50
 
51
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
51
+	add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
52 52
 
53
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
53
+	update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
54 54
 
55 55
 }
56 56
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  */
64 64
 function geodirectory_upgrade_all()
65 65
 {
66
-    geodir_create_tables();
67
-    geodir_update_review_db();
68
-    gd_install_theme_compat();
69
-    gd_convert_custom_field_display();
66
+	geodir_create_tables();
67
+	geodir_update_review_db();
68
+	gd_install_theme_compat();
69
+	gd_convert_custom_field_display();
70 70
 }
71 71
 
72 72
 /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function geodir_upgrade_136()
79 79
 {
80
-    geodir_fix_review_overall_rating();
80
+	geodir_fix_review_overall_rating();
81 81
 }
82 82
 
83 83
 /**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  * @package GeoDirectory
88 88
  */
89 89
 function geodir_upgrade_146(){
90
-    gd_convert_virtual_pages();
90
+	gd_convert_virtual_pages();
91 91
 }
92 92
 
93 93
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  * @package GeoDirectory
98 98
  */
99 99
 function geodir_upgrade_150(){
100
-    gd_fix_cpt_rewrite_slug();
100
+	gd_fix_cpt_rewrite_slug();
101 101
 }
102 102
 
103 103
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
  * @package GeoDirectory
110 110
  */
111 111
 function geodir_upgrade_148(){
112
-    /*
112
+	/*
113 113
      * Blank the users google password if present as we now use oAuth 2.0
114 114
      */
115
-    update_option('geodir_ga_pass','');
116
-    update_option('geodir_ga_user','');
115
+	update_option('geodir_ga_pass','');
116
+	update_option('geodir_ga_user','');
117 117
 
118 118
 }
119 119
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  * @package GeoDirectory
126 126
  */
127 127
 function geodir_upgrade_153(){
128
-    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
129
-    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
128
+	geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
129
+	geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
130 130
 }
131 131
 
132 132
 /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  * @package GeoDirectory
137 137
  */
138 138
 function geodir_upgrade_154(){
139
-    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
139
+	geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
140 140
 }
141 141
 
142 142
 /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
  * @package GeoDirectory
147 147
  */
148 148
 function geodir_upgrade_152(){
149
-    gd_fix_address_detail_table_limit();
149
+	gd_fix_address_detail_table_limit();
150 150
 }
151 151
 
152 152
 
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function geodir_update_review_db()
164 164
 {
165
-    global $wpdb, $plugin_prefix;
165
+	global $wpdb, $plugin_prefix;
166 166
 
167
-    geodir_fix_review_date();
168
-    geodir_fix_review_post_status();
169
-    geodir_fix_review_content();
170
-    geodir_fix_review_location();
167
+	geodir_fix_review_date();
168
+	geodir_fix_review_post_status();
169
+	geodir_fix_review_content();
170
+	geodir_fix_review_location();
171 171
 
172 172
 }
173 173
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
  */
181 181
 function geodir_fix_review_date()
182 182
 {
183
-    global $wpdb;
184
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
183
+	global $wpdb;
184
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
185 185
 }
186 186
 
187 187
 /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
  */
194 194
 function geodir_fix_review_post_status()
195 195
 {
196
-    global $wpdb;
197
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
196
+	global $wpdb;
197
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
198 198
 }
199 199
 
200 200
 /**
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
  */
208 208
 function geodir_fix_review_content()
209 209
 {
210
-    global $wpdb;
211
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
212
-        return true;
213
-    } else {
214
-        return false;
215
-    }
210
+	global $wpdb;
211
+	if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
212
+		return true;
213
+	} else {
214
+		return false;
215
+	}
216 216
 }
217 217
 
218 218
 /**
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
  */
226 226
 function geodir_fix_review_location()
227 227
 {
228
-    global $wpdb;
228
+	global $wpdb;
229 229
 
230
-    $all_postypes = geodir_get_posttypes();
230
+	$all_postypes = geodir_get_posttypes();
231 231
 
232
-    if (!empty($all_postypes)) {
233
-        foreach ($all_postypes as $key) {
234
-            // update each GD CTP
232
+	if (!empty($all_postypes)) {
233
+		foreach ($all_postypes as $key) {
234
+			// update each GD CTP
235 235
 
236
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
236
+			$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
237 237
 
238
-        }
239
-        return true;
240
-    }
241
-    return false;
238
+		}
239
+		return true;
240
+	}
241
+	return false;
242 242
 }
243 243
 
244 244
 /**
@@ -250,82 +250,82 @@  discard block
 block discarded – undo
250 250
  */
251 251
 function geodir_fix_review_overall_rating()
252 252
 {
253
-    global $wpdb;
253
+	global $wpdb;
254 254
 
255
-    $all_postypes = geodir_get_posttypes();
255
+	$all_postypes = geodir_get_posttypes();
256 256
 
257
-    if (!empty($all_postypes)) {
258
-        foreach ($all_postypes as $key) {
259
-            // update each GD CTP
260
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
257
+	if (!empty($all_postypes)) {
258
+		foreach ($all_postypes as $key) {
259
+			// update each GD CTP
260
+			$reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
261 261
 
262
-            if (!empty($reviews)) {
263
-                foreach ($reviews as $post_id) {
264
-                    geodir_update_postrating($post_id->post_id, $key);
265
-                }
262
+			if (!empty($reviews)) {
263
+				foreach ($reviews as $post_id) {
264
+					geodir_update_postrating($post_id->post_id, $key);
265
+				}
266 266
 
267
-            }
267
+			}
268 268
 
269
-        }
269
+		}
270 270
 
271
-    }
271
+	}
272 272
 }
273 273
 
274 274
 
275 275
 function gd_convert_custom_field_display(){
276
-    global $wpdb;
276
+	global $wpdb;
277 277
 
278
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
278
+	$field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
279 279
 
280
-    $has_run = get_option('gd_convert_custom_field_display');
281
-    if($has_run){return;}
280
+	$has_run = get_option('gd_convert_custom_field_display');
281
+	if($has_run){return;}
282 282
 
283
-    // set the field_type_key for standard fields
284
-    $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
283
+	// set the field_type_key for standard fields
284
+	$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
285 285
 
286 286
 
287
-    if(is_array( $field_info)){
287
+	if(is_array( $field_info)){
288 288
 
289
-        foreach( $field_info as $cf){
289
+		foreach( $field_info as $cf){
290 290
 
291
-            $id = $cf->id;
291
+			$id = $cf->id;
292 292
 
293
-            if(!property_exists($cf,'show_in') || !$id){return;}
293
+			if(!property_exists($cf,'show_in') || !$id){return;}
294 294
 
295
-            $show_in_arr = array();
295
+			$show_in_arr = array();
296 296
 
297
-            if($cf->is_default){
298
-                $show_in_arr[] = "[detail]";
299
-            }
297
+			if($cf->is_default){
298
+				$show_in_arr[] = "[detail]";
299
+			}
300 300
 
301
-            if($cf->show_on_detail){
302
-                $show_in_arr[] = "[moreinfo]";
303
-            }
301
+			if($cf->show_on_detail){
302
+				$show_in_arr[] = "[moreinfo]";
303
+			}
304 304
 
305
-            if($cf->show_on_listing){
306
-                $show_in_arr[] = "[listing]";
307
-            }
305
+			if($cf->show_on_listing){
306
+				$show_in_arr[] = "[listing]";
307
+			}
308 308
 
309
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
310
-                $show_in_arr[] = "[owntab]";
311
-            }
309
+			if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
310
+				$show_in_arr[] = "[owntab]";
311
+			}
312 312
 
313
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
314
-                $show_in_arr[] = "[mapbubble]";
315
-            }
313
+			if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
314
+				$show_in_arr[] = "[mapbubble]";
315
+			}
316 316
 
317
-            if(!empty($show_in_arr )){
318
-                $show_in_arr = implode(',',$show_in_arr);
319
-            }else{
320
-                $show_in_arr = '';
321
-            }
317
+			if(!empty($show_in_arr )){
318
+				$show_in_arr = implode(',',$show_in_arr);
319
+			}else{
320
+				$show_in_arr = '';
321
+			}
322 322
 
323
-            $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
323
+			$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
324 324
 
325
-        }
325
+		}
326 326
 
327
-        update_option('gd_convert_custom_field_display',1);
328
-    }
327
+		update_option('gd_convert_custom_field_display',1);
328
+	}
329 329
 }
330 330
 
331 331
 ############################################
@@ -341,372 +341,372 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function gd_install_theme_compat()
343 343
 {
344
-    global $wpdb;
344
+	global $wpdb;
345 345
 
346
-    $theme_compat = array();
347
-    $theme_compat = get_option('gd_theme_compats');
346
+	$theme_compat = array();
347
+	$theme_compat = get_option('gd_theme_compats');
348 348
 //GDF
349
-    $theme_compat['GeoDirectory_Framework'] = array(
350
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
351
-        'geodir_wrapper_open_class' => '',
352
-        'geodir_wrapper_open_replace' => '',
353
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
354
-        'geodir_wrapper_content_open_id' => 'geodir_content',
355
-        'geodir_wrapper_content_open_class' => '',
356
-        'geodir_wrapper_content_open_replace' => '',
357
-        'geodir_wrapper_content_close_replace' => '',
358
-        'geodir_article_open_id' => '',
359
-        'geodir_article_open_class' => '',
360
-        'geodir_article_open_replace' => '',
361
-        'geodir_article_close_replace' => '',
362
-        'geodir_sidebar_right_open_id' => '',
363
-        'geodir_sidebar_right_open_class' => '',
364
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
365
-        'geodir_sidebar_right_close_replace' => '',
366
-        'geodir_sidebar_left_open_id' => '',
367
-        'geodir_sidebar_left_open_class' => '',
368
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
369
-        'geodir_sidebar_left_close_replace' => '',
370
-        'geodir_main_content_open_id' => '',
371
-        'geodir_main_content_open_class' => '',
372
-        'geodir_main_content_open_replace' => '<!-- removed -->',
373
-        'geodir_main_content_close_replace' => '<!-- removed -->',
374
-        'geodir_top_content_add' => '',
375
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
376
-        'geodir_before_widget_filter' => '',
377
-        'geodir_after_widget_filter' => '',
378
-        'geodir_theme_compat_css' => '',
379
-        'geodir_theme_compat_js' => '',
380
-        'geodir_theme_compat_default_options' => '',
381
-        'geodir_theme_compat_code' => ''
382
-    );
349
+	$theme_compat['GeoDirectory_Framework'] = array(
350
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
351
+		'geodir_wrapper_open_class' => '',
352
+		'geodir_wrapper_open_replace' => '',
353
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
354
+		'geodir_wrapper_content_open_id' => 'geodir_content',
355
+		'geodir_wrapper_content_open_class' => '',
356
+		'geodir_wrapper_content_open_replace' => '',
357
+		'geodir_wrapper_content_close_replace' => '',
358
+		'geodir_article_open_id' => '',
359
+		'geodir_article_open_class' => '',
360
+		'geodir_article_open_replace' => '',
361
+		'geodir_article_close_replace' => '',
362
+		'geodir_sidebar_right_open_id' => '',
363
+		'geodir_sidebar_right_open_class' => '',
364
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
365
+		'geodir_sidebar_right_close_replace' => '',
366
+		'geodir_sidebar_left_open_id' => '',
367
+		'geodir_sidebar_left_open_class' => '',
368
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
369
+		'geodir_sidebar_left_close_replace' => '',
370
+		'geodir_main_content_open_id' => '',
371
+		'geodir_main_content_open_class' => '',
372
+		'geodir_main_content_open_replace' => '<!-- removed -->',
373
+		'geodir_main_content_close_replace' => '<!-- removed -->',
374
+		'geodir_top_content_add' => '',
375
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
376
+		'geodir_before_widget_filter' => '',
377
+		'geodir_after_widget_filter' => '',
378
+		'geodir_theme_compat_css' => '',
379
+		'geodir_theme_compat_js' => '',
380
+		'geodir_theme_compat_default_options' => '',
381
+		'geodir_theme_compat_code' => ''
382
+	);
383 383
 
384 384
 //Directory Theme
385
-    $theme_compat['Directory_Starter'] = array(
386
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
387
-        'geodir_wrapper_open_class' => '',
388
-        'geodir_wrapper_open_replace' => '',
389
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
390
-        'geodir_wrapper_content_open_id' => 'geodir_content',
391
-        'geodir_wrapper_content_open_class' => '',
392
-        'geodir_wrapper_content_open_replace' => '',
393
-        'geodir_wrapper_content_close_replace' => '',
394
-        'geodir_article_open_id' => '',
395
-        'geodir_article_open_class' => '',
396
-        'geodir_article_open_replace' => '',
397
-        'geodir_article_close_replace' => '',
398
-        'geodir_sidebar_right_open_id' => '',
399
-        'geodir_sidebar_right_open_class' => '',
400
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
401
-        'geodir_sidebar_right_close_replace' => '',
402
-        'geodir_sidebar_left_open_id' => '',
403
-        'geodir_sidebar_left_open_class' => '',
404
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
405
-        'geodir_sidebar_left_close_replace' => '',
406
-        'geodir_main_content_open_id' => '',
407
-        'geodir_main_content_open_class' => '',
408
-        'geodir_main_content_open_replace' => '<!-- removed -->',
409
-        'geodir_main_content_close_replace' => '<!-- removed -->',
410
-        'geodir_top_content_add' => '',
411
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
412
-        'geodir_before_widget_filter' => '',
413
-        'geodir_after_widget_filter' => '',
414
-        'geodir_theme_compat_css' => '',
415
-        'geodir_theme_compat_js' => '',
416
-        'geodir_theme_compat_default_options' => '',
417
-        'geodir_theme_compat_code' => ''
418
-    );
385
+	$theme_compat['Directory_Starter'] = array(
386
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
387
+		'geodir_wrapper_open_class' => '',
388
+		'geodir_wrapper_open_replace' => '',
389
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
390
+		'geodir_wrapper_content_open_id' => 'geodir_content',
391
+		'geodir_wrapper_content_open_class' => '',
392
+		'geodir_wrapper_content_open_replace' => '',
393
+		'geodir_wrapper_content_close_replace' => '',
394
+		'geodir_article_open_id' => '',
395
+		'geodir_article_open_class' => '',
396
+		'geodir_article_open_replace' => '',
397
+		'geodir_article_close_replace' => '',
398
+		'geodir_sidebar_right_open_id' => '',
399
+		'geodir_sidebar_right_open_class' => '',
400
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
401
+		'geodir_sidebar_right_close_replace' => '',
402
+		'geodir_sidebar_left_open_id' => '',
403
+		'geodir_sidebar_left_open_class' => '',
404
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
405
+		'geodir_sidebar_left_close_replace' => '',
406
+		'geodir_main_content_open_id' => '',
407
+		'geodir_main_content_open_class' => '',
408
+		'geodir_main_content_open_replace' => '<!-- removed -->',
409
+		'geodir_main_content_close_replace' => '<!-- removed -->',
410
+		'geodir_top_content_add' => '',
411
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
412
+		'geodir_before_widget_filter' => '',
413
+		'geodir_after_widget_filter' => '',
414
+		'geodir_theme_compat_css' => '',
415
+		'geodir_theme_compat_js' => '',
416
+		'geodir_theme_compat_default_options' => '',
417
+		'geodir_theme_compat_code' => ''
418
+	);
419 419
 
420 420
 //Jobby
421
-    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
421
+	$theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
422 422
 
423 423
 //GeoProperty
424
-    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
424
+	$theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
425 425
 
426 426
 //Avada
427
-    $theme_compat['Avada'] = array(
428
-        'geodir_wrapper_open_id' => '',
429
-        'geodir_wrapper_open_class' => '',
430
-        'geodir_wrapper_open_replace' => '<!-- removed -->',
431
-        'geodir_wrapper_close_replace' => '<!-- removed -->',
432
-        'geodir_wrapper_content_open_id' => 'content',
433
-        'geodir_wrapper_content_open_class' => '',
434
-        'geodir_wrapper_content_open_replace' => '',
435
-        'geodir_wrapper_content_close_replace' => '',
436
-        'geodir_article_open_id' => '',
437
-        'geodir_article_open_class' => '',
438
-        'geodir_article_open_replace' => '',
439
-        'geodir_article_close_replace' => '',
440
-        'geodir_sidebar_right_open_id' => '',
441
-        'geodir_sidebar_right_open_class' => '',
442
-        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
443
-        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
444
-        'geodir_sidebar_left_open_id' => '',
445
-        'geodir_sidebar_left_open_class' => '',
446
-        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
447
-        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
448
-        'geodir_main_content_open_id' => '',
449
-        'geodir_main_content_open_class' => '',
450
-        'geodir_main_content_open_replace' => '<!-- removed -->',
451
-        'geodir_main_content_close_replace' => '<!-- removed -->',
452
-        'geodir_top_content_add' => '',
453
-        'geodir_before_main_content_add' => '',
454
-        'geodir_before_widget_filter' => '',
455
-        'geodir_after_widget_filter' => '',
456
-        'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
457
-        'geodir_theme_compat_js' => '',
458
-        'geodir_theme_compat_default_options' => '',
459
-        'geodir_theme_compat_code' => 'Avada'
460
-    );
427
+	$theme_compat['Avada'] = array(
428
+		'geodir_wrapper_open_id' => '',
429
+		'geodir_wrapper_open_class' => '',
430
+		'geodir_wrapper_open_replace' => '<!-- removed -->',
431
+		'geodir_wrapper_close_replace' => '<!-- removed -->',
432
+		'geodir_wrapper_content_open_id' => 'content',
433
+		'geodir_wrapper_content_open_class' => '',
434
+		'geodir_wrapper_content_open_replace' => '',
435
+		'geodir_wrapper_content_close_replace' => '',
436
+		'geodir_article_open_id' => '',
437
+		'geodir_article_open_class' => '',
438
+		'geodir_article_open_replace' => '',
439
+		'geodir_article_close_replace' => '',
440
+		'geodir_sidebar_right_open_id' => '',
441
+		'geodir_sidebar_right_open_class' => '',
442
+		'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
443
+		'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
444
+		'geodir_sidebar_left_open_id' => '',
445
+		'geodir_sidebar_left_open_class' => '',
446
+		'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
447
+		'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
448
+		'geodir_main_content_open_id' => '',
449
+		'geodir_main_content_open_class' => '',
450
+		'geodir_main_content_open_replace' => '<!-- removed -->',
451
+		'geodir_main_content_close_replace' => '<!-- removed -->',
452
+		'geodir_top_content_add' => '',
453
+		'geodir_before_main_content_add' => '',
454
+		'geodir_before_widget_filter' => '',
455
+		'geodir_after_widget_filter' => '',
456
+		'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
457
+		'geodir_theme_compat_js' => '',
458
+		'geodir_theme_compat_default_options' => '',
459
+		'geodir_theme_compat_code' => 'Avada'
460
+	);
461 461
 
462 462
 //Enfold
463
-    $theme_compat['Enfold'] = array(
464
-        'geodir_wrapper_open_id' => '',
465
-        'geodir_wrapper_open_class' => '',
466
-        'geodir_wrapper_open_replace' => '',
467
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
468
-        'geodir_wrapper_content_open_id' => '',
469
-        'geodir_wrapper_content_open_class' => '',
470
-        'geodir_wrapper_content_open_replace' => '',
471
-        'geodir_wrapper_content_close_replace' => '</div></main>',
472
-        'geodir_article_open_id' => '',
473
-        'geodir_article_open_class' => '',
474
-        'geodir_article_open_replace' => '',
475
-        'geodir_article_close_replace' => '',
476
-        'geodir_sidebar_right_open_id' => '',
477
-        'geodir_sidebar_right_open_class' => '',
478
-        'geodir_sidebar_right_open_replace' => '',
479
-        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
480
-        'geodir_sidebar_left_open_id' => '',
481
-        'geodir_sidebar_left_open_class' => '',
482
-        'geodir_sidebar_left_open_replace' => '',
483
-        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
484
-        'geodir_main_content_open_id' => '',
485
-        'geodir_main_content_open_class' => '',
486
-        'geodir_main_content_open_replace' => '',
487
-        'geodir_main_content_close_replace' => '',
488
-        'geodir_top_content_add' => '',
489
-        'geodir_before_main_content_add' => '',
490
-        'geodir_before_widget_filter' => '',
491
-        'geodir_after_widget_filter' => '',
492
-        'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
493
-        'geodir_theme_compat_js' => '',
494
-        'geodir_theme_compat_default_options' => '',
495
-        'geodir_theme_compat_code' => 'Enfold'
496
-    );
463
+	$theme_compat['Enfold'] = array(
464
+		'geodir_wrapper_open_id' => '',
465
+		'geodir_wrapper_open_class' => '',
466
+		'geodir_wrapper_open_replace' => '',
467
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
468
+		'geodir_wrapper_content_open_id' => '',
469
+		'geodir_wrapper_content_open_class' => '',
470
+		'geodir_wrapper_content_open_replace' => '',
471
+		'geodir_wrapper_content_close_replace' => '</div></main>',
472
+		'geodir_article_open_id' => '',
473
+		'geodir_article_open_class' => '',
474
+		'geodir_article_open_replace' => '',
475
+		'geodir_article_close_replace' => '',
476
+		'geodir_sidebar_right_open_id' => '',
477
+		'geodir_sidebar_right_open_class' => '',
478
+		'geodir_sidebar_right_open_replace' => '',
479
+		'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
480
+		'geodir_sidebar_left_open_id' => '',
481
+		'geodir_sidebar_left_open_class' => '',
482
+		'geodir_sidebar_left_open_replace' => '',
483
+		'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
484
+		'geodir_main_content_open_id' => '',
485
+		'geodir_main_content_open_class' => '',
486
+		'geodir_main_content_open_replace' => '',
487
+		'geodir_main_content_close_replace' => '',
488
+		'geodir_top_content_add' => '',
489
+		'geodir_before_main_content_add' => '',
490
+		'geodir_before_widget_filter' => '',
491
+		'geodir_after_widget_filter' => '',
492
+		'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
493
+		'geodir_theme_compat_js' => '',
494
+		'geodir_theme_compat_default_options' => '',
495
+		'geodir_theme_compat_code' => 'Enfold'
496
+	);
497 497
 
498 498
 // X
499
-    $theme_compat['X'] = array(
500
-        'geodir_wrapper_open_id' => '',
501
-        'geodir_wrapper_open_class' => '',
502
-        'geodir_wrapper_open_replace' => '',
503
-        'geodir_wrapper_close_replace' => '',
504
-        'geodir_wrapper_content_open_id' => '',
505
-        'geodir_wrapper_content_open_class' => '',
506
-        'geodir_wrapper_content_open_replace' => '',
507
-        'geodir_wrapper_content_close_replace' => '',
508
-        'geodir_article_open_id' => '',
509
-        'geodir_article_open_class' => '',
510
-        'geodir_article_open_replace' => '',
511
-        'geodir_article_close_replace' => '',
512
-        'geodir_sidebar_right_open_id' => '',
513
-        'geodir_sidebar_right_open_class' => '',
514
-        'geodir_sidebar_right_open_replace' => '',
515
-        'geodir_sidebar_right_close_replace' => '',
516
-        'geodir_sidebar_left_open_id' => '',
517
-        'geodir_sidebar_left_open_class' => '',
518
-        'geodir_sidebar_left_open_replace' => '',
519
-        'geodir_sidebar_left_close_replace' => '',
520
-        'geodir_main_content_open_id' => '',
521
-        'geodir_main_content_open_class' => '',
522
-        'geodir_main_content_open_replace' => '',
523
-        'geodir_main_content_close_replace' => '',
524
-        'geodir_top_content_add' => '',
525
-        'geodir_before_main_content_add' => '',
526
-        'geodir_before_widget_filter' => '',
527
-        'geodir_after_widget_filter' => '',
528
-        'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
529
-        'geodir_theme_compat_js' => '',
530
-        'geodir_theme_compat_default_options' => '',
531
-        'geodir_theme_compat_code' => 'X'
532
-    );
499
+	$theme_compat['X'] = array(
500
+		'geodir_wrapper_open_id' => '',
501
+		'geodir_wrapper_open_class' => '',
502
+		'geodir_wrapper_open_replace' => '',
503
+		'geodir_wrapper_close_replace' => '',
504
+		'geodir_wrapper_content_open_id' => '',
505
+		'geodir_wrapper_content_open_class' => '',
506
+		'geodir_wrapper_content_open_replace' => '',
507
+		'geodir_wrapper_content_close_replace' => '',
508
+		'geodir_article_open_id' => '',
509
+		'geodir_article_open_class' => '',
510
+		'geodir_article_open_replace' => '',
511
+		'geodir_article_close_replace' => '',
512
+		'geodir_sidebar_right_open_id' => '',
513
+		'geodir_sidebar_right_open_class' => '',
514
+		'geodir_sidebar_right_open_replace' => '',
515
+		'geodir_sidebar_right_close_replace' => '',
516
+		'geodir_sidebar_left_open_id' => '',
517
+		'geodir_sidebar_left_open_class' => '',
518
+		'geodir_sidebar_left_open_replace' => '',
519
+		'geodir_sidebar_left_close_replace' => '',
520
+		'geodir_main_content_open_id' => '',
521
+		'geodir_main_content_open_class' => '',
522
+		'geodir_main_content_open_replace' => '',
523
+		'geodir_main_content_close_replace' => '',
524
+		'geodir_top_content_add' => '',
525
+		'geodir_before_main_content_add' => '',
526
+		'geodir_before_widget_filter' => '',
527
+		'geodir_after_widget_filter' => '',
528
+		'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
529
+		'geodir_theme_compat_js' => '',
530
+		'geodir_theme_compat_default_options' => '',
531
+		'geodir_theme_compat_code' => 'X'
532
+	);
533 533
 
534 534
 // Divi
535
-    $theme_compat['Divi'] = array(
536
-        'geodir_wrapper_open_id' => 'main-content',
537
-        'geodir_wrapper_open_class' => '',
538
-        'geodir_wrapper_open_replace' => '',
539
-        'geodir_wrapper_close_replace' => '',
540
-        'geodir_wrapper_content_open_id' => 'left-area',
541
-        'geodir_wrapper_content_open_class' => '',
542
-        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
543
-        'geodir_wrapper_content_close_replace' => '',
544
-        'geodir_article_open_id' => '',
545
-        'geodir_article_open_class' => '',
546
-        'geodir_article_open_replace' => '',
547
-        'geodir_article_close_replace' => '',
548
-        'geodir_sidebar_right_open_id' => 'sidebar',
549
-        'geodir_sidebar_right_open_class' => '',
550
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
551
-        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
552
-        'geodir_sidebar_left_open_id' => 'sidebar',
553
-        'geodir_sidebar_left_open_class' => '',
554
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
555
-        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
556
-        'geodir_main_content_open_id' => '',
557
-        'geodir_main_content_open_class' => '',
558
-        'geodir_main_content_open_replace' => '',
559
-        'geodir_main_content_close_replace' => '',
560
-        'geodir_top_content_add' => '',
561
-        'geodir_before_main_content_add' => '',
562
-        'geodir_before_widget_filter' => '',
563
-        'geodir_after_widget_filter' => '',
564
-        'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
565
-        'geodir_theme_compat_js' => '',
566
-        'geodir_theme_compat_default_options' => '',
567
-        'geodir_theme_compat_code' => 'Divi'
568
-    );
535
+	$theme_compat['Divi'] = array(
536
+		'geodir_wrapper_open_id' => 'main-content',
537
+		'geodir_wrapper_open_class' => '',
538
+		'geodir_wrapper_open_replace' => '',
539
+		'geodir_wrapper_close_replace' => '',
540
+		'geodir_wrapper_content_open_id' => 'left-area',
541
+		'geodir_wrapper_content_open_class' => '',
542
+		'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
543
+		'geodir_wrapper_content_close_replace' => '',
544
+		'geodir_article_open_id' => '',
545
+		'geodir_article_open_class' => '',
546
+		'geodir_article_open_replace' => '',
547
+		'geodir_article_close_replace' => '',
548
+		'geodir_sidebar_right_open_id' => 'sidebar',
549
+		'geodir_sidebar_right_open_class' => '',
550
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
551
+		'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
552
+		'geodir_sidebar_left_open_id' => 'sidebar',
553
+		'geodir_sidebar_left_open_class' => '',
554
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
555
+		'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
556
+		'geodir_main_content_open_id' => '',
557
+		'geodir_main_content_open_class' => '',
558
+		'geodir_main_content_open_replace' => '',
559
+		'geodir_main_content_close_replace' => '',
560
+		'geodir_top_content_add' => '',
561
+		'geodir_before_main_content_add' => '',
562
+		'geodir_before_widget_filter' => '',
563
+		'geodir_after_widget_filter' => '',
564
+		'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
565
+		'geodir_theme_compat_js' => '',
566
+		'geodir_theme_compat_default_options' => '',
567
+		'geodir_theme_compat_code' => 'Divi'
568
+	);
569 569
 
570 570
 // Genesis
571
-    $theme_compat['Genesis'] = array(
572
-        'geodir_wrapper_open_id' => '',
573
-        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
574
-        'geodir_wrapper_open_replace' => '',
575
-        'geodir_wrapper_close_replace' => '',
576
-        'geodir_wrapper_content_open_id' => '',
577
-        'geodir_wrapper_content_open_class' => 'content',
578
-        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
579
-        'geodir_wrapper_content_close_replace' => '',
580
-        'geodir_article_open_id' => '',
581
-        'geodir_article_open_class' => '',
582
-        'geodir_article_open_replace' => '',
583
-        'geodir_article_close_replace' => '',
584
-        'geodir_sidebar_right_open_id' => '',
585
-        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
586
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
587
-        'geodir_sidebar_right_close_replace' => '',
588
-        'geodir_sidebar_left_open_id' => '',
589
-        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
590
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
591
-        'geodir_sidebar_left_close_replace' => '',
592
-        'geodir_main_content_open_id' => '',
593
-        'geodir_main_content_open_class' => '',
594
-        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
595
-        'geodir_main_content_close_replace' => '',
596
-        'geodir_top_content_add' => '',
597
-        'geodir_before_main_content_add' => '',
598
-        'geodir_before_widget_filter' => '',
599
-        'geodir_after_widget_filter' => '',
600
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
601
-        'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
602
-        'geodir_theme_compat_js' => '',
603
-        'geodir_theme_compat_default_options' => '',
604
-        'geodir_theme_compat_code' => 'Genesis'
605
-    );
571
+	$theme_compat['Genesis'] = array(
572
+		'geodir_wrapper_open_id' => '',
573
+		'geodir_wrapper_open_class' => 'content-sidebar-wrap',
574
+		'geodir_wrapper_open_replace' => '',
575
+		'geodir_wrapper_close_replace' => '',
576
+		'geodir_wrapper_content_open_id' => '',
577
+		'geodir_wrapper_content_open_class' => 'content',
578
+		'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
579
+		'geodir_wrapper_content_close_replace' => '',
580
+		'geodir_article_open_id' => '',
581
+		'geodir_article_open_class' => '',
582
+		'geodir_article_open_replace' => '',
583
+		'geodir_article_close_replace' => '',
584
+		'geodir_sidebar_right_open_id' => '',
585
+		'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
586
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
587
+		'geodir_sidebar_right_close_replace' => '',
588
+		'geodir_sidebar_left_open_id' => '',
589
+		'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
590
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
591
+		'geodir_sidebar_left_close_replace' => '',
592
+		'geodir_main_content_open_id' => '',
593
+		'geodir_main_content_open_class' => '',
594
+		'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
595
+		'geodir_main_content_close_replace' => '',
596
+		'geodir_top_content_add' => '',
597
+		'geodir_before_main_content_add' => '',
598
+		'geodir_before_widget_filter' => '',
599
+		'geodir_after_widget_filter' => '',
600
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
601
+		'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
602
+		'geodir_theme_compat_js' => '',
603
+		'geodir_theme_compat_default_options' => '',
604
+		'geodir_theme_compat_code' => 'Genesis'
605
+	);
606 606
 
607 607
 // Jupiter
608
-    $theme_compat['Jupiter'] = array(
609
-        'geodir_wrapper_open_id' => '',
610
-        'geodir_wrapper_open_class' => '',
611
-        'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
612
-        'geodir_wrapper_close_replace' => '</div></div></div>',
613
-        'geodir_wrapper_content_open_id' => '',
614
-        'geodir_wrapper_content_open_class' => '',
615
-        'geodir_wrapper_content_open_replace' => '',
616
-        'geodir_wrapper_content_close_replace' => '',
617
-        'geodir_article_open_id' => '',
618
-        'geodir_article_open_class' => '',
619
-        'geodir_article_open_replace' => '',
620
-        'geodir_article_close_replace' => '',
621
-        'geodir_sidebar_right_open_id' => 'mk-sidebar',
622
-        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
623
-        'geodir_sidebar_right_open_replace' => '',
624
-        'geodir_sidebar_right_close_replace' => '',
625
-        'geodir_sidebar_left_open_id' => 'mk-sidebar',
626
-        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
627
-        'geodir_sidebar_left_open_replace' => '',
628
-        'geodir_sidebar_left_close_replace' => '',
629
-        'geodir_main_content_open_id' => '',
630
-        'geodir_main_content_open_class' => '',
631
-        'geodir_main_content_open_replace' => '',
632
-        'geodir_main_content_close_replace' => '',
633
-        'geodir_top_content_add' => '',
634
-        'geodir_before_main_content_add' => '',
635
-        'geodir_before_widget_filter' => '',
636
-        'geodir_after_widget_filter' => '',
637
-        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
638
-        'geodir_after_title_filter' => '',
639
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
640
-        'geodir_sub_menu_ul_class_filter' => '',
641
-        'geodir_sub_menu_li_class_filter' => '',
642
-        'geodir_menu_a_class_filter' => 'menu-item-link',
643
-        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
644
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
645
-        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
646
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
647
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
648
-        'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
649
-        'geodir_theme_compat_js' => '',
650
-        'geodir_theme_compat_default_options' => '',
651
-        'geodir_theme_compat_code' => 'Jupiter'
652
-    );
608
+	$theme_compat['Jupiter'] = array(
609
+		'geodir_wrapper_open_id' => '',
610
+		'geodir_wrapper_open_class' => '',
611
+		'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
612
+		'geodir_wrapper_close_replace' => '</div></div></div>',
613
+		'geodir_wrapper_content_open_id' => '',
614
+		'geodir_wrapper_content_open_class' => '',
615
+		'geodir_wrapper_content_open_replace' => '',
616
+		'geodir_wrapper_content_close_replace' => '',
617
+		'geodir_article_open_id' => '',
618
+		'geodir_article_open_class' => '',
619
+		'geodir_article_open_replace' => '',
620
+		'geodir_article_close_replace' => '',
621
+		'geodir_sidebar_right_open_id' => 'mk-sidebar',
622
+		'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
623
+		'geodir_sidebar_right_open_replace' => '',
624
+		'geodir_sidebar_right_close_replace' => '',
625
+		'geodir_sidebar_left_open_id' => 'mk-sidebar',
626
+		'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
627
+		'geodir_sidebar_left_open_replace' => '',
628
+		'geodir_sidebar_left_close_replace' => '',
629
+		'geodir_main_content_open_id' => '',
630
+		'geodir_main_content_open_class' => '',
631
+		'geodir_main_content_open_replace' => '',
632
+		'geodir_main_content_close_replace' => '',
633
+		'geodir_top_content_add' => '',
634
+		'geodir_before_main_content_add' => '',
635
+		'geodir_before_widget_filter' => '',
636
+		'geodir_after_widget_filter' => '',
637
+		'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
638
+		'geodir_after_title_filter' => '',
639
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
640
+		'geodir_sub_menu_ul_class_filter' => '',
641
+		'geodir_sub_menu_li_class_filter' => '',
642
+		'geodir_menu_a_class_filter' => 'menu-item-link',
643
+		'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
644
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
645
+		'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
646
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
647
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
648
+		'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
649
+		'geodir_theme_compat_js' => '',
650
+		'geodir_theme_compat_default_options' => '',
651
+		'geodir_theme_compat_code' => 'Jupiter'
652
+	);
653 653
 
654 654
 // Multi News
655
-    $theme_compat['Multi_News'] = array(
656
-        'geodir_wrapper_open_id' => '',
657
-        'geodir_wrapper_open_class' => 'main-container clearfix',
658
-        'geodir_wrapper_open_replace' => '',
659
-        'geodir_wrapper_close_replace' => '',
660
-        'geodir_wrapper_content_open_id' => '',
661
-        'geodir_wrapper_content_open_class' => '',
662
-        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
663
-        'geodir_wrapper_content_close_replace' => '</div></div></div>',
664
-        'geodir_article_open_id' => '',
665
-        'geodir_article_open_class' => '',
666
-        'geodir_article_open_replace' => '',
667
-        'geodir_article_close_replace' => '',
668
-        'geodir_sidebar_right_open_id' => '',
669
-        'geodir_sidebar_right_open_class' => '',
670
-        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
671
-        'geodir_sidebar_right_close_replace' => '',
672
-        'geodir_sidebar_left_open_id' => '',
673
-        'geodir_sidebar_left_open_class' => '',
674
-        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
675
-        'geodir_sidebar_left_close_replace' => '',
676
-        'geodir_main_content_open_id' => '',
677
-        'geodir_main_content_open_class' => '',
678
-        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
679
-        'geodir_main_content_close_replace' => '</div>',
680
-        'geodir_top_content_add' => '',
681
-        'geodir_before_main_content_add' => '',
682
-        'geodir_full_page_class_filter' => 'section full-width-section',
683
-        'geodir_before_widget_filter' => '',
684
-        'geodir_after_widget_filter' => '',
685
-        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
686
-        'geodir_after_title_filter' => '</h2></div>',
687
-        'geodir_menu_li_class_filter' => '',
688
-        'geodir_sub_menu_ul_class_filter' => '',
689
-        'geodir_sub_menu_li_class_filter' => '',
690
-        'geodir_menu_a_class_filter' => '',
691
-        'geodir_sub_menu_a_class_filter' => '',
692
-        'geodir_location_switcher_menu_li_class_filter' => '',
693
-        'geodir_location_switcher_menu_a_class_filter' => '',
694
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
695
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
696
-        'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
697
-        'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
698
-        'geodir_theme_compat_default_options' => '',
699
-        'geodir_theme_compat_code' => 'Multi_News'
700
-    );
701
-
702
-    //Kelo
703
-    $theme_compat['Kleo'] = array(
704
-        'geodir_theme_compat_code' => 'Kleo'
705
-    );
706
-
707
-    update_option('gd_theme_compats', $theme_compat);
708
-
709
-    gd_set_theme_compat();// set the compat pack if avail
655
+	$theme_compat['Multi_News'] = array(
656
+		'geodir_wrapper_open_id' => '',
657
+		'geodir_wrapper_open_class' => 'main-container clearfix',
658
+		'geodir_wrapper_open_replace' => '',
659
+		'geodir_wrapper_close_replace' => '',
660
+		'geodir_wrapper_content_open_id' => '',
661
+		'geodir_wrapper_content_open_class' => '',
662
+		'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
663
+		'geodir_wrapper_content_close_replace' => '</div></div></div>',
664
+		'geodir_article_open_id' => '',
665
+		'geodir_article_open_class' => '',
666
+		'geodir_article_open_replace' => '',
667
+		'geodir_article_close_replace' => '',
668
+		'geodir_sidebar_right_open_id' => '',
669
+		'geodir_sidebar_right_open_class' => '',
670
+		'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
671
+		'geodir_sidebar_right_close_replace' => '',
672
+		'geodir_sidebar_left_open_id' => '',
673
+		'geodir_sidebar_left_open_class' => '',
674
+		'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
675
+		'geodir_sidebar_left_close_replace' => '',
676
+		'geodir_main_content_open_id' => '',
677
+		'geodir_main_content_open_class' => '',
678
+		'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
679
+		'geodir_main_content_close_replace' => '</div>',
680
+		'geodir_top_content_add' => '',
681
+		'geodir_before_main_content_add' => '',
682
+		'geodir_full_page_class_filter' => 'section full-width-section',
683
+		'geodir_before_widget_filter' => '',
684
+		'geodir_after_widget_filter' => '',
685
+		'geodir_before_title_filter' => '<div class="widget-title"><h2>',
686
+		'geodir_after_title_filter' => '</h2></div>',
687
+		'geodir_menu_li_class_filter' => '',
688
+		'geodir_sub_menu_ul_class_filter' => '',
689
+		'geodir_sub_menu_li_class_filter' => '',
690
+		'geodir_menu_a_class_filter' => '',
691
+		'geodir_sub_menu_a_class_filter' => '',
692
+		'geodir_location_switcher_menu_li_class_filter' => '',
693
+		'geodir_location_switcher_menu_a_class_filter' => '',
694
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
695
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
696
+		'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
697
+		'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
698
+		'geodir_theme_compat_default_options' => '',
699
+		'geodir_theme_compat_code' => 'Multi_News'
700
+	);
701
+
702
+	//Kelo
703
+	$theme_compat['Kleo'] = array(
704
+		'geodir_theme_compat_code' => 'Kleo'
705
+	);
706
+
707
+	update_option('gd_theme_compats', $theme_compat);
708
+
709
+	gd_set_theme_compat();// set the compat pack if avail
710 710
 }
711 711
 
712 712
 
@@ -718,61 +718,61 @@  discard block
 block discarded – undo
718 718
  * @global object $wpdb WordPress Database object.
719 719
  */
720 720
 function gd_convert_virtual_pages(){
721
-    global $wpdb;
722
-
723
-    // Update the add listing page settings
724
-    $add_listing_page = $wpdb->get_var(
725
-        $wpdb->prepare(
726
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
727
-            array('add-listing')
728
-        )
729
-    );
730
-
731
-    if($add_listing_page){
732
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
733
-        update_option( 'geodir_add_listing_page', $add_listing_page);
734
-    }
735
-
736
-    // Update the listing preview page settings
737
-    $listing_preview_page = $wpdb->get_var(
738
-        $wpdb->prepare(
739
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
740
-            array('listing-preview')
741
-        )
742
-    );
743
-
744
-    if($listing_preview_page){
745
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
746
-        update_option( 'geodir_preview_page', $listing_preview_page);
747
-    }
748
-
749
-    // Update the listing success page settings
750
-    $listing_success_page = $wpdb->get_var(
751
-        $wpdb->prepare(
752
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
753
-            array('listing-success')
754
-        )
755
-    );
756
-
757
-    if($listing_success_page){
758
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
759
-        update_option( 'geodir_success_page', $listing_success_page);
760
-    }
761
-
762
-    // Update the listing success page settings
763
-    $location_page = $wpdb->get_var(
764
-        $wpdb->prepare(
765
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
766
-            array('location')
767
-        )
768
-    );
769
-
770
-    if($location_page){
771
-        $location_slug = get_option('geodir_location_prefix');
772
-        if(!$location_slug ){$location_slug  = 'location';}
773
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
774
-        update_option( 'geodir_location_page', $location_page);
775
-    }
721
+	global $wpdb;
722
+
723
+	// Update the add listing page settings
724
+	$add_listing_page = $wpdb->get_var(
725
+		$wpdb->prepare(
726
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
727
+			array('add-listing')
728
+		)
729
+	);
730
+
731
+	if($add_listing_page){
732
+		wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
733
+		update_option( 'geodir_add_listing_page', $add_listing_page);
734
+	}
735
+
736
+	// Update the listing preview page settings
737
+	$listing_preview_page = $wpdb->get_var(
738
+		$wpdb->prepare(
739
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
740
+			array('listing-preview')
741
+		)
742
+	);
743
+
744
+	if($listing_preview_page){
745
+		wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
746
+		update_option( 'geodir_preview_page', $listing_preview_page);
747
+	}
748
+
749
+	// Update the listing success page settings
750
+	$listing_success_page = $wpdb->get_var(
751
+		$wpdb->prepare(
752
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
753
+			array('listing-success')
754
+		)
755
+	);
756
+
757
+	if($listing_success_page){
758
+		wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
759
+		update_option( 'geodir_success_page', $listing_success_page);
760
+	}
761
+
762
+	// Update the listing success page settings
763
+	$location_page = $wpdb->get_var(
764
+		$wpdb->prepare(
765
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
766
+			array('location')
767
+		)
768
+	);
769
+
770
+	if($location_page){
771
+		$location_slug = get_option('geodir_location_prefix');
772
+		if(!$location_slug ){$location_slug  = 'location';}
773
+		wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
774
+		update_option( 'geodir_location_page', $location_page);
775
+	}
776 776
 
777 777
 }
778 778
 
@@ -786,31 +786,31 @@  discard block
 block discarded – undo
786 786
 function gd_fix_cpt_rewrite_slug()
787 787
 {
788 788
 
789
-    $alt_post_types = array();
790
-    $post_types = get_option('geodir_post_types');
789
+	$alt_post_types = array();
790
+	$post_types = get_option('geodir_post_types');
791 791
 
792 792
 
793
-    if (is_array($post_types)){
793
+	if (is_array($post_types)){
794 794
 
795
-        foreach ($post_types as $post_type => $args) {
795
+		foreach ($post_types as $post_type => $args) {
796 796
 
797 797
 
798
-            if(isset($args['rewrite']['slug'])){
799
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
800
-            }
798
+			if(isset($args['rewrite']['slug'])){
799
+				$args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
800
+			}
801 801
 
802
-                $alt_post_types[$post_type] = $args;
802
+				$alt_post_types[$post_type] = $args;
803 803
 
804
-        }
805
-    }
804
+		}
805
+	}
806 806
 
807
-    if(!empty($alt_post_types)) {
808
-        update_option('geodir_post_types',$alt_post_types);
809
-        }
807
+	if(!empty($alt_post_types)) {
808
+		update_option('geodir_post_types',$alt_post_types);
809
+		}
810 810
 
811 811
 
812
-    // flush the rewrite rules
813
-    flush_rewrite_rules();
812
+	// flush the rewrite rules
813
+	flush_rewrite_rules();
814 814
 }
815 815
 
816 816
 
@@ -823,18 +823,18 @@  discard block
 block discarded – undo
823 823
  */
824 824
 function gd_fix_address_detail_table_limit()
825 825
 {
826
-    global $wpdb;
827
-
828
-    $all_postypes = geodir_get_posttypes();
829
-
830
-    if (!empty($all_postypes)) {
831
-        foreach ($all_postypes as $key) {
832
-            // update each GD CTP
833
-            try {
834
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
835
-            } catch(Exception $e) {
836
-                error_log( 'Error: ' . $e->getMessage() );
837
-            }
838
-        }
839
-    }
826
+	global $wpdb;
827
+
828
+	$all_postypes = geodir_get_posttypes();
829
+
830
+	if (!empty($all_postypes)) {
831
+		foreach ($all_postypes as $key) {
832
+			// update each GD CTP
833
+			try {
834
+				$wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
835
+			} catch(Exception $e) {
836
+				error_log( 'Error: ' . $e->getMessage() );
837
+			}
838
+		}
839
+	}
840 840
 }
Please login to merge, or discard this patch.