Test Failed
Push — master ( ed3296...209135 )
by Stiofan
11:26
created
geodirectory-functions/compatibility/Avada.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
  * @since 1.0.0
180 180
  * @package GeoDirectory
181 181
  * @param array $classes Class array.
182
- * @return array Modified class array.
182
+ * @return string[] Modified class array.
183 183
  */
184 184
 function gd_compat_body_class($classes)
185 185
 {
Please login to merge, or discard this patch.
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function gd_strip_breadcrumb_wrappers($breadcrumb)
20 20
 {
21
-    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
22
-    $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23
-    $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24
-    return $breadcrumb;
21
+	$breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
22
+	$breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23
+	$breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24
+	return $breadcrumb;
25 25
 }
26 26
 
27 27
 add_filter('geodir_breadcrumb_separator', 'gd_change_breadcrumb_separator');
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function gd_change_breadcrumb_separator($separator)
37 37
 {
38
-    $separator = ' / ';
39
-    return $separator;
38
+	$separator = ' / ';
39
+	return $separator;
40 40
 }
41 41
 
42 42
 add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change');
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function gd_avada_current_page_title_bar_change($c_pageID)
51 51
 {
52
-    if (geodir_is_geodir_page()) {
53
-        gd_avada_current_page_title_bar();
54
-    }else{
55
-        avada_current_page_title_bar( $c_pageID );
56
-    }
52
+	if (geodir_is_geodir_page()) {
53
+		gd_avada_current_page_title_bar();
54
+	}else{
55
+		avada_current_page_title_bar( $c_pageID );
56
+	}
57 57
 
58 58
 }
59 59
 
@@ -65,44 +65,44 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function gd_avada_current_page_title_bar()
67 67
 {
68
-    ob_start();
69
-    geodir_breadcrumb();
70
-    $secondary_content = ob_get_contents();
71
-    ob_get_clean();
72
-
73
-    $title = '';
74
-    $subtitle = '';
75
-
76
-    if (geodir_is_page('listing')) {
77
-        ob_start(); // Start buffering;
78
-        geodir_action_listings_title();
79
-        $title = ob_get_clean();
80
-        avada_page_title_bar($title, $subtitle, $secondary_content);
81
-    }elseif (geodir_is_page('add-listing')) {
82
-        ob_start(); // Start buffering;
83
-        geodir_action_add_listing_page_title();
84
-        $title = ob_get_clean();
85
-        avada_page_title_bar($title, $subtitle, $secondary_content);
86
-    }elseif (geodir_is_page('author')) {
87
-        ob_start(); // Start buffering;
88
-        geodir_action_author_page_title();
89
-        $title = ob_get_clean();
90
-        avada_page_title_bar($title, $subtitle, $secondary_content);
91
-    }elseif (geodir_is_page('detail') || geodir_is_page('preview')) {
92
-        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {}
93
-        else {
94
-            $title = get_the_title();
95
-        }
96
-        avada_page_title_bar($title, $subtitle, $secondary_content);
97
-    }elseif (geodir_is_page('search')) {
98
-        ob_start(); // Start buffering;
99
-        geodir_action_search_page_title();
100
-        $title = ob_get_clean();
101
-        avada_page_title_bar($title, $subtitle, $secondary_content);
102
-    }else{
103
-        $title = get_the_title();
104
-        avada_page_title_bar($title, $subtitle, $secondary_content);
105
-    }
68
+	ob_start();
69
+	geodir_breadcrumb();
70
+	$secondary_content = ob_get_contents();
71
+	ob_get_clean();
72
+
73
+	$title = '';
74
+	$subtitle = '';
75
+
76
+	if (geodir_is_page('listing')) {
77
+		ob_start(); // Start buffering;
78
+		geodir_action_listings_title();
79
+		$title = ob_get_clean();
80
+		avada_page_title_bar($title, $subtitle, $secondary_content);
81
+	}elseif (geodir_is_page('add-listing')) {
82
+		ob_start(); // Start buffering;
83
+		geodir_action_add_listing_page_title();
84
+		$title = ob_get_clean();
85
+		avada_page_title_bar($title, $subtitle, $secondary_content);
86
+	}elseif (geodir_is_page('author')) {
87
+		ob_start(); // Start buffering;
88
+		geodir_action_author_page_title();
89
+		$title = ob_get_clean();
90
+		avada_page_title_bar($title, $subtitle, $secondary_content);
91
+	}elseif (geodir_is_page('detail') || geodir_is_page('preview')) {
92
+		if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {}
93
+		else {
94
+			$title = get_the_title();
95
+		}
96
+		avada_page_title_bar($title, $subtitle, $secondary_content);
97
+	}elseif (geodir_is_page('search')) {
98
+		ob_start(); // Start buffering;
99
+		geodir_action_search_page_title();
100
+		$title = ob_get_clean();
101
+		avada_page_title_bar($title, $subtitle, $secondary_content);
102
+	}else{
103
+		$title = get_the_title();
104
+		avada_page_title_bar($title, $subtitle, $secondary_content);
105
+	}
106 106
 }
107 107
 
108 108
 /**
@@ -113,34 +113,34 @@  discard block
 block discarded – undo
113 113
  */
114 114
 function gd_compat_php_avada()
115 115
 {
116
-    // change widget wrappers
117
-    //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );
118
-    //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );
119
-
120
-    // REMOVE BREADCRUMB
121
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
122
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
123
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
124
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
125
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
126
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
127
-
128
-    // REMOVE PAGE TITLES
129
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
130
-    remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10);
131
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
132
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
133
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
134
-
135
-    // make top section wide
136
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
137
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
138
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
139
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
140
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
141
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
142
-
143
-    //gd_compat_add_top_section_back();
116
+	// change widget wrappers
117
+	//add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 );
118
+	//add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 );
119
+
120
+	// REMOVE BREADCRUMB
121
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
122
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
123
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
124
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
125
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
126
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
127
+
128
+	// REMOVE PAGE TITLES
129
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
130
+	remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10);
131
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
132
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
133
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
134
+
135
+	// make top section wide
136
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
137
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
138
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
139
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
140
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
141
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
142
+
143
+	//gd_compat_add_top_section_back();
144 144
 
145 145
 }
146 146
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
  * @package GeoDirectory
153 153
  */
154 154
 function gd_compat_add_top_section_back() {
155
-    if (geodir_is_page('home') || geodir_is_page('location')) {
156
-        geodir_action_geodir_sidebar_home_top();
157
-    } elseif (geodir_is_page('listing')) {
158
-        geodir_action_geodir_sidebar_listings_top();
159
-    } elseif (geodir_is_page('detail')) {
160
-        geodir_action_geodir_sidebar_detail_top();
161
-    } elseif (geodir_is_page('search')) {
162
-        geodir_action_geodir_sidebar_search_top();
163
-    } elseif (geodir_is_page('author')) {
164
-        geodir_action_geodir_sidebar_author_top();
165
-    }
155
+	if (geodir_is_page('home') || geodir_is_page('location')) {
156
+		geodir_action_geodir_sidebar_home_top();
157
+	} elseif (geodir_is_page('listing')) {
158
+		geodir_action_geodir_sidebar_listings_top();
159
+	} elseif (geodir_is_page('detail')) {
160
+		geodir_action_geodir_sidebar_detail_top();
161
+	} elseif (geodir_is_page('search')) {
162
+		geodir_action_geodir_sidebar_search_top();
163
+	} elseif (geodir_is_page('author')) {
164
+		geodir_action_geodir_sidebar_author_top();
165
+	}
166 166
 }
167 167
 
168 168
 add_filter('body_class', 'gd_compat_body_class');
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function gd_compat_body_class($classes)
178 178
 {
179
-    if (geodir_is_geodir_page()) {
180
-        $classes[] = 'wpgeo-avada';
181
-    } else {
182
-        $classes[] = '';
183
-    }
184
-    return $classes;
179
+	if (geodir_is_geodir_page()) {
180
+		$classes[] = 'wpgeo-avada';
181
+	} else {
182
+		$classes[] = '';
183
+	}
184
+	return $classes;
185 185
 }
186 186
 
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_before_widget_compat($var)
197 197
 {
198
-    return '<div id="%1$s" class="geodir-widget %2$s">';
198
+	return '<div id="%1$s" class="geodir-widget %2$s">';
199 199
 }
200 200
 
201 201
 /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
  */
209 209
 function geodir_after_widget_compat($var)
210 210
 {
211
-    return '</div>';
211
+	return '</div>';
212 212
 }
213 213
 
214 214
 add_filter('geodir_search_form_class', 'geodir_search_form_class_avada');
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_search_form_class_avada($class)
224 224
 {
225
-    $class .= ' search';
226
-    return $class;
225
+	$class .= ' search';
226
+	return $class;
227 227
 }
228 228
 
229 229
 
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 
233 233
 // Avada sets the search page to use wither post or page, we need it to be 'any'
234 234
 function gd_avada_search_filter( $query ) {
235
-    if ( geodir_is_page('search') && is_search() && $query->is_search) {
236
-        $query->set('post_type', 'any');
237
-    }
238
-    return $query;
235
+	if ( geodir_is_page('search') && is_search() && $query->is_search) {
236
+		$query->set('post_type', 'any');
237
+	}
238
+	return $query;
239 239
 }
240 240
 if ( ! is_admin() ) {
241
-    add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );
241
+	add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );
242 242
 }
243 243
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function gd_strip_breadcrumb_wrappers($breadcrumb)
20 20
 {
21
-    $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb);
21
+    $breadcrumb = str_replace(array("<li>", "</li>"), "", $breadcrumb);
22 22
     $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb);
23 23
     $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb);
24 24
     return $breadcrumb;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     return $separator;
40 40
 }
41 41
 
42
-add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change');
42
+add_action('avada_override_current_page_title_bar', 'gd_avada_current_page_title_bar_change');
43 43
 /**
44 44
  * new title bar functions for gd pages.
45 45
  *
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 {
52 52
     if (geodir_is_geodir_page()) {
53 53
         gd_avada_current_page_title_bar();
54
-    }else{
55
-        avada_current_page_title_bar( $c_pageID );
54
+    } else {
55
+        avada_current_page_title_bar($c_pageID);
56 56
     }
57 57
 
58 58
 }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $title = ob_get_clean();
90 90
         avada_page_title_bar($title, $subtitle, $secondary_content);
91 91
     }elseif (geodir_is_page('detail') || geodir_is_page('preview')) {
92
-        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {}
92
+        if ($title = get_post_meta(get_the_ID(), 'pyre_page_title_custom_text', true)) {}
93 93
         else {
94 94
             $title = get_the_title();
95 95
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         geodir_action_search_page_title();
100 100
         $title = ob_get_clean();
101 101
         avada_page_title_bar($title, $subtitle, $secondary_content);
102
-    }else{
102
+    } else {
103 103
         $title = get_the_title();
104 104
         avada_page_title_bar($title, $subtitle, $secondary_content);
105 105
     }
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 gd_compat_php_avada();
232 232
 
233 233
 // Avada sets the search page to use wither post or page, we need it to be 'any'
234
-function gd_avada_search_filter( $query ) {
235
-    if ( geodir_is_page('search') && is_search() && $query->is_search) {
234
+function gd_avada_search_filter($query) {
235
+    if (geodir_is_page('search') && is_search() && $query->is_search) {
236 236
         $query->set('post_type', 'any');
237 237
     }
238 238
     return $query;
239 239
 }
240
-if ( ! is_admin() ) {
241
-    add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 );
240
+if (!is_admin()) {
241
+    add_filter('pre_get_posts', 'gd_avada_search_filter', 11);
242 242
 }
243 243
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 {
52 52
     if (geodir_is_geodir_page()) {
53 53
         gd_avada_current_page_title_bar();
54
-    }else{
54
+    } else{
55 55
         avada_current_page_title_bar( $c_pageID );
56 56
     }
57 57
 
@@ -78,28 +78,27 @@  discard block
 block discarded – undo
78 78
         geodir_action_listings_title();
79 79
         $title = ob_get_clean();
80 80
         avada_page_title_bar($title, $subtitle, $secondary_content);
81
-    }elseif (geodir_is_page('add-listing')) {
81
+    } elseif (geodir_is_page('add-listing')) {
82 82
         ob_start(); // Start buffering;
83 83
         geodir_action_add_listing_page_title();
84 84
         $title = ob_get_clean();
85 85
         avada_page_title_bar($title, $subtitle, $secondary_content);
86
-    }elseif (geodir_is_page('author')) {
86
+    } elseif (geodir_is_page('author')) {
87 87
         ob_start(); // Start buffering;
88 88
         geodir_action_author_page_title();
89 89
         $title = ob_get_clean();
90 90
         avada_page_title_bar($title, $subtitle, $secondary_content);
91
-    }elseif (geodir_is_page('detail') || geodir_is_page('preview')) {
92
-        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {}
93
-        else {
91
+    } elseif (geodir_is_page('detail') || geodir_is_page('preview')) {
92
+        if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} else {
94 93
             $title = get_the_title();
95 94
         }
96 95
         avada_page_title_bar($title, $subtitle, $secondary_content);
97
-    }elseif (geodir_is_page('search')) {
96
+    } elseif (geodir_is_page('search')) {
98 97
         ob_start(); // Start buffering;
99 98
         geodir_action_search_page_title();
100 99
         $title = ob_get_clean();
101 100
         avada_page_title_bar($title, $subtitle, $secondary_content);
102
-    }else{
101
+    } else{
103 102
         $title = get_the_title();
104 103
         avada_page_title_bar($title, $subtitle, $secondary_content);
105 104
     }
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Enfold.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
  * @since 1.0.0
134 134
  * @package GeoDirectory
135 135
  * @param array $classes Class array.
136
- * @return array Modified class array.
136
+ * @return string[] Modified class array.
137 137
  */
138 138
 function wpgeo_enfold_body_class($classes)
139 139
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function enfold_action_wrapper_open()
164 164
 {
165
-    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
165
+    echo "<div class='container_wrap container_wrap_first main_color ".avia_layout_class('main', false)."'>";
166 166
     echo "<div class='container template-blog '>";
167 167
 }
168 168
 
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')
255 255
 {
256 256
     if (geodir_is_page('login')) {
257
-        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
257
+        echo "<main class='template-page content twelve alpha units ".$class."' ".avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)).">";
258 258
     } else {
259
-        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
259
+        echo "<main class='template-page content ".avia_layout_class('content', false)." units ".$class."' ".avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)).">";
260 260
     }
261 261
     echo '<div class="entry-content-wrapper">';
262 262
 }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
276 276
 {
277 277
     $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
-    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
278
+    echo "<aside class='sidebar sidebar_right ".$sidebar_smartphone." ".avia_layout_class('sidebar', false)." units' ".avia_markup_helper(array('context' => 'sidebar', 'echo' => false)).">";
279 279
     echo "<div class='inner_sidebar extralight-border'>";
280 280
 }
281 281
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
293 293
 {
294 294
     $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
-    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
295
+    echo "<aside class='sidebar sidebar_left ".$sidebar_smartphone." ".avia_layout_class('sidebar', false)." units' ".avia_markup_helper(array('context' => 'sidebar', 'echo' => false)).">";
296 296
     echo "<div class='inner_sidebar extralight-border'>";
297 297
 }
298 298
 
Please login to merge, or discard this patch.
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -17,84 +17,84 @@  discard block
 block discarded – undo
17 17
 function enfold_action_calls()
18 18
 {
19 19
 
20
-    /* ACTIONS
20
+	/* ACTIONS
21 21
     ****************************************************************************************/
22 22
 
23
-    // Add body class for styling purposes
24
-    add_filter('body_class', 'wpgeo_enfold_body_class');
23
+	// Add body class for styling purposes
24
+	add_filter('body_class', 'wpgeo_enfold_body_class');
25 25
 
26
-    // Pages using the page-builder shouldn't redirect on successful payment
27
-    if (isset($_REQUEST['pay_action'])) {
28
-        add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
-    }
26
+	// Pages using the page-builder shouldn't redirect on successful payment
27
+	if (isset($_REQUEST['pay_action'])) {
28
+		add_action('init', 'geodir_allow_payment_urls_enfold', 15);
29
+	}
30 30
 
31
-    // LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
-    if (function_exists('geodir_location_menu_items')) {
33
-        remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
-        add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
-    }
36
-    // GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
-    remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
-    add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
31
+	// LOCATION MANAGER MENU ACTIONS - set the location menu item before the Enfold search
32
+	if (function_exists('geodir_location_menu_items')) {
33
+		remove_filter('wp_nav_menu_items', 'geodir_location_menu_items', 110);
34
+		add_filter('wp_nav_menu_items', 'geodir_location_menu_items', 8, 2);
35
+	}
36
+	// GEODIR MENU ACTIONS - set the GeoDir menu items before the Enfold search
37
+	remove_filter('wp_nav_menu_items', 'geodir_menu_items', 100);
38
+	add_filter('wp_nav_menu_items', 'geodir_menu_items', 7, 2);
39 39
 
40
-    // HOME TOP SIDEBAR
41
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
-    //add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
40
+	// HOME TOP SIDEBAR
41
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
42
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
43
+	//add_action( 'ava_after_main_container', 'enfold_home_sidebar' );
44 44
 
45 45
 
46
-    // WRAPPER OPEN ACTIONS
47
-    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
-    add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
-    add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
46
+	// WRAPPER OPEN ACTIONS
47
+	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
48
+	add_action('geodir_wrapper_open', 'enfold_action_wrapper_open', 9);
49
+	add_action('geodir_wrapper_open', 'enfold_detail_title', 8, 2); // ADD GEODIR TITLE
50 50
 
51 51
 
52
-    // WRAPPER CONTENT OPEN ACTIONS
53
-    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
-    add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
52
+	// WRAPPER CONTENT OPEN ACTIONS
53
+	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
54
+	add_action('geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3);
55 55
 
56 56
 
57
-    // SIDEBAR RIGHT OPEN ACTIONS
58
-    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
-    add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
57
+	// SIDEBAR RIGHT OPEN ACTIONS
58
+	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
59
+	add_action('geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4);
60 60
 
61
-    // SIDEBAR LEFT OPEN ACTIONS
62
-    remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
-    add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
61
+	// SIDEBAR LEFT OPEN ACTIONS
62
+	remove_action('geodir_sidebar_left_open', 'geodir_action_sidebar_left_open', 10);
63
+	add_action('geodir_sidebar_left_open', 'enfold_action_sidebar_left_open', 10, 4);
64 64
 
65 65
 
66
-    // HOME PAGE BREADCRUMBS
67
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
66
+	// HOME PAGE BREADCRUMBS
67
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
69 69
 
70
-    // LISTINGS PAGE BREADCRUMBS & TITLES
71
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
70
+	// LISTINGS PAGE BREADCRUMBS & TITLES
71
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
72
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
73 73
 
74
-    // DETAILS PAGE BREADCRUMBS & TITLES
75
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
-    remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
74
+	// DETAILS PAGE BREADCRUMBS & TITLES
75
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
76
+	remove_action('geodir_details_main_content', 'geodir_action_page_title', 20);
77 77
 
78
-    // SEARCH PAGE BREADCRUMBS & TITLES
79
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
78
+	// SEARCH PAGE BREADCRUMBS & TITLES
79
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
80
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
81 81
 
82
-    // AUTHOR PAGE BREADCRUMBS & TITLES
83
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
82
+	// AUTHOR PAGE BREADCRUMBS & TITLES
83
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
84
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
85 85
 
86
-    // DISABLE ENFOLD MAPS CALL
87
-    add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
86
+	// DISABLE ENFOLD MAPS CALL
87
+	add_filter('avf_load_google_map_api', 'gd_enfold_remove_maps_api', 10, 1);
88 88
 
89
-    // make top section wide
90
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
89
+	// make top section wide
90
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
91
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
92
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
93
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
94
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
95
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
96 96
 
97
-    add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
97
+	add_action('geodir_wrapper_open', 'gd_enfold_compat_add_top_section_back', 5);
98 98
 
99 99
 } // Close enfold_action_calls
100 100
 
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 function gd_enfold_compat_add_top_section_back()
109 109
 {
110 110
 
111
-    if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
112
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
-    } elseif (geodir_is_page('listing')) {
114
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
-    } elseif (geodir_is_page('detail')) {
116
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
-    } elseif (geodir_is_page('search')) {
118
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
-    } elseif (geodir_is_page('author')) {
120
-        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
-    }
111
+	if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
112
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
113
+	} elseif (geodir_is_page('listing')) {
114
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
115
+	} elseif (geodir_is_page('detail')) {
116
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
117
+	} elseif (geodir_is_page('search')) {
118
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
119
+	} elseif (geodir_is_page('author')) {
120
+		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
121
+	}
122 122
 
123 123
 
124 124
 }
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
  */
138 138
 function wpgeo_enfold_body_class($classes)
139 139
 {
140
-    $classes[] = 'wpgeo-enfold';
141
-    return $classes;
140
+	$classes[] = 'wpgeo-enfold';
141
+	return $classes;
142 142
 }
143 143
 
144 144
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function geodir_allow_payment_urls_enfold()
151 151
 {
152
-    global $builder;
153
-    remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
152
+	global $builder;
153
+	remove_action('template_redirect', array($builder, 'template_redirect'), 1000);
154 154
 }
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function enfold_action_wrapper_open()
164 164
 {
165
-    echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
-    echo "<div class='container template-blog '>";
165
+	echo "<div class='container_wrap container_wrap_first main_color " . avia_layout_class('main', false) . "'>";
166
+	echo "<div class='container template-blog '>";
167 167
 }
168 168
 
169 169
 /**
@@ -177,38 +177,38 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function enfold_detail_title($page, $class)
179 179
 {
180
-    //echo '###'.$page;
181
-    global $wp;
182
-    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
-        echo avia_title();
185
-    } elseif ($page == 'details-page') {
186
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
-        echo avia_title();
188
-    } elseif ($page == 'listings-page' || $page == 'search-page') {
189
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
-        ob_start(); // Start buffering;
191
-        geodir_action_listings_title();
192
-        $gd_title = ob_get_clean();
193
-        $title_p = explode('">', $gd_title);
194
-        $title = str_replace('</h1></header>', "", $title_p[2]);
195
-        //print_r($title_p);
196
-        echo avia_title(array('title' => $title));
197
-    } elseif ($page == 'author-page') {
198
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
-        ob_start(); // Start buffering;
200
-        geodir_action_author_page_title();
201
-        $gd_title = ob_get_clean();
202
-        $gd_title = str_replace('<h1>', "", $gd_title);
203
-        $gd_title = str_replace('</h1>', "", $gd_title);
204
-        echo avia_title(array('title' => $gd_title));
205
-    } elseif ($page == 'add-listing-page') {
206
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
-        echo avia_title();
208
-    } elseif ($page == 'add-listing-page') {
209
-        add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
-        echo avia_title();
211
-    }
180
+	//echo '###'.$page;
181
+	global $wp;
182
+	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id() && !geodir_is_page('login')) {
183
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
184
+		echo avia_title();
185
+	} elseif ($page == 'details-page') {
186
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
187
+		echo avia_title();
188
+	} elseif ($page == 'listings-page' || $page == 'search-page') {
189
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
190
+		ob_start(); // Start buffering;
191
+		geodir_action_listings_title();
192
+		$gd_title = ob_get_clean();
193
+		$title_p = explode('">', $gd_title);
194
+		$title = str_replace('</h1></header>', "", $title_p[2]);
195
+		//print_r($title_p);
196
+		echo avia_title(array('title' => $title));
197
+	} elseif ($page == 'author-page') {
198
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
199
+		ob_start(); // Start buffering;
200
+		geodir_action_author_page_title();
201
+		$gd_title = ob_get_clean();
202
+		$gd_title = str_replace('<h1>', "", $gd_title);
203
+		$gd_title = str_replace('</h1>', "", $gd_title);
204
+		echo avia_title(array('title' => $gd_title));
205
+	} elseif ($page == 'add-listing-page') {
206
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
207
+		echo avia_title();
208
+	} elseif ($page == 'add-listing-page') {
209
+		add_action('avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8, 2);
210
+		echo avia_title();
211
+	}
212 212
 
213 213
 }
214 214
 
@@ -223,22 +223,22 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function enfold_detail_breadcrum($trail, $args)
225 225
 {
226
-    ob_start(); // Start buffering;
227
-    geodir_breadcrumb();
228
-    $gd_crums = ob_get_clean();
229
-    if ($gd_crums) {
230
-        $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
-        $gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
-        $gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
-        $gd_crums = str_replace('</li><li>', "", $gd_crums);
234
-        $gd_crums = explode(" > ", $gd_crums);
235
-        $trail_end = array_pop($gd_crums);
236
-        $gd_crums['trail_end'] = $trail_end;
237
-        //print_r($gd_crums);
238
-        //print_r($trail);
239
-        $trail = $gd_crums;
240
-    }
241
-    return $trail;
226
+	ob_start(); // Start buffering;
227
+	geodir_breadcrumb();
228
+	$gd_crums = ob_get_clean();
229
+	if ($gd_crums) {
230
+		$gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums);
231
+		$gd_crums = str_replace('</li></ul></div>', "", $gd_crums);
232
+		$gd_crums = str_replace('&nbsp;>&nbsp;', " > ", $gd_crums);
233
+		$gd_crums = str_replace('</li><li>', "", $gd_crums);
234
+		$gd_crums = explode(" > ", $gd_crums);
235
+		$trail_end = array_pop($gd_crums);
236
+		$gd_crums['trail_end'] = $trail_end;
237
+		//print_r($gd_crums);
238
+		//print_r($trail);
239
+		$trail = $gd_crums;
240
+	}
241
+	return $trail;
242 242
 }
243 243
 
244 244
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function enfold_action_wrapper_content_open($type = '', $id = '', $class = '')
255 255
 {
256
-    if (geodir_is_page('login')) {
257
-        echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
-    } else {
259
-        echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
-    }
261
-    echo '<div class="entry-content-wrapper">';
256
+	if (geodir_is_page('login')) {
257
+		echo "<main class='template-page content twelve alpha units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
258
+	} else {
259
+		echo "<main class='template-page content " . avia_layout_class('content', false) . " units " . $class . "' " . avia_markup_helper(array('context' => 'content', 'post_type' => 'page', 'echo' => false)) . ">";
260
+	}
261
+	echo '<div class="entry-content-wrapper">';
262 262
 }
263 263
 
264 264
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function enfold_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
276 276
 {
277
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
-    echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
-    echo "<div class='inner_sidebar extralight-border'>";
277
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
278
+	echo "<aside class='sidebar sidebar_right " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
279
+	echo "<div class='inner_sidebar extralight-border'>";
280 280
 }
281 281
 
282 282
 /**
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function enfold_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
293 293
 {
294
-    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
-    echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
-    echo "<div class='inner_sidebar extralight-border'>";
294
+	$sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
295
+	echo "<aside class='sidebar sidebar_left " . $sidebar_smartphone . " " . avia_layout_class('sidebar', false) . " units' " . avia_markup_helper(array('context' => 'sidebar', 'echo' => false)) . ">";
296
+	echo "<div class='inner_sidebar extralight-border'>";
297 297
 }
298 298
 
299 299
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function gd_enfold_remove_maps_api($call)
309 309
 {
310
-    return false;
310
+	return false;
311 311
 }
312 312
 
313 313
 
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/X.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
  * @since 1.0.0
114 114
  * @package GeoDirectory
115 115
  * @param array $classes Class array.
116
- * @return array Modified class array.
116
+ * @return string[] Modified class array.
117 117
  */
118 118
 function geodir_x_body_class($classes)
119 119
 {
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         echo '<div class="x-main full" role="main">';
184 184
     } elseif ($stack == 'ethos') {
185 185
         echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';
186
-    }else{
186
+    } else{
187 187
         echo '<div class="x-container max width offset">';
188 188
     }
189 189
 }
@@ -344,7 +344,9 @@  discard block
 block discarded – undo
344 344
                     echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
345 345
                     if (is_category()) {
346 346
                         $the_cat = get_category(get_query_var('cat'), false);
347
-                        if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);
347
+                        if ($the_cat->parent != 0) {
348
+                        	echo get_category_parents($the_cat->parent, TRUE, $delimiter);
349
+                        }
348 350
                         echo $current_before . single_cat_title('', false) . $current_after;
349 351
                     } elseif (x_is_product_category()) {
350 352
                         echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
@@ -379,7 +381,9 @@  discard block
 block discarded – undo
379 381
                         $breadcrumbs = array_reverse($breadcrumbs);
380 382
                         for ($i = 0; $i < count($breadcrumbs); $i++) {
381 383
                             echo $breadcrumbs[$i];
382
-                            if ($i != count($breadcrumbs) - 1) echo $delimiter;
384
+                            if ($i != count($breadcrumbs) - 1) {
385
+                            	echo $delimiter;
386
+                            }
383 387
                         }
384 388
                         echo $delimiter . $current_before . $page_title . $current_after;
385 389
                     } elseif (is_tag()) {
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 {
123 123
     $classes[] = 'geodir-x';
124 124
 
125
-    if(isset($_REQUEST['geodir_search'])){
125
+    if (isset($_REQUEST['geodir_search'])) {
126 126
         $classes[] = 'geodir-x-search';
127 127
     }
128 128
     return $classes;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         echo '<div class="x-main full" role="main">';
188 188
     } elseif ($stack == 'ethos') {
189 189
         echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';
190
-    }else{
190
+    } else {
191 191
         echo '<div class="x-container max width offset">';
192 192
     }
193 193
 }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 {
222 222
     $content_class = ' entry-wrap ';
223 223
 
224
-    echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';
224
+    echo '<div class="x-main left '.$class.$content_class.' " role="main">';
225 225
 }
226 226
 
227 227
 /**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_x_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
249 249
 {
250
-    echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';
250
+    echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="'.$itemtype.'">';
251 251
 }
252 252
 
253 253
 /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             // 8. Get shop title.
320 320
             //
321 321
 
322
-            GLOBAL $post,$wp;
322
+            GLOBAL $post, $wp;
323 323
 
324 324
             if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) {
325 325
                 geodir_breadcrumb();
@@ -327,57 +327,57 @@  discard block
 block discarded – undo
327 327
 
328 328
                 $stack = x_get_stack();
329 329
                 $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1
330
-                $home_text = '<span class="home"><i class="x-icon-home"></i></span>';               // 2
331
-                $home_link = home_url();                                                            // 3
332
-                $current_before = '<span class="current">';                                              // 4
333
-                $current_after = '</span>';                                                             // 5
334
-                $page_title = get_the_title();                                                       // 6
335
-                $blog_title = get_the_title(get_option('page_for_posts', true));                 // 7
336
-                $shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8
330
+                $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2
331
+                $home_link = home_url(); // 3
332
+                $current_before = '<span class="current">'; // 4
333
+                $current_after = '</span>'; // 5
334
+                $page_title = get_the_title(); // 6
335
+                $blog_title = get_the_title(get_option('page_for_posts', true)); // 7
336
+                $shop_title = get_theme_mod('x_'.$stack.'_shop_title'); // 8
337 337
 
338 338
                 if (function_exists('woocommerce_get_page_id')) {
339 339
                     $shop_url = x_get_shop_link();
340
-                    $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
340
+                    $shop_link = '<a href="'.$shop_url.'">'.$shop_title.'</a>';
341 341
                 }
342 342
 
343 343
                 if (is_front_page()) {
344
-                    echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';
344
+                    echo '<div class="x-breadcrumbs">'.$current_before.$home_text.$current_after.'</div>';
345 345
                 } elseif (is_home()) {
346
-                    echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';
346
+                    echo '<div class="x-breadcrumbs"><a href="'.$home_link.'">'.$home_text.'</a>'.$delimiter.$current_before.$blog_title.$current_after.'</div>';
347 347
                 } else {
348
-                    echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
348
+                    echo '<div class="x-breadcrumbs"><a href="'.$home_link.'">'.$home_text.'</a>'.$delimiter;
349 349
                     if (is_category()) {
350 350
                         $the_cat = get_category(get_query_var('cat'), false);
351 351
                         if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);
352
-                        echo $current_before . single_cat_title('', false) . $current_after;
352
+                        echo $current_before.single_cat_title('', false).$current_after;
353 353
                     } elseif (x_is_product_category()) {
354
-                        echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
354
+                        echo $shop_link.$delimiter.$current_before.single_cat_title('', false).$current_after;
355 355
                     } elseif (x_is_product_tag()) {
356
-                        echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
356
+                        echo $shop_link.$delimiter.$current_before.single_tag_title('', false).$current_after;
357 357
                     } elseif (is_search()) {
358
-                        echo $current_before . __('Search Results for ', '__x__') . '&#8220;' . get_search_query() . '&#8221;' . $current_after;
358
+                        echo $current_before.__('Search Results for ', '__x__').'&#8220;'.get_search_query().'&#8221;'.$current_after;
359 359
                     } elseif (is_singular('post')) {
360 360
                         if (get_option('page_for_posts') == is_front_page()) {
361
-                            echo $current_before . $page_title . $current_after;
361
+                            echo $current_before.$page_title.$current_after;
362 362
                         } else {
363
-                            echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
363
+                            echo '<a href="'.get_permalink(get_option('page_for_posts')).'" title="'.esc_attr(__('See All Posts', '__x__')).'">'.$blog_title.'</a>'.$delimiter.$current_before.$page_title.$current_after;
364 364
                         }
365 365
                     } elseif (x_is_portfolio()) {
366
-                        echo $current_before . get_the_title() . $current_after;
366
+                        echo $current_before.get_the_title().$current_after;
367 367
                     } elseif (x_is_portfolio_item()) {
368 368
                         $link = x_get_parent_portfolio_link();
369 369
                         $title = x_get_parent_portfolio_title();
370
-                        echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
370
+                        echo '<a href="'.$link.'" title="'.esc_attr(__('See All Posts', '__x__')).'">'.$title.'</a>'.$delimiter.$current_before.$page_title.$current_after;
371 371
                     } elseif (x_is_product()) {
372
-                        echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
372
+                        echo $shop_link.$delimiter.$current_before.$page_title.$current_after;
373 373
                     } elseif (is_page() && !$post->post_parent) {
374
-                        echo $current_before . $page_title . $current_after;
374
+                        echo $current_before.$page_title.$current_after;
375 375
                     } elseif (is_page() && $post->post_parent) {
376 376
                         $parent_id = $post->post_parent;
377 377
                         $breadcrumbs = array();
378 378
                         while ($parent_id) {
379 379
                             $page = get_page($parent_id);
380
-                            $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
380
+                            $breadcrumbs[] = '<a href="'.get_permalink($page->ID).'">'.get_the_title($page->ID).'</a>';
381 381
                             $parent_id = $page->post_parent;
382 382
                         }
383 383
                         $breadcrumbs = array_reverse($breadcrumbs);
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
                             echo $breadcrumbs[$i];
386 386
                             if ($i != count($breadcrumbs) - 1) echo $delimiter;
387 387
                         }
388
-                        echo $delimiter . $current_before . $page_title . $current_after;
388
+                        echo $delimiter.$current_before.$page_title.$current_after;
389 389
                     } elseif (is_tag()) {
390
-                        echo $current_before . single_tag_title('', false) . $current_after;
390
+                        echo $current_before.single_tag_title('', false).$current_after;
391 391
                     } elseif (is_author()) {
392 392
                         GLOBAL $author;
393 393
                         $userdata = get_userdata($author);
394
-                        echo $current_before . __('Posts by ', '__x__') . '&#8220;' . $userdata->display_name . $current_after . '&#8221;';
394
+                        echo $current_before.__('Posts by ', '__x__').'&#8220;'.$userdata->display_name.$current_after.'&#8221;';
395 395
                     } elseif (is_404()) {
396
-                        echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after;
396
+                        echo $current_before.__('404 (Page Not Found)', '__x__').$current_after;
397 397
                     } elseif (is_archive()) {
398 398
                         if (x_is_shop()) {
399
-                            echo $current_before . $shop_title . $current_after;
399
+                            echo $current_before.$shop_title.$current_after;
400 400
                         } else {
401
-                            echo $current_before . __('Archives ', '__x__') . $current_after;
401
+                            echo $current_before.__('Archives ', '__x__').$current_after;
402 402
                         }
403 403
                     }
404 404
                     if (get_query_var('paged')) {
405
-                        echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>';
405
+                        echo ' <span class="current" style="white-space: nowrap;">('.__('Page', '__x__').' '.get_query_var('paged').')</span>';
406 406
                     }
407 407
                     echo '</div>';
408 408
                 }
Please login to merge, or discard this patch.
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -22,60 +22,60 @@  discard block
 block discarded – undo
22 22
 function geodir_x_action_calls()
23 23
 {
24 24
 
25
-    /* ACTIONS
25
+	/* ACTIONS
26 26
     ****************************************************************************************/
27 27
 
28
-    // Add body class for styling purposes
29
-    add_filter('body_class', 'geodir_x_body_class');
28
+	// Add body class for styling purposes
29
+	add_filter('body_class', 'geodir_x_body_class');
30 30
 
31
-    // HOME TOP SIDEBAR
32
-    //remove_action( 'geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );
33
-    //remove_action( 'geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );
34
-    //add_action( 'geodir_wrapper_open', 'geodir_x_home_sidebar', 5 );
35
-    add_action('geodir_before_search_form', 'geodir_x_search_container_open');
36
-    add_action('geodir_after_search_form', 'geodir_x_search_container_close');
31
+	// HOME TOP SIDEBAR
32
+	//remove_action( 'geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );
33
+	//remove_action( 'geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10 );
34
+	//add_action( 'geodir_wrapper_open', 'geodir_x_home_sidebar', 5 );
35
+	add_action('geodir_before_search_form', 'geodir_x_search_container_open');
36
+	add_action('geodir_after_search_form', 'geodir_x_search_container_close');
37 37
 
38
-    // WRAPPER OPEN ACTIONS
39
-    remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
40
-    add_action('geodir_wrapper_open', 'geodir_x_action_wrapper_open', 9);
38
+	// WRAPPER OPEN ACTIONS
39
+	remove_action('geodir_wrapper_open', 'geodir_action_wrapper_open', 10);
40
+	add_action('geodir_wrapper_open', 'geodir_x_action_wrapper_open', 9);
41 41
 
42
-    // WRAPPER CLOSE ACTIONS
43
-    remove_action('geodir_wrapper_close', 'geodir_action_wrapper_close', 10);
44
-    add_action('geodir_wrapper_close', 'geodir_x_action_wrapper_close', 11);
42
+	// WRAPPER CLOSE ACTIONS
43
+	remove_action('geodir_wrapper_close', 'geodir_action_wrapper_close', 10);
44
+	add_action('geodir_wrapper_close', 'geodir_x_action_wrapper_close', 11);
45 45
 
46
-    // WRAPPER CONTENT OPEN ACTIONS
47
-    remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
48
-    add_action('geodir_wrapper_content_open', 'geodir_x_action_wrapper_content_open', 9, 3);
46
+	// WRAPPER CONTENT OPEN ACTIONS
47
+	remove_action('geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10);
48
+	add_action('geodir_wrapper_content_open', 'geodir_x_action_wrapper_content_open', 9, 3);
49 49
 
50
-    // WRAPPER CONTENT CLOSE ACTIONS
51
-    remove_action('geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10);
52
-    add_action('geodir_wrapper_content_close', 'geodir_x_action_wrapper_content_close', 11);
50
+	// WRAPPER CONTENT CLOSE ACTIONS
51
+	remove_action('geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10);
52
+	add_action('geodir_wrapper_content_close', 'geodir_x_action_wrapper_content_close', 11);
53 53
 
54
-    // SIDEBAR RIGHT OPEN ACTIONS
55
-    remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
56
-    add_action('geodir_sidebar_right_open', 'geodir_x_action_sidebar_right_open', 10, 4);
54
+	// SIDEBAR RIGHT OPEN ACTIONS
55
+	remove_action('geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10);
56
+	add_action('geodir_sidebar_right_open', 'geodir_x_action_sidebar_right_open', 10, 4);
57 57
 
58
-    // SIDEBAR RIGHT CLOSE ACTIONS
59
-    remove_action('geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10);
60
-    add_action('geodir_sidebar_right_close', 'geodir_x_action_sidebar_right_close', 10, 1);
58
+	// SIDEBAR RIGHT CLOSE ACTIONS
59
+	remove_action('geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10);
60
+	add_action('geodir_sidebar_right_close', 'geodir_x_action_sidebar_right_close', 10, 1);
61 61
 
62
-    // REMOVE BREADCRUMBS
63
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
64
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
65
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
66
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
67
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
62
+	// REMOVE BREADCRUMBS
63
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
64
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
65
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
66
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
67
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
68
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
69 69
 
70
-    // make top section wide
71
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
72
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
73
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
74
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
75
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
76
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
70
+	// make top section wide
71
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
72
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
73
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
74
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
75
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
76
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
77 77
 
78
-    add_action('geodir_wrapper_open', 'gd_X_compat_add_top_section_back', 5);
78
+	add_action('geodir_wrapper_open', 'gd_X_compat_add_top_section_back', 5);
79 79
 
80 80
 
81 81
 } // Close geodir_x_action_calls
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 function gd_X_compat_add_top_section_back()
93 93
 {
94 94
 
95
-    if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
96
-        geodir_action_geodir_sidebar_home_top();
97
-    } elseif (geodir_is_page('listing')) {
98
-        geodir_action_geodir_sidebar_listings_top();
99
-    } elseif (geodir_is_page('detail')) {
100
-        geodir_action_geodir_sidebar_detail_top();
101
-    } elseif (geodir_is_page('search')) {
102
-        geodir_action_geodir_sidebar_search_top();
103
-    } elseif (geodir_is_page('author')) {
104
-        geodir_action_geodir_sidebar_author_top();
105
-    }
95
+	if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
96
+		geodir_action_geodir_sidebar_home_top();
97
+	} elseif (geodir_is_page('listing')) {
98
+		geodir_action_geodir_sidebar_listings_top();
99
+	} elseif (geodir_is_page('detail')) {
100
+		geodir_action_geodir_sidebar_detail_top();
101
+	} elseif (geodir_is_page('search')) {
102
+		geodir_action_geodir_sidebar_search_top();
103
+	} elseif (geodir_is_page('author')) {
104
+		geodir_action_geodir_sidebar_author_top();
105
+	}
106 106
 
107 107
 
108 108
 }
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
  */
121 121
 function geodir_x_body_class($classes)
122 122
 {
123
-    $classes[] = 'geodir-x';
123
+	$classes[] = 'geodir-x';
124 124
 
125
-    if(isset($_REQUEST['geodir_search'])){
126
-        $classes[] = 'geodir-x-search';
127
-    }
128
-    return $classes;
125
+	if(isset($_REQUEST['geodir_search'])){
126
+		$classes[] = 'geodir-x-search';
127
+	}
128
+	return $classes;
129 129
 }
130 130
 
131 131
 /**
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
  */
138 138
 function geodir_x_home_sidebar()
139 139
 {
140
-    //if ( geodir_is_geodir_page() ) {
141
-    global $wp;
142
-    if ($wp->query_vars['page_id'] == geodir_location_page_id() || is_home() && !geodir_is_page('login')) {
143
-        echo '<div class="x-main full">';
144
-        dynamic_sidebar('geodir_home_top');
145
-        echo '</div>';
146
-    }
147
-    //}
140
+	//if ( geodir_is_geodir_page() ) {
141
+	global $wp;
142
+	if ($wp->query_vars['page_id'] == geodir_location_page_id() || is_home() && !geodir_is_page('login')) {
143
+		echo '<div class="x-main full">';
144
+		dynamic_sidebar('geodir_home_top');
145
+		echo '</div>';
146
+	}
147
+	//}
148 148
 }
149 149
 
150 150
 /**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function geodir_x_search_container_open()
157 157
 {
158
-    echo '<div class="x-container-fluid x-container max">';
158
+	echo '<div class="x-container-fluid x-container max">';
159 159
 }
160 160
 
161 161
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function geodir_x_search_container_close()
168 168
 {
169
-    echo '</div>';
169
+	echo '</div>';
170 170
 }
171 171
 
172 172
 /**
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function geodir_x_action_wrapper_open()
179 179
 {
180
-    $stack = x_get_stack();
181
-
182
-    if ($stack == 'integrity') {
183
-        echo '<div class="x-container-fluid x-container max width offset">';
184
-    } elseif ($stack == 'renew') {
185
-        echo '<div class="x-container-fluid x-container max width offset cf">';
186
-    } elseif ($stack == 'icon') {
187
-        echo '<div class="x-main full" role="main">';
188
-    } elseif ($stack == 'ethos') {
189
-        echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';
190
-    }else{
191
-        echo '<div class="x-container max width offset">';
192
-    }
180
+	$stack = x_get_stack();
181
+
182
+	if ($stack == 'integrity') {
183
+		echo '<div class="x-container-fluid x-container max width offset">';
184
+	} elseif ($stack == 'renew') {
185
+		echo '<div class="x-container-fluid x-container max width offset cf">';
186
+	} elseif ($stack == 'icon') {
187
+		echo '<div class="x-main full" role="main">';
188
+	} elseif ($stack == 'ethos') {
189
+		echo '<div class="x-container-fluid x-container max width main"><div class="offset cf">';
190
+	}else{
191
+		echo '<div class="x-container max width offset">';
192
+	}
193 193
 }
194 194
 
195 195
 /**
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
  */
201 201
 function geodir_x_action_wrapper_close()
202 202
 {
203
-    $stack = x_get_stack();
204
-    if ($stack == 'ethos') {
205
-        echo '</div></div>';
206
-    } else {
207
-        echo '</div>';
208
-    }
203
+	$stack = x_get_stack();
204
+	if ($stack == 'ethos') {
205
+		echo '</div></div>';
206
+	} else {
207
+		echo '</div>';
208
+	}
209 209
 }
210 210
 
211 211
 /**
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function geodir_x_action_wrapper_content_open($type = '', $id = '', $class = '')
221 221
 {
222
-    $content_class = ' entry-wrap ';
222
+	$content_class = ' entry-wrap ';
223 223
 
224
-    echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';
224
+	echo '<div class="x-main left ' . $class . $content_class . ' " role="main">';
225 225
 }
226 226
 
227 227
 /**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
  */
233 233
 function geodir_x_action_wrapper_content_close()
234 234
 {
235
-    echo '</div>';
235
+	echo '</div>';
236 236
 }
237 237
 
238 238
 /**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_x_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
249 249
 {
250
-    echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';
250
+	echo '<aside class="x-sidebar right" role="complementary" itemscope itemtype="' . $itemtype . '">';
251 251
 }
252 252
 
253 253
 /**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function geodir_x_action_sidebar_right_close($type = '')
261 261
 {
262
-    echo '</aside>';
262
+	echo '</aside>';
263 263
 }
264 264
 
265 265
 add_filter('geodir_breadcrumb', 'geodir_x_breadcrumb');
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function geodir_x_breadcrumb($breadcrumb)
275 275
 {
276
-    $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '', $breadcrumb);
277
-    $breadcrumb = str_replace('<li>', '', $breadcrumb);
278
-    $breadcrumb = str_replace('</li>', '', $breadcrumb);
279
-    $breadcrumb = str_replace('Home', '<span class="home"><i class="x-icon-home"></i></span>', $breadcrumb);
280
-    $breadcrumb = str_replace('</ul></div>', '', $breadcrumb);
281
-    return $breadcrumb;
276
+	$breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '', $breadcrumb);
277
+	$breadcrumb = str_replace('<li>', '', $breadcrumb);
278
+	$breadcrumb = str_replace('</li>', '', $breadcrumb);
279
+	$breadcrumb = str_replace('Home', '<span class="home"><i class="x-icon-home"></i></span>', $breadcrumb);
280
+	$breadcrumb = str_replace('</ul></div>', '', $breadcrumb);
281
+	return $breadcrumb;
282 282
 }
283 283
 
284 284
 add_filter('geodir_breadcrumb_separator', 'geodir_x_breadcrumb_separator');
@@ -292,125 +292,125 @@  discard block
 block discarded – undo
292 292
  */
293 293
 function geodir_x_breadcrumb_separator($separator)
294 294
 {
295
-    $separator = str_replace(' > ', ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> ', $separator);
296
-    return $separator;
295
+	$separator = str_replace(' > ', ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> ', $separator);
296
+	return $separator;
297 297
 }
298 298
 
299 299
 if (!function_exists('x_breadcrumbs')) :
300
-    /**
301
-     * breadcrumbs.
302
-     *
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function x_breadcrumbs()
307
-    {
308
-
309
-        if (x_get_option('x_breadcrumb_display', '1')) {
310
-
311
-            //
312
-            // 1. Delimiter between crumbs.
313
-            // 2. Output text for the "Home" link.
314
-            // 3. Link to the home page.
315
-            // 4. Tag before the current crumb.
316
-            // 5. Tag after the current crumb.
317
-            // 6. Get page title.
318
-            // 7. Get blog title.
319
-            // 8. Get shop title.
320
-            //
321
-
322
-            GLOBAL $post,$wp;
323
-
324
-            if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) {
325
-                geodir_breadcrumb();
326
-            } else {
327
-
328
-                $stack = x_get_stack();
329
-                $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1
330
-                $home_text = '<span class="home"><i class="x-icon-home"></i></span>';               // 2
331
-                $home_link = home_url();                                                            // 3
332
-                $current_before = '<span class="current">';                                              // 4
333
-                $current_after = '</span>';                                                             // 5
334
-                $page_title = get_the_title();                                                       // 6
335
-                $blog_title = get_the_title(get_option('page_for_posts', true));                 // 7
336
-                $shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8
337
-
338
-                if (function_exists('woocommerce_get_page_id')) {
339
-                    $shop_url = x_get_shop_link();
340
-                    $shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
341
-                }
342
-
343
-                if (is_front_page()) {
344
-                    echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';
345
-                } elseif (is_home()) {
346
-                    echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';
347
-                } else {
348
-                    echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
349
-                    if (is_category()) {
350
-                        $the_cat = get_category(get_query_var('cat'), false);
351
-                        if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);
352
-                        echo $current_before . single_cat_title('', false) . $current_after;
353
-                    } elseif (x_is_product_category()) {
354
-                        echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
355
-                    } elseif (x_is_product_tag()) {
356
-                        echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
357
-                    } elseif (is_search()) {
358
-                        echo $current_before . __('Search Results for ', '__x__') . '&#8220;' . get_search_query() . '&#8221;' . $current_after;
359
-                    } elseif (is_singular('post')) {
360
-                        if (get_option('page_for_posts') == is_front_page()) {
361
-                            echo $current_before . $page_title . $current_after;
362
-                        } else {
363
-                            echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
364
-                        }
365
-                    } elseif (x_is_portfolio()) {
366
-                        echo $current_before . get_the_title() . $current_after;
367
-                    } elseif (x_is_portfolio_item()) {
368
-                        $link = x_get_parent_portfolio_link();
369
-                        $title = x_get_parent_portfolio_title();
370
-                        echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
371
-                    } elseif (x_is_product()) {
372
-                        echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
373
-                    } elseif (is_page() && !$post->post_parent) {
374
-                        echo $current_before . $page_title . $current_after;
375
-                    } elseif (is_page() && $post->post_parent) {
376
-                        $parent_id = $post->post_parent;
377
-                        $breadcrumbs = array();
378
-                        while ($parent_id) {
379
-                            $page = get_page($parent_id);
380
-                            $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
381
-                            $parent_id = $page->post_parent;
382
-                        }
383
-                        $breadcrumbs = array_reverse($breadcrumbs);
384
-                        for ($i = 0; $i < count($breadcrumbs); $i++) {
385
-                            echo $breadcrumbs[$i];
386
-                            if ($i != count($breadcrumbs) - 1) echo $delimiter;
387
-                        }
388
-                        echo $delimiter . $current_before . $page_title . $current_after;
389
-                    } elseif (is_tag()) {
390
-                        echo $current_before . single_tag_title('', false) . $current_after;
391
-                    } elseif (is_author()) {
392
-                        GLOBAL $author;
393
-                        $userdata = get_userdata($author);
394
-                        echo $current_before . __('Posts by ', '__x__') . '&#8220;' . $userdata->display_name . $current_after . '&#8221;';
395
-                    } elseif (is_404()) {
396
-                        echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after;
397
-                    } elseif (is_archive()) {
398
-                        if (x_is_shop()) {
399
-                            echo $current_before . $shop_title . $current_after;
400
-                        } else {
401
-                            echo $current_before . __('Archives ', '__x__') . $current_after;
402
-                        }
403
-                    }
404
-                    if (get_query_var('paged')) {
405
-                        echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>';
406
-                    }
407
-                    echo '</div>';
408
-                }
409
-
410
-            }
411
-
412
-        }
413
-    } // ends my geodir check
300
+	/**
301
+	 * breadcrumbs.
302
+	 *
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function x_breadcrumbs()
307
+	{
308
+
309
+		if (x_get_option('x_breadcrumb_display', '1')) {
310
+
311
+			//
312
+			// 1. Delimiter between crumbs.
313
+			// 2. Output text for the "Home" link.
314
+			// 3. Link to the home page.
315
+			// 4. Tag before the current crumb.
316
+			// 5. Tag after the current crumb.
317
+			// 6. Get page title.
318
+			// 7. Get blog title.
319
+			// 8. Get shop title.
320
+			//
321
+
322
+			GLOBAL $post,$wp;
323
+
324
+			if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) {
325
+				geodir_breadcrumb();
326
+			} else {
327
+
328
+				$stack = x_get_stack();
329
+				$delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1
330
+				$home_text = '<span class="home"><i class="x-icon-home"></i></span>';               // 2
331
+				$home_link = home_url();                                                            // 3
332
+				$current_before = '<span class="current">';                                              // 4
333
+				$current_after = '</span>';                                                             // 5
334
+				$page_title = get_the_title();                                                       // 6
335
+				$blog_title = get_the_title(get_option('page_for_posts', true));                 // 7
336
+				$shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8
337
+
338
+				if (function_exists('woocommerce_get_page_id')) {
339
+					$shop_url = x_get_shop_link();
340
+					$shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
341
+				}
342
+
343
+				if (is_front_page()) {
344
+					echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';
345
+				} elseif (is_home()) {
346
+					echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';
347
+				} else {
348
+					echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
349
+					if (is_category()) {
350
+						$the_cat = get_category(get_query_var('cat'), false);
351
+						if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);
352
+						echo $current_before . single_cat_title('', false) . $current_after;
353
+					} elseif (x_is_product_category()) {
354
+						echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
355
+					} elseif (x_is_product_tag()) {
356
+						echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
357
+					} elseif (is_search()) {
358
+						echo $current_before . __('Search Results for ', '__x__') . '&#8220;' . get_search_query() . '&#8221;' . $current_after;
359
+					} elseif (is_singular('post')) {
360
+						if (get_option('page_for_posts') == is_front_page()) {
361
+							echo $current_before . $page_title . $current_after;
362
+						} else {
363
+							echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
364
+						}
365
+					} elseif (x_is_portfolio()) {
366
+						echo $current_before . get_the_title() . $current_after;
367
+					} elseif (x_is_portfolio_item()) {
368
+						$link = x_get_parent_portfolio_link();
369
+						$title = x_get_parent_portfolio_title();
370
+						echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
371
+					} elseif (x_is_product()) {
372
+						echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
373
+					} elseif (is_page() && !$post->post_parent) {
374
+						echo $current_before . $page_title . $current_after;
375
+					} elseif (is_page() && $post->post_parent) {
376
+						$parent_id = $post->post_parent;
377
+						$breadcrumbs = array();
378
+						while ($parent_id) {
379
+							$page = get_page($parent_id);
380
+							$breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
381
+							$parent_id = $page->post_parent;
382
+						}
383
+						$breadcrumbs = array_reverse($breadcrumbs);
384
+						for ($i = 0; $i < count($breadcrumbs); $i++) {
385
+							echo $breadcrumbs[$i];
386
+							if ($i != count($breadcrumbs) - 1) echo $delimiter;
387
+						}
388
+						echo $delimiter . $current_before . $page_title . $current_after;
389
+					} elseif (is_tag()) {
390
+						echo $current_before . single_tag_title('', false) . $current_after;
391
+					} elseif (is_author()) {
392
+						GLOBAL $author;
393
+						$userdata = get_userdata($author);
394
+						echo $current_before . __('Posts by ', '__x__') . '&#8220;' . $userdata->display_name . $current_after . '&#8221;';
395
+					} elseif (is_404()) {
396
+						echo $current_before . __('404 (Page Not Found)', '__x__') . $current_after;
397
+					} elseif (is_archive()) {
398
+						if (x_is_shop()) {
399
+							echo $current_before . $shop_title . $current_after;
400
+						} else {
401
+							echo $current_before . __('Archives ', '__x__') . $current_after;
402
+						}
403
+					}
404
+					if (get_query_var('paged')) {
405
+						echo ' <span class="current" style="white-space: nowrap;">(' . __('Page', '__x__') . ' ' . get_query_var('paged') . ')</span>';
406
+					}
407
+					echo '</div>';
408
+				}
409
+
410
+			}
411
+
412
+		}
413
+	} // ends my geodir check
414 414
 endif;
415 415
 
416 416
 
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
  */
426 426
 function geodir_x_location_switcher_menu_li_class($class)
427 427
 {
428
-    $class .= " menu-item-has-children ";
429
-    return $class;
428
+	$class .= " menu-item-has-children ";
429
+	return $class;
430 430
 }
431 431
 
432 432
 add_filter('geodir_sub_menu_li_class', 'geodir_x_sub_menu_li_class', 10, 1);
@@ -440,6 +440,6 @@  discard block
 block discarded – undo
440 440
  */
441 441
 function geodir_x_sub_menu_li_class($class)
442 442
 {
443
-    $class .= " menu-item-has-children ";
444
-    return $class;
443
+	$class .= " menu-item-has-children ";
444
+	return $class;
445 445
 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_taxonomy_hooks_actions.php 4 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @global wpdb $wpdb WordPress database abstraction object.
326 326
  * @deprecated 1.5.0 No longer required.
327 327
  * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
328
- * @return array Rewrite rules.
328
+ * @return string Rewrite rules.
329 329
  */
330 330
 function geodir_htaccess_contents($rules)
331 331
 {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
  * @since 1.0.0
351 351
  *
352 352
  * @param array $public_query_vars The array of query variables.
353
- * @return array Query variables.
353
+ * @return string[] Query variables.
354 354
  */
355 355
 function geodir_add_location_var($public_query_vars)
356 356
 {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
  * @since 1.0.0
367 367
  *
368 368
  * @param array $public_query_vars The array of query variables.
369
- * @return array Query variables.
369
+ * @return string[] Query variables.
370 370
  */
371 371
 function geodir_add_geodir_page_var($public_query_vars)
372 372
 {
@@ -793,7 +793,6 @@  discard block
 block discarded – undo
793 793
  *
794 794
  * @since 1.0.0
795 795
  *
796
- * @param object $wp The WordPress object.
797 796
  */
798 797
 function geodir_custom_post_status()
799 798
 {
Please login to merge, or discard this patch.
Braces   +103 added lines, -70 removed lines patch added patch discarded remove patch
@@ -106,24 +106,30 @@  discard block
 block discarded – undo
106 106
         $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
107 107
 
108 108
         if ($post_type == 'gd_place') {
109
-            if (array_key_exists('has_archive', $args))
110
-                $args['has_archive'] = $listing_slug;
109
+            if (array_key_exists('has_archive', $args)) {
110
+                            $args['has_archive'] = $listing_slug;
111
+            }
111 112
 
112 113
             if (array_key_exists('rewrite', $args)) {
113
-                if (array_key_exists('slug', $args['rewrite']))
114
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
114
+                if (array_key_exists('slug', $args['rewrite'])) {
115
+                                    $args['rewrite']['slug'] = $listing_slug;
116
+                }
117
+                // . '/%gd_taxonomy%';
115 118
             }
116 119
 
117 120
             $geodir_post_types = get_option('geodir_post_types');
118 121
 
119 122
             if (array_key_exists($post_type, $geodir_post_types)) {
120 123
 
121
-                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
122
-                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
124
+                if (array_key_exists('has_archive', $geodir_post_types[$post_type])) {
125
+                                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
126
+                }
123 127
 
124
-                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
125
-                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
126
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
128
+                if (array_key_exists('rewrite', $geodir_post_types[$post_type])) {
129
+                                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
130
+                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;
131
+                }
132
+                // . '/%gd_taxonomy%';
127 133
 
128 134
                 update_option('geodir_post_types', $geodir_post_types);
129 135
 
@@ -138,10 +144,11 @@  discard block
 block discarded – undo
138 144
             if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
139 145
                 $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
140 146
 
141
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
142
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
147
+                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) {
148
+                                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
143 149
                         if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
144
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
150
+                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
151
+                }
145 152
 
146 153
                 update_option('geodir_taxonomies', $geodir_taxonomies);
147 154
 
@@ -152,10 +159,11 @@  discard block
 block discarded – undo
152 159
             if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
153 160
                 $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
154 161
 
155
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
156
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
162
+                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) {
163
+                                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
157 164
                         if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
158
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
165
+                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
166
+                }
159 167
 
160 168
                 update_option('geodir_taxonomies', $geodir_taxonomies_tag);
161 169
 
@@ -221,8 +229,9 @@  discard block
 block discarded – undo
221 229
         global $wpdb;
222 230
         $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
223 231
     }
224
-    if (!isset($location_prefix))
225
-        $location_prefix = 'location';
232
+    if (!isset($location_prefix)) {
233
+            $location_prefix = 'location';
234
+    }
226 235
 
227 236
 	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
228 237
 	if ($location_manager) {
@@ -441,14 +450,17 @@  discard block
 block discarded – undo
441 450
         $gd_country = '';
442 451
         $gd_region = '';
443 452
         $gd_city = '';
444
-        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
445
-            $gd_country = urldecode($wp->query_vars['gd_country']);
453
+        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') {
454
+                    $gd_country = urldecode($wp->query_vars['gd_country']);
455
+        }
446 456
 
447
-        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
448
-            $gd_region = urldecode($wp->query_vars['gd_region']);
457
+        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') {
458
+                    $gd_region = urldecode($wp->query_vars['gd_region']);
459
+        }
449 460
 
450
-        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
451
-            $gd_city = urldecode($wp->query_vars['gd_city']);
461
+        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') {
462
+                    $gd_city = urldecode($wp->query_vars['gd_city']);
463
+        }
452 464
 
453 465
         if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
454 466
             $default_location = geodir_get_default_location();
@@ -456,17 +468,19 @@  discard block
 block discarded – undo
456 468
             if (get_option('geodir_add_location_url')) {
457 469
                 if ($geodir_show_location_url != 'all') {
458 470
                     if ($gd_region == '') {
459
-                        if ($gd_ses_region = $gd_session->get('gd_region'))
460
-                            $gd_region = $gd_ses_region;
461
-                        else
462
-                            $gd_region = $default_location->region_slug;
471
+                        if ($gd_ses_region = $gd_session->get('gd_region')) {
472
+                                                    $gd_region = $gd_ses_region;
473
+                        } else {
474
+                                                    $gd_region = $default_location->region_slug;
475
+                        }
463 476
                     }
464 477
 
465 478
                     if ($gd_city == '') {
466
-                        if ($gd_ses_city = $gd_session->get('gd_city'))
467
-                            $gd_city = $gd_ses_city;
468
-                        else
469
-                            $gd_city = $default_location->city_slug;
479
+                        if ($gd_ses_city = $gd_session->get('gd_city')) {
480
+                                                    $gd_city = $gd_ses_city;
481
+                        } else {
482
+                                                    $gd_city = $default_location->city_slug;
483
+                        }
470 484
 
471 485
                         $base_location_link = geodir_get_location_link('base');
472 486
                         wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
@@ -585,8 +599,9 @@  discard block
 block discarded – undo
585 599
 
586 600
 
587 601
 				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
588
-				if (!$post_title_replace_count)
589
-					$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
602
+				if (!$post_title_replace_count) {
603
+									$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
604
+				}
590 605
 				$geodir_terms = explode('/', $geodir_term);
591 606
 				$geodir_last_term = end($geodir_terms);
592 607
 
@@ -622,8 +637,9 @@  discard block
 block discarded – undo
622 637
                     if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623 638
                         geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624 639
                         geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
-                    )
626
-                        $is_geodir_location_found = true;
640
+                    ) {
641
+                                            $is_geodir_location_found = true;
642
+                    }
627 643
 
628 644
                     // if location has not been found for country , region and city then search for country and region only
629 645
 
@@ -631,8 +647,9 @@  discard block
 block discarded – undo
631 647
                         $gd_city = '';
632 648
                         if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633 649
                             geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
-                        )
635
-                            $is_geodir_location_found = true;
650
+                        ) {
651
+                                                    $is_geodir_location_found = true;
652
+                        }
636 653
 
637 654
                     }
638 655
 
@@ -640,8 +657,9 @@  discard block
 block discarded – undo
640 657
                     if (!$is_geodir_location_found) {
641 658
                         $gd_city = '';
642 659
                         $gd_region = '';
643
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
-                            $is_geodir_location_found = true;
660
+                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) {
661
+                                                    $is_geodir_location_found = true;
662
+                        }
645 663
                     }
646 664
                 } else if ($geodir_show_location_url == 'country_city') {
647 665
                     if (count($geodir_terms) >= 2) {
@@ -651,17 +669,19 @@  discard block
 block discarded – undo
651 669
                         $gd_country = urldecode($geodir_terms[0]);
652 670
                     }
653 671
 
654
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
-                        $is_geodir_location_found = true;
672
+                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
673
+                                            $is_geodir_location_found = true;
674
+                    }
656 675
 
657 676
                     // if location has not been found for country and city  then search for country only
658 677
                     if (!$is_geodir_location_found) {
659 678
                         $gd_city = '';
660 679
                         
661
-						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662
-                            $is_geodir_location_found = true;
680
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) {
681
+						                            $is_geodir_location_found = true;
682
+						}
663 683
                     }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
684
+                } else if ($geodir_show_location_url == 'region_city') {
665 685
                     if (count($geodir_terms) >= 2) {
666 686
                         $gd_region = urldecode($geodir_terms[0]);
667 687
                         $gd_city = urldecode($geodir_terms[1]);
@@ -669,15 +689,17 @@  discard block
 block discarded – undo
669 689
                         $gd_region = urldecode($geodir_terms[0]);
670 690
                     }
671 691
 
672
-                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
-                        $is_geodir_location_found = true;
692
+                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
693
+                                            $is_geodir_location_found = true;
694
+                    }
674 695
 
675 696
                     // if location has not been found for region and city  then search for region only
676 697
                     if (!$is_geodir_location_found) {
677 698
                         $gd_city = '';
678 699
                         
679
-						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
680
-                            $is_geodir_location_found = true;
700
+						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) {
701
+						                            $is_geodir_location_found = true;
702
+						}
681 703
                     }
682 704
                 } else {
683 705
                     $gd_city = $geodir_terms[0];
@@ -719,14 +741,17 @@  discard block
 block discarded – undo
719 741
 
720 742
             $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721 743
             // eliminate location related terms from taxonomy term
722
-            if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
744
+            if ($gd_country != '') {
745
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
746
+            }
724 747
 
725
-            if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
748
+            if ($gd_region != '') {
749
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
750
+            }
727 751
 
728
-            if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
752
+            if ($gd_city != '') {
753
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
754
+            }
730 755
 
731 756
 
732 757
             $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
@@ -762,27 +787,34 @@  discard block
 block discarded – undo
762 787
     if (get_option('geodir_add_location_url')) {        
763 788
 		if ($geodir_show_location_url == 'all') {
764 789
 		} else if ($geodir_show_location_url == 'country_city') {
765
-			 if (isset($wp->query_vars['gd_region']))
766
-                $wp->query_vars['gd_region'] = '';
790
+			 if (isset($wp->query_vars['gd_region'])) {
791
+			                 $wp->query_vars['gd_region'] = '';
792
+			 }
767 793
 		} else if ($geodir_show_location_url == 'region_city') {
768
-			if (isset($wp->query_vars['gd_country']))
769
-                $wp->query_vars['gd_country'] = '';
794
+			if (isset($wp->query_vars['gd_country'])) {
795
+			                $wp->query_vars['gd_country'] = '';
796
+			}
770 797
 		} else {
771
-			if (isset($wp->query_vars['gd_country']))
772
-                $wp->query_vars['gd_country'] = '';
798
+			if (isset($wp->query_vars['gd_country'])) {
799
+			                $wp->query_vars['gd_country'] = '';
800
+			}
773 801
 
774
-            if (isset($wp->query_vars['gd_region']))
775
-                $wp->query_vars['gd_region'] = '';
802
+            if (isset($wp->query_vars['gd_region'])) {
803
+                            $wp->query_vars['gd_region'] = '';
804
+            }
776 805
 		}
777 806
     } else {
778
-        if (isset($wp->query_vars['gd_country']))
779
-            $wp->query_vars['gd_country'] = '';
807
+        if (isset($wp->query_vars['gd_country'])) {
808
+                    $wp->query_vars['gd_country'] = '';
809
+        }
780 810
 
781
-        if (isset($wp->query_vars['gd_region']))
782
-            $wp->query_vars['gd_region'] = '';
811
+        if (isset($wp->query_vars['gd_region'])) {
812
+                    $wp->query_vars['gd_region'] = '';
813
+        }
783 814
 
784
-        if (isset($wp->query_vars['gd_city']))
785
-            $wp->query_vars['gd_city'] = '';
815
+        if (isset($wp->query_vars['gd_city'])) {
816
+                    $wp->query_vars['gd_city'] = '';
817
+        }
786 818
     }
787 819
 }
788 820
 
@@ -894,8 +926,9 @@  discard block
 block discarded – undo
894 926
 function geodir_exclude_page_where($where)
895 927
 {
896 928
     global $wpdb;
897
-    if (is_admin())
898
-        $where .= " AND $wpdb->posts.post_status != 'virtual'";
929
+    if (is_admin()) {
930
+            $where .= " AND $wpdb->posts.post_status != 'virtual'";
931
+    }
899 932
 
900 933
     return $where;
901 934
 }
Please login to merge, or discard this patch.
Indentation   +503 added lines, -503 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function geodir_register_taxonomies()
15 15
 {
16
-    $taxonomies = array();
17
-    $taxonomies = get_option('geodir_taxonomies');
18
-    // If custom taxonomies are present, register them
19
-    if (is_array($taxonomies)) {
20
-        // Sort taxonomies
21
-        ksort($taxonomies);
22
-
23
-        // Register taxonomies
24
-        foreach ($taxonomies as $taxonomy => $args) {
25
-            // Allow taxonomy names to be translated
26
-            if (!empty($args['args']['labels'])) {
27
-                foreach ($args['args']['labels'] as $key => $tax_label) {
28
-                    $args['args']['labels'][$key] = __($tax_label, 'geodirectory');
29
-                }
30
-            }
31
-
32
-            $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);
33
-
34
-            if (taxonomy_exists($taxonomy)) {
35
-                $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);
36
-            }
37
-        }
38
-    }
16
+	$taxonomies = array();
17
+	$taxonomies = get_option('geodir_taxonomies');
18
+	// If custom taxonomies are present, register them
19
+	if (is_array($taxonomies)) {
20
+		// Sort taxonomies
21
+		ksort($taxonomies);
22
+
23
+		// Register taxonomies
24
+		foreach ($taxonomies as $taxonomy => $args) {
25
+			// Allow taxonomy names to be translated
26
+			if (!empty($args['args']['labels'])) {
27
+				foreach ($args['args']['labels'] as $key => $tax_label) {
28
+					$args['args']['labels'][$key] = __($tax_label, 'geodirectory');
29
+				}
30
+			}
31
+
32
+			$tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);
33
+
34
+			if (taxonomy_exists($taxonomy)) {
35
+				$tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);
36
+			}
37
+		}
38
+	}
39 39
 }
40 40
 
41 41
 /**
@@ -46,45 +46,45 @@  discard block
 block discarded – undo
46 46
  * @global array $wp_post_types List of post types.
47 47
  */
48 48
 function geodir_register_post_types() {
49
-    global $wp_post_types;
49
+	global $wp_post_types;
50 50
     
51
-    /**
52
-     * Get available custom posttypes and taxonomies and register them.
53
-     */
54
-    _x('places', 'URL slug', 'geodirectory');
55
-
56
-    $post_types = array();
57
-    $post_types = get_option('geodir_post_types');
58
-
59
-    // Register each post type if array of data is returned
60
-    if (is_array($post_types)):
61
-
62
-        foreach ($post_types as $post_type => $args):
63
-
64
-            if (!empty($args['rewrite']['slug'])) {
65
-                $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');
66
-            }
67
-            $args = stripslashes_deep($args);
68
-
69
-            if (!empty($args['labels'])) {
70
-                foreach ($args['labels'] as $key => $val) {
71
-                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
72
-                }
73
-            }
74
-
75
-            /**
76
-             * Filter post type args.
77
-             *
78
-             * @since 1.0.0
79
-             * @param string $args Post type args.
80
-             * @param string $post_type The post type.
81
-             */
82
-            $args = apply_filters('geodir_post_type_args', $args, $post_type);
83
-
84
-            $post_type = register_post_type($post_type, $args);
85
-
86
-        endforeach;
87
-    endif;
51
+	/**
52
+	 * Get available custom posttypes and taxonomies and register them.
53
+	 */
54
+	_x('places', 'URL slug', 'geodirectory');
55
+
56
+	$post_types = array();
57
+	$post_types = get_option('geodir_post_types');
58
+
59
+	// Register each post type if array of data is returned
60
+	if (is_array($post_types)):
61
+
62
+		foreach ($post_types as $post_type => $args):
63
+
64
+			if (!empty($args['rewrite']['slug'])) {
65
+				$args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');
66
+			}
67
+			$args = stripslashes_deep($args);
68
+
69
+			if (!empty($args['labels'])) {
70
+				foreach ($args['labels'] as $key => $val) {
71
+					$args['labels'][$key] = __($val, 'geodirectory');// allow translation
72
+				}
73
+			}
74
+
75
+			/**
76
+			 * Filter post type args.
77
+			 *
78
+			 * @since 1.0.0
79
+			 * @param string $args Post type args.
80
+			 * @param string $post_type The post type.
81
+			 */
82
+			$args = apply_filters('geodir_post_type_args', $args, $post_type);
83
+
84
+			$post_type = register_post_type($post_type, $args);
85
+
86
+		endforeach;
87
+	endif;
88 88
 }
89 89
 
90 90
 /**
@@ -98,72 +98,72 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function geodir_post_type_args_modify($args, $post_type)
100 100
 {
101
-    $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
101
+	$geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
102 102
 	if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
103 103
 
104
-        $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
104
+		$listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
105 105
 
106
-        if ($post_type == 'gd_place') {
107
-            if (array_key_exists('has_archive', $args))
108
-                $args['has_archive'] = $listing_slug;
106
+		if ($post_type == 'gd_place') {
107
+			if (array_key_exists('has_archive', $args))
108
+				$args['has_archive'] = $listing_slug;
109 109
 
110
-            if (array_key_exists('rewrite', $args)) {
111
-                if (array_key_exists('slug', $args['rewrite']))
112
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
113
-            }
110
+			if (array_key_exists('rewrite', $args)) {
111
+				if (array_key_exists('slug', $args['rewrite']))
112
+					$args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
113
+			}
114 114
 
115
-            $geodir_post_types = get_option('geodir_post_types');
115
+			$geodir_post_types = get_option('geodir_post_types');
116 116
 
117
-            if (array_key_exists($post_type, $geodir_post_types)) {
117
+			if (array_key_exists($post_type, $geodir_post_types)) {
118 118
 
119
-                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
120
-                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
119
+				if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
120
+					$geodir_post_types[$post_type]['has_archive'] = $listing_slug;
121 121
 
122
-                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123
-                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
122
+				if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123
+					if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
+						$geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
125 125
 
126
-                update_option('geodir_post_types', $geodir_post_types);
126
+				update_option('geodir_post_types', $geodir_post_types);
127 127
 
128
-            }
128
+			}
129 129
 
130
-            $geodir_post_types = get_option('geodir_post_types');
130
+			$geodir_post_types = get_option('geodir_post_types');
131 131
 
132
-            /* --- update taxonomies (category) --- */
132
+			/* --- update taxonomies (category) --- */
133 133
 
134
-            $geodir_taxonomies = get_option('geodir_taxonomies');
134
+			$geodir_taxonomies = get_option('geodir_taxonomies');
135 135
 
136
-            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
-                $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
136
+			if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
+				$geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
138 138
 
139
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
-                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
139
+				if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
+					if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
+						if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
+							$geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
143 143
 
144
-                update_option('geodir_taxonomies', $geodir_taxonomies);
144
+				update_option('geodir_taxonomies', $geodir_taxonomies);
145 145
 
146
-            }
146
+			}
147 147
 
148
-            /* --- update taxonomies (tags) --- */
149
-            $geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
-            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
-                $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
148
+			/* --- update taxonomies (tags) --- */
149
+			$geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
+			if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
+				$geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
152 152
 
153
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
-                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
153
+				if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
+					if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
+						if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
+							$geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
157 157
 
158
-                update_option('geodir_taxonomies', $geodir_taxonomies_tag);
158
+				update_option('geodir_taxonomies', $geodir_taxonomies_tag);
159 159
 
160
-            }
160
+			}
161 161
 
162
-        }
162
+		}
163 163
 
164
-    }
164
+	}
165 165
 
166
-    return $args;
166
+	return $args;
167 167
 }
168 168
 
169 169
 /**
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_flush_rewrite_rules()
178 178
 {
179
-    global $wp_rewrite;
180
-    $wp_rewrite->flush_rules(false);
179
+	global $wp_rewrite;
180
+	$wp_rewrite->flush_rules(false);
181 181
 }
182 182
 
183 183
 /**
@@ -192,35 +192,35 @@  discard block
 block discarded – undo
192 192
  * @return array Rewrite rules.
193 193
  */
194 194
 function geodir_listing_rewrite_rules($rules) {
195
-    $newrules = array();
196
-    $taxonomies = get_option('geodir_taxonomies');
197
-    $detail_url_seprator = get_option('geodir_detailurl_separator');
195
+	$newrules = array();
196
+	$taxonomies = get_option('geodir_taxonomies');
197
+	$detail_url_seprator = get_option('geodir_detailurl_separator');
198 198
     
199 199
 	// create rules for post listing
200
-    if (is_array($taxonomies)):
201
-        foreach ($taxonomies as $taxonomy => $args):
202
-            $post_type = $args['object_type'];
203
-            $listing_slug = $args['listing_slug'];
204
-
205
-            if (strpos($taxonomy, 'tags')) {
206
-                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
-                $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
208
-            } else {
209
-                // use this loop to add paging for details page comments paging
210
-                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
211
-            }
212
-        endforeach;
213
-    endif;
214
-
215
-    // create rules for location listing
216
-    $location_page = get_option('geodir_location_page');
200
+	if (is_array($taxonomies)):
201
+		foreach ($taxonomies as $taxonomy => $args):
202
+			$post_type = $args['object_type'];
203
+			$listing_slug = $args['listing_slug'];
204
+
205
+			if (strpos($taxonomy, 'tags')) {
206
+				$newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
+				$newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
208
+			} else {
209
+				// use this loop to add paging for details page comments paging
210
+				$newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
211
+			}
212
+		endforeach;
213
+	endif;
214
+
215
+	// create rules for location listing
216
+	$location_page = get_option('geodir_location_page');
217 217
 	
218
-    if($location_page) {
219
-        global $wpdb;
220
-        $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221
-    }
222
-    if (!isset($location_prefix))
223
-        $location_prefix = 'location';
218
+	if($location_page) {
219
+		global $wpdb;
220
+		$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221
+	}
222
+	if (!isset($location_prefix))
223
+		$location_prefix = 'location';
224 224
 
225 225
 	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
226 226
 	if ($location_manager) {
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
265 265
 	}
266 266
 
267
-    if ($location_page && geodir_is_wpml()) {
268
-        foreach(icl_get_languages('skip_missing=N') as $lang){
269
-            $alt_page_id = '';
270
-            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
-            if($alt_page_id){
272
-                $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
267
+	if ($location_page && geodir_is_wpml()) {
268
+		foreach(icl_get_languages('skip_missing=N') as $lang){
269
+			$alt_page_id = '';
270
+			$alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
+			if($alt_page_id){
272
+				$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
273 273
 
274 274
 				if ($location_manager && ($hide_country_part || $hide_region_part)) {
275 275
 					$matches2 = '';
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 					$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
306 306
 					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
307 307
 				}
308
-            }
309
-        }
310
-    }
308
+			}
309
+		}
310
+	}
311 311
 
312
-    $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
312
+	$newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
313 313
 
314
-    $rules = array_merge($newrules, $rules);
315
-    return $rules;
314
+	$rules = array_merge($newrules, $rules);
315
+	return $rules;
316 316
 }
317 317
 
318 318
 /**
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function geodir_htaccess_contents($rules)
329 329
 {
330
-    global $wpdb;
331
-    $location_prefix = get_option('geodir_location_prefix');
332
-    // if location page slug changed then add redirect
333
-    if ($location_prefix == 'location') {
334
-        return $rules;
335
-    }
336
-    $my_content = <<<EOD
330
+	global $wpdb;
331
+	$location_prefix = get_option('geodir_location_prefix');
332
+	// if location page slug changed then add redirect
333
+	if ($location_prefix == 'location') {
334
+		return $rules;
335
+	}
336
+	$my_content = <<<EOD
337 337
 \n# BEGIN GeoDirectory Rules
338 338
 #Redirect 301 /location/ /$location_prefix/
339 339
 # END GeoDirectory Rules\n\n
340 340
 EOD;
341
-    return $my_content . $rules;
341
+	return $my_content . $rules;
342 342
 }
343 343
 //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
344 344
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
  */
353 353
 function geodir_add_location_var($public_query_vars)
354 354
 {
355
-    $public_query_vars[] = 'gd_country';
356
-    $public_query_vars[] = 'gd_region';
357
-    $public_query_vars[] = 'gd_city';
358
-    return $public_query_vars;
355
+	$public_query_vars[] = 'gd_country';
356
+	$public_query_vars[] = 'gd_region';
357
+	$public_query_vars[] = 'gd_city';
358
+	return $public_query_vars;
359 359
 }
360 360
 
361 361
 /**
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_add_geodir_page_var($public_query_vars)
370 370
 {
371
-    $public_query_vars[] = 'gd_is_geodir_page';
372
-    return $public_query_vars;
371
+	$public_query_vars[] = 'gd_is_geodir_page';
372
+	return $public_query_vars;
373 373
 }
374 374
 
375 375
 /**
@@ -381,20 +381,20 @@  discard block
 block discarded – undo
381 381
  */
382 382
 function geodir_add_page_id_in_query_var()
383 383
 {
384
-    global $wp_query;
384
+	global $wp_query;
385 385
 
386
-    $page_id = $wp_query->get_queried_object_id();
386
+	$page_id = $wp_query->get_queried_object_id();
387 387
 
388
-    if (!get_query_var('page_id') && !is_archive()) {
389
-        // fix for WP tags conflict with enfold theme
390
-        $theme_name = geodir_strtolower(wp_get_theme());
391
-        if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
392
-            return $wp_query;
393
-        }
394
-        $wp_query->set('page_id', $page_id);
395
-    }
388
+	if (!get_query_var('page_id') && !is_archive()) {
389
+		// fix for WP tags conflict with enfold theme
390
+		$theme_name = geodir_strtolower(wp_get_theme());
391
+		if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
392
+			return $wp_query;
393
+		}
394
+		$wp_query->set('page_id', $page_id);
395
+	}
396 396
 
397
-    return $wp_query;
397
+	return $wp_query;
398 398
 }
399 399
 
400 400
 /**
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 function geodir_set_location_var_in_session_in_core($wp) {
410 410
 	global $gd_session;
411 411
 
412
-    // Fix for WPML removing page_id query var:
413
-    if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
414
-        global $wpdb;
412
+	// Fix for WPML removing page_id query var:
413
+	if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
414
+		global $wpdb;
415 415
 
416
-        $page_for_posts = get_option('page_for_posts');
417
-        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
416
+		$page_for_posts = get_option('page_for_posts');
417
+		$real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
418 418
 
419
-        if (geodir_is_wpml()) {
420
-            $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421
-        }
422
-        if ($real_page_id && $real_page_id!=$page_for_posts) {
423
-            $wp->query_vars['page_id'] = $real_page_id;
424
-        }
425
-    }
419
+		if (geodir_is_wpml()) {
420
+			$real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421
+		}
422
+		if ($real_page_id && $real_page_id!=$page_for_posts) {
423
+			$wp->query_vars['page_id'] = $real_page_id;
424
+		}
425
+	}
426 426
 	// Query Vars will have page_id parameter
427 427
 	// check if query var has page_id and that page id is location page
428
-    geodir_set_is_geodir_page($wp);
428
+	geodir_set_is_geodir_page($wp);
429 429
 	// if is GD homepage set the page ID
430 430
 	if (geodir_is_page('home')) {
431 431
 		$wp->query_vars['page_id'] = get_option('page_on_front');
@@ -434,118 +434,118 @@  discard block
 block discarded – undo
434 434
 	// The location url format (all or country_city or region_city or city).
435 435
 	$geodir_show_location_url = get_option('geodir_show_location_url');
436 436
 
437
-    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
438
-        $gd_country = '';
439
-        $gd_region = '';
440
-        $gd_city = '';
441
-        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
442
-            $gd_country = urldecode($wp->query_vars['gd_country']);
443
-
444
-        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
445
-            $gd_region = urldecode($wp->query_vars['gd_region']);
446
-
447
-        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
448
-            $gd_city = urldecode($wp->query_vars['gd_city']);
449
-
450
-        if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
451
-            $default_location = geodir_get_default_location();
452
-
453
-            if (get_option('geodir_add_location_url')) {
454
-                if ($geodir_show_location_url != 'all') {
455
-                    if ($gd_region == '') {
456
-                        if ($gd_ses_region = $gd_session->get('gd_region'))
457
-                            $gd_region = $gd_ses_region;
458
-                        else
459
-                            $gd_region = $default_location->region_slug;
460
-                    }
461
-
462
-                    if ($gd_city == '') {
463
-                        if ($gd_ses_city = $gd_session->get('gd_city'))
464
-                            $gd_city = $gd_ses_city;
465
-                        else
466
-                            $gd_city = $default_location->city_slug;
467
-
468
-                        $base_location_link = geodir_get_location_link('base');
469
-                        wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
470
-                        exit();
471
-                    }
472
-                }
473
-            }
474
-
475
-            $args = array(
476
-                'what' => 'city',
477
-                'city_val' => $gd_city,
478
-                'region_val' => $gd_region,
479
-                'country_val' => $gd_country,
480
-                'country_column_name' => 'country_slug',
481
-                'region_column_name' => 'region_slug',
482
-                'city_column_name' => 'city_slug',
483
-                'location_link_part' => false,
484
-                'compare_operator' => ''
485
-            );
486
-
487
-            $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
488
-            if (!empty($location_array)) {
489
-                $gd_session->set('gd_multi_location', 1);
490
-                $gd_session->set('gd_country', $gd_country);
491
-                $gd_session->set('gd_region', $gd_region);
492
-                $gd_session->set('gd_city', $gd_city);
437
+	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
438
+		$gd_country = '';
439
+		$gd_region = '';
440
+		$gd_city = '';
441
+		if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
442
+			$gd_country = urldecode($wp->query_vars['gd_country']);
443
+
444
+		if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
445
+			$gd_region = urldecode($wp->query_vars['gd_region']);
446
+
447
+		if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
448
+			$gd_city = urldecode($wp->query_vars['gd_city']);
449
+
450
+		if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
451
+			$default_location = geodir_get_default_location();
452
+
453
+			if (get_option('geodir_add_location_url')) {
454
+				if ($geodir_show_location_url != 'all') {
455
+					if ($gd_region == '') {
456
+						if ($gd_ses_region = $gd_session->get('gd_region'))
457
+							$gd_region = $gd_ses_region;
458
+						else
459
+							$gd_region = $default_location->region_slug;
460
+					}
461
+
462
+					if ($gd_city == '') {
463
+						if ($gd_ses_city = $gd_session->get('gd_city'))
464
+							$gd_city = $gd_ses_city;
465
+						else
466
+							$gd_city = $default_location->city_slug;
467
+
468
+						$base_location_link = geodir_get_location_link('base');
469
+						wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
470
+						exit();
471
+					}
472
+				}
473
+			}
474
+
475
+			$args = array(
476
+				'what' => 'city',
477
+				'city_val' => $gd_city,
478
+				'region_val' => $gd_region,
479
+				'country_val' => $gd_country,
480
+				'country_column_name' => 'country_slug',
481
+				'region_column_name' => 'region_slug',
482
+				'city_column_name' => 'city_slug',
483
+				'location_link_part' => false,
484
+				'compare_operator' => ''
485
+			);
486
+
487
+			$location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
488
+			if (!empty($location_array)) {
489
+				$gd_session->set('gd_multi_location', 1);
490
+				$gd_session->set('gd_country', $gd_country);
491
+				$gd_session->set('gd_region', $gd_region);
492
+				$gd_session->set('gd_city', $gd_city);
493 493
                 
494 494
 				$wp->query_vars['gd_country'] = $gd_country;
495
-                $wp->query_vars['gd_region'] = $gd_region;
496
-                $wp->query_vars['gd_city'] = $gd_city;
497
-            } else {
498
-                $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
499
-            }
500
-        } else {
501
-            $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
502
-        }
503
-
504
-    } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
505
-        if (!is_admin()) {
506
-            $requested_post_type = $wp->query_vars['post_type'];
507
-            // check if this post type is geodirectory post types
508
-            $post_type_array = geodir_get_posttypes();
495
+				$wp->query_vars['gd_region'] = $gd_region;
496
+				$wp->query_vars['gd_city'] = $gd_city;
497
+			} else {
498
+				$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
499
+			}
500
+		} else {
501
+			$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
502
+		}
503
+
504
+	} else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
505
+		if (!is_admin()) {
506
+			$requested_post_type = $wp->query_vars['post_type'];
507
+			// check if this post type is geodirectory post types
508
+			$post_type_array = geodir_get_posttypes();
509 509
             
510 510
 			if (in_array($requested_post_type, $post_type_array)) {
511
-                // now u can apply geodirectory related manipulation.
512
-            }
513
-        }
514
-    } else {
515
-        // check if a geodirectory taxonomy is set
516
-        $gd_country = '';
517
-        $gd_region = '';
518
-        $gd_city = '';
511
+				// now u can apply geodirectory related manipulation.
512
+			}
513
+		}
514
+	} else {
515
+		// check if a geodirectory taxonomy is set
516
+		$gd_country = '';
517
+		$gd_region = '';
518
+		$gd_city = '';
519 519
         
520 520
 		$is_geodir_taxonomy = false;
521
-        $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not
522
-        $is_geodir_location_found = false;
521
+		$is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not
522
+		$is_geodir_location_found = false;
523 523
 		
524 524
 		$geodir_taxonomy = '';
525
-        $geodir_post_type = '';
526
-        $geodir_term = '';
527
-        $geodir_set_location_session = true;
528
-        $geodir_taxonomis = geodir_get_taxonomies('', true);
529
-
530
-        if(!empty($geodir_taxonomis)){
531
-            foreach ($geodir_taxonomis as $taxonomy) {
532
-                if (array_key_exists($taxonomy, $wp->query_vars)) {
533
-                    $is_geodir_taxonomy = true;
534
-                    $geodir_taxonomy = $taxonomy;
535
-                    $geodir_post_type = str_replace('category', '', $taxonomy);
536
-                    $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
537
-                    $geodir_term = $wp->query_vars[$geodir_taxonomy];
538
-                    break;
539
-                }
540
-            }
541
-        }
542
-
543
-        // now get an array of all terms seperated by '/'
544
-        $geodir_terms = explode('/', $geodir_term);
545
-        $geodir_last_term = end($geodir_terms);
546
-
547
-        if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
548
-            $wp->query_vars['post_type'] = $geodir_post_type;
525
+		$geodir_post_type = '';
526
+		$geodir_term = '';
527
+		$geodir_set_location_session = true;
528
+		$geodir_taxonomis = geodir_get_taxonomies('', true);
529
+
530
+		if(!empty($geodir_taxonomis)){
531
+			foreach ($geodir_taxonomis as $taxonomy) {
532
+				if (array_key_exists($taxonomy, $wp->query_vars)) {
533
+					$is_geodir_taxonomy = true;
534
+					$geodir_taxonomy = $taxonomy;
535
+					$geodir_post_type = str_replace('category', '', $taxonomy);
536
+					$geodir_post_type = str_replace('_tags', '', $geodir_post_type);
537
+					$geodir_term = $wp->query_vars[$geodir_taxonomy];
538
+					break;
539
+				}
540
+			}
541
+		}
542
+
543
+		// now get an array of all terms seperated by '/'
544
+		$geodir_terms = explode('/', $geodir_term);
545
+		$geodir_last_term = end($geodir_terms);
546
+
547
+		if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
548
+			$wp->query_vars['post_type'] = $geodir_post_type;
549 549
 
550 550
 			// now check if last term is a post of geodirectory post types
551 551
 			$geodir_post = get_posts(array(
@@ -594,196 +594,196 @@  discard block
 block discarded – undo
594 594
 				//return ;
595 595
 			}
596 596
 
597
-            $geodir_location_terms = '';
598
-            // if last term is not a post then check if last term is a term of the specific texonomy or not
599
-            if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
600
-                $is_geodir_taxonomy_term = true;
597
+			$geodir_location_terms = '';
598
+			// if last term is not a post then check if last term is a term of the specific texonomy or not
599
+			if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
600
+				$is_geodir_taxonomy_term = true;
601 601
 
602
-                $geodir_set_location_session = false;
603
-            }
602
+				$geodir_set_location_session = false;
603
+			}
604 604
 
605 605
 
606
-            // now check if there is location parts in the url or not
607
-            if (get_option('geodir_add_location_url')) {				
606
+			// now check if there is location parts in the url or not
607
+			if (get_option('geodir_add_location_url')) {				
608 608
 				$default_location = geodir_get_default_location();
609 609
                 
610 610
 				if ($geodir_show_location_url == 'all') {
611
-                    if (count($geodir_terms) >= 3) {
612
-                        $gd_country = urldecode($geodir_terms[0]);
613
-                        $gd_region = urldecode($geodir_terms[1]);
614
-                        $gd_city = urldecode($geodir_terms[2]);
615
-                    } else if (count($geodir_terms) >= 2) {
616
-                        $gd_country = urldecode($geodir_terms[0]);
617
-                        $gd_region = urldecode($geodir_terms[1]);
618
-                    } else if (count($geodir_terms) >= 1) {
619
-                        $gd_country = urldecode($geodir_terms[0]);
620
-                    }
621
-
622
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623
-                        geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624
-                        geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
-                    )
626
-                        $is_geodir_location_found = true;
627
-
628
-                    // if location has not been found for country , region and city then search for country and region only
629
-
630
-                    if (!$is_geodir_location_found) {
631
-                        $gd_city = '';
632
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633
-                            geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
-                        )
635
-                            $is_geodir_location_found = true;
636
-
637
-                    }
638
-
639
-                    // if location has not been found for country , region  then search for country only
640
-                    if (!$is_geodir_location_found) {
641
-                        $gd_city = '';
642
-                        $gd_region = '';
643
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
-                            $is_geodir_location_found = true;
645
-                    }
646
-                } else if ($geodir_show_location_url == 'country_city') {
647
-                    if (count($geodir_terms) >= 2) {
648
-                        $gd_country = urldecode($geodir_terms[0]);
649
-                        $gd_city = urldecode($geodir_terms[1]);
650
-                    } else if (count($geodir_terms) >= 1) {
651
-                        $gd_country = urldecode($geodir_terms[0]);
652
-                    }
653
-
654
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
-                        $is_geodir_location_found = true;
656
-
657
-                    // if location has not been found for country and city  then search for country only
658
-                    if (!$is_geodir_location_found) {
659
-                        $gd_city = '';
611
+					if (count($geodir_terms) >= 3) {
612
+						$gd_country = urldecode($geodir_terms[0]);
613
+						$gd_region = urldecode($geodir_terms[1]);
614
+						$gd_city = urldecode($geodir_terms[2]);
615
+					} else if (count($geodir_terms) >= 2) {
616
+						$gd_country = urldecode($geodir_terms[0]);
617
+						$gd_region = urldecode($geodir_terms[1]);
618
+					} else if (count($geodir_terms) >= 1) {
619
+						$gd_country = urldecode($geodir_terms[0]);
620
+					}
621
+
622
+					if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623
+						geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624
+						geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
+					)
626
+						$is_geodir_location_found = true;
627
+
628
+					// if location has not been found for country , region and city then search for country and region only
629
+
630
+					if (!$is_geodir_location_found) {
631
+						$gd_city = '';
632
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633
+							geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
+						)
635
+							$is_geodir_location_found = true;
636
+
637
+					}
638
+
639
+					// if location has not been found for country , region  then search for country only
640
+					if (!$is_geodir_location_found) {
641
+						$gd_city = '';
642
+						$gd_region = '';
643
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
+							$is_geodir_location_found = true;
645
+					}
646
+				} else if ($geodir_show_location_url == 'country_city') {
647
+					if (count($geodir_terms) >= 2) {
648
+						$gd_country = urldecode($geodir_terms[0]);
649
+						$gd_city = urldecode($geodir_terms[1]);
650
+					} else if (count($geodir_terms) >= 1) {
651
+						$gd_country = urldecode($geodir_terms[0]);
652
+					}
653
+
654
+					if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
+						$is_geodir_location_found = true;
656
+
657
+					// if location has not been found for country and city  then search for country only
658
+					if (!$is_geodir_location_found) {
659
+						$gd_city = '';
660 660
                         
661 661
 						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662
-                            $is_geodir_location_found = true;
663
-                    }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
665
-                    if (count($geodir_terms) >= 2) {
666
-                        $gd_region = urldecode($geodir_terms[0]);
667
-                        $gd_city = urldecode($geodir_terms[1]);
668
-                    } else if (count($geodir_terms) >= 1) {
669
-                        $gd_region = urldecode($geodir_terms[0]);
670
-                    }
671
-
672
-                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
-                        $is_geodir_location_found = true;
674
-
675
-                    // if location has not been found for region and city  then search for region only
676
-                    if (!$is_geodir_location_found) {
677
-                        $gd_city = '';
662
+							$is_geodir_location_found = true;
663
+					}
664
+				}  else if ($geodir_show_location_url == 'region_city') {
665
+					if (count($geodir_terms) >= 2) {
666
+						$gd_region = urldecode($geodir_terms[0]);
667
+						$gd_city = urldecode($geodir_terms[1]);
668
+					} else if (count($geodir_terms) >= 1) {
669
+						$gd_region = urldecode($geodir_terms[0]);
670
+					}
671
+
672
+					if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
+						$is_geodir_location_found = true;
674
+
675
+					// if location has not been found for region and city  then search for region only
676
+					if (!$is_geodir_location_found) {
677
+						$gd_city = '';
678 678
                         
679 679
 						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
680
-                            $is_geodir_location_found = true;
681
-                    }
682
-                } else {
683
-                    $gd_city = $geodir_terms[0];
684
-
685
-                    if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
686
-                        $is_geodir_location_found = true;
687
-                        $gd_region = $default_location->region_slug;
688
-                        $gd_country = $default_location->country_slug;
689
-                    }
690
-                }
691
-                // if location still not found then clear location related session variables
692
-                if ($is_geodir_location_found && $geodir_set_location_session) {
693
-                    $gd_session->set('gd_multi_location', 1);
694
-                    $gd_session->set('gd_country', $gd_country);
695
-                    $gd_session->set('gd_region', $gd_region);
696
-                    $gd_session->set('gd_city', $gd_city);
697
-                }
698
-
699
-                if ($geodir_show_location_url == 'all') {
680
+							$is_geodir_location_found = true;
681
+					}
682
+				} else {
683
+					$gd_city = $geodir_terms[0];
684
+
685
+					if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
686
+						$is_geodir_location_found = true;
687
+						$gd_region = $default_location->region_slug;
688
+						$gd_country = $default_location->country_slug;
689
+					}
690
+				}
691
+				// if location still not found then clear location related session variables
692
+				if ($is_geodir_location_found && $geodir_set_location_session) {
693
+					$gd_session->set('gd_multi_location', 1);
694
+					$gd_session->set('gd_country', $gd_country);
695
+					$gd_session->set('gd_region', $gd_region);
696
+					$gd_session->set('gd_city', $gd_city);
697
+				}
698
+
699
+				if ($geodir_show_location_url == 'all') {
700 700
 				} else if ($geodir_show_location_url == 'country_city') {
701 701
 					$gd_region = '';
702 702
 				} else if ($geodir_show_location_url == 'region_city') {
703 703
 					$gd_country = '';
704 704
 				} else {
705 705
 					$gd_country = '';
706
-                    $gd_region = '';
706
+					$gd_region = '';
707
+				}
708
+
709
+				if ($is_geodir_location_found) {
710
+					$wp->query_vars['gd_country'] = $gd_country;
711
+					$wp->query_vars['gd_region'] = $gd_region;
712
+					$wp->query_vars['gd_city'] = $gd_city;
713
+				} else {
714
+					$gd_country = '';
715
+					$gd_region = '';
716
+					$gd_city = '';
707 717
 				}
718
+			}
719
+
720
+			$wp->query_vars[$geodir_taxonomy] = $geodir_term;
721
+			// eliminate location related terms from taxonomy term
722
+			if ($gd_country != '')
723
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
724
+
725
+			if ($gd_region != '')
726
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
727
+
728
+			if ($gd_city != '')
729
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
708 730
 
709
-                if ($is_geodir_location_found) {
710
-                    $wp->query_vars['gd_country'] = $gd_country;
711
-                    $wp->query_vars['gd_region'] = $gd_region;
712
-                    $wp->query_vars['gd_city'] = $gd_city;
713
-                } else {
714
-                    $gd_country = '';
715
-                    $gd_region = '';
716
-                    $gd_city = '';
717
-                }
718
-            }
719
-
720
-            $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721
-            // eliminate location related terms from taxonomy term
722
-            if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
724
-
725
-            if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
727
-
728
-            if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
730
-
731
-
732
-            $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
733
-            $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
734
-
735
-            $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');
736
-
737
-            if ($wp->query_vars[$geodir_taxonomy] == '') {
738
-                unset($wp->query_vars[$geodir_taxonomy]);
739
-            } else {
740
-                if (!$is_geodir_taxonomy_term) {
741
-                    foreach ($wp->query_vars as $key => $vars) {
742
-                        unset($wp->query_vars[$key]);
743
-                    }
744
-                    $wp->query_vars['error'] = '404';
745
-                }
746
-            }
747
-        }
748
-    }
731
+
732
+			$wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
733
+			$wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
734
+
735
+			$wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');
736
+
737
+			if ($wp->query_vars[$geodir_taxonomy] == '') {
738
+				unset($wp->query_vars[$geodir_taxonomy]);
739
+			} else {
740
+				if (!$is_geodir_taxonomy_term) {
741
+					foreach ($wp->query_vars as $key => $vars) {
742
+						unset($wp->query_vars[$key]);
743
+					}
744
+					$wp->query_vars['error'] = '404';
745
+				}
746
+			}
747
+		}
748
+	}
749 749
 	
750 750
 	// Unset location session if gd page and location not set.
751 751
 	if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
752 752
 		$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
753 753
 	}
754 754
 
755
-    if ($gd_session->get('gd_multi_location') == 1) {
756
-        $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
757
-        $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
758
-        $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
759
-    }
755
+	if ($gd_session->get('gd_multi_location') == 1) {
756
+		$wp->query_vars['gd_country'] = $gd_session->get('gd_country');
757
+		$wp->query_vars['gd_region'] = $gd_session->get('gd_region');
758
+		$wp->query_vars['gd_city'] = $gd_session->get('gd_city');
759
+	}
760 760
 
761
-    // now check if there is location parts in the url or not
762
-    if (get_option('geodir_add_location_url')) {        
761
+	// now check if there is location parts in the url or not
762
+	if (get_option('geodir_add_location_url')) {        
763 763
 		if ($geodir_show_location_url == 'all') {
764 764
 		} else if ($geodir_show_location_url == 'country_city') {
765 765
 			 if (isset($wp->query_vars['gd_region']))
766
-                $wp->query_vars['gd_region'] = '';
766
+				$wp->query_vars['gd_region'] = '';
767 767
 		} else if ($geodir_show_location_url == 'region_city') {
768 768
 			if (isset($wp->query_vars['gd_country']))
769
-                $wp->query_vars['gd_country'] = '';
769
+				$wp->query_vars['gd_country'] = '';
770 770
 		} else {
771 771
 			if (isset($wp->query_vars['gd_country']))
772
-                $wp->query_vars['gd_country'] = '';
772
+				$wp->query_vars['gd_country'] = '';
773 773
 
774
-            if (isset($wp->query_vars['gd_region']))
775
-                $wp->query_vars['gd_region'] = '';
774
+			if (isset($wp->query_vars['gd_region']))
775
+				$wp->query_vars['gd_region'] = '';
776 776
 		}
777
-    } else {
778
-        if (isset($wp->query_vars['gd_country']))
779
-            $wp->query_vars['gd_country'] = '';
777
+	} else {
778
+		if (isset($wp->query_vars['gd_country']))
779
+			$wp->query_vars['gd_country'] = '';
780 780
 
781
-        if (isset($wp->query_vars['gd_region']))
782
-            $wp->query_vars['gd_region'] = '';
781
+		if (isset($wp->query_vars['gd_region']))
782
+			$wp->query_vars['gd_region'] = '';
783 783
 
784
-        if (isset($wp->query_vars['gd_city']))
785
-            $wp->query_vars['gd_city'] = '';
786
-    }
784
+		if (isset($wp->query_vars['gd_city']))
785
+			$wp->query_vars['gd_city'] = '';
786
+	}
787 787
 }
788 788
 
789 789
 /**
@@ -797,24 +797,24 @@  discard block
 block discarded – undo
797 797
  */
798 798
 function geodir_custom_post_status()
799 799
 {
800
-    // Virtual Page Status
801
-    register_post_status('virtual', array(
802
-        'label' => _x('Virtual', 'page', 'geodirectory'),
803
-        'public' => true,
804
-        'exclude_from_search' => true,
805
-        'show_in_admin_all_list' => true,
806
-        'show_in_admin_status_list' => true,
807
-        'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
808
-    ));
809
-
810
-    /**
811
-     * Called after we register the custom post status 'Virtual'.
812
-     *
813
-     * Can be use to add more post statuses.
814
-     *
815
-     * @since 1.0.0
816
-     */
817
-    do_action('geodir_custom_post_status');
800
+	// Virtual Page Status
801
+	register_post_status('virtual', array(
802
+		'label' => _x('Virtual', 'page', 'geodirectory'),
803
+		'public' => true,
804
+		'exclude_from_search' => true,
805
+		'show_in_admin_all_list' => true,
806
+		'show_in_admin_status_list' => true,
807
+		'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
808
+	));
809
+
810
+	/**
811
+	 * Called after we register the custom post status 'Virtual'.
812
+	 *
813
+	 * Can be use to add more post statuses.
814
+	 *
815
+	 * @since 1.0.0
816
+	 */
817
+	do_action('geodir_custom_post_status');
818 818
 }
819 819
 
820 820
 /**
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
  */
830 830
 function geodir_get_term_link($termlink, $term, $taxonomy)
831 831
 {
832
-    return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php
832
+	return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php
833 833
 }
834 834
 
835 835
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
  */
844 844
 function geodir_get_posttype_link($link, $post_type)
845 845
 {
846
-    return geodir_posttype_link($link, $post_type); // taxonomy_functions.php
846
+	return geodir_posttype_link($link, $post_type); // taxonomy_functions.php
847 847
 }
848 848
 
849 849
 /**
@@ -858,13 +858,13 @@  discard block
 block discarded – undo
858 858
  */
859 859
 function exclude_from_wp_list_pages($exclude_array)
860 860
 {
861
-    $pages_ids = array();
862
-    $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
863
-    foreach ($pages_array as $page) {
864
-        $pages_ids[] = $page->ID;
865
-    }
866
-    $exclude_array = $exclude_array + $pages_ids;
867
-    return $exclude_array;
861
+	$pages_ids = array();
862
+	$pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
863
+	foreach ($pages_array as $page) {
864
+		$pages_ids[] = $page->ID;
865
+	}
866
+	$exclude_array = $exclude_array + $pages_ids;
867
+	return $exclude_array;
868 868
 }
869 869
 
870 870
 /**
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_exclude_page($query)
879 879
 {
880
-    add_filter('posts_where', 'geodir_exclude_page_where', 100);
881
-    return $query;
880
+	add_filter('posts_where', 'geodir_exclude_page_where', 100);
881
+	return $query;
882 882
 }
883 883
 
884 884
 /**
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
  */
894 894
 function geodir_exclude_page_where($where)
895 895
 {
896
-    global $wpdb;
897
-    if (is_admin())
898
-        $where .= " AND $wpdb->posts.post_status != 'virtual'";
896
+	global $wpdb;
897
+	if (is_admin())
898
+		$where .= " AND $wpdb->posts.post_status != 'virtual'";
899 899
 
900
-    return $where;
900
+	return $where;
901 901
 }
902 902
 
903 903
 /**
@@ -912,21 +912,21 @@  discard block
 block discarded – undo
912 912
  * @return mixed The taxonomy option value.
913 913
  */
914 914
 function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
915
-    global $wp_query;
915
+	global $wp_query;
916 916
     
917
-    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
918
-        $term = $wp_query->get_queried_object();
917
+	if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
918
+		$term = $wp_query->get_queried_object();
919 919
         
920
-        if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
-            $image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
920
+		if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
+			$image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
922 922
             
923
-            if ( !empty( $image['src'] ) ) {
924
-                $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925
-                $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926
-            }
927
-        }
928
-    }
929
-    return $value;
923
+			if ( !empty( $image['src'] ) ) {
924
+				$value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925
+				$value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926
+			}
927
+		}
928
+	}
929
+	return $value;
930 930
 }
931 931
 add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 );
932 932
 
@@ -937,24 +937,24 @@  discard block
 block discarded – undo
937 937
  *
938 938
  */
939 939
 function geodir_affiliate_wp_rewrite_fix() {
940
-    if ( !class_exists( 'Affiliate_WP' ) ) {
941
-        return;
942
-    }
943
-
944
-    $gd_post_types = geodir_get_posttypes( 'array' );
945
-
946
-    if ( !empty( $gd_post_types ) ) {
947
-        $ref = affiliate_wp()->tracking->get_referral_var();
948
-        if ( empty( $ref ) ) {
949
-            return;
950
-        }
951
-
952
-        foreach ( $gd_post_types as $key => $post_type ) {
953
-            if ( !empty( $key ) && !empty( $post_type['rewrite']['slug'] ) ) {
954
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]&paged=$matches[3]', 'top');
955
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]', 'top');
956
-            }
957
-        }
958
-    }
940
+	if ( !class_exists( 'Affiliate_WP' ) ) {
941
+		return;
942
+	}
943
+
944
+	$gd_post_types = geodir_get_posttypes( 'array' );
945
+
946
+	if ( !empty( $gd_post_types ) ) {
947
+		$ref = affiliate_wp()->tracking->get_referral_var();
948
+		if ( empty( $ref ) ) {
949
+			return;
950
+		}
951
+
952
+		foreach ( $gd_post_types as $key => $post_type ) {
953
+			if ( !empty( $key ) && !empty( $post_type['rewrite']['slug'] ) ) {
954
+				add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]&paged=$matches[3]', 'top');
955
+				add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]', 'top');
956
+			}
957
+		}
958
+	}
959 959
 }
960 960
 add_action( 'init', 'geodir_affiliate_wp_rewrite_fix', 99999 );
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
             if (!empty($args['labels'])) {
70 70
                 foreach ($args['labels'] as $key => $val) {
71
-                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
71
+                    $args['labels'][$key] = __($val, 'geodirectory'); // allow translation
72 72
                 }
73 73
             }
74 74
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
             if (array_key_exists('rewrite', $args)) {
111 111
                 if (array_key_exists('slug', $args['rewrite']))
112
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
112
+                    $args['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
113 113
             }
114 114
 
115 115
             $geodir_post_types = get_option('geodir_post_types');
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
                 if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123 123
                     if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
124
+                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
125 125
 
126 126
                 update_option('geodir_post_types', $geodir_post_types);
127 127
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 
134 134
             $geodir_taxonomies = get_option('geodir_taxonomies');
135 135
 
136
-            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
-                $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
136
+            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type.'category'])) {
137
+                $geodir_taxonomies[$post_type.'category']['listing_slug'] = $listing_slug;
138 138
 
139
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
-                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
139
+                if (array_key_exists('args', $geodir_taxonomies[$post_type.'category']))
140
+                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type.'category']['args']))
141
+                        if (array_key_exists('slug', $geodir_taxonomies[$post_type.'category']['args']['rewrite']))
142
+                            $geodir_taxonomies[$post_type.'category']['args']['rewrite']['slug'] = $listing_slug;
143 143
 
144 144
                 update_option('geodir_taxonomies', $geodir_taxonomies);
145 145
 
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 
148 148
             /* --- update taxonomies (tags) --- */
149 149
             $geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
-            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
-                $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
150
+            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type.'_tags'])) {
151
+                $geodir_taxonomies_tag[$post_type.'_tags']['listing_slug'] = $listing_slug.'/tags';
152 152
 
153
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
-                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
153
+                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type.'_tags']))
154
+                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type.'_tags']['args']))
155
+                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite']))
156
+                            $geodir_taxonomies_tag[$post_type.'_tags']['args']['rewrite']['slug'] = $listing_slug.'/tags';
157 157
 
158 158
                 update_option('geodir_taxonomies', $geodir_taxonomies_tag);
159 159
 
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
             $listing_slug = $args['listing_slug'];
204 204
 
205 205
             if (strpos($taxonomy, 'tags')) {
206
-                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
-                $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
206
+                $newrules[$listing_slug.'/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]';
207
+                $newrules[$listing_slug.'/(.+?)/?$'] = 'index.php?'.$taxonomy.'=$matches[1]';
208 208
             } else {
209 209
                 // use this loop to add paging for details page comments paging
210
-                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
210
+                $newrules[str_replace("/tags", "", $listing_slug).'/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?'.$taxonomy.'=$matches[1]&cpage=$matches[2]';
211 211
             }
212 212
         endforeach;
213 213
     endif;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     // create rules for location listing
216 216
     $location_page = get_option('geodir_location_page');
217 217
 	
218
-    if($location_page) {
218
+    if ($location_page) {
219 219
         global $wpdb;
220 220
         $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221 221
     }
@@ -245,30 +245,30 @@  discard block
 block discarded – undo
245 245
 		
246 246
 		if ($matches2) {
247 247
 			if ($neighbourhood_active) {
248
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
248
+				$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]';
249 249
 			}
250
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
250
+			$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]';
251 251
 		} else {
252 252
 			if ($neighbourhood_active) {
253
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
253
+				$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]';
254 254
 			}
255 255
 		}
256 256
 		
257
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]';
257
+		$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&'.$matches1.'=$matches[1]';
258 258
 	} else { // country/region/city
259 259
 		if ($neighbourhood_active) {
260
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
260
+			$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
261 261
 		}
262
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
263
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]';
264
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
262
+		$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
263
+		$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]&gd_region=$matches[2]';
264
+		$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$location_page.'&gd_country=$matches[1]';
265 265
 	}
266 266
 
267 267
     if ($location_page && geodir_is_wpml()) {
268
-        foreach(icl_get_languages('skip_missing=N') as $lang){
268
+        foreach (icl_get_languages('skip_missing=N') as $lang) {
269 269
             $alt_page_id = '';
270
-            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
-            if($alt_page_id){
270
+            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false, $lang['language_code']);
271
+            if ($alt_page_id) {
272 272
                 $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
273 273
 
274 274
 				if ($location_manager && ($hide_country_part || $hide_region_part)) {
@@ -287,29 +287,29 @@  discard block
 block discarded – undo
287 287
 					
288 288
 					if ($matches2) {
289 289
 						if ($neighbourhood_active) {
290
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
290
+							$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]&gd_neighbourhood=$matches[3]';
291 291
 						}
292
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
292
+						$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&'.$matches2.'=$matches[2]';
293 293
 					} else {
294 294
 						if ($neighbourhood_active) {
295
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
295
+							$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]&gd_neighbourhood=$matches[2]';
296 296
 						}
297 297
 					}
298 298
 					
299
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]';
299
+					$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&'.$matches1.'=$matches[1]';
300 300
 				} else { // country/region/city
301 301
 					if ($neighbourhood_active) {
302
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
302
+						$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
303 303
 					}
304
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
305
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
306
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
304
+					$newrules[$location_prefix.'/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
305
+					$newrules[$location_prefix.'/([^/]+)/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]&gd_region=$matches[2]';
306
+					$newrules[$location_prefix.'/([^/]+)/?$'] = 'index.php?page_id='.$alt_page_id.'&gd_country=$matches[1]';
307 307
 				}
308 308
             }
309 309
         }
310 310
     }
311 311
 
312
-    $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
312
+    $newrules[$location_prefix.'/?$'] = 'index.php?page_id='.$location_page;
313 313
 
314 314
     $rules = array_merge($newrules, $rules);
315 315
     return $rules;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 #Redirect 301 /location/ /$location_prefix/
339 339
 # END GeoDirectory Rules\n\n
340 340
 EOD;
341
-    return $my_content . $rules;
341
+    return $my_content.$rules;
342 342
 }
343 343
 //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
344 344
 
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
         global $wpdb;
415 415
 
416 416
         $page_for_posts = get_option('page_for_posts');
417
-        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
417
+        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s", $wp->query_vars['pagename']));
418 418
 
419 419
         if (geodir_is_wpml()) {
420 420
             $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421 421
         }
422
-        if ($real_page_id && $real_page_id!=$page_for_posts) {
422
+        if ($real_page_id && $real_page_id != $page_for_posts) {
423 423
             $wp->query_vars['page_id'] = $real_page_id;
424 424
         }
425 425
     }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                             $gd_city = $default_location->city_slug;
467 467
 
468 468
                         $base_location_link = geodir_get_location_link('base');
469
-                        wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
469
+                        wp_redirect($base_location_link.'/'.$gd_country.'/'.$gd_region.'/'.$gd_city);
470 470
                         exit();
471 471
                     }
472 472
                 }
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         $geodir_set_location_session = true;
528 528
         $geodir_taxonomis = geodir_get_taxonomies('', true);
529 529
 
530
-        if(!empty($geodir_taxonomis)){
530
+        if (!empty($geodir_taxonomis)) {
531 531
             foreach ($geodir_taxonomis as $taxonomy) {
532 532
                 if (array_key_exists($taxonomy, $wp->query_vars)) {
533 533
                     $is_geodir_taxonomy = true;
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				}
585 585
 
586 586
 
587
-				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
587
+				$geodir_term = str_replace('/'.$geodir_last_term, '', $geodir_term, $post_title_replace_count);
588 588
 				if (!$post_title_replace_count)
589 589
 					$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
590 590
 				$geodir_terms = explode('/', $geodir_term);
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662 662
                             $is_geodir_location_found = true;
663 663
                     }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
664
+                } else if ($geodir_show_location_url == 'region_city') {
665 665
                     if (count($geodir_terms) >= 2) {
666 666
                         $gd_region = urldecode($geodir_terms[0]);
667 667
                         $gd_city = urldecode($geodir_terms[1]);
@@ -720,13 +720,13 @@  discard block
 block discarded – undo
720 720
             $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721 721
             // eliminate location related terms from taxonomy term
722 722
             if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
723
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_country).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
724 724
 
725 725
             if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
726
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_region).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
727 727
 
728 728
             if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
729
+                $wp->query_vars[$geodir_taxonomy] = preg_replace('/'.urlencode($gd_city).'/', '', $wp->query_vars[$geodir_taxonomy], 1);
730 730
 
731 731
 
732 732
             $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
  * @param string $option Option name.
912 912
  * @return mixed The taxonomy option value.
913 913
  */
914
-function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
914
+function geodir_wpseo_taxonomy_meta($value, $option = '') {
915 915
     global $wp_query;
916 916
     
917
-    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
917
+    if (!empty($value) && (is_category() || is_tax())) {
918 918
         $term = $wp_query->get_queried_object();
919 919
         
920
-        if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
-            $image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
920
+        if (!empty($term->term_id) && !empty($term->taxonomy) && isset($value[$term->taxonomy][$term->term_id]) && in_array(str_replace('category', '', $term->taxonomy), geodir_get_posttypes())) {
921
+            $image = geodir_get_default_catimage($term->term_id, str_replace('category', '', $term->taxonomy));
922 922
             
923
-            if ( !empty( $image['src'] ) ) {
923
+            if (!empty($image['src'])) {
924 924
                 $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925 925
                 $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926 926
             }
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
     }
929 929
     return $value;
930 930
 }
931
-add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 );
931
+add_filter('option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2);
932 932
 
933 933
 /**
934 934
  * Fix affiliate links for GeoDirectory CPTs listing pages.
@@ -937,24 +937,24 @@  discard block
 block discarded – undo
937 937
  *
938 938
  */
939 939
 function geodir_affiliate_wp_rewrite_fix() {
940
-    if ( !class_exists( 'Affiliate_WP' ) ) {
940
+    if (!class_exists('Affiliate_WP')) {
941 941
         return;
942 942
     }
943 943
 
944
-    $gd_post_types = geodir_get_posttypes( 'array' );
944
+    $gd_post_types = geodir_get_posttypes('array');
945 945
 
946
-    if ( !empty( $gd_post_types ) ) {
946
+    if (!empty($gd_post_types)) {
947 947
         $ref = affiliate_wp()->tracking->get_referral_var();
948
-        if ( empty( $ref ) ) {
948
+        if (empty($ref)) {
949 949
             return;
950 950
         }
951 951
 
952
-        foreach ( $gd_post_types as $key => $post_type ) {
953
-            if ( !empty( $key ) && !empty( $post_type['rewrite']['slug'] ) ) {
954
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]&paged=$matches[3]', 'top');
955
-                add_rewrite_rule( $post_type['rewrite']['slug'] . '/' . $ref . '(/(.*))?/?$', 'index.php?post_type=' . $key . '&' . $ref . '=$matches[1]', 'top');
952
+        foreach ($gd_post_types as $key => $post_type) {
953
+            if (!empty($key) && !empty($post_type['rewrite']['slug'])) {
954
+                add_rewrite_rule($post_type['rewrite']['slug'].'/'.$ref.'(/(.*))?/page/([0-9]{1,})/?$', 'index.php?post_type='.$key.'&'.$ref.'=$matches[1]&paged=$matches[3]', 'top');
955
+                add_rewrite_rule($post_type['rewrite']['slug'].'/'.$ref.'(/(.*))?/?$', 'index.php?post_type='.$key.'&'.$ref.'=$matches[1]', 'top');
956 956
             }
957 957
         }
958 958
     }
959 959
 }
960
-add_action( 'init', 'geodir_affiliate_wp_rewrite_fix', 99999 );
960
+add_action('init', 'geodir_affiliate_wp_rewrite_fix', 99999);
Please login to merge, or discard this patch.
geodirectory-functions/geodir-class-session.php 3 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 1.5.7
152 152
 	 *
153 153
 	 * @param string|array $key Session key.
154
-	 * @param integer $value Session variable.
155
-	 * @return string Session variable.
154
+	 * @return boolean Session variable.
156 155
 	 */
157 156
 	public function un_set( $key ) {
158 157
 		if ( empty( $key ) ) {
@@ -188,8 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * @since 1.5.7
189 188
 	 *
190 189
 	 * @param string $key Session key.
191
-	 * @param integer $value Session variable.
192
-	 * @return string Session variable.
190
+	 * @return boolean Session variable.
193 191
 	 */
194 192
 	public function is_set( $key ) {
195 193
 		$key = sanitize_key( $key );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined( 'ABSPATH' ) ) {
4
+	exit;
5
+}
4 6
 
5 7
 /**
6 8
  * Geodir_Session Class.
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5 5
 /**
6 6
  * Geodir_Session Class.
@@ -46,44 +46,44 @@  discard block
 block discarded – undo
46 46
 	public function __construct() {
47 47
 		$this->use_php_sessions = $this->use_php_sessions();
48 48
 
49
-		if ( $this->use_php_sessions ) {
50
-			if ( is_multisite() ) {
51
-				$this->prefix = '_' . get_current_blog_id();
49
+		if ($this->use_php_sessions) {
50
+			if (is_multisite()) {
51
+				$this->prefix = '_'.get_current_blog_id();
52 52
 			}
53 53
 
54 54
 			// Use PHP SESSION (must be enabled via the GEODIR_USE_PHP_SESSIONS constant)
55
-			add_action( 'init', array( $this, 'maybe_start_session' ), -2 );
55
+			add_action('init', array($this, 'maybe_start_session'), -2);
56 56
 		} else {
57 57
 			// Use WP_Session (default)
58
-			if ( !defined( 'WP_SESSION_COOKIE' ) ) {
59
-				define( 'WP_SESSION_COOKIE', 'geodir_wp_session' );
58
+			if (!defined('WP_SESSION_COOKIE')) {
59
+				define('WP_SESSION_COOKIE', 'geodir_wp_session');
60 60
 			}
61 61
 
62
-			if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
63
-				require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-recursive-arrayaccess.php';
62
+			if (!class_exists('Recursive_ArrayAccess')) {
63
+				require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-recursive-arrayaccess.php';
64 64
 			}
65 65
             
66
-			if ( !class_exists( 'WP_Session_Utils' ) ) {
67
-				require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-wp-session-utils.php';
66
+			if (!class_exists('WP_Session_Utils')) {
67
+				require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-wp-session-utils.php';
68 68
 			}
69 69
             
70
-			if ( defined( 'WP_CLI' ) && WP_CLI && !class_exists( 'WP_Session_Command' ) ) {
71
-				require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/wp-cli.php';
70
+			if (defined('WP_CLI') && WP_CLI && !class_exists('WP_Session_Command')) {
71
+				require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/wp-cli.php';
72 72
 			}
73 73
 
74
-			if ( !class_exists( 'WP_Session' ) ) {
75
-				require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/class-wp-session.php';
76
-				require_once GEODIRECTORY_PLUGIN_DIR . 'geodirectory-functions/wp-session/wp-session.php';
74
+			if (!class_exists('WP_Session')) {
75
+				require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/class-wp-session.php';
76
+				require_once GEODIRECTORY_PLUGIN_DIR.'geodirectory-functions/wp-session/wp-session.php';
77 77
 			}
78 78
 
79
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
80
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
79
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
80
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
81 81
 		}
82 82
 
83
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
84
-			add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
83
+		if (empty($this->session) && !$this->use_php_sessions) {
84
+			add_action('plugins_loaded', array($this, 'init'), -1);
85 85
 		} else {
86
-			add_action( 'init', array( $this, 'init' ), -1 );
86
+			add_action('init', array($this, 'init'), -1);
87 87
 		}
88 88
 	}
89 89
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	public function init() {
98
-		if ( $this->use_php_sessions ) {
99
-			$this->session = isset( $_SESSION['gd' . $this->prefix ] ) && is_array( $_SESSION['gd' . $this->prefix ] ) ? $_SESSION['gd' . $this->prefix ] : array();
98
+		if ($this->use_php_sessions) {
99
+			$this->session = isset($_SESSION['gd'.$this->prefix]) && is_array($_SESSION['gd'.$this->prefix]) ? $_SESSION['gd'.$this->prefix] : array();
100 100
 		} else {
101 101
 			$this->session = WP_Session::get_instance();
102 102
 		}
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 	 * @return string Session ID
113 113
 	 */
114 114
 	public function get_id() {
115
-		if ( $this->use_php_sessions ) {
116
-			$session_id = !empty( $_SESSION ) && function_exists( 'session_id' ) ? session_id() : NULL;
115
+		if ($this->use_php_sessions) {
116
+			$session_id = !empty($_SESSION) && function_exists('session_id') ? session_id() : NULL;
117 117
 		} else {
118
-			$session_id = !empty( $this->session ) && isset( $this->session->session_id ) ? $this->session->session_id : NULL;
118
+			$session_id = !empty($this->session) && isset($this->session->session_id) ? $this->session->session_id : NULL;
119 119
 		}
120 120
 		return $session_id;
121 121
 	}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 	 * @param string $key Session key
129 129
 	 * @return string Session variable
130 130
 	 */
131
-	public function get( $key ) {
132
-		$key = sanitize_key( $key );
133
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
131
+	public function get($key) {
132
+		$key = sanitize_key($key);
133
+		return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 	 * @param integer $value Session variable
143 143
 	 * @return string Session variable
144 144
 	 */
145
-	public function set( $key, $value ) {
146
-		$key = sanitize_key( $key );
145
+	public function set($key, $value) {
146
+		$key = sanitize_key($key);
147 147
 
148
-		if ( is_array( $value ) ) {
149
-			$this->session[ $key ] = maybe_serialize( $value );
148
+		if (is_array($value)) {
149
+			$this->session[$key] = maybe_serialize($value);
150 150
 		} else {
151
-			$this->session[ $key ] = $value;
151
+			$this->session[$key] = $value;
152 152
 		}
153 153
 
154
-		if ( $this->use_php_sessions ) {
155
-			$_SESSION['gd' . $this->prefix ] = $this->session;
154
+		if ($this->use_php_sessions) {
155
+			$_SESSION['gd'.$this->prefix] = $this->session;
156 156
 		}
157 157
 
158
-		return $this->session[ $key ];
158
+		return $this->session[$key];
159 159
 	}
160 160
 	
161 161
 	/**
@@ -167,29 +167,29 @@  discard block
 block discarded – undo
167 167
 	 * @param integer $value Session variable.
168 168
 	 * @return string Session variable.
169 169
 	 */
170
-	public function un_set( $key ) {
171
-		if ( empty( $key ) ) {
170
+	public function un_set($key) {
171
+		if (empty($key)) {
172 172
 			return false;
173 173
 		}
174 174
 		
175
-		if ( is_array( $key ) ) {
175
+		if (is_array($key)) {
176 176
 			foreach ($key as $index) {
177
-				$index = sanitize_key( $index );
177
+				$index = sanitize_key($index);
178 178
 			
179
-				if ( $index && isset( $this->session[ $index ] ) ) {
180
-					unset( $this->session[ $index ] );
179
+				if ($index && isset($this->session[$index])) {
180
+					unset($this->session[$index]);
181 181
 				}
182 182
 			}
183 183
 		} else {
184
-			$key = sanitize_key( $key );
184
+			$key = sanitize_key($key);
185 185
 			
186
-			if ( isset( $this->session[ $key ] ) ) {
187
-				unset( $this->session[ $key ] );
186
+			if (isset($this->session[$key])) {
187
+				unset($this->session[$key]);
188 188
 			}
189 189
 		}
190 190
 
191
-		if ( $this->use_php_sessions ) {
192
-			$_SESSION['gd' . $this->prefix ] = $this->session;
191
+		if ($this->use_php_sessions) {
192
+			$_SESSION['gd'.$this->prefix] = $this->session;
193 193
 		}
194 194
 
195 195
 		return true;
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 	 * @param integer $value Session variable.
205 205
 	 * @return string Session variable.
206 206
 	 */
207
-	public function is_set( $key ) {
208
-		$key = sanitize_key( $key );
207
+	public function is_set($key) {
208
+		$key = sanitize_key($key);
209 209
 		
210
-		if ( empty( $key ) ) {
210
+		if (empty($key)) {
211 211
 			return false;
212 212
 		}
213 213
 
214
-		if ( isset( $this->session[ $key ] ) ) {
214
+		if (isset($this->session[$key])) {
215 215
 			return true;
216 216
 		}
217 217
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @param int $exp Default expiration (1 hour)
227 227
 	 * @return int
228 228
 	 */
229
-	public function set_expiration_variant_time( $exp ) {
230
-		return ( 30 * 60 * 23 );
229
+	public function set_expiration_variant_time($exp) {
230
+		return (30 * 60 * 23);
231 231
 	}
232 232
 
233 233
 	/**
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @param int $exp Default expiration (1 hour)
239 239
 	 * @return int
240 240
 	 */
241
-	public function set_expiration_time( $exp ) {
242
-		return ( 30 * 60 * 24 );
241
+	public function set_expiration_time($exp) {
242
+		return (30 * 60 * 24);
243 243
 	}
244 244
 
245 245
 	/**
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 		$ret = false;
258 258
 
259 259
 		// If the database variable is already set, no need to run autodetection
260
-		$geodir_use_php_sessions = (bool)get_option( 'geodir_use_php_sessions' );
260
+		$geodir_use_php_sessions = (bool) get_option('geodir_use_php_sessions');
261 261
 
262
-		if (!$geodir_use_php_sessions ) {
262
+		if (!$geodir_use_php_sessions) {
263 263
 			// Attempt to detect if the server supports PHP sessions
264
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
265
-				$this->set( 'geodir_use_php_sessions', 1 );
264
+			if (function_exists('session_start') && !ini_get('safe_mode')) {
265
+				$this->set('geodir_use_php_sessions', 1);
266 266
 				
267
-				if ( $this->get( 'geodir_use_php_sessions' ) ) {
267
+				if ($this->get('geodir_use_php_sessions')) {
268 268
 					$ret = true;
269 269
 
270 270
 					// Set the database option
271
-					update_option( 'geodir_use_php_sessions', true );
271
+					update_option('geodir_use_php_sessions', true);
272 272
 				}
273 273
 			}
274 274
 		} else {
@@ -276,20 +276,20 @@  discard block
 block discarded – undo
276 276
 		}
277 277
 
278 278
 		// Enable or disable PHP Sessions based on the GEODIR_USE_PHP_SESSIONS constant
279
-		if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && GEODIR_USE_PHP_SESSIONS ) {
279
+		if (defined('GEODIR_USE_PHP_SESSIONS') && GEODIR_USE_PHP_SESSIONS) {
280 280
 			$ret = true;
281
-		} else if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && ! GEODIR_USE_PHP_SESSIONS ) {
281
+		} else if (defined('GEODIR_USE_PHP_SESSIONS') && !GEODIR_USE_PHP_SESSIONS) {
282 282
 			$ret = false;
283 283
 		}
284 284
 
285
-		return (bool) apply_filters( 'geodir_use_php_sessions', $ret );
285
+		return (bool) apply_filters('geodir_use_php_sessions', $ret);
286 286
 	}
287 287
 
288 288
 	/**
289 289
 	 * Starts a new session if one hasn't started yet.
290 290
 	 */
291 291
 	public function maybe_start_session() {
292
-		if ( !session_id() && !headers_sent() && !isset($_POST['newcontent'])) { // @todo this is a quick hack to make the edit theme/plugin fiels work with new WP edit feature
292
+		if (!session_id() && !headers_sent() && !isset($_POST['newcontent'])) { // @todo this is a quick hack to make the edit theme/plugin fiels work with new WP edit feature
293 293
 			session_start();
294 294
 		}
295 295
 	}
Please login to merge, or discard this patch.
geodirectory-functions/shortcode_functions.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,6 @@  discard block
 block discarded – undo
46 46
  * @since 1.0.0
47 47
  * @since 1.5.2 Added TERRAIN map type.
48 48
  *
49
- * @param string $value Input value to validate measurement.
50 49
  * @return string The measurement valud in valid format.
51 50
  */
52 51
 function gdsc_validate_map_args($params)
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
  * @param mixed $in The variable to check
96 95
  * @param bool $strict If set to false, consider everything that is not false to be true.
97 96
  *
98
- * @return bool The boolean equivalent or null
97
+ * @return null|boolean The boolean equivalent or null
99 98
  */
100 99
 function gdsc_to_bool_val($in, $strict = false)
101 100
 {
Please login to merge, or discard this patch.
Indentation   +427 added lines, -427 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  
10 10
 // If this file is called directly, abort.
11 11
 if (!defined('WPINC')) {
12
-    die;
12
+	die;
13 13
 }
14 14
 
15 15
 /**
@@ -22,22 +22,22 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function gdsc_validate_measurements($value)
24 24
 {
25
-    if ((strlen($value) - 1) == strpos(trim($value), '%')) {
26
-        // $value is entered as a percent, so it can't be less than 0 or more than 100
27
-        $value = preg_replace('/\D/', '', $value);
28
-        if (100 < $value) {
29
-            $value = 100;
30
-        }
31
-        // Re-add the percent symbol
32
-        $value = $value . '%';
33
-    } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) {
34
-        // Get the absint & re-add the 'px'
35
-        $value = preg_replace('/\D/', '', $value) . 'px';
36
-    } else {
37
-        $value = preg_replace('/\D/', '', $value);
38
-    }
25
+	if ((strlen($value) - 1) == strpos(trim($value), '%')) {
26
+		// $value is entered as a percent, so it can't be less than 0 or more than 100
27
+		$value = preg_replace('/\D/', '', $value);
28
+		if (100 < $value) {
29
+			$value = 100;
30
+		}
31
+		// Re-add the percent symbol
32
+		$value = $value . '%';
33
+	} elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) {
34
+		// Get the absint & re-add the 'px'
35
+		$value = preg_replace('/\D/', '', $value) . 'px';
36
+	} else {
37
+		$value = preg_replace('/\D/', '', $value);
38
+	}
39 39
 
40
-    return $value;
40
+	return $value;
41 41
 }
42 42
 
43 43
 /**
@@ -52,35 +52,35 @@  discard block
 block discarded – undo
52 52
 function gdsc_validate_map_args($params)
53 53
 {
54 54
 
55
-    $params['width'] = gdsc_validate_measurements($params['width']);
56
-    $params['height'] = gdsc_validate_measurements($params['height']);
55
+	$params['width'] = gdsc_validate_measurements($params['width']);
56
+	$params['height'] = gdsc_validate_measurements($params['height']);
57 57
 
58
-    // Only accept our 4 maptypes. Otherwise, revert to the default.
59
-    if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) {
60
-        $params['maptype'] = 'ROADMAP';
61
-    } else {
62
-        $params['maptype'] = geodir_strtoupper($params['maptype']);
63
-    }
58
+	// Only accept our 4 maptypes. Otherwise, revert to the default.
59
+	if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) {
60
+		$params['maptype'] = 'ROADMAP';
61
+	} else {
62
+		$params['maptype'] = geodir_strtoupper($params['maptype']);
63
+	}
64 64
 
65
-    // Zoom accepts a value between 1 and 19
66
-    $params['zoom'] = absint($params['zoom']);
67
-    if (19 < $params['zoom']) {
68
-        $params['zoom'] = '19';
69
-    }
70
-    if (0 == $params['zoom']) {
71
-        $params['zoom'] = '1';
72
-    }
65
+	// Zoom accepts a value between 1 and 19
66
+	$params['zoom'] = absint($params['zoom']);
67
+	if (19 < $params['zoom']) {
68
+		$params['zoom'] = '19';
69
+	}
70
+	if (0 == $params['zoom']) {
71
+		$params['zoom'] = '1';
72
+	}
73 73
 
74
-    // Child_collapse must be boolean
75
-    $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']);
74
+	// Child_collapse must be boolean
75
+	$params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']);
76 76
 
77
-    // Scrollwheel must be boolean
78
-    $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']);
77
+	// Scrollwheel must be boolean
78
+	$params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']);
79 79
 
80
-    // Scrollwheel must be boolean
81
-    $params['autozoom'] = gdsc_to_bool_val($params['autozoom']);
80
+	// Scrollwheel must be boolean
81
+	$params['autozoom'] = gdsc_to_bool_val($params['autozoom']);
82 82
 
83
-    return $params;
83
+	return $params;
84 84
 }
85 85
 
86 86
 /**
@@ -99,52 +99,52 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function gdsc_to_bool_val($in, $strict = false)
101 101
 {
102
-    $out = null;
103
-
104
-    // if not strict, we only have to check if something is false
105
-    if (in_array($in, array(
106
-        'false',
107
-        'False',
108
-        'FALSE',
109
-        'no',
110
-        'No',
111
-        'n',
112
-        'N',
113
-        '0',
114
-        'off',
115
-        'Off',
116
-        'OFF',
117
-        false,
118
-        0,
119
-        null
120
-    ), true)) {
121
-        $out = false;
122
-    } else if ($strict) {
123
-        // if strict, check the equivalent true values
124
-        if (in_array($in, array(
125
-            'true',
126
-            'True',
127
-            'TRUE',
128
-            'yes',
129
-            'Yes',
130
-            'y',
131
-            'Y',
132
-            '1',
133
-            'on',
134
-            'On',
135
-            'ON',
136
-            true,
137
-            1
138
-        ), true)) {
139
-            $out = true;
140
-        }
141
-    } else {
142
-        // not strict? let the regular php bool check figure it out (will
143
-        //     largely default to true)
144
-        $out = ($in ? true : false);
145
-    }
102
+	$out = null;
103
+
104
+	// if not strict, we only have to check if something is false
105
+	if (in_array($in, array(
106
+		'false',
107
+		'False',
108
+		'FALSE',
109
+		'no',
110
+		'No',
111
+		'n',
112
+		'N',
113
+		'0',
114
+		'off',
115
+		'Off',
116
+		'OFF',
117
+		false,
118
+		0,
119
+		null
120
+	), true)) {
121
+		$out = false;
122
+	} else if ($strict) {
123
+		// if strict, check the equivalent true values
124
+		if (in_array($in, array(
125
+			'true',
126
+			'True',
127
+			'TRUE',
128
+			'yes',
129
+			'Yes',
130
+			'y',
131
+			'Y',
132
+			'1',
133
+			'on',
134
+			'On',
135
+			'ON',
136
+			true,
137
+			1
138
+		), true)) {
139
+			$out = true;
140
+		}
141
+	} else {
142
+		// not strict? let the regular php bool check figure it out (will
143
+		//     largely default to true)
144
+		$out = ($in ? true : false);
145
+	}
146 146
 
147
-    return $out;
147
+	return $out;
148 148
 }
149 149
 
150 150
 /**
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
  */
158 158
 function gdsc_is_post_type_valid($incoming_post_type)
159 159
 {
160
-    $post_types = geodir_get_posttypes();
161
-    $post_types = array_map('geodir_strtolower', $post_types);
162
-    $post_type_found = false;
163
-    foreach ($post_types as $type) {
164
-        if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) {
165
-            $post_type_found = true;
166
-        }
167
-    }
160
+	$post_types = geodir_get_posttypes();
161
+	$post_types = array_map('geodir_strtolower', $post_types);
162
+	$post_type_found = false;
163
+	foreach ($post_types as $type) {
164
+		if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) {
165
+			$post_type_found = true;
166
+		}
167
+	}
168 168
 
169
-    return $post_type_found;
169
+	return $post_type_found;
170 170
 }
171 171
 
172 172
 /**
@@ -186,52 +186,52 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function gdsc_listing_loop_filter($query)
188 188
 {
189
-    global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term;
190
-
191
-    $geodir_post_type = geodir_get_current_posttype();
192
-
193
-    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
194
-        $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
195
-
196
-        if (isset($wp_query->query[$taxonomies[0]])) {
197
-            $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
198
-            $request_term = end($request_term);
199
-            if (!term_exists($request_term)) {
200
-                $args = array('number' => '1',);
201
-                $terms_arr = get_terms($taxonomies[0], $args);
202
-                foreach ($terms_arr as $location_term) {
203
-                    $term_arr = $location_term;
204
-                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
205
-                }
206
-                $wp_query->queried_object_id = 1;
207
-                $wp_query->queried_object = $term_arr;
208
-            }
209
-        }
189
+	global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term;
190
+
191
+	$geodir_post_type = geodir_get_current_posttype();
192
+
193
+	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
194
+		$taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
195
+
196
+		if (isset($wp_query->query[$taxonomies[0]])) {
197
+			$request_term = explode("/", $wp_query->query[$taxonomies[0]]);
198
+			$request_term = end($request_term);
199
+			if (!term_exists($request_term)) {
200
+				$args = array('number' => '1',);
201
+				$terms_arr = get_terms($taxonomies[0], $args);
202
+				foreach ($terms_arr as $location_term) {
203
+					$term_arr = $location_term;
204
+					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
205
+				}
206
+				$wp_query->queried_object_id = 1;
207
+				$wp_query->queried_object = $term_arr;
208
+			}
209
+		}
210 210
 
211
-    }
212
-    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
211
+	}
212
+	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
213 213
 
214
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
214
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
215 215
 
216
-        add_filter('posts_fields', 'geodir_posts_fields', 1);
217
-        add_filter('posts_join', 'geodir_posts_join', 1);
218
-        geodir_post_where();
219
-        if (!is_admin()) {
220
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
221
-        }
216
+		add_filter('posts_fields', 'geodir_posts_fields', 1);
217
+		add_filter('posts_join', 'geodir_posts_join', 1);
218
+		geodir_post_where();
219
+		if (!is_admin()) {
220
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
221
+		}
222 222
 
223
-        // advanced filter for popular post view widget
224
-        global $wp_query;
225
-        if (!is_admin()) {
226
-            if (!empty($wp_query->query['with_pics_only'])) {
227
-                add_filter('posts_join', 'geodir_filter_widget_join', 1000);
228
-            }
229
-            add_filter('posts_where', 'geodir_filter_widget_where', 1000);
230
-        }
223
+		// advanced filter for popular post view widget
224
+		global $wp_query;
225
+		if (!is_admin()) {
226
+			if (!empty($wp_query->query['with_pics_only'])) {
227
+				add_filter('posts_join', 'geodir_filter_widget_join', 1000);
228
+			}
229
+			add_filter('posts_where', 'geodir_filter_widget_where', 1000);
230
+		}
231 231
 
232
-    }
232
+	}
233 233
 
234
-    return $query;
234
+	return $query;
235 235
 }
236 236
 
237 237
 /**
@@ -245,40 +245,40 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function gdsc_manage_category_choice($post_type, $category)
247 247
 {
248
-    if (0 == $category || '' == $category) {
249
-        return '';
250
-    }
248
+	if (0 == $category || '' == $category) {
249
+		return '';
250
+	}
251 251
 
252
-    if (!(gdsc_is_post_type_valid($post_type))) {
253
-        return '';
254
-    }
252
+	if (!(gdsc_is_post_type_valid($post_type))) {
253
+		return '';
254
+	}
255 255
 
256
-    $taxonomies = geodir_get_taxonomies($post_type);
256
+	$taxonomies = geodir_get_taxonomies($post_type);
257 257
 
258
-    $categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false));
258
+	$categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false));
259 259
 
260
-    $cat_id = 0;
260
+	$cat_id = 0;
261 261
 
262
-    foreach ($categories as $cat) {
263
-        if (is_numeric($category)) {
264
-            if (absint($category) == $cat->term_id) {
265
-                $cat_id = $cat->term_id;
266
-                break;
267
-            }
268
-        } else {
269
-            if ($category == $cat->slug) {
270
-                $cat_id = $cat->term_id;
271
-                break;
272
-            }
262
+	foreach ($categories as $cat) {
263
+		if (is_numeric($category)) {
264
+			if (absint($category) == $cat->term_id) {
265
+				$cat_id = $cat->term_id;
266
+				break;
267
+			}
268
+		} else {
269
+			if ($category == $cat->slug) {
270
+				$cat_id = $cat->term_id;
271
+				break;
272
+			}
273 273
 
274
-            if ($category == $cat->name) {
275
-                $cat_id = $cat->term_id;
276
-                break;
277
-            }
278
-        }
279
-    }
274
+			if ($category == $cat->name) {
275
+				$cat_id = $cat->term_id;
276
+				break;
277
+			}
278
+		}
279
+	}
280 280
 
281
-    return $cat_id;
281
+	return $cat_id;
282 282
 }
283 283
 
284 284
 // @todo: Extract this
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
 	 * Adds the script in the page footer for the home page google map.
289 289
 	 *
290 290
 	 * @since 1.0.0
291
-     * @return string Print the script in page footer.
291
+	 * @return string Print the script in page footer.
292 292
 	 */
293 293
 	function geodir_home_map_add_script()
294
-    {
295
-        ?>
294
+	{
295
+		?>
296 296
         <script type="text/javascript">
297 297
             jQuery(document).ready(function () {
298 298
                 geoDirMapSlide();
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             }
366 366
         </script>
367 367
     <?php
368
-    }
368
+	}
369 369
 }
370 370
 
371 371
 /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function geodir_popular_category_add_scripts()
378 378
 {
379
-    ?>
379
+	?>
380 380
     <script type="text/javascript">
381 381
         jQuery(function ($) {
382 382
             $('.geodir-showcat').click(function () {
@@ -406,56 +406,56 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function gdsc_validate_layout_choice($layout_choice)
408 408
 {
409
-    switch (geodir_strtolower($layout_choice)) {
410
-        case 'list';
411
-        case 'one';
412
-        case 'one_column';
413
-        case 'onecolumn';
414
-        case '1';
415
-            $layout_choice = 'list';
416
-            break;
417
-        case 'gridview_onehalf';
418
-        case 'two';
419
-        case 'two_column';
420
-        case 'two_columns';
421
-        case 'twocolumn';
422
-        case 'twocolumns';
423
-        case '2';
424
-            $layout_choice = 'gridview_onehalf';
425
-            break;
426
-        case 'gridview_onethird';
427
-        case 'three';
428
-        case 'three_column';
429
-        case 'three_columns';
430
-        case 'threecolumn';
431
-        case 'threecolumns';
432
-        case '3';
433
-            $layout_choice = 'gridview_onethird';
434
-            break;
435
-        case 'gridview_onefourth';
436
-        case 'four';
437
-        case 'four_column';
438
-        case 'four_columns';
439
-        case 'fourcolumn';
440
-        case 'fourcolumns';
441
-        case '4';
442
-            $layout_choice = 'gridview_onefourth';
443
-            break;
444
-        case 'gridview_onefifth';
445
-        case 'five';
446
-        case 'five_column';
447
-        case 'five_columns';
448
-        case 'fivecolumn';
449
-        case 'fivecolumns';
450
-        case '5';
451
-            $layout_choice = 'gridview_onefifth';
452
-            break;
453
-        default:
454
-            $layout_choice = 'gridview_onehalf';
455
-            break;
456
-    }
409
+	switch (geodir_strtolower($layout_choice)) {
410
+		case 'list';
411
+		case 'one';
412
+		case 'one_column';
413
+		case 'onecolumn';
414
+		case '1';
415
+			$layout_choice = 'list';
416
+			break;
417
+		case 'gridview_onehalf';
418
+		case 'two';
419
+		case 'two_column';
420
+		case 'two_columns';
421
+		case 'twocolumn';
422
+		case 'twocolumns';
423
+		case '2';
424
+			$layout_choice = 'gridview_onehalf';
425
+			break;
426
+		case 'gridview_onethird';
427
+		case 'three';
428
+		case 'three_column';
429
+		case 'three_columns';
430
+		case 'threecolumn';
431
+		case 'threecolumns';
432
+		case '3';
433
+			$layout_choice = 'gridview_onethird';
434
+			break;
435
+		case 'gridview_onefourth';
436
+		case 'four';
437
+		case 'four_column';
438
+		case 'four_columns';
439
+		case 'fourcolumn';
440
+		case 'fourcolumns';
441
+		case '4';
442
+			$layout_choice = 'gridview_onefourth';
443
+			break;
444
+		case 'gridview_onefifth';
445
+		case 'five';
446
+		case 'five_column';
447
+		case 'five_columns';
448
+		case 'fivecolumn';
449
+		case 'fivecolumns';
450
+		case '5';
451
+			$layout_choice = 'gridview_onefifth';
452
+			break;
453
+		default:
454
+			$layout_choice = 'gridview_onehalf';
455
+			break;
456
+	}
457 457
 
458
-    return $layout_choice;
458
+	return $layout_choice;
459 459
 }
460 460
 
461 461
 /**
@@ -472,34 +472,34 @@  discard block
 block discarded – undo
472 472
  */
473 473
 function gdsc_validate_sort_choice($sort_choice, $post_type = '')
474 474
 {
475
-    global $plugin_prefix;
476
-
477
-    $sorts = array(
478
-        'az',
479
-        'latest',
480
-        'featured',
481
-        'high_review',
482
-        'high_rating',
483
-        'random',
484
-    );
485
-
486
-    if (in_array($sort_choice, $sorts)) {
487
-        return $sort_choice;
488
-    }
475
+	global $plugin_prefix;
476
+
477
+	$sorts = array(
478
+		'az',
479
+		'latest',
480
+		'featured',
481
+		'high_review',
482
+		'high_rating',
483
+		'random',
484
+	);
485
+
486
+	if (in_array($sort_choice, $sorts)) {
487
+		return $sort_choice;
488
+	}
489 489
 
490
-    if (!empty($post_type)) {
491
-        $table = $plugin_prefix . $post_type . '_detail';
490
+	if (!empty($post_type)) {
491
+		$table = $plugin_prefix . $post_type . '_detail';
492 492
         
493
-        if (!geodir_prepare_custom_sorting($sort_choice, $table)) {
494
-            $sort_choice = '';
495
-        }
496
-    }
493
+		if (!geodir_prepare_custom_sorting($sort_choice, $table)) {
494
+			$sort_choice = '';
495
+		}
496
+	}
497 497
 
498
-    if (empty($post_type) || empty($sort_choice)) {
499
-        $sort_choice = 'latest';
500
-    }
498
+	if (empty($post_type) || empty($sort_choice)) {
499
+		$sort_choice = 'latest';
500
+	}
501 501
 
502
-    return $sort_choice;
502
+	return $sort_choice;
503 503
 }
504 504
 
505 505
 /**
@@ -512,22 +512,22 @@  discard block
 block discarded – undo
512 512
  */
513 513
 function gdsc_validate_listing_width($width_choice)
514 514
 {
515
-    if (!(empty($width_choice))) {
516
-        $width_choice = absint($width_choice);
517
-    } else {
518
-        return '';
519
-    }
515
+	if (!(empty($width_choice))) {
516
+		$width_choice = absint($width_choice);
517
+	} else {
518
+		return '';
519
+	}
520 520
 
521
-    if (100 < $width_choice) {
522
-        $width_choice = 100;
523
-    }
521
+	if (100 < $width_choice) {
522
+		$width_choice = 100;
523
+	}
524 524
 
525
-    // If listing_width is too narrow, it won't work, arbitrarily set to 10% here
526
-    if (10 > $width_choice) {
527
-        $width_choice = 10;
528
-    }
525
+	// If listing_width is too narrow, it won't work, arbitrarily set to 10% here
526
+	if (10 > $width_choice) {
527
+		$width_choice = 10;
528
+	}
529 529
 
530
-    return $width_choice;
530
+	return $width_choice;
531 531
 }
532 532
 
533 533
 /**
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
  */
541 541
 function gdsc_validate_list_filter_choice($filter_choice)
542 542
 {
543
-    $filters = array(
544
-        'all',
545
-        'today',
546
-        'upcoming',
547
-        'past',
548
-    );
549
-
550
-    if (!(in_array($filter_choice, $filters))) {
551
-        $filter_choice = 'all';
552
-    }
543
+	$filters = array(
544
+		'all',
545
+		'today',
546
+		'upcoming',
547
+		'past',
548
+	);
549
+
550
+	if (!(in_array($filter_choice, $filters))) {
551
+		$filter_choice = 'all';
552
+	}
553 553
 
554
-    return $filter_choice;
554
+	return $filter_choice;
555 555
 }
556 556
 
557 557
 /**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
  * @return string Listings HTML content.
575 575
  */
576 576
 function geodir_sc_gd_listings_output($args = array()) {
577
-    $title				 = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';
577
+	$title				 = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';
578 578
 	$post_type 			 = !empty($args['post_type']) ? $args['post_type'] : 'gd_place';
579 579
 	$category 			 = !empty($args['category']) ? $args['category'] : '0';
580 580
 	$post_number		 = !empty($args['post_number']) ? $args['post_number'] : 10;
@@ -585,17 +585,17 @@  discard block
 block discarded – undo
585 585
 	$listing_width 		 = !empty($args['listing_width']) ? $args['listing_width'] : '';
586 586
 	$with_pagination 	 = !empty($args['with_pagination']) ? true : false;
587 587
 	$event_type 	 	 = !empty($args['event_type']) ? $args['event_type'] : '';
588
-    $shortcode_content   = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';
589
-    $tags                = !empty($args['tags']) ? $args['tags'] : array();
590
-    /**
591
-     * Filter the content text displayed when no listings found.
592
-     *
593
-     * @since 1.6.0
594
-     *
595
-     * @param string $shortcode_content The shortcode content text.
596
-     * @param array $args Array of arguements to filter listings.
597
-     */
598
-    $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args);
588
+	$shortcode_content   = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';
589
+	$tags                = !empty($args['tags']) ? $args['tags'] : array();
590
+	/**
591
+	 * Filter the content text displayed when no listings found.
592
+	 *
593
+	 * @since 1.6.0
594
+	 *
595
+	 * @param string $shortcode_content The shortcode content text.
596
+	 * @param array $args Array of arguements to filter listings.
597
+	 */
598
+	$shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args);
599 599
 		
600 600
 	$top_pagination 	 = $with_pagination && !empty($args['top_pagination']) ? true : false;
601 601
 	$bottom_pagination 	 = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
@@ -607,92 +607,92 @@  discard block
 block discarded – undo
607 607
 	$pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
608 608
 	
609 609
 	$query_args = array(
610
-        'posts_per_page' => $post_number,
611
-        'is_geodir_loop' => true,
612
-        'gd_location' => $add_location_filter,
613
-        'post_type' => $post_type,
614
-        'order_by' => $list_sort,
610
+		'posts_per_page' => $post_number,
611
+		'is_geodir_loop' => true,
612
+		'gd_location' => $add_location_filter,
613
+		'post_type' => $post_type,
614
+		'order_by' => $list_sort,
615 615
 		'pageno' => $pageno
616
-    );
616
+	);
617 617
 
618
-    if ($character_count >= 0) {
619
-        $query_args['excerpt_length'] = $character_count;
620
-    }
618
+	if ($character_count >= 0) {
619
+		$query_args['excerpt_length'] = $character_count;
620
+	}
621 621
     
622
-    if (!empty($args['post_author'])) {
623
-        $query_args['post_author'] = $args['post_author'];
624
-    }
622
+	if (!empty($args['post_author'])) {
623
+		$query_args['post_author'] = $args['post_author'];
624
+	}
625 625
 
626
-    if (!empty($args['show_featured_only'])) {
627
-        $query_args['show_featured_only'] = 1;
628
-    }
626
+	if (!empty($args['show_featured_only'])) {
627
+		$query_args['show_featured_only'] = 1;
628
+	}
629 629
 
630
-    if (!empty($args['show_special_only'])) {
631
-        $query_args['show_special_only'] = 1;
632
-    }
630
+	if (!empty($args['show_special_only'])) {
631
+		$query_args['show_special_only'] = 1;
632
+	}
633 633
 
634
-    if (!empty($args['with_pics_only'])) {
635
-        $query_args['with_pics_only'] = 0;
636
-        $query_args['featured_image_only'] = 1;
637
-    }
634
+	if (!empty($args['with_pics_only'])) {
635
+		$query_args['with_pics_only'] = 0;
636
+		$query_args['featured_image_only'] = 1;
637
+	}
638 638
 
639
-    if (!empty($args['with_videos_only'])) {
640
-        $query_args['with_videos_only'] = 1;
641
-    }
639
+	if (!empty($args['with_videos_only'])) {
640
+		$query_args['with_videos_only'] = 1;
641
+	}
642 642
     
643
-    if (!empty($args['show_favorites_only'])) {
644
-        $query_args['show_favorites_only'] = 1;
645
-        $query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0;
646
-    }
647
-    $with_no_results = !empty($args['without_no_results']) ? false : true;
643
+	if (!empty($args['show_favorites_only'])) {
644
+		$query_args['show_favorites_only'] = 1;
645
+		$query_args['favorites_by_user'] = !empty($args['favorites_by_user']) ? $args['favorites_by_user'] : 0;
646
+	}
647
+	$with_no_results = !empty($args['without_no_results']) ? false : true;
648 648
 
649
-    if (!empty($category) && isset($category[0]) && $category[0] != '0') {
650
-        $category_taxonomy = geodir_get_taxonomies($post_type);
649
+	if (!empty($category) && isset($category[0]) && $category[0] != '0') {
650
+		$category_taxonomy = geodir_get_taxonomies($post_type);
651 651
 
652
-        ######### WPML #########
653
-        if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) {
654
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
655
-        }
656
-        ######### WPML #########
652
+		######### WPML #########
653
+		if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) {
654
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
655
+		}
656
+		######### WPML #########
657 657
 
658
-        $tax_query = array(
659
-            'taxonomy' => $category_taxonomy[0],
660
-            'field' => 'id',
661
-            'terms' => $category
662
-        );
658
+		$tax_query = array(
659
+			'taxonomy' => $category_taxonomy[0],
660
+			'field' => 'id',
661
+			'terms' => $category
662
+		);
663 663
 
664
-        $query_args['tax_query'] = array($tax_query);
665
-    }
664
+		$query_args['tax_query'] = array($tax_query);
665
+	}
666 666
     
667
-    if (!empty($tags)) {
668
-        // Clean tags
669
-        if (!is_array($tags)) {
670
-            $comma = _x(',', 'tag delimiter');
671
-            if ( ',' !== $comma ) {
672
-                $tags = str_replace($comma, ',', $tags);
673
-            }
674
-            $tags = explode(',', trim($tags, " \n\t\r\0\x0B,"));
675
-            $tags = array_map('trim', $tags);
676
-        }
667
+	if (!empty($tags)) {
668
+		// Clean tags
669
+		if (!is_array($tags)) {
670
+			$comma = _x(',', 'tag delimiter');
671
+			if ( ',' !== $comma ) {
672
+				$tags = str_replace($comma, ',', $tags);
673
+			}
674
+			$tags = explode(',', trim($tags, " \n\t\r\0\x0B,"));
675
+			$tags = array_map('trim', $tags);
676
+		}
677 677
         
678
-        if (!empty($tags)) {
679
-            $tag_query = array(
680
-                'taxonomy' => $post_type . '_tags',
681
-                'field' => 'name',
682
-                'terms' => $tags
683
-            );
684
-
685
-            if (!empty($query_args['tax_query'])) {
686
-                $query_args['tax_query'][] = $tag_query;
687
-            } else {
688
-                $query_args['tax_query'] = array($tag_query);
689
-            }
690
-        }
691
-    }
678
+		if (!empty($tags)) {
679
+			$tag_query = array(
680
+				'taxonomy' => $post_type . '_tags',
681
+				'field' => 'name',
682
+				'terms' => $tags
683
+			);
684
+
685
+			if (!empty($query_args['tax_query'])) {
686
+				$query_args['tax_query'][] = $tag_query;
687
+			} else {
688
+				$query_args['tax_query'] = array($tag_query);
689
+			}
690
+		}
691
+	}
692 692
 
693
-    global $gridview_columns_widget, $geodir_is_widget_listing;
693
+	global $gridview_columns_widget, $geodir_is_widget_listing;
694 694
 
695
-    if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
695
+	if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
696 696
 		global $geodir_event_widget_listview;
697 697
 		$geodir_event_widget_listview = true;
698 698
 		
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
 		$widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();
708 708
 	}
709 709
 	$current_gridview_columns_widget = $gridview_columns_widget;
710
-    $identifier = ' gd-wgt-pagi-' . mt_rand();
711
-    ob_start();
710
+	$identifier = ' gd-wgt-pagi-' . mt_rand();
711
+	ob_start();
712 712
 	if (!empty($widget_listings) || $with_no_results) {
713 713
 		if (!$geodir_ajax) {
714
-        /**
715
-         * Called before the shortcode [gd_listings] content is output.
716
-         *
717
-         * @since 1.0.0
718
-         */
719
-        do_action('geodir_before_sc_gd_listings');
714
+		/**
715
+		 * Called before the shortcode [gd_listings] content is output.
716
+		 *
717
+		 * @since 1.0.0
718
+		 */
719
+		do_action('geodir_before_sc_gd_listings');
720 720
 		?>
721 721
         <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>">
722 722
             <?php if ($title != '') { ?>
@@ -727,63 +727,63 @@  discard block
 block discarded – undo
727 727
             <div class="gd-sc-loader">
728 728
                 <div class="gd-sc-content">
729 729
             <?php }
730
-            if (!(empty($widget_listings) && !empty($shortcode_content))) {
731
-                if (strstr($layout, 'gridview')) {
732
-                    $listing_view_exp = explode('_', $layout);
733
-                    $gridview_columns_widget = $layout;
734
-                    $layout = $listing_view_exp[0];
735
-                } else {
736
-                    $gridview_columns_widget = '';
737
-                }
738
-
739
-                /**
740
-                 * Filter the widget listing listview template.
741
-                 *
742
-                 * @since 1.0.0
743
-                 *
744
-                 * @param string The template file to display listing.
745
-                 */
746
-                $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
730
+			if (!(empty($widget_listings) && !empty($shortcode_content))) {
731
+				if (strstr($layout, 'gridview')) {
732
+					$listing_view_exp = explode('_', $layout);
733
+					$gridview_columns_widget = $layout;
734
+					$layout = $listing_view_exp[0];
735
+				} else {
736
+					$gridview_columns_widget = '';
737
+				}
738
+
739
+				/**
740
+				 * Filter the widget listing listview template.
741
+				 *
742
+				 * @since 1.0.0
743
+				 *
744
+				 * @param string The template file to display listing.
745
+				 */
746
+				$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
747 747
                             
748
-                global $post, $map_jason, $map_canvas_arr, $gd_session;
749
-
750
-                $current_post = $post;
751
-                $current_map_jason = $map_jason;
752
-                $current_map_canvas_arr = $map_canvas_arr;
753
-                $geodir_is_widget_listing = true;
754
-                $gd_session->un_set('gd_listing_view');
755
-
756
-                if ($with_pagination && $top_pagination) {				
757
-                    echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
758
-                }
759
-
760
-                /**
761
-                 * Includes listing listview template.
762
-                 *
763
-                 * @since 1.0.0
764
-                 */
765
-                include($template);
748
+				global $post, $map_jason, $map_canvas_arr, $gd_session;
749
+
750
+				$current_post = $post;
751
+				$current_map_jason = $map_jason;
752
+				$current_map_canvas_arr = $map_canvas_arr;
753
+				$geodir_is_widget_listing = true;
754
+				$gd_session->un_set('gd_listing_view');
755
+
756
+				if ($with_pagination && $top_pagination) {				
757
+					echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
758
+				}
759
+
760
+				/**
761
+				 * Includes listing listview template.
762
+				 *
763
+				 * @since 1.0.0
764
+				 */
765
+				include($template);
766 766
                 
767
-                if ($with_pagination && $bottom_pagination) {				
768
-                    echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
769
-                }
770
-
771
-                $geodir_is_widget_listing = false;
772
-
773
-                $GLOBALS['post'] = $current_post;
774
-                if (!empty($current_post)) {
775
-                    setup_postdata($current_post);
776
-                }
777
-                $map_jason = $current_map_jason;
778
-                $map_canvas_arr = $current_map_canvas_arr;
779
-                global $gridview_columns_widget;
780
-                $gridview_columns_widget = $current_gridview_columns_widget;
781
-            } else {
782
-                echo $shortcode_content;
783
-            }
767
+				if ($with_pagination && $bottom_pagination) {				
768
+					echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
769
+				}
770
+
771
+				$geodir_is_widget_listing = false;
772
+
773
+				$GLOBALS['post'] = $current_post;
774
+				if (!empty($current_post)) {
775
+					setup_postdata($current_post);
776
+				}
777
+				$map_jason = $current_map_jason;
778
+				$map_canvas_arr = $current_map_canvas_arr;
779
+				global $gridview_columns_widget;
780
+				$gridview_columns_widget = $current_gridview_columns_widget;
781
+			} else {
782
+				echo $shortcode_content;
783
+			}
784 784
 			?>
785 785
 			<?php
786
-            if (!$geodir_ajax) { 
786
+			if (!$geodir_ajax) { 
787 787
 			?>
788 788
             </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fas fa-cog fa-spin"></i></p></div>
789 789
 <script type="text/javascript">
@@ -822,10 +822,10 @@  discard block
 block discarded – undo
822 822
             loading.hide();
823 823
             jQuery(items).html(response);
824 824
             <?php
825
-              /**
826
-               * if lazyload images enabled then refresh them once ajax page changed.
827
-               */
828
-              if (get_option('geodir_lazy_load', 1)) { ?>
825
+			  /**
826
+			   * if lazyload images enabled then refresh them once ajax page changed.
827
+			   */
828
+			  if (get_option('geodir_lazy_load', 1)) { ?>
829 829
               geodir_init_lazy_load();
830 830
               <?php } ?>
831 831
         }
@@ -836,11 +836,11 @@  discard block
 block discarded – undo
836 836
 </div>
837 837
 		<?php } ?>
838 838
     <?php
839
-    }
839
+	}
840 840
 	$output = ob_get_contents();
841
-    ob_end_clean();
841
+	ob_end_clean();
842 842
 
843
-    return trim($output);
843
+	return trim($output);
844 844
 }
845 845
 
846 846
 /**
@@ -867,15 +867,15 @@  discard block
 block discarded – undo
867 867
  * @return string Listings pagination HTML content.
868 868
  */
869 869
 function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
870
-    if (empty($prelabel)) {
871
-        $prelabel = '<strong>&laquo;</strong>';
872
-    }
870
+	if (empty($prelabel)) {
871
+		$prelabel = '<strong>&laquo;</strong>';
872
+	}
873 873
 
874
-    if (empty($nxtlabel)) {
875
-        $nxtlabel = '<strong>&raquo;</strong>';
876
-    }
874
+	if (empty($nxtlabel)) {
875
+		$nxtlabel = '<strong>&raquo;</strong>';
876
+	}
877 877
 
878
-    $half_pages_to_show = round($pages_to_show / 2);
878
+	$half_pages_to_show = round($pages_to_show / 2);
879 879
 
880 880
 	$numposts = $total_posts;
881 881
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 		}
909 909
 		
910 910
 		if (($pageno - 1) > 0) {
911
-            echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a>&nbsp;';
911
+			echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a>&nbsp;';
912 912
 		}
913 913
 		
914 914
 		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
@@ -931,9 +931,9 @@  discard block
 block discarded – undo
931 931
 		echo "</div> $after </div>";
932 932
 	}
933 933
 	$output = ob_get_contents();
934
-    ob_end_clean();
934
+	ob_end_clean();
935 935
 
936
-    return trim($output);
936
+	return trim($output);
937 937
 }
938 938
 
939 939
 /**
@@ -944,10 +944,10 @@  discard block
 block discarded – undo
944 944
  * @return string Listings HTML content.
945 945
  */
946 946
 function geodir_sclistings_callback() {
947
-    check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce');
948
-    //set variables
949
-    $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
950
-    $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
947
+	check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce');
948
+	//set variables
949
+	$scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
950
+	$pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
951 951
 	
952 952
 	$shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
953 953
 	
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 	} else {
960 960
 		echo 0;
961 961
 	}
962
-    wp_die();
962
+	wp_die();
963 963
 }
964 964
 add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback');
965 965
 add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback');
966 966
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
             $value = 100;
30 30
         }
31 31
         // Re-add the percent symbol
32
-        $value = $value . '%';
32
+        $value = $value.'%';
33 33
     } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) {
34 34
         // Get the absint & re-add the 'px'
35
-        $value = preg_replace('/\D/', '', $value) . 'px';
35
+        $value = preg_replace('/\D/', '', $value).'px';
36 36
     } else {
37 37
         $value = preg_replace('/\D/', '', $value);
38 38
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     }
212 212
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
213 213
 
214
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
214
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
215 215
 
216 216
         add_filter('posts_fields', 'geodir_posts_fields', 1);
217 217
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
     $taxonomies = geodir_get_taxonomies($post_type);
257 257
 
258
-    $categories = get_terms(array('taxonomy' => $taxonomies[0],'hide_empty' => false));
258
+    $categories = get_terms(array('taxonomy' => $taxonomies[0], 'hide_empty' => false));
259 259
 
260 260
     $cat_id = 0;
261 261
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     }
489 489
 
490 490
     if (!empty($post_type)) {
491
-        $table = $plugin_prefix . $post_type . '_detail';
491
+        $table = $plugin_prefix.$post_type.'_detail';
492 492
         
493 493
         if (!geodir_prepare_custom_sorting($sort_choice, $table)) {
494 494
             $sort_choice = '';
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
 	$add_location_filter = !empty($args['add_location_filter']) ? true : false;
582 582
 	$list_sort 			 = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';
583 583
 	$character_count	 = isset($args['character_count']) ? $args['character_count'] : '';
584
-	$layout 			 = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
584
+	$layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
585 585
 	$listing_width 		 = !empty($args['listing_width']) ? $args['listing_width'] : '';
586
-	$with_pagination 	 = !empty($args['with_pagination']) ? true : false;
587
-	$event_type 	 	 = !empty($args['event_type']) ? $args['event_type'] : '';
586
+	$with_pagination = !empty($args['with_pagination']) ? true : false;
587
+	$event_type = !empty($args['event_type']) ? $args['event_type'] : '';
588 588
     $shortcode_content   = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : '';
589 589
     $tags                = !empty($args['tags']) ? $args['tags'] : array();
590 590
     /**
@@ -598,13 +598,13 @@  discard block
 block discarded – undo
598 598
     $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args);
599 599
 		
600 600
 	$top_pagination 	 = $with_pagination && !empty($args['top_pagination']) ? true : false;
601
-	$bottom_pagination 	 = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
601
+	$bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
602 602
 	
603 603
 	$shortcode_atts		 = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();
604 604
 
605 605
 	// ajax mode
606
-	$geodir_ajax		 = !empty($args['geodir_ajax']) ? true : false;
607
-	$pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
606
+	$geodir_ajax = !empty($args['geodir_ajax']) ? true : false;
607
+	$pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
608 608
 	
609 609
 	$query_args = array(
610 610
         'posts_per_page' => $post_number,
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         // Clean tags
669 669
         if (!is_array($tags)) {
670 670
             $comma = _x(',', 'tag delimiter');
671
-            if ( ',' !== $comma ) {
671
+            if (',' !== $comma) {
672 672
                 $tags = str_replace($comma, ',', $tags);
673 673
             }
674 674
             $tags = explode(',', trim($tags, " \n\t\r\0\x0B,"));
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         
678 678
         if (!empty($tags)) {
679 679
             $tag_query = array(
680
-                'taxonomy' => $post_type . '_tags',
680
+                'taxonomy' => $post_type.'_tags',
681 681
                 'field' => 'name',
682 682
                 'terms' => $tags
683 683
             );
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		$widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();
708 708
 	}
709 709
 	$current_gridview_columns_widget = $gridview_columns_widget;
710
-    $identifier = ' gd-wgt-pagi-' . mt_rand();
710
+    $identifier = ' gd-wgt-pagi-'.mt_rand();
711 711
     ob_start();
712 712
 	if (!empty($widget_listings) || $with_no_results) {
713 713
 		if (!$geodir_ajax) {
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
          */
719 719
         do_action('geodir_before_sc_gd_listings');
720 720
 		?>
721
-        <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>">
721
+        <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>">
722 722
             <?php if ($title != '') { ?>
723 723
             <div class="geodir_list_heading clearfix">
724 724
                 <?php echo $title; ?>
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
             </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fas fa-cog fa-spin"></i></p></div>
789 789
 <script type="text/javascript">
790 790
 /* <![CDATA[ */
791
-jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) {
792
-    var container = jQuery( '.<?php echo trim($identifier);?>');
791
+jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) {
792
+    var container = jQuery( '.<?php echo trim($identifier); ?>');
793 793
     var obj = this;
794 794
     var pid = parseInt(jQuery(this).data('page'));
795 795
     var items = jQuery(obj).closest('.gd-sc-content');
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         return false;
800 800
     }
801 801
     
802
-    var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>";
802
+    var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>";
803 803
     
804 804
     var data = {
805 805
       'action': 'geodir_sclistings',
@@ -889,16 +889,16 @@  discard block
 block discarded – undo
889 889
 	if ($max_page > 1 || $always_show) {
890 890
 		// Extra pagination info
891 891
 		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
892
-		$start_no = ( $pageno - 1 ) * $posts_per_page + 1;
892
+		$start_no = ($pageno - 1) * $posts_per_page + 1;
893 893
 		$end_no = min($pageno * $posts_per_page, $numposts);
894 894
 		
895 895
 		if ($geodir_pagination_more_info != '') {
896
-			$pagination_info = '<div class="gd-pagination-details gd-pagination-details-' . $geodir_pagination_more_info . '">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
896
+			$pagination_info = '<div class="gd-pagination-details gd-pagination-details-'.$geodir_pagination_more_info.'">'.wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts).'</div>';
897 897
 			
898 898
 			if ($geodir_pagination_more_info == 'before') {
899
-				$before = $before . $pagination_info;
899
+				$before = $before.$pagination_info;
900 900
 			} else if ($geodir_pagination_more_info == 'after') {
901
-				$after = $pagination_info . $after;
901
+				$after = $pagination_info.$after;
902 902
 			}
903 903
 		}
904 904
 			
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 		}
909 909
 		
910 910
 		if (($pageno - 1) > 0) {
911
-            echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a>&nbsp;';
911
+            echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a>&nbsp;';
912 912
 		}
913 913
 		
914 914
 		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
@@ -916,17 +916,17 @@  discard block
 block discarded – undo
916 916
 				if ($i == $pageno) {
917 917
 					echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";
918 918
 				} else {
919
-					echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> ';
919
+					echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> ';
920 920
 				}
921 921
 			}
922 922
 		}
923 923
 		
924 924
 		if (($pageno + 1) <= $max_page) {
925
-			echo '&nbsp;<a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>';
925
+			echo '&nbsp;<a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>';
926 926
 		}
927 927
 		
928 928
 		if ($pageno < $max_page) {
929
-			echo '&nbsp;<a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">&raquo;</a>';
929
+			echo '&nbsp;<a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">&raquo;</a>';
930 930
 		}
931 931
 		echo "</div> $after </div>";
932 932
 	}
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
     $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
950 950
     $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
951 951
 	
952
-	$shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
952
+	$shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL;
953 953
 	
954 954
 	if (!empty($shortcode_atts) && is_array($shortcode_atts)) {
955 955
 		$shortcode_atts['pageno'] = $pageno;
Please login to merge, or discard this patch.
geodirectory-functions/signup_function.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @package GeoDirectory
14 14
  * @global object $current_user Current user object.
15 15
  * @param bool $redirect Optional. Do you want to redirect to signup page, if user not logged in? Default: false.
16
- * @return bool
16
+ * @return null|boolean
17 17
  */
18 18
 function geodir_is_login($redirect = false)
19 19
 {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @since 1.0.0
71 71
  * @package GeoDirectory
72
- * @return string|mixed|void The email ID.
72
+ * @return string The email ID.
73 73
  */
74 74
 function geodir_get_site_email_id()
75 75
 {
Please login to merge, or discard this patch.
Braces   +74 added lines, -48 removed lines patch added patch discarded remove patch
@@ -25,11 +25,13 @@  discard block
 block discarded – undo
25 25
                 window.location.href = '<?php echo geodir_login_url();?>';
26 26
             </script>
27 27
         <?php
28
-        } else
29
-            return false;
30
-    } else
31
-        return true;
32
-}
28
+        } else {
29
+                    return false;
30
+        }
31
+    } else {
32
+            return true;
33
+    }
34
+    }
33 35
 
34 36
 /**
35 37
  * Redirect to SSL url, if SSL is being used.
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
      * @param string $message Login message.
61 63
      */
62 64
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
65
+    if (!empty($message)) {
66
+    	echo $message . "\n";
67
+    }
64 68
 
65 69
 }
66 70
 
@@ -141,14 +145,16 @@  discard block
 block discarded – undo
141 145
     global $wpdb;
142 146
 
143 147
     $errors = new WP_Error();
144
-    if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
-        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
148
+    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
149
+            $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
150
+    }
146 151
 
147 152
     if (strpos($_POST['user_login'], '@')) {
148 153
         //$user_data = get_user_by_email(trim($_POST['user_login']));
149 154
         $user_data = get_user_by('email', trim($_POST['user_login']));
150
-        if (empty($user_data))
151
-            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
155
+        if (empty($user_data)) {
156
+                    $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
157
+        }
152 158
     } else {
153 159
         $login = trim($_POST['user_login']);
154 160
         $user_data = get_user_by('email', $login);
@@ -161,8 +167,9 @@  discard block
 block discarded – undo
161 167
      */
162 168
     do_action('lostpassword_post');
163 169
 
164
-    if ($errors->get_error_code())
165
-        return $errors;
170
+    if ($errors->get_error_code()) {
171
+            return $errors;
172
+    }
166 173
 
167 174
     if (!$user_data) {
168 175
         $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
@@ -192,8 +199,9 @@  discard block
 block discarded – undo
192 199
         )
193 200
     );
194 201
 
195
-    if (empty($user))
196
-        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
202
+    if (empty($user)) {
203
+            return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
204
+    }
197 205
 
198 206
     $new_pass = wp_generate_password(12, false);
199 207
 
@@ -282,13 +290,14 @@  discard block
 block discarded – undo
282 290
     }
283 291
 
284 292
     // Check the username
285
-    if ($user_login == '')
286
-        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
-    elseif (!validate_username($user_login)) {
293
+    if ($user_login == '') {
294
+            $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
295
+    } elseif (!validate_username($user_login)) {
288 296
         $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289 297
         $user_login = '';
290
-    } elseif (username_exists($user_login))
291
-        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
298
+    } elseif (username_exists($user_login)) {
299
+            $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
300
+    }
292 301
 
293 302
     // Check the e-mail address
294 303
     if ($user_email == '') {
@@ -296,8 +305,9 @@  discard block
 block discarded – undo
296 305
     } elseif (!is_email($user_email)) {
297 306
         $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298 307
         $user_email = '';
299
-    } elseif (email_exists($user_email))
300
-        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
308
+    } elseif (email_exists($user_email)) {
309
+            $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
310
+    }
301 311
 
302 312
     /**
303 313
      * Called when registering a new user.
@@ -317,8 +327,9 @@  discard block
 block discarded – undo
317 327
      */
318 328
     $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319 329
 
320
-    if ($errors->get_error_code())
321
-        return $errors;
330
+    if ($errors->get_error_code()) {
331
+            return $errors;
332
+    }
322 333
 
323 334
 
324 335
     if (!isset($user_pass) || $user_pass == '') {
@@ -423,28 +434,33 @@  discard block
 block discarded – undo
423 434
 
424 435
     $errors = new WP_Error();
425 436
 
426
-    if (isset($_GET['key']))
427
-        $action = 'resetpass';
437
+    if (isset($_GET['key'])) {
438
+            $action = 'resetpass';
439
+    }
428 440
 
429 441
     // validate action so as to default to the login screen
430
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
431
-        $action = 'login';
442
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) {
443
+            $action = 'login';
444
+    }
432 445
 
433 446
     nocache_headers();
434 447
 
435 448
     if (defined('RELOCATE')) { // Move flag is set
436
-        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
437
-            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
449
+        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) {
450
+                    $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
451
+        }
438 452
 
439 453
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
440
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
441
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
454
+        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) {
455
+                    update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
456
+        }
442 457
     }
443 458
 
444 459
     //Set a cookie now to see if they are supported by the browser.
445 460
     //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
446
-    if (SITECOOKIEPATH != COOKIEPATH)
447
-        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
461
+    if (SITECOOKIEPATH != COOKIEPATH) {
462
+            setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
463
+    }
448 464
 
449 465
     /**
450 466
      * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
@@ -465,8 +481,9 @@  discard block
 block discarded – undo
465 481
 
466 482
             $redirect_to = $_SERVER['HTTP_REFERER'];
467 483
             //$redirect_to = home_url().'/?ptype=login&loggedout=true';
468
-            if (isset($_REQUEST['redirect_to']))
469
-                $redirect_to = $_REQUEST['redirect_to'];
484
+            if (isset($_REQUEST['redirect_to'])) {
485
+                            $redirect_to = $_REQUEST['redirect_to'];
486
+            }
470 487
             $redirect_to = home_url();
471 488
             wp_safe_redirect($redirect_to);
472 489
             exit();
@@ -486,7 +503,9 @@  discard block
 block discarded – undo
486 503
                     gd_die();
487 504
                 }
488 505
             }
489
-            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
506
+            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
507
+            	$errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
508
+            }
490 509
         /**
491 510
          * Called in the geodir_user_signup() function during the lostpassword case.
492 511
          *
@@ -582,8 +601,9 @@  discard block
 block discarded – undo
582 601
                     }
583 602
 
584 603
 
585
-                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
586
-                        $secure_cookie = false;
604
+                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
605
+                                            $secure_cookie = false;
606
+                    }
587 607
 
588 608
                     $user = wp_signon('', $secure_cookie);
589 609
 
@@ -652,22 +672,26 @@  discard block
 block discarded – undo
652 672
                     $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
653 673
 
654 674
                     $_REQUEST['redirect_to'] = $default_author_link;
655
-                else:
656
-                    $_REQUEST['redirect_to'] = home_url();
675
+                else {
676
+                	:
677
+                    $_REQUEST['redirect_to'] = home_url();
678
+                }
657 679
                 endif;
658 680
 
659 681
             }
660 682
             if (isset($_REQUEST['redirect_to'])) {
661 683
                 $redirect_to = $_REQUEST['redirect_to'];
662 684
                 // Redirect to https if user wants ssl
663
-                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
664
-                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
685
+                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
686
+                                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
687
+                }
665 688
             } else {
666 689
                 $redirect_to = admin_url();
667 690
             }
668 691
 
669
-            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
670
-                $secure_cookie = false;
692
+            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
693
+                            $secure_cookie = false;
694
+            }
671 695
             $user = wp_signon('', $secure_cookie);
672 696
 
673 697
 
@@ -702,11 +726,13 @@  discard block
 block discarded – undo
702 726
             $errors = $user;
703 727
 
704 728
             // Clear errors if loggedout is set.
705
-            if (!empty($_GET['loggedout']))
706
-                $errors = new WP_Error();
729
+            if (!empty($_GET['loggedout'])) {
730
+                            $errors = new WP_Error();
731
+            }
707 732
             // If cookies are disabled we can't log in even with a valid user+pass
708
-            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
709
-                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
733
+            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
734
+                            $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
735
+            }
710 736
 
711 737
             // Some parts of this script use the main login form to display a message
712 738
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
Please login to merge, or discard this patch.
Indentation   +621 added lines, -621 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_is_login($redirect = false)
19 19
 {
20
-    global $current_user;
21
-    if (!$current_user->ID) {
22
-        if ($redirect) {
23
-            ?>
20
+	global $current_user;
21
+	if (!$current_user->ID) {
22
+		if ($redirect) {
23
+			?>
24 24
             <script type="text/javascript">
25 25
                 window.location.href = '<?php echo geodir_login_url();?>';
26 26
             </script>
27 27
         <?php
28
-        } else
29
-            return false;
30
-    } else
31
-        return true;
28
+		} else
29
+			return false;
30
+	} else
31
+		return true;
32 32
 }
33 33
 
34 34
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 {
43 43
 
44 44
 // Redirect to https login if forced to use SSL
45
-    if (force_ssl_admin() && !is_ssl()) {
46
-        if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
47
-            wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48
-            exit();
49
-        } else {
50
-            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
51
-            exit();
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Filter the login message.
57
-     *
58
-     * @since 1.0.0
59
-     *
60
-     * @param string $message Login message.
61
-     */
62
-    $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
45
+	if (force_ssl_admin() && !is_ssl()) {
46
+		if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
47
+			wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48
+			exit();
49
+		} else {
50
+			wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
51
+			exit();
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Filter the login message.
57
+	 *
58
+	 * @since 1.0.0
59
+	 *
60
+	 * @param string $message Login message.
61
+	 */
62
+	$message = apply_filters('login_message', $message);
63
+	if (!empty($message)) echo $message . "\n";
64 64
 
65 65
 }
66 66
 
@@ -73,59 +73,59 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function geodir_get_site_email_id()
75 75
 {
76
-    if (get_option('site_email')) {
76
+	if (get_option('site_email')) {
77 77
 
78
-        return get_option('site_email');
78
+		return get_option('site_email');
79 79
 
80
-    } else {
80
+	} else {
81 81
 
82
-        return get_option('admin_email');
82
+		return get_option('admin_email');
83 83
 
84
-    }
84
+	}
85 85
 
86 86
 }
87 87
 
88 88
 
89 89
 if (!function_exists('get_site_emailName')) {
90
-    /**
91
-     * Get site name for sending emails.
92
-     *
93
-     * @since 1.0.0
94
-     * @package GeoDirectory
95
-     * @return string Site name.
96
-     */
97
-    function get_site_emailName()
90
+	/**
91
+	 * Get site name for sending emails.
92
+	 *
93
+	 * @since 1.0.0
94
+	 * @package GeoDirectory
95
+	 * @return string Site name.
96
+	 */
97
+	function get_site_emailName()
98 98
 
99
-    {
99
+	{
100 100
 
101
-        if (get_option('site_email_name')) {
101
+		if (get_option('site_email_name')) {
102 102
 
103
-            return stripslashes(get_option('site_email_name'));
103
+			return stripslashes(get_option('site_email_name'));
104 104
 
105
-        } else {
105
+		} else {
106 106
 
107
-            return stripslashes(get_option('blogname'));
107
+			return stripslashes(get_option('blogname'));
108 108
 
109
-        }
109
+		}
110 110
 
111
-    }
111
+	}
112 112
 }
113 113
 
114 114
 if (!function_exists('is_allow_user_register')) {
115
-    /**
116
-     * Checks whether the site allowing user registration or not.
117
-     *
118
-     * @since 1.0.0
119
-     * @package GeoDirectory
120
-     * @return bool|string
121
-     */
122
-    function is_allow_user_register()
115
+	/**
116
+	 * Checks whether the site allowing user registration or not.
117
+	 *
118
+	 * @since 1.0.0
119
+	 * @package GeoDirectory
120
+	 * @return bool|string
121
+	 */
122
+	function is_allow_user_register()
123 123
 
124
-    {
124
+	{
125 125
 
126
-        return get_option('users_can_register');
126
+		return get_option('users_can_register');
127 127
 
128
-    }
128
+	}
129 129
 }
130 130
 
131 131
 /**
@@ -138,107 +138,107 @@  discard block
 block discarded – undo
138 138
  */
139 139
 function geodir_retrieve_password()
140 140
 {
141
-    global $wpdb;
142
-
143
-    $errors = new WP_Error();
144
-    if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
-        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
146
-
147
-    if (strpos($_POST['user_login'], '@')) {
148
-        //$user_data = get_user_by_email(trim($_POST['user_login']));
149
-        $user_data = get_user_by('email', trim($_POST['user_login']));
150
-        if (empty($user_data))
151
-            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
152
-    } else {
153
-        $login = trim($_POST['user_login']);
154
-        $user_data = get_user_by('email', $login);
155
-    }
156
-
157
-    /**
158
-     * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.
159
-     *
160
-     * @since 1.0.0
161
-     */
162
-    do_action('lostpassword_post');
163
-
164
-    if ($errors->get_error_code())
165
-        return $errors;
166
-
167
-    if (!$user_data) {
168
-        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
169
-        return $errors;
170
-    }
171
-
172
-    // redefining user_login ensures we return the right case in the email
173
-    $user_login = $user_data->user_login;
174
-    $user_email = $user_data->user_email;
175
-
176
-    /**
177
-     * Called in the geodir_retrieve_password() function before any emails are sent.
178
-     *
179
-     * @since 1.0.0
180
-     * @param string $user_login The users username.
181
-     */
182
-    do_action('retrieve_password', $user_login);
183
-
184
-    ////////////////////////////////////
185
-    $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
186
-    $user_login = $_POST['user_login'];
187
-
188
-    $user = $wpdb->get_row(
189
-        $wpdb->prepare(
190
-            "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",
191
-            array($user_login, $user_login)
192
-        )
193
-    );
194
-
195
-    if (empty($user))
196
-        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
197
-
198
-    $new_pass = wp_generate_password(12, false);
199
-
200
-    /**
201
-     * Called in the geodir_retrieve_password() function before any emails are sent.
202
-     *
203
-     * @since 1.0.0
204
-     * @param object $user The user object.
205
-     * @param string $new_pass The new pass being sent to the user.
206
-     */
207
-    do_action('password_reset', $user, $new_pass);
208
-
209
-    wp_set_password($new_pass, $user->ID);
210
-    update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
-    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
-    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
-    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
214
-    //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215
-    //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216
-    $user_email = $user_data->user_email;
217
-    $user_name = geodir_get_client_name($user->ID);
218
-    $fromEmail = geodir_get_site_email_id();
219
-    $fromEmailName = get_site_emailName();
220
-    $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
221
-    /**
222
-     * Filter the password reset email subject part.
223
-     *
224
-     * @since 1.0.0
225
-     *
226
-     * @param string $title Password reset email subject.
227
-     */
228
-    $title = apply_filters('password_reset_title', $title);
229
-    /**
230
-     * Filter the password reset email message part.
231
-     *
232
-     * @since 1.0.0
233
-     *
234
-     * @param string $message Password reset email message.
235
-     * @param string $new_pass The new password string.
236
-     */
237
-    $message = apply_filters('password_reset_message', $message, $new_pass);
238
-    //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
240
-
241
-    return true;
141
+	global $wpdb;
142
+
143
+	$errors = new WP_Error();
144
+	if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
+		$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
146
+
147
+	if (strpos($_POST['user_login'], '@')) {
148
+		//$user_data = get_user_by_email(trim($_POST['user_login']));
149
+		$user_data = get_user_by('email', trim($_POST['user_login']));
150
+		if (empty($user_data))
151
+			$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
152
+	} else {
153
+		$login = trim($_POST['user_login']);
154
+		$user_data = get_user_by('email', $login);
155
+	}
156
+
157
+	/**
158
+	 * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.
159
+	 *
160
+	 * @since 1.0.0
161
+	 */
162
+	do_action('lostpassword_post');
163
+
164
+	if ($errors->get_error_code())
165
+		return $errors;
166
+
167
+	if (!$user_data) {
168
+		$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
169
+		return $errors;
170
+	}
171
+
172
+	// redefining user_login ensures we return the right case in the email
173
+	$user_login = $user_data->user_login;
174
+	$user_email = $user_data->user_email;
175
+
176
+	/**
177
+	 * Called in the geodir_retrieve_password() function before any emails are sent.
178
+	 *
179
+	 * @since 1.0.0
180
+	 * @param string $user_login The users username.
181
+	 */
182
+	do_action('retrieve_password', $user_login);
183
+
184
+	////////////////////////////////////
185
+	$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
186
+	$user_login = $_POST['user_login'];
187
+
188
+	$user = $wpdb->get_row(
189
+		$wpdb->prepare(
190
+			"SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",
191
+			array($user_login, $user_login)
192
+		)
193
+	);
194
+
195
+	if (empty($user))
196
+		return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
197
+
198
+	$new_pass = wp_generate_password(12, false);
199
+
200
+	/**
201
+	 * Called in the geodir_retrieve_password() function before any emails are sent.
202
+	 *
203
+	 * @since 1.0.0
204
+	 * @param object $user The user object.
205
+	 * @param string $new_pass The new pass being sent to the user.
206
+	 */
207
+	do_action('password_reset', $user, $new_pass);
208
+
209
+	wp_set_password($new_pass, $user->ID);
210
+	update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
+	$message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
+	$message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
+	$message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
214
+	//$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215
+	//$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216
+	$user_email = $user_data->user_email;
217
+	$user_name = geodir_get_client_name($user->ID);
218
+	$fromEmail = geodir_get_site_email_id();
219
+	$fromEmailName = get_site_emailName();
220
+	$title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
221
+	/**
222
+	 * Filter the password reset email subject part.
223
+	 *
224
+	 * @since 1.0.0
225
+	 *
226
+	 * @param string $title Password reset email subject.
227
+	 */
228
+	$title = apply_filters('password_reset_title', $title);
229
+	/**
230
+	 * Filter the password reset email message part.
231
+	 *
232
+	 * @since 1.0.0
233
+	 *
234
+	 * @param string $message Password reset email message.
235
+	 * @param string $new_pass The new password string.
236
+	 */
237
+	$message = apply_filters('password_reset_message', $message, $new_pass);
238
+	//geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
+	geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
240
+
241
+	return true;
242 242
 }
243 243
 
244 244
 /**
@@ -253,80 +253,80 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function geodir_register_new_user($user_login, $user_email)
255 255
 {
256
-    global $wpdb;
257
-    $errors = new WP_Error();
258
-
259
-
260
-    $user_login = sanitize_user($user_login);
261
-    $user_login = str_replace(",", "", $user_login);
262
-    $user_email = str_replace(",", "", $user_email);
263
-    /**
264
-     * Filter the user registration email.
265
-     *
266
-     * @since 1.0.0
267
-     *
268
-     * @param string $user_email User registration email.
269
-     */
270
-    $user_email = apply_filters('user_registration_email', $user_email);
271
-
272
-
273
-    if (get_option('geodir_allow_cpass')) {
274
-        $user_pass = $_REQUEST['user_pass'];
275
-        $user_pass2 = $_REQUEST['user_pass2'];
276
-        // Check the password
277
-        if ($user_pass != $user_pass2) {
278
-            $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
279
-        } elseif (strlen($user_pass) < 7) {
280
-            $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
281
-        }
282
-    }
283
-
284
-    // Check the username
285
-    if ($user_login == '')
286
-        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
-    elseif (!validate_username($user_login)) {
288
-        $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289
-        $user_login = '';
290
-    } elseif (username_exists($user_login))
291
-        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
292
-
293
-    // Check the e-mail address
294
-    if ($user_email == '') {
295
-        $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
296
-    } elseif (!is_email($user_email)) {
297
-        $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298
-        $user_email = '';
299
-    } elseif (email_exists($user_email))
300
-        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
301
-
302
-    /**
303
-     * Called when registering a new user.
304
-     *
305
-     * This is a WordPress core hook.
306
-     *
307
-     * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post
308
-     * @since 1.0.0
309
-     */
310
-    do_action('register_post', $user_login, $user_email, $errors);
311
-    /**
312
-     * Filter the registration error messages.
313
-     *
314
-     * @since 1.0.0
315
-     *
316
-     * @param object $errors Registration error messages.
317
-     */
318
-    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319
-
320
-    if ($errors->get_error_code())
321
-        return $errors;
322
-
323
-
324
-    if (!isset($user_pass) || $user_pass == '') {
325
-        $user_pass = wp_generate_password(12, false);
326
-    }
327
-    $user_id = wp_create_user($user_login, $user_pass, $user_email);
328
-    $user_web = '';
329
-    /*$user_add1 = $_POST['user_add1'];
256
+	global $wpdb;
257
+	$errors = new WP_Error();
258
+
259
+
260
+	$user_login = sanitize_user($user_login);
261
+	$user_login = str_replace(",", "", $user_login);
262
+	$user_email = str_replace(",", "", $user_email);
263
+	/**
264
+	 * Filter the user registration email.
265
+	 *
266
+	 * @since 1.0.0
267
+	 *
268
+	 * @param string $user_email User registration email.
269
+	 */
270
+	$user_email = apply_filters('user_registration_email', $user_email);
271
+
272
+
273
+	if (get_option('geodir_allow_cpass')) {
274
+		$user_pass = $_REQUEST['user_pass'];
275
+		$user_pass2 = $_REQUEST['user_pass2'];
276
+		// Check the password
277
+		if ($user_pass != $user_pass2) {
278
+			$errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
279
+		} elseif (strlen($user_pass) < 7) {
280
+			$errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
281
+		}
282
+	}
283
+
284
+	// Check the username
285
+	if ($user_login == '')
286
+		$errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
+	elseif (!validate_username($user_login)) {
288
+		$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289
+		$user_login = '';
290
+	} elseif (username_exists($user_login))
291
+		$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
292
+
293
+	// Check the e-mail address
294
+	if ($user_email == '') {
295
+		$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
296
+	} elseif (!is_email($user_email)) {
297
+		$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298
+		$user_email = '';
299
+	} elseif (email_exists($user_email))
300
+		$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
301
+
302
+	/**
303
+	 * Called when registering a new user.
304
+	 *
305
+	 * This is a WordPress core hook.
306
+	 *
307
+	 * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post
308
+	 * @since 1.0.0
309
+	 */
310
+	do_action('register_post', $user_login, $user_email, $errors);
311
+	/**
312
+	 * Filter the registration error messages.
313
+	 *
314
+	 * @since 1.0.0
315
+	 *
316
+	 * @param object $errors Registration error messages.
317
+	 */
318
+	$errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319
+
320
+	if ($errors->get_error_code())
321
+		return $errors;
322
+
323
+
324
+	if (!isset($user_pass) || $user_pass == '') {
325
+		$user_pass = wp_generate_password(12, false);
326
+	}
327
+	$user_id = wp_create_user($user_login, $user_pass, $user_email);
328
+	$user_web = '';
329
+	/*$user_add1 = $_POST['user_add1'];
330 330
     $user_add2 = $_POST['user_add2'];
331 331
     $user_city = $_POST['user_city'];
332 332
     $user_state = $_POST['user_state'];
@@ -335,79 +335,79 @@  discard block
 block discarded – undo
335 335
     $user_web = $_POST['user_web'];
336 336
     $user_phone = $_POST['user_phone'];
337 337
     $user_twitter = $_POST['user_twitter'];	*/
338
-    $user_fname = sanitize_user($_POST['user_fname']);
339
-    $user_fname = str_replace(",", "", $user_fname);
338
+	$user_fname = sanitize_user($_POST['user_fname']);
339
+	$user_fname = str_replace(",", "", $user_fname);
340 340
 	if ( empty( $user_fname ) ) {
341 341
 		$user_fname = strstr( $user_login, '@', true );
342 342
 	}
343 343
 
344
-    /**
345
-     * Filter the submitted user meta.
346
-     *
347
-     * @since 1.0.0
348
-     *
349
-     * @param int $user_id User ID.
350
-     */
351
-    $user_address_info = apply_filters('geodir_manage_user_meta', array(
352
-        "user_add1" => '',
353
-        "user_add2" => '',
354
-        "user_city" => '',
355
-        "user_state" => '',
356
-        "user_country" => '',
357
-        "user_postalcode" => '',
358
-        "user_phone" => '',
359
-        "user_twitter" => '',
360
-        "first_name" => $user_fname,
361
-        "last_name" => '',
362
-    ), $user_id);
363
-    foreach ($user_address_info as $key => $val) {
364
-        update_user_meta($user_id, $key, $val); // User Address Information Here
365
-    }
366
-    //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here
367
-    $userName = $user_fname;
368
-    update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369
-    //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370
-
371
-    $user_nicename = geodir_generate_user_nicename( $userName, $user_login );
372
-
373
-    $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374
-
375
-    $wpdb->query($updateUsersql);
376
-
377
-    if (!$user_id) {
378
-        $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
379
-        return $errors;
380
-    }
381
-    global $upload_folder_path;
382
-
383
-    if ($user_id) {
344
+	/**
345
+	 * Filter the submitted user meta.
346
+	 *
347
+	 * @since 1.0.0
348
+	 *
349
+	 * @param int $user_id User ID.
350
+	 */
351
+	$user_address_info = apply_filters('geodir_manage_user_meta', array(
352
+		"user_add1" => '',
353
+		"user_add2" => '',
354
+		"user_city" => '',
355
+		"user_state" => '',
356
+		"user_country" => '',
357
+		"user_postalcode" => '',
358
+		"user_phone" => '',
359
+		"user_twitter" => '',
360
+		"first_name" => $user_fname,
361
+		"last_name" => '',
362
+	), $user_id);
363
+	foreach ($user_address_info as $key => $val) {
364
+		update_user_meta($user_id, $key, $val); // User Address Information Here
365
+	}
366
+	//update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here
367
+	$userName = $user_fname;
368
+	update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369
+	//update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370
+
371
+	$user_nicename = geodir_generate_user_nicename( $userName, $user_login );
372
+
373
+	$updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374
+
375
+	$wpdb->query($updateUsersql);
376
+
377
+	if (!$user_id) {
378
+		$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
379
+		return $errors;
380
+	}
381
+	global $upload_folder_path;
382
+
383
+	if ($user_id) {
384 384
 		clean_user_cache($user_id);
385
-        /**
386
-         * Called after registering a user and before the registration email is sent.
387
-         *
388
-         * @since 1.0.0
389
-         * @param int $user_id The user ID of the registered user.
390
-         */
391
-        do_action('geodir_user_register', $user_id);
392
-        ///////REGISTRATION EMAIL START//////
393
-        $fromEmail = geodir_get_site_email_id();
394
-        $fromEmailName = get_site_emailName();
395
-        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
385
+		/**
386
+		 * Called after registering a user and before the registration email is sent.
387
+		 *
388
+		 * @since 1.0.0
389
+		 * @param int $user_id The user ID of the registered user.
390
+		 */
391
+		do_action('geodir_user_register', $user_id);
392
+		///////REGISTRATION EMAIL START//////
393
+		$fromEmail = geodir_get_site_email_id();
394
+		$fromEmailName = get_site_emailName();
395
+		$message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
396 396
 <p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
397 397
 <p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
398 398
 
399
-        /////////////customer email//////////////
400
-        //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
402
-        //////REGISTRATION EMAIL END////////
403
-    }
399
+		/////////////customer email//////////////
400
+		//geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
+		geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
402
+		//////REGISTRATION EMAIL END////////
403
+	}
404 404
 
405
-    if (get_option('ptthemes_auto_login')) {
406
-        $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
407
-        return $errors;
408
-    }
405
+	if (get_option('ptthemes_auto_login')) {
406
+		$errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
407
+		return $errors;
408
+	}
409 409
 
410
-    return array($user_id, $user_pass);
410
+	return array($user_id, $user_pass);
411 411
 }
412 412
 
413 413
 /**
@@ -420,333 +420,333 @@  discard block
 block discarded – undo
420 420
  */
421 421
 function geodir_user_signup()
422 422
 {
423
-    global $errors;
424
-    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
425
-
426
-    $errors = new WP_Error();
427
-
428
-    if (isset($_GET['key']))
429
-        $action = 'resetpass';
430
-
431
-    // validate action so as to default to the login screen
432
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
433
-        $action = 'login';
434
-
435
-    nocache_headers();
436
-
437
-    if (defined('RELOCATE')) { // Move flag is set
438
-        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
439
-            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440
-
441
-        $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
444
-    }
445
-
446
-    //Set a cookie now to see if they are supported by the browser.
447
-    //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
448
-    if (SITECOOKIEPATH != COOKIEPATH)
449
-        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
450
-
451
-    /**
452
-     * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
453
-     *
454
-     * Used dynamic hook login_form_$action
455
-     *
456
-     * @since 1.0.0
457
-     */
458
-    do_action('login_form_' . $action);
459
-
460
-    $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461
-
462
-    switch ($action):
463
-
464
-        case 'logout' :
465
-            //check_admin_referer('log-out');
466
-            wp_logout();
467
-
468
-            $redirect_to = $_SERVER['HTTP_REFERER'];
469
-            //$redirect_to = home_url().'/?ptype=login&loggedout=true';
470
-            if (isset($_REQUEST['redirect_to']))
471
-                $redirect_to = $_REQUEST['redirect_to'];
472
-            $redirect_to = home_url();
473
-            wp_safe_redirect($redirect_to);
474
-            exit();
475
-
476
-            break;
477
-
478
-        case 'lostpassword' :
479
-        case 'retrievepassword' :
480
-            if ($http_post) {
481
-                $errors = geodir_retrieve_password();
482
-                $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';
483
-                if (!is_wp_error($errors)) {
484
-                    wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
485
-                    gd_die();
486
-                } else {
487
-                    wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
488
-                    gd_die();
489
-                }
490
-            }
491
-            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
492
-        /**
493
-         * Called in the geodir_user_signup() function during the lostpassword case.
494
-         *
495
-         * @since 1.0.0
496
-         */
497
-        do_action('lost_password');
498
-            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
499
-            $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500
-
501
-            break;
502
-
503
-        case 'resetpass' :
504
-        case 'rp' :
505
-            $errors = reset_password($_GET['key'], $_GET['login']);
506
-
507
-            if (!is_wp_error($errors)) {
508
-                wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
509
-                exit();
510
-            }
511
-
512
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
513
-            exit();
514
-
515
-            break;
516
-
517
-        case 'register' :
518
-            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
519
-            if (!get_option('users_can_register')) {
520
-                wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
521
-                exit();
522
-            }
523
-            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
524
-            global $user_email, $user_fname;
525
-            $user_login = '';
526
-            $user_email = '';
527
-            if ($http_post) {
528
-                $user_login = $_POST['user_email'];
529
-                $user_email = $_POST['user_email'];
530
-                $user_fname = $_POST['user_fname'];
531
-
532
-                $errors = geodir_register_new_user($user_login, $user_email);
533
-
534
-                /* display error in registration form */
535
-                if (is_wp_error($errors)) {
536
-                    $error_code = $errors->get_error_code();
537
-                    $error_message = $errors->get_error_message($error_code);
538
-                    if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
539
-                        if ($error_code == 'empty_username') {
540
-                            $error_code = 'empty_email';
541
-                        } else if ($error_code == 'invalid_username') {
542
-                            $error_code = 'invalid_email';
543
-                        } else if ($error_code == 'username_exists') {
544
-                            $error_code = 'email_exists';
545
-                        }
546
-
547
-                        $error_message = $errors->get_error_message($error_code);
548
-                    }
549
-                    global $geodir_signup_error;
550
-                    $geodir_signup_error = $error_message;
551
-                }
552
-
553
-                if (!is_wp_error($errors)) {
554
-                    $_POST['log'] = $user_login;
555
-                    $_POST['pwd'] = $errors[1];
556
-                    $_POST['testcookie'] = 1;
557
-
558
-                    $secure_cookie = '';
559
-                    // If the user wants ssl but the session is not ssl, force a secure cookie.
560
-                    if (!empty($_POST['log'])) {
561
-                        $user_name = sanitize_user($_POST['log']);
562
-                        if ($user = get_user_by('email', $user_name)) {
563
-                            if (get_user_option('use_ssl', $user->ID)) {
564
-                                $secure_cookie = true;
565
-                                force_ssl_admin(true);
566
-                            }
567
-                        }
568
-                    }
569
-
570
-                    $redirect_to = $_REQUEST['redirect_to'];
571
-
572
-                    if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
573
-                        if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
574
-                            $redirect_to = $_SERVER['HTTP_REFERER'];
575
-                        } else {
576
-                            $redirect_to = home_url();
577
-                        }
578
-
579
-                    }
580
-
581
-                    if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
582
-
583
-                        $redirect_to = $_REQUEST['redirect_add_listing'];
584
-                    }
585
-
586
-
587
-                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
588
-                        $secure_cookie = false;
589
-
590
-                    $user = wp_signon('', $secure_cookie);
591
-
592
-                    $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
593
-                    /**
594
-                     * Filter the login redirect URL.
595
-                     *
596
-                     * @since 1.4.9
597
-                     * @param string $redirect_to The redirect destination URL.
598
-                     * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
599
-                     * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
600
-                     */
601
-                    $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
602
-
603
-
604
-                    if (!is_wp_error($user)) {
605
-                        wp_safe_redirect($redirect_to);
606
-                        exit();
607
-                    }
608
-                    exit();
609
-                }
610
-            }
611
-
612
-            break;
613
-
614
-        case 'login' :
615
-        default:
616
-            $secure_cookie = '';
617
-
618
-            if (!empty($_POST['log'])) {
619
-                $user_name = sanitize_user($_POST['log']);
620
-                if ($user = get_user_by('login', $user_name)) {
621
-
622
-                    if (get_user_option('use_ssl', $user->ID)) {
623
-                        $secure_cookie = true;
624
-                        force_ssl_admin(true);
625
-                    }
626
-                } elseif ($user = get_user_by('email', $user_name)) {
627
-                    $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login
628
-                    if (get_user_option('use_ssl', $user->ID)) {
629
-                        $secure_cookie = true;
630
-                        force_ssl_admin(true);
631
-                    }
632
-                }
633
-            }
634
-            ///////////////////////////
635
-            if (isset($_REQUEST['redirect_add_listing'])) {
636
-                $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];
637
-            }
638
-
639
-
640
-            if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
641
-                if (is_user_logged_in()) :
642
-                    $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643
-                    $post_types = geodir_get_posttypes();
423
+	global $errors;
424
+	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
425
+
426
+	$errors = new WP_Error();
427
+
428
+	if (isset($_GET['key']))
429
+		$action = 'resetpass';
430
+
431
+	// validate action so as to default to the login screen
432
+	if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
433
+		$action = 'login';
434
+
435
+	nocache_headers();
436
+
437
+	if (defined('RELOCATE')) { // Move flag is set
438
+		if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
439
+			$_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440
+
441
+		$schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
+		if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
+			update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
444
+	}
445
+
446
+	//Set a cookie now to see if they are supported by the browser.
447
+	//setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
448
+	if (SITECOOKIEPATH != COOKIEPATH)
449
+		setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
450
+
451
+	/**
452
+	 * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
453
+	 *
454
+	 * Used dynamic hook login_form_$action
455
+	 *
456
+	 * @since 1.0.0
457
+	 */
458
+	do_action('login_form_' . $action);
459
+
460
+	$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461
+
462
+	switch ($action):
463
+
464
+		case 'logout' :
465
+			//check_admin_referer('log-out');
466
+			wp_logout();
467
+
468
+			$redirect_to = $_SERVER['HTTP_REFERER'];
469
+			//$redirect_to = home_url().'/?ptype=login&loggedout=true';
470
+			if (isset($_REQUEST['redirect_to']))
471
+				$redirect_to = $_REQUEST['redirect_to'];
472
+			$redirect_to = home_url();
473
+			wp_safe_redirect($redirect_to);
474
+			exit();
475
+
476
+			break;
477
+
478
+		case 'lostpassword' :
479
+		case 'retrievepassword' :
480
+			if ($http_post) {
481
+				$errors = geodir_retrieve_password();
482
+				$error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';
483
+				if (!is_wp_error($errors)) {
484
+					wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
485
+					gd_die();
486
+				} else {
487
+					wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
488
+					gd_die();
489
+				}
490
+			}
491
+			if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
492
+		/**
493
+		 * Called in the geodir_user_signup() function during the lostpassword case.
494
+		 *
495
+		 * @since 1.0.0
496
+		 */
497
+		do_action('lost_password');
498
+			$message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
499
+			$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500
+
501
+			break;
502
+
503
+		case 'resetpass' :
504
+		case 'rp' :
505
+			$errors = reset_password($_GET['key'], $_GET['login']);
506
+
507
+			if (!is_wp_error($errors)) {
508
+				wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
509
+				exit();
510
+			}
511
+
512
+			wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
513
+			exit();
514
+
515
+			break;
516
+
517
+		case 'register' :
518
+			############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
519
+			if (!get_option('users_can_register')) {
520
+				wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
521
+				exit();
522
+			}
523
+			############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
524
+			global $user_email, $user_fname;
525
+			$user_login = '';
526
+			$user_email = '';
527
+			if ($http_post) {
528
+				$user_login = $_POST['user_email'];
529
+				$user_email = $_POST['user_email'];
530
+				$user_fname = $_POST['user_fname'];
531
+
532
+				$errors = geodir_register_new_user($user_login, $user_email);
533
+
534
+				/* display error in registration form */
535
+				if (is_wp_error($errors)) {
536
+					$error_code = $errors->get_error_code();
537
+					$error_message = $errors->get_error_message($error_code);
538
+					if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
539
+						if ($error_code == 'empty_username') {
540
+							$error_code = 'empty_email';
541
+						} else if ($error_code == 'invalid_username') {
542
+							$error_code = 'invalid_email';
543
+						} else if ($error_code == 'username_exists') {
544
+							$error_code = 'email_exists';
545
+						}
546
+
547
+						$error_message = $errors->get_error_message($error_code);
548
+					}
549
+					global $geodir_signup_error;
550
+					$geodir_signup_error = $error_message;
551
+				}
552
+
553
+				if (!is_wp_error($errors)) {
554
+					$_POST['log'] = $user_login;
555
+					$_POST['pwd'] = $errors[1];
556
+					$_POST['testcookie'] = 1;
557
+
558
+					$secure_cookie = '';
559
+					// If the user wants ssl but the session is not ssl, force a secure cookie.
560
+					if (!empty($_POST['log'])) {
561
+						$user_name = sanitize_user($_POST['log']);
562
+						if ($user = get_user_by('email', $user_name)) {
563
+							if (get_user_option('use_ssl', $user->ID)) {
564
+								$secure_cookie = true;
565
+								force_ssl_admin(true);
566
+							}
567
+						}
568
+					}
569
+
570
+					$redirect_to = $_REQUEST['redirect_to'];
571
+
572
+					if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
573
+						if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
574
+							$redirect_to = $_SERVER['HTTP_REFERER'];
575
+						} else {
576
+							$redirect_to = home_url();
577
+						}
578
+
579
+					}
580
+
581
+					if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
582
+
583
+						$redirect_to = $_REQUEST['redirect_add_listing'];
584
+					}
585
+
586
+
587
+					if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
588
+						$secure_cookie = false;
589
+
590
+					$user = wp_signon('', $secure_cookie);
591
+
592
+					$requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
593
+					/**
594
+					 * Filter the login redirect URL.
595
+					 *
596
+					 * @since 1.4.9
597
+					 * @param string $redirect_to The redirect destination URL.
598
+					 * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
599
+					 * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
600
+					 */
601
+					$redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
602
+
603
+
604
+					if (!is_wp_error($user)) {
605
+						wp_safe_redirect($redirect_to);
606
+						exit();
607
+					}
608
+					exit();
609
+				}
610
+			}
611
+
612
+			break;
613
+
614
+		case 'login' :
615
+		default:
616
+			$secure_cookie = '';
617
+
618
+			if (!empty($_POST['log'])) {
619
+				$user_name = sanitize_user($_POST['log']);
620
+				if ($user = get_user_by('login', $user_name)) {
621
+
622
+					if (get_user_option('use_ssl', $user->ID)) {
623
+						$secure_cookie = true;
624
+						force_ssl_admin(true);
625
+					}
626
+				} elseif ($user = get_user_by('email', $user_name)) {
627
+					$_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login
628
+					if (get_user_option('use_ssl', $user->ID)) {
629
+						$secure_cookie = true;
630
+						force_ssl_admin(true);
631
+					}
632
+				}
633
+			}
634
+			///////////////////////////
635
+			if (isset($_REQUEST['redirect_add_listing'])) {
636
+				$_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];
637
+			}
638
+
639
+
640
+			if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
641
+				if (is_user_logged_in()) :
642
+					$user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643
+					$post_types = geodir_get_posttypes();
644 644
                     
645
-                    if ( !empty( $_REQUEST['stype'] ) ) {
646
-                        $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647
-                    } else {
648
-                        $user_listings = geodir_user_post_listing_count( $user_ID );
649
-                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
650
-                            $dashboard_post_type = $dashboard_post_types[0];
651
-                        }
652
-                    }
653
-                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
654
-                        $dashboard_post_type = $post_types[0];
655
-                    }
645
+					if ( !empty( $_REQUEST['stype'] ) ) {
646
+						$dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647
+					} else {
648
+						$user_listings = geodir_user_post_listing_count( $user_ID );
649
+						if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
650
+							$dashboard_post_type = $dashboard_post_types[0];
651
+						}
652
+					}
653
+					if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
654
+						$dashboard_post_type = $post_types[0];
655
+					}
656 656
                     
657
-                    $author_link = get_author_posts_url($user_ID);
658
-                    $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
659
-
660
-                    /**
661
-                     * Filter the author link.
662
-                     *
663
-                     * @since 1.0.0
664
-                     *
665
-                     * @param string $default_author_link Default author link.
666
-                     * @param int $user_ID The user ID.
667
-                     */
668
-                    $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
669
-
670
-                    $_REQUEST['redirect_to'] = $default_author_link;
671
-                else:
672
-                    $_REQUEST['redirect_to'] = home_url();
673
-                endif;
674
-
675
-            }
676
-            if (isset($_REQUEST['redirect_to'])) {
677
-                $redirect_to = $_REQUEST['redirect_to'];
678
-                // Redirect to https if user wants ssl
679
-                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
680
-                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
681
-            } else {
682
-                $redirect_to = admin_url();
683
-            }
684
-
685
-            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
686
-                $secure_cookie = false;
687
-            $user = wp_signon('', $secure_cookie);
688
-
689
-
690
-            /**
691
-             * Filter the login redirect URL.
692
-             *
693
-             * @since 1.4.9
694
-             * @param string $redirect_to The redirect destination URL.
695
-             * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
696
-             */
697
-            $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
698
-
699
-            if (is_wp_error($user)) {
700
-                if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
-                    wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
702
-                }
703
-            }
704
-            if (!is_wp_error($user)) {
705
-
706
-                // Some servers are not logging the user in properly after wp_signon, se we set the user here.
707
-                //wp_set_current_user($user->ID);
708
-                //echo '###';exit;
709
-
710
-                if ($redirect_to) {
711
-                    wp_redirect($redirect_to);
712
-                } else {
713
-                    wp_redirect(home_url());
714
-                }
715
-                gd_die();
716
-            }
717
-
718
-            $errors = $user;
719
-
720
-            // Clear errors if loggedout is set.
721
-            if (!empty($_GET['loggedout']))
722
-                $errors = new WP_Error();
723
-            // If cookies are disabled we can't log in even with a valid user+pass
724
-            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
725
-                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
726
-
727
-            // Some parts of this script use the main login form to display a message
728
-            if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
-                $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
730
-            } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731
-                $successmsg = USER_REG_NOT_ALLOW_MSG;
732
-            } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
733
-                $successmsg = EMAIL_CONFIRM_LINK_MSG;
734
-            } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
735
-                $successmsg = NEW_PW_EMAIL_MSG;
736
-            } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
737
-                $successmsg = REG_COMPLETE_MSG;
738
-            }
739
-
740
-            if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741
-                if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
-                    wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
743
-                } else {
744
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745
-                }
746
-                gd_die();
747
-            }
748
-            break;
749
-    endswitch; // end action switch
657
+					$author_link = get_author_posts_url($user_ID);
658
+					$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
659
+
660
+					/**
661
+					 * Filter the author link.
662
+					 *
663
+					 * @since 1.0.0
664
+					 *
665
+					 * @param string $default_author_link Default author link.
666
+					 * @param int $user_ID The user ID.
667
+					 */
668
+					$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
669
+
670
+					$_REQUEST['redirect_to'] = $default_author_link;
671
+				else:
672
+					$_REQUEST['redirect_to'] = home_url();
673
+				endif;
674
+
675
+			}
676
+			if (isset($_REQUEST['redirect_to'])) {
677
+				$redirect_to = $_REQUEST['redirect_to'];
678
+				// Redirect to https if user wants ssl
679
+				if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
680
+					$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
681
+			} else {
682
+				$redirect_to = admin_url();
683
+			}
684
+
685
+			if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
686
+				$secure_cookie = false;
687
+			$user = wp_signon('', $secure_cookie);
688
+
689
+
690
+			/**
691
+			 * Filter the login redirect URL.
692
+			 *
693
+			 * @since 1.4.9
694
+			 * @param string $redirect_to The redirect destination URL.
695
+			 * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
696
+			 */
697
+			$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
698
+
699
+			if (is_wp_error($user)) {
700
+				if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
+					wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
702
+				}
703
+			}
704
+			if (!is_wp_error($user)) {
705
+
706
+				// Some servers are not logging the user in properly after wp_signon, se we set the user here.
707
+				//wp_set_current_user($user->ID);
708
+				//echo '###';exit;
709
+
710
+				if ($redirect_to) {
711
+					wp_redirect($redirect_to);
712
+				} else {
713
+					wp_redirect(home_url());
714
+				}
715
+				gd_die();
716
+			}
717
+
718
+			$errors = $user;
719
+
720
+			// Clear errors if loggedout is set.
721
+			if (!empty($_GET['loggedout']))
722
+				$errors = new WP_Error();
723
+			// If cookies are disabled we can't log in even with a valid user+pass
724
+			if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
725
+				$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
726
+
727
+			// Some parts of this script use the main login form to display a message
728
+			if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
+				$successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
730
+			} elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731
+				$successmsg = USER_REG_NOT_ALLOW_MSG;
732
+			} elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
733
+				$successmsg = EMAIL_CONFIRM_LINK_MSG;
734
+			} elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
735
+				$successmsg = NEW_PW_EMAIL_MSG;
736
+			} elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
737
+				$successmsg = REG_COMPLETE_MSG;
738
+			}
739
+
740
+			if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741
+				if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
+					wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
743
+				} else {
744
+					wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745
+				}
746
+				gd_die();
747
+			}
748
+			break;
749
+	endswitch; // end action switch
750 750
 }
751 751
 
752 752
 function geodir_generate_user_nicename( $display_name, $user_login ) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         if ($redirect) {
23 23
             ?>
24 24
             <script type="text/javascript">
25
-                window.location.href = '<?php echo geodir_login_url();?>';
25
+                window.location.href = '<?php echo geodir_login_url(); ?>';
26 26
             </script>
27 27
         <?php
28 28
         } else
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48 48
             exit();
49 49
         } else {
50
-            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
50
+            wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
51 51
             exit();
52 52
         }
53 53
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param string $message Login message.
61 61
      */
62 62
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
63
+    if (!empty($message)) echo $message."\n";
64 64
 
65 65
 }
66 66
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
     wp_set_password($new_pass, $user->ID);
210 210
     update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
-    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
-    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
-    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
211
+    $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
212
+    $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
213
+    $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
214 214
     //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215 215
     //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216 216
     $user_email = $user_data->user_email;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     $message = apply_filters('password_reset_message', $message, $new_pass);
238 238
     //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
239
+    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email
240 240
 
241 241
     return true;
242 242
 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      *
316 316
      * @param object $errors Registration error messages.
317 317
      */
318
-    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
318
+    $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
319 319
 
320 320
     if ($errors->get_error_code())
321 321
         return $errors;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
     $user_twitter = $_POST['user_twitter'];	*/
338 338
     $user_fname = sanitize_user($_POST['user_fname']);
339 339
     $user_fname = str_replace(",", "", $user_fname);
340
-	if ( empty( $user_fname ) ) {
341
-		$user_fname = strstr( $user_login, '@', true );
340
+	if (empty($user_fname)) {
341
+		$user_fname = strstr($user_login, '@', true);
342 342
 	}
343 343
 
344 344
     /**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369 369
     //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370 370
 
371
-    $user_nicename = geodir_generate_user_nicename( $userName, $user_login );
371
+    $user_nicename = geodir_generate_user_nicename($userName, $user_login);
372 372
 
373 373
     $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374 374
 
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
         ///////REGISTRATION EMAIL START//////
393 393
         $fromEmail = geodir_get_site_email_id();
394 394
         $fromEmailName = get_site_emailName();
395
-        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
396
-<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
397
-<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
395
+        $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>
396
+<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p>
397
+<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>');
398 398
 
399 399
         /////////////customer email//////////////
400 400
         //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
401
+        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email
402 402
         //////REGISTRATION EMAIL END////////
403 403
     }
404 404
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
         $action = 'resetpass';
430 430
 
431 431
     // validate action so as to default to the login screen
432
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
432
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action))
433 433
         $action = 'login';
434 434
 
435 435
     nocache_headers();
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
             $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440 440
 
441 441
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
442
+        if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url())
443
+            update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']));
444 444
     }
445 445
 
446 446
     //Set a cookie now to see if they are supported by the browser.
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      *
456 456
      * @since 1.0.0
457 457
      */
458
-    do_action('login_form_' . $action);
458
+    do_action('login_form_'.$action);
459 459
 
460 460
     $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461 461
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
          * @since 1.0.0
496 496
          */
497 497
         do_action('lost_password');
498
-            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
498
+            $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>';
499 499
             $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500 500
 
501 501
             break;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 exit();
510 510
             }
511 511
 
512
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
512
+            wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
513 513
             exit();
514 514
 
515 515
             break;
@@ -642,15 +642,15 @@  discard block
 block discarded – undo
642 642
                     $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643 643
                     $post_types = geodir_get_posttypes();
644 644
                     
645
-                    if ( !empty( $_REQUEST['stype'] ) ) {
645
+                    if (!empty($_REQUEST['stype'])) {
646 646
                         $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647 647
                     } else {
648
-                        $user_listings = geodir_user_post_listing_count( $user_ID );
649
-                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
648
+                        $user_listings = geodir_user_post_listing_count($user_ID);
649
+                        if (!empty($user_listings) && $dashboard_post_types = array_keys($user_listings)) {
650 650
                             $dashboard_post_type = $dashboard_post_types[0];
651 651
                         }
652 652
                     }
653
-                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
653
+                    if (!(!empty($dashboard_post_type) && in_array($dashboard_post_type, $post_types))) {
654 654
                         $dashboard_post_type = $post_types[0];
655 655
                     }
656 656
                     
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
             if (is_wp_error($user)) {
700 700
                 if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
-                    wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
701
+                    wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1');
702 702
                 }
703 703
             }
704 704
             if (!is_wp_error($user)) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
             // Some parts of this script use the main login form to display a message
728 728
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
-                $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
729
+                $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>';
730 730
             } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731 731
                 $successmsg = USER_REG_NOT_ALLOW_MSG;
732 732
             } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 
740 740
             if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741 741
                 if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
-                    wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
742
+                    wp_redirect($_REQUEST['pagetype'].'&emsg=1');
743 743
                 } else {
744
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
744
+                    wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745 745
                 }
746 746
                 gd_die();
747 747
             }
@@ -749,28 +749,28 @@  discard block
 block discarded – undo
749 749
     endswitch; // end action switch
750 750
 }
751 751
 
752
-function geodir_generate_user_nicename( $display_name, $user_login ) {
752
+function geodir_generate_user_nicename($display_name, $user_login) {
753 753
 	global $wpdb;
754 754
 	$user_nicename = '';
755
-	if ( ! empty( $display_name ) ) {
756
-		$user_nicename = sanitize_user( $display_name, true );
755
+	if (!empty($display_name)) {
756
+		$user_nicename = sanitize_user($display_name, true);
757 757
 	}
758
-	if ( empty( $user_nicename ) ) {
758
+	if (empty($user_nicename)) {
759 759
 		$user_nicename = $user_login;
760 760
 	}
761
-	$user_nicename = mb_substr( $user_nicename, 0, 50 );
762
-	$user_nicename = sanitize_title( $user_nicename );
763
-	$user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
761
+	$user_nicename = mb_substr($user_nicename, 0, 50);
762
+	$user_nicename = sanitize_title($user_nicename);
763
+	$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
764 764
 				
765
-	$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
765
+	$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login));
766 766
 		
767
-	if ( $user_nicename_check ) {
767
+	if ($user_nicename_check) {
768 768
 		$suffix = 2;
769 769
 		while ($user_nicename_check) {
770 770
 			// user_nicename allows 50 chars. Subtract one for a hyphen, plus the length of the suffix.
771
-			$base_length = 49 - mb_strlen( $suffix );
772
-			$alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix";
773
-			$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
771
+			$base_length = 49 - mb_strlen($suffix);
772
+			$alt_user_nicename = mb_substr($user_nicename, 0, $base_length)."-$suffix";
773
+			$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login));
774 774
 			$suffix++;
775 775
 		}
776 776
 		$user_nicename = $alt_user_nicename;
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/class-recursive-arrayaccess.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,6 @@
 block discarded – undo
107 107
 	 * @link http://php.net/manual/en/arrayaccess.offsetset.php
108 108
 	 *
109 109
 	 * @param mixed $offset The offset to assign the value to.
110
-	 * @param mixed $value  The value to set.
111 110
 	 *
112 111
 	 * @return void
113 112
 	 */
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param array $data
38 38
 	 */
39
-	protected function __construct( $data = array() ) {
40
-		foreach ( $data as $key => $value ) {
41
-			$this[ $key ] = $value;
39
+	protected function __construct($data = array()) {
40
+		foreach ($data as $key => $value) {
41
+			$this[$key] = $value;
42 42
 		}
43 43
 	}
44 44
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	 * Allow deep copies of objects
47 47
 	 */
48 48
 	public function __clone() {
49
-		foreach ( $this->container as $key => $value ) {
50
-			if ( $value instanceof self ) {
51
-				$this[ $key ] = clone $value;
49
+		foreach ($this->container as $key => $value) {
50
+			if ($value instanceof self) {
51
+				$this[$key] = clone $value;
52 52
 			}
53 53
 		}
54 54
 	}
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function toArray() {
62 62
 		$data = $this->container;
63
-		foreach ( $data as $key => $value ) {
64
-			if ( $value instanceof self ) {
65
-				$data[ $key ] = $value->toArray();
63
+		foreach ($data as $key => $value) {
64
+			if ($value instanceof self) {
65
+				$data[$key] = $value->toArray();
66 66
 			}
67 67
 		}
68 68
 		return $data;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return boolean true on success or false on failure.
83 83
 	 */
84
-	public function offsetExists( $offset ) {
85
-		return isset( $this->container[ $offset ]) ;
84
+	public function offsetExists($offset) {
85
+		return isset($this->container[$offset]);
86 86
 	}
87 87
 
88 88
 	/**
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @return mixed Can return all value types.
96 96
 	 */
97
-	public function offsetGet( $offset ) {
98
-		return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
97
+	public function offsetGet($offset) {
98
+		return isset($this->container[$offset]) ? $this->container[$offset] : null;
99 99
 	}
100 100
 
101 101
 	/**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return void
110 110
 	 */
111
-	public function offsetSet( $offset, $data ) {
112
-		if ( is_array( $data ) ) {
113
-			$data = new self( $data );
111
+	public function offsetSet($offset, $data) {
112
+		if (is_array($data)) {
113
+			$data = new self($data);
114 114
 		}
115
-		if ( $offset === null ) { // don't forget this!
115
+		if ($offset === null) { // don't forget this!
116 116
 			$this->container[] = $data;
117 117
 		} else {
118
-			$this->container[ $offset ] = $data;
118
+			$this->container[$offset] = $data;
119 119
 		}
120 120
 
121 121
 		$this->dirty = true;
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return void
132 132
 	 */
133
-	public function offsetUnset( $offset ) {
134
-		unset( $this->container[ $offset ] );
133
+	public function offsetUnset($offset) {
134
+		unset($this->container[$offset]);
135 135
 
136 136
 		$this->dirty = true;
137 137
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return mixed
150 150
 	 */
151 151
 	public function current() {
152
-		return current( $this->container );
152
+		return current($this->container);
153 153
 	}
154 154
 
155 155
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed
161 161
 	 */
162 162
 	public function key() {
163
-		return key( $this->container );
163
+		return key($this->container);
164 164
 	}
165 165
 
166 166
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return void
172 172
 	 */
173 173
 	public function next() {
174
-		next( $this->container );
174
+		next($this->container);
175 175
 	}
176 176
 
177 177
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return void
183 183
 	 */
184 184
 	public function rewind() {
185
-		reset( $this->container );
185
+		reset($this->container);
186 186
 	}
187 187
 
188 188
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return bool
194 194
 	 */
195 195
 	public function valid() {
196
-		return $this->offsetExists( $this->key() );
196
+		return $this->offsetExists($this->key());
197 197
 	}
198 198
 
199 199
 	/*****************************************************************/
@@ -208,6 +208,6 @@  discard block
 block discarded – undo
208 208
 	 * @return int
209 209
 	 */
210 210
 	public function count() {
211
-		return count( $this->container );
211
+		return count($this->container);
212 212
 	}
213 213
 }
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/class-wp-session.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,6 @@
 block discarded – undo
51 51
 	/**
52 52
 	 * Retrieve the current session instance.
53 53
 	 *
54
-	 * @param bool $session_id Session ID from which to populate data.
55 54
 	 *
56 55
 	 * @return bool|WP_Session
57 56
 	 */
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 			$cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
74 74
 			$cookie_crumbs = explode( '||', $cookie );
75 75
 
76
-            $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0] );
77
-            $this->expires = absint( $cookie_crumbs[1] );
78
-            $this->exp_variant = absint( $cookie_crumbs[2] );
76
+			$this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0] );
77
+			$this->expires = absint( $cookie_crumbs[1] );
78
+			$this->exp_variant = absint( $cookie_crumbs[2] );
79 79
 
80 80
 			// Update the session expiration if we're past the variant time
81 81
 			if ( time() > $this->exp_variant ) {
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	/**
121
-	* Set the session cookie
122
-	* @uses apply_filters Calls `wp_session_cookie_secure` to set the $secure parameter of setcookie()
123
-	* @uses apply_filters Calls `wp_session_cookie_httponly` to set the $httponly parameter of setcookie()
124
-	*/
121
+	 * Set the session cookie
122
+	 * @uses apply_filters Calls `wp_session_cookie_secure` to set the $secure parameter of setcookie()
123
+	 * @uses apply_filters Calls `wp_session_cookie_httponly` to set the $httponly parameter of setcookie()
124
+	 */
125 125
 	protected function set_cookie() {
126 126
 		if ( !defined( 'GD_TESTING_MODE' ) ) {
127 127
 			try {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return bool|WP_Session
54 54
 	 */
55 55
 	public static function get_instance() {
56
-		if ( ! self::$instance ) {
56
+		if (!self::$instance) {
57 57
 			self::$instance = new self();
58 58
 		}
59 59
 
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
70 70
 	 */
71 71
 	protected function __construct() {
72
-		if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
73
-			$cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
74
-			$cookie_crumbs = explode( '||', $cookie );
72
+		if (isset($_COOKIE[WP_SESSION_COOKIE])) {
73
+			$cookie = stripslashes($_COOKIE[WP_SESSION_COOKIE]);
74
+			$cookie_crumbs = explode('||', $cookie);
75 75
 
76
-            $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0] );
77
-            $this->expires = absint( $cookie_crumbs[1] );
78
-            $this->exp_variant = absint( $cookie_crumbs[2] );
76
+            $this->session_id = preg_replace("/[^A-Za-z0-9_]/", '', $cookie_crumbs[0]);
77
+            $this->expires = absint($cookie_crumbs[1]);
78
+            $this->exp_variant = absint($cookie_crumbs[2]);
79 79
 
80 80
 			// Update the session expiration if we're past the variant time
81
-			if ( time() > $this->exp_variant ) {
81
+			if (time() > $this->exp_variant) {
82 82
 				$this->set_expiration();
83
-				delete_option( "_wp_session_expires_{$this->session_id}" );
84
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
83
+				delete_option("_wp_session_expires_{$this->session_id}");
84
+				add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
85 85
 			}
86 86
 		} else {
87 87
 			$this->session_id = WP_Session_Utils::generate_id();
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
114 114
 	 */
115 115
 	protected function set_expiration() {
116
-		$this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
117
-		$this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
116
+		$this->exp_variant = time() + (int) apply_filters('wp_session_expiration_variant', 24 * 60);
117
+		$this->expires = time() + (int) apply_filters('wp_session_expiration', 30 * 60);
118 118
 	}
119 119
 
120 120
 	/**
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 	* @uses apply_filters Calls `wp_session_cookie_httponly` to set the $httponly parameter of setcookie()
124 124
 	*/
125 125
 	protected function set_cookie() {
126
-		if ( !defined( 'GD_TESTING_MODE' ) ) {
126
+		if (!defined('GD_TESTING_MODE')) {
127 127
 			try {
128 128
 				$secure = apply_filters('wp_session_cookie_secure', false);
129 129
 				$httponly = apply_filters('wp_session_cookie_httponly', false);
130
-				setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly );
131
-			} catch(Exception $e) {
132
-				error_log( 'Set Cookie Error: ' . $e->getMessage() );
130
+				setcookie(WP_SESSION_COOKIE, $this->session_id.'||'.$this->expires.'||'.$this->exp_variant, $this->expires, COOKIEPATH, COOKIE_DOMAIN, $secure, $httponly);
131
+			} catch (Exception $e) {
132
+				error_log('Set Cookie Error: '.$e->getMessage());
133 133
 			}
134 134
 		}
135 135
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return array
143 143
 	 */
144 144
 	protected function read_data() {
145
-		$this->container = get_option( "_wp_session_{$this->session_id}", array() );
145
+		$this->container = get_option("_wp_session_{$this->session_id}", array());
146 146
 
147 147
 		return $this->container;
148 148
 	}
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	public function write_data() {
154 154
 		$option_key = "_wp_session_{$this->session_id}";
155 155
 		
156
-		if ( false === get_option( $option_key ) ) {
157
-			add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
158
-			add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
156
+		if (false === get_option($option_key)) {
157
+			add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
158
+			add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
159 159
 		} else {
160
-			delete_option( "_wp_session_{$this->session_id}" );
161
-			add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
160
+			delete_option("_wp_session_{$this->session_id}");
161
+			add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
162 162
 		}
163 163
 	}
164 164
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return string
169 169
 	 */
170 170
 	public function json_out() {
171
-		return json_encode( $this->container );
171
+		return json_encode($this->container);
172 172
 	}
173 173
 
174 174
 	/**
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool
180 180
 	 */
181
-	public function json_in( $data ) {
182
-		$array = json_decode( $data );
181
+	public function json_in($data) {
182
+		$array = json_decode($data);
183 183
 
184
-		if ( is_array( $array ) ) {
184
+		if (is_array($array)) {
185 185
 			$this->container = $array;
186 186
 			return true;
187 187
 		}
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @param bool $delete_old Flag whether or not to delete the old session data from the server.
196 196
 	 */
197
-	public function regenerate_id( $delete_old = false ) {
198
-		if ( $delete_old ) {
199
-			delete_option( "_wp_session_{$this->session_id}" );
197
+	public function regenerate_id($delete_old = false) {
198
+		if ($delete_old) {
199
+			delete_option("_wp_session_{$this->session_id}");
200 200
 		}
201 201
 
202 202
 		$this->session_id = WP_Session_Utils::generate_id();
Please login to merge, or discard this patch.