Test Failed
Pull Request — master (#274)
by Viruthagiri
10:39
created
geodirectory-functions/general_functions.php 1 patch
Spacing   +1371 added lines, -1371 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function geodir_plugin_url() {
29 29
 
30
-	if ( is_ssl() ) :
31
-		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
30
+	if (is_ssl()) :
31
+		return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
32 32
 	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
33
+		return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
34 34
 	endif;
35 35
 }
36 36
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
46 46
  */
47 47
 function geodir_plugin_path() {
48
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
49
-		return dirname( dirname( __FILE__ ) );
48
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
49
+		return dirname(dirname(__FILE__));
50 50
 	} else {
51
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
51
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
52 52
 	}
53 53
 }
54 54
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  * @return bool true or false.
64 64
  * @todo    check if this is faster than normal WP check and remove if not.
65 65
  */
66
-function geodir_is_plugin_active( $plugin ) {
67
-	$active_plugins = get_option( 'active_plugins' );
68
-	foreach ( $active_plugins as $key => $active_plugin ) {
69
-		if ( strstr( $active_plugin, $plugin ) ) {
66
+function geodir_is_plugin_active($plugin) {
67
+	$active_plugins = get_option('active_plugins');
68
+	foreach ($active_plugins as $key => $active_plugin) {
69
+		if (strstr($active_plugin, $plugin)) {
70 70
 			return true;
71 71
 		}
72 72
 	}
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool|int|string the formatted date.
90 90
  */
91
-function geodir_get_formated_date( $date ) {
92
-	return mysql2date( get_option( 'date_format' ), $date );
91
+function geodir_get_formated_date($date) {
92
+	return mysql2date(get_option('date_format'), $date);
93 93
 }
94 94
 
95 95
 /**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return bool|int|string the formatted time.
107 107
  */
108
-function geodir_get_formated_time( $time ) {
109
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
108
+function geodir_get_formated_time($time) {
109
+	return mysql2date(get_option('time_format'), $time, $translate = true);
110 110
 }
111 111
 
112 112
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return string Formatted link.
126 126
  */
127
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
128
-	if ( $use_existing_arguments ) {
127
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
128
+	if ($use_existing_arguments) {
129 129
 		$params = $params + $_GET;
130 130
 	}
131
-	if ( ! $params ) {
131
+	if (!$params) {
132 132
 		return $url;
133 133
 	}
134 134
 	$link = $url;
135
-	if ( strpos( $link, '?' ) === false ) {
135
+	if (strpos($link, '?') === false) {
136 136
 		$link .= '?';
137 137
 	} //If there is no '?' add one at the end
138
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
138
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
139 139
 		$link .= '&';
140 140
 	} //If there is no '&' at the END, add one.
141
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
141
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
142 142
 		$link .= '&';
143 143
 	} //If there is no '&' at the END, add one.
144 144
 
145 145
 	$params_arr = array();
146
-	foreach ( $params as $key => $value ) {
147
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
148
-			foreach ( $value as $val ) {
149
-				$params_arr[] = $key . '[]=' . urlencode( $val );
146
+	foreach ($params as $key => $value) {
147
+		if (gettype($value) == 'array') { //Handle array data properly
148
+			foreach ($value as $val) {
149
+				$params_arr[] = $key.'[]='.urlencode($val);
150 150
 			}
151 151
 		} else {
152
-			$params_arr[] = $key . '=' . urlencode( $value );
152
+			$params_arr[] = $key.'='.urlencode($value);
153 153
 		}
154 154
 	}
155
-	$link .= implode( '&', $params_arr );
155
+	$link .= implode('&', $params_arr);
156 156
 
157 157
 	return $link;
158 158
 }
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @return string Listing page url if valid. Otherwise home url will be returned.
171 171
  */
172
-function geodir_get_addlisting_link( $post_type = '' ) {
172
+function geodir_get_addlisting_link($post_type = '') {
173 173
 	global $wpdb;
174 174
 
175 175
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
176 176
 	$check_pkg = 1;
177
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
177
+	if (post_type_exists($post_type) && $check_pkg) {
178 178
 
179
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
179
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
180 180
 
181
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
181
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
182 182
 	} else {
183
-		return get_bloginfo( 'url' );
183
+		return get_bloginfo('url');
184 184
 	}
185 185
 }
186 186
 
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function geodir_curPageURL() {
196 196
 	$pageURL = 'http';
197
-	if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
197
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
198 198
 		$pageURL .= "s";
199 199
 	}
200 200
 	$pageURL .= "://";
201
-	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
201
+	$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
202 202
 
203 203
 	/**
204 204
 	 * Filter the current page URL returned by function geodir_curPageURL().
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $pageURL The URL of the current page.
209 209
 	 */
210
-	return apply_filters( 'geodir_curPageURL', $pageURL );
210
+	return apply_filters('geodir_curPageURL', $pageURL);
211 211
 }
212 212
 
213 213
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return string Cleaned variable.
225 225
  */
226
-function geodir_clean( $string ) {
226
+function geodir_clean($string) {
227 227
 
228
-	$string = trim( strip_tags( stripslashes( $string ) ) );
229
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
230
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
231
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
228
+	$string = trim(strip_tags(stripslashes($string)));
229
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
230
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
231
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
232 232
 
233 233
 	return $string;
234 234
 }
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
  */
243 243
 function geodir_get_weekday() {
244 244
 	return array(
245
-		__( 'Sunday', 'geodirectory' ),
246
-		__( 'Monday', 'geodirectory' ),
247
-		__( 'Tuesday', 'geodirectory' ),
248
-		__( 'Wednesday', 'geodirectory' ),
249
-		__( 'Thursday', 'geodirectory' ),
250
-		__( 'Friday', 'geodirectory' ),
251
-		__( 'Saturday', 'geodirectory' )
245
+		__('Sunday', 'geodirectory'),
246
+		__('Monday', 'geodirectory'),
247
+		__('Tuesday', 'geodirectory'),
248
+		__('Wednesday', 'geodirectory'),
249
+		__('Thursday', 'geodirectory'),
250
+		__('Friday', 'geodirectory'),
251
+		__('Saturday', 'geodirectory')
252 252
 	);
253 253
 }
254 254
 
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
  */
262 262
 function geodir_get_weeks() {
263 263
 	return array(
264
-		__( 'First', 'geodirectory' ),
265
-		__( 'Second', 'geodirectory' ),
266
-		__( 'Third', 'geodirectory' ),
267
-		__( 'Fourth', 'geodirectory' ),
268
-		__( 'Last', 'geodirectory' )
264
+		__('First', 'geodirectory'),
265
+		__('Second', 'geodirectory'),
266
+		__('Third', 'geodirectory'),
267
+		__('Fourth', 'geodirectory'),
268
+		__('Last', 'geodirectory')
269 269
 	);
270 270
 }
271 271
 
@@ -284,112 +284,112 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @return bool If valid returns true. Otherwise false.
286 286
  */
287
-function geodir_is_page( $gdpage = '' ) {
287
+function geodir_is_page($gdpage = '') {
288 288
 
289 289
 	global $wp_query, $post, $wp;
290 290
 	//if(!is_admin()):
291 291
 
292
-	switch ( $gdpage ):
292
+	switch ($gdpage):
293 293
 		case 'add-listing':
294 294
 
295
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
295
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
296 296
 				return true;
297
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
297
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
298 298
 				return true;
299 299
 			}
300 300
 
301 301
 			break;
302 302
 		case 'preview':
303
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
304
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
303
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
304
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
305 305
 			) {
306 306
 				return true;
307 307
 			}
308 308
 			break;
309 309
 		case 'listing-success':
310
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
310
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
311 311
 				return true;
312 312
 			}
313 313
 			break;
314 314
 		case 'detail':
315
-			$post_type = get_query_var( 'post_type' );
316
-			if ( is_array( $post_type ) ) {
317
-				$post_type = reset( $post_type );
315
+			$post_type = get_query_var('post_type');
316
+			if (is_array($post_type)) {
317
+				$post_type = reset($post_type);
318 318
 			}
319
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
319
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
320 320
 				return true;
321 321
 			}
322 322
 			break;
323 323
 		case 'pt':
324
-			$post_type = get_query_var( 'post_type' );
325
-			if ( is_array( $post_type ) ) {
326
-				$post_type = reset( $post_type );
324
+			$post_type = get_query_var('post_type');
325
+			if (is_array($post_type)) {
326
+				$post_type = reset($post_type);
327 327
 			}
328
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
328
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
329 329
 				return true;
330 330
 			}
331 331
 
332 332
 			break;
333 333
 		case 'listing':
334
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
334
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
335 335
 				global $current_term, $taxonomy, $term;
336 336
 
337 337
 				return true;
338 338
 			}
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 
347 347
 			break;
348 348
 		case 'home':
349 349
 
350
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
350
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
351 351
 				return true;
352 352
 			}
353 353
 
354 354
 			break;
355 355
 		case 'location':
356
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
356
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
357 357
 				return true;
358 358
 			}
359 359
 			break;
360 360
 		case 'author':
361
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
361
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
362 362
 				return true;
363 363
 			}
364 364
 
365
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
366
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
365
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
366
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
367 367
 					return true;
368 368
 				}
369 369
 			}
370 370
 			break;
371 371
 		case 'search':
372
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
372
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
373 373
 				return true;
374 374
 			}
375 375
 			break;
376 376
 		case 'info':
377
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
377
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
378 378
 				return true;
379 379
 			}
380 380
 			break;
381 381
 		case 'login':
382
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
382
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
383 383
 				return true;
384 384
 			}
385 385
 			break;
386 386
 		case 'checkout':
387
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
387
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
388 388
 				return true;
389 389
 			}
390 390
 			break;
391 391
 		case 'invoices':
392
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
392
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
393 393
 				return true;
394 394
 			}
395 395
 			break;
@@ -414,28 +414,28 @@  discard block
 block discarded – undo
414 414
  *
415 415
  * @param object $wp WordPress object.
416 416
  */
417
-function geodir_set_is_geodir_page( $wp ) {
418
-	if ( ! is_admin() ) {
417
+function geodir_set_is_geodir_page($wp) {
418
+	if (!is_admin()) {
419 419
 		//$wp->query_vars['gd_is_geodir_page'] = false;
420 420
 		//print_r()
421
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
421
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
422 422
 				'preview',
423 423
 				'page',
424 424
 				'paged',
425 425
 				'cpage'
426
-			) )
426
+			))
427 427
 		) {
428
-			if ( get_option( 'geodir_set_as_home' ) ) {
428
+			if (get_option('geodir_set_as_home')) {
429 429
 				$wp->query_vars['gd_is_geodir_page'] = true;
430 430
 			}
431
-			if ( geodir_is_page( 'home' ) ) {
431
+			if (geodir_is_page('home')) {
432 432
 				$wp->query_vars['gd_is_geodir_page'] = true;
433 433
 			}
434 434
 
435 435
 
436 436
 		}
437 437
 
438
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
438
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
439 439
 			if (
440 440
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
441 441
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -444,26 +444,26 @@  discard block
 block discarded – undo
444 444
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
445 445
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
446 446
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
447
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
448
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
447
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
448
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
449 449
 			) {
450 450
 				$wp->query_vars['gd_is_geodir_page'] = true;
451 451
 			}
452 452
 		}
453 453
 
454
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
455
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
454
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
455
+			$page = get_page_by_path($wp->query_vars['pagename']);
456 456
 
457
-			if ( ! empty( $page ) && (
457
+			if (!empty($page) && (
458 458
 					$page->ID == geodir_add_listing_page_id()
459 459
 					|| $page->ID == geodir_preview_page_id()
460 460
 					|| $page->ID == geodir_success_page_id()
461 461
 					|| $page->ID == geodir_location_page_id()
462
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
463
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
464
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
465
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
466
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
462
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
463
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
464
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
465
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
466
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
467 467
 				)
468 468
 			) {
469 469
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -471,20 +471,20 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 
473 473
 
474
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
474
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
475 475
 			$requested_post_type = $wp->query_vars['post_type'];
476 476
 			// check if this post type is geodirectory post types
477 477
 			$post_type_array = geodir_get_posttypes();
478
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
478
+			if (in_array($requested_post_type, $post_type_array)) {
479 479
 				$wp->query_vars['gd_is_geodir_page'] = true;
480 480
 			}
481 481
 		}
482 482
 
483
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
484
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
485
-			if ( ! empty( $geodir_taxonomis ) ) {
486
-				foreach ( $geodir_taxonomis as $taxonomy ) {
487
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
483
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
484
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
485
+			if (!empty($geodir_taxonomis)) {
486
+				foreach ($geodir_taxonomis as $taxonomy) {
487
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
488 488
 						$wp->query_vars['gd_is_geodir_page'] = true;
489 489
 						break;
490 490
 					}
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
 
494 494
 		}
495 495
 
496
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
496
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
497 497
 			$wp->query_vars['gd_is_geodir_page'] = true;
498 498
 		}
499 499
 
500 500
 
501
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
501
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
502 502
 			$wp->query_vars['gd_is_geodir_page'] = true;
503 503
 		}
504 504
 
505 505
 
506 506
 //check if homepage
507
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
508
-		     && ! isset( $wp->query_vars['page_id'] )
509
-		     && ! isset( $wp->query_vars['pagename'] )
507
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
508
+		     && !isset($wp->query_vars['page_id'])
509
+		     && !isset($wp->query_vars['pagename'])
510 510
 		     && is_page_geodir_home()
511 511
 		) {
512 512
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
  */
531 531
 function geodir_is_geodir_page() {
532 532
 	global $wp;
533
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
533
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
534 534
 		return true;
535 535
 	} else {
536 536
 		return false;
537 537
 	}
538 538
 }
539 539
 
540
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
540
+if (!function_exists('geodir_get_imagesize')) {
541 541
 	/**
542 542
 	 * Get image size using the size key .
543 543
 	 *
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
 	 *
549 549
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
550 550
 	 */
551
-	function geodir_get_imagesize( $size = '' ) {
551
+	function geodir_get_imagesize($size = '') {
552 552
 
553 553
 		$imagesizes = array(
554
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
555
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
556
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
557
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
554
+			'list-thumb'   => array('w' => 283, 'h' => 188),
555
+			'thumbnail'    => array('w' => 125, 'h' => 125),
556
+			'widget-thumb' => array('w' => 50, 'h' => 50),
557
+			'slider-thumb' => array('w' => 100, 'h' => 100)
558 558
 		);
559 559
 
560 560
 		/**
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @param array $imagesizes Image size array.
566 566
 		 */
567
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
567
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
568 568
 
569
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
569
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
570 570
 			/**
571 571
 			 * Filters image size of the passed key.
572 572
 			 *
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 			 *
575 575
 			 * @param array $imagesizes [$size] Image size array of the passed key.
576 576
 			 */
577
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
577
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
578 578
 
579
-		} elseif ( ! empty( $size ) ) {
579
+		} elseif (!empty($size)) {
580 580
 
581
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
581
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
582 582
 
583 583
 		}
584 584
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 */
603 603
 
604 604
 
605
-if ( ! function_exists( 'createRandomString' ) ) {
605
+if (!function_exists('createRandomString')) {
606 606
 	/**
607 607
 	 * Creates random string.
608 608
 	 *
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
 	 */
613 613
 	function createRandomString() {
614 614
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
615
-		srand( (double) microtime() * 1000000 );
615
+		srand((double) microtime() * 1000000);
616 616
 		$i       = 0;
617 617
 		$rstring = '';
618
-		while ( $i <= 25 ) {
618
+		while ($i <= 25) {
619 619
 			$num     = rand() % 33;
620
-			$tmp     = substr( $chars, $num, 1 );
621
-			$rstring = $rstring . $tmp;
622
-			$i ++;
620
+			$tmp     = substr($chars, $num, 1);
621
+			$rstring = $rstring.$tmp;
622
+			$i++;
623 623
 		}
624 624
 
625 625
 		return $rstring;
626 626
 	}
627 627
 }
628 628
 
629
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
629
+if (!function_exists('geodir_getDistanceRadius')) {
630 630
 	/**
631 631
 	 * Calculates the distance radius.
632 632
 	 *
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 	 *
638 638
 	 * @return float The mean radius.
639 639
 	 */
640
-	function geodir_getDistanceRadius( $uom = 'km' ) {
640
+	function geodir_getDistanceRadius($uom = 'km') {
641 641
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
642
-		switch ( geodir_strtolower( $uom ) ):
642
+		switch (geodir_strtolower($uom)):
643 643
 			case 'km'    :
644 644
 				$earthMeanRadius = 6371.009; // km
645 645
 				break;
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 }
672 672
 
673 673
 
674
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
674
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
675 675
 	/**
676 676
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
677 677
 	 *
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	 *
685 685
 	 * @return float The distance.
686 686
 	 */
687
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
687
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
688 688
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
689 689
 
690
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
690
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
691 691
 
692
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
693
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
694
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
695
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
697
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
692
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
693
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
694
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
695
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
696
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
697
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
698 698
 		$distance       = $earthMeanRadius * $c;
699 699
 
700 700
 		return $distance;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 }
704 704
 
705 705
 
706
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
706
+if (!function_exists('geodir_sendEmail')) {
707 707
 	/**
708 708
 	 * The main function that send transactional emails using the args provided.
709 709
 	 *
@@ -722,83 +722,83 @@  discard block
 block discarded – undo
722 722
 	 * @param string $post_id       The post ID.
723 723
 	 * @param string $user_id       The user ID.
724 724
 	 */
725
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
725
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
726 726
 		$login_details = '';
727 727
 
728 728
 		// strip slashes from subject & message text
729
-		$to_subject = stripslashes_deep( $to_subject );
730
-		$to_message = stripslashes_deep( $to_message );
731
-
732
-		if ( $message_type == 'send_friend' ) {
733
-			$subject = get_option( 'geodir_email_friend_subject' );
734
-			$message = get_option( 'geodir_email_friend_content' );
735
-		} elseif ( $message_type == 'send_enquiry' ) {
736
-			$subject = get_option( 'geodir_email_enquiry_subject' );
737
-			$message = get_option( 'geodir_email_enquiry_content' );
738
-		} elseif ( $message_type == 'forgot_password' ) {
739
-			$subject       = get_option( 'geodir_forgot_password_subject' );
740
-			$message       = get_option( 'geodir_forgot_password_content' );
729
+		$to_subject = stripslashes_deep($to_subject);
730
+		$to_message = stripslashes_deep($to_message);
731
+
732
+		if ($message_type == 'send_friend') {
733
+			$subject = get_option('geodir_email_friend_subject');
734
+			$message = get_option('geodir_email_friend_content');
735
+		} elseif ($message_type == 'send_enquiry') {
736
+			$subject = get_option('geodir_email_enquiry_subject');
737
+			$message = get_option('geodir_email_enquiry_content');
738
+		} elseif ($message_type == 'forgot_password') {
739
+			$subject       = get_option('geodir_forgot_password_subject');
740
+			$message       = get_option('geodir_forgot_password_content');
741 741
 			$login_details = $to_message;
742
-		} elseif ( $message_type == 'registration' ) {
743
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
744
-			$message       = get_option( 'geodir_registration_success_email_content' );
742
+		} elseif ($message_type == 'registration') {
743
+			$subject       = get_option('geodir_registration_success_email_subject');
744
+			$message       = get_option('geodir_registration_success_email_content');
745 745
 			$login_details = $to_message;
746
-		} elseif ( $message_type == 'post_submit' ) {
747
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
748
-			$message = get_option( 'geodir_post_submited_success_email_content' );
749
-		} elseif ( $message_type == 'listing_published' ) {
750
-			$subject = get_option( 'geodir_post_published_email_subject' );
751
-			$message = get_option( 'geodir_post_published_email_content' );
752
-		} elseif ( $message_type == 'listing_edited' ) {
753
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
754
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
746
+		} elseif ($message_type == 'post_submit') {
747
+			$subject = get_option('geodir_post_submited_success_email_subject');
748
+			$message = get_option('geodir_post_submited_success_email_content');
749
+		} elseif ($message_type == 'listing_published') {
750
+			$subject = get_option('geodir_post_published_email_subject');
751
+			$message = get_option('geodir_post_published_email_content');
752
+		} elseif ($message_type == 'listing_edited') {
753
+			$subject = get_option('geodir_post_edited_email_subject_admin');
754
+			$message = get_option('geodir_post_edited_email_content_admin');
755 755
 		}
756 756
 
757
-		if ( ! empty( $subject ) ) {
758
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
757
+		if (!empty($subject)) {
758
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
759 759
 		}
760 760
 
761
-		if ( ! empty( $message ) ) {
762
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
761
+		if (!empty($message)) {
762
+			$message = __(stripslashes_deep($message), 'geodirectory');
763 763
 		}
764 764
 
765
-		$to_message        = nl2br( $to_message );
766
-		$sitefromEmail     = get_option( 'site_email' );
765
+		$to_message        = nl2br($to_message);
766
+		$sitefromEmail     = get_option('site_email');
767 767
 		$sitefromEmailName = get_site_emailName();
768
-		$productlink       = get_permalink( $post_id );
768
+		$productlink       = get_permalink($post_id);
769 769
 
770 770
 		$user_login = '';
771
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
771
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
772 772
 			$user_login = $user_info->user_login;
773 773
 		}
774 774
 
775 775
 		$posted_date = '';
776 776
 		$listingLink = '';
777 777
 
778
-		$post_info = get_post( $post_id );
778
+		$post_info = get_post($post_id);
779 779
 
780
-		if ( $post_info ) {
780
+		if ($post_info) {
781 781
 			$posted_date = $post_info->post_date;
782
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
782
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
783 783
 		}
784 784
 		$siteurl       = home_url();
785
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
785
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
786 786
 		$loginurl      = geodir_login_url();
787
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
787
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
788 788
 
789
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
790
-		$post_author_name = geodir_get_client_name( $post_author_id );
791
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
789
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
790
+		$post_author_name = geodir_get_client_name($post_author_id);
791
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
792 792
 
793
-		if ( $fromEmail == '' ) {
794
-			$fromEmail = get_option( 'site_email' );
793
+		if ($fromEmail == '') {
794
+			$fromEmail = get_option('site_email');
795 795
 		}
796 796
 
797
-		if ( $fromEmailName == '' ) {
798
-			$fromEmailName = get_option( 'site_email_name' );
797
+		if ($fromEmailName == '') {
798
+			$fromEmailName = get_option('site_email_name');
799 799
 		}
800 800
 
801
-		$search_array  = array(
801
+		$search_array = array(
802 802
 			'[#listing_link#]',
803 803
 			'[#site_name_url#]',
804 804
 			'[#post_id#]',
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 			$post_author_name,
839 839
 			$current_date
840 840
 		);
841
-		$message       = str_replace( $search_array, $replace_array, $message );
841
+		$message       = str_replace($search_array, $replace_array, $message);
842 842
 
843 843
 		$search_array  = array(
844 844
 			'[#listing_link#]',
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
 			$post_author_name,
875 875
 			$current_date
876 876
 		);
877
-		$subject       = str_replace( $search_array, $replace_array, $subject );
877
+		$subject = str_replace($search_array, $replace_array, $subject);
878 878
 
879
-		$headers = 'MIME-Version: 1.0' . "\r\n";
880
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
881
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
882
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
879
+		$headers = 'MIME-Version: 1.0'."\r\n";
880
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
881
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
882
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
883 883
 
884 884
 		$to = $toEmail;
885 885
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 		 * @param string $post_id       The post ID.
902 902
 		 * @param string $user_id       The user ID.
903 903
 		 */
904
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
904
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
905 905
 		/**
906 906
 		 * Filter the client email subject.
907 907
 		 *
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 		 * @param string $post_id       The post ID.
921 921
 		 * @param string $user_id       The user ID.
922 922
 		 */
923
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
923
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
924 924
 		/**
925 925
 		 * Filter the client email message.
926 926
 		 *
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		 * @param string $post_id       The post ID.
940 940
 		 * @param string $user_id       The user ID.
941 941
 		 */
942
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
942
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
943 943
 		/**
944 944
 		 * Filter the client email headers.
945 945
 		 *
@@ -958,34 +958,34 @@  discard block
 block discarded – undo
958 958
 		 * @param string $post_id       The post ID.
959 959
 		 * @param string $user_id       The user ID.
960 960
 		 */
961
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
961
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
962 962
 
963
-		$sent = wp_mail( $to, $subject, $message, $headers );
963
+		$sent = wp_mail($to, $subject, $message, $headers);
964 964
 
965
-		if ( ! $sent ) {
966
-			if ( is_array( $to ) ) {
967
-				$to = implode( ',', $to );
965
+		if (!$sent) {
966
+			if (is_array($to)) {
967
+				$to = implode(',', $to);
968 968
 			}
969 969
 			$log_message = sprintf(
970
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
970
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
971 971
 				$message_type,
972
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
972
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
973 973
 				$to,
974 974
 				$subject
975 975
 			);
976
-			geodir_error_log( $log_message );
976
+			geodir_error_log($log_message);
977 977
 		}
978 978
 
979 979
 		///////// ADMIN BCC EMIALS
980
-		$adminEmail = get_bloginfo( 'admin_email' );
980
+		$adminEmail = get_bloginfo('admin_email');
981 981
 		$to         = $adminEmail;
982 982
 
983 983
 		$admin_bcc = false;
984
-		if ( $message_type == 'post_submit' ) {
985
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
986
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
984
+		if ($message_type == 'post_submit') {
985
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
986
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
987 987
 
988
-			$search_array  = array(
988
+			$search_array = array(
989 989
 				'[#listing_link#]',
990 990
 				'[#site_name_url#]',
991 991
 				'[#post_id#]',
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 				$user_login,
1018 1018
 				$user_login
1019 1019
 			);
1020
-			$message       = str_replace( $search_array, $replace_array, $message );
1020
+			$message       = str_replace($search_array, $replace_array, $message);
1021 1021
 
1022 1022
 			$search_array  = array(
1023 1023
 				'[#listing_link#]',
@@ -1045,40 +1045,40 @@  discard block
 block discarded – undo
1045 1045
 				$user_login,
1046 1046
 				$user_login
1047 1047
 			);
1048
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1048
+			$subject = str_replace($search_array, $replace_array, $subject);
1049 1049
 
1050 1050
 			$subject .= ' - ADMIN BCC COPY';
1051 1051
 			$admin_bcc = true;
1052 1052
 
1053
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1053
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1054 1054
 			$subject .= ' - ADMIN BCC COPY';
1055 1055
 			$admin_bcc = true;
1056
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1056
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1057 1057
 			$subject .= ' - ADMIN BCC COPY';
1058 1058
 			$admin_bcc = true;
1059
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1059
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1060 1060
 			$subject .= ' - ADMIN BCC COPY';
1061 1061
 			$admin_bcc = true;
1062
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1062
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1063 1063
 			$subject .= ' - ADMIN BCC COPY';
1064 1064
 			$admin_bcc = true;
1065 1065
 		}
1066 1066
 
1067
-		if ( $admin_bcc === true ) {
1068
-			$sent = wp_mail( $to, $subject, $message, $headers );
1067
+		if ($admin_bcc === true) {
1068
+			$sent = wp_mail($to, $subject, $message, $headers);
1069 1069
 
1070
-			if ( ! $sent ) {
1071
-				if ( is_array( $to ) ) {
1072
-					$to = implode( ',', $to );
1070
+			if (!$sent) {
1071
+				if (is_array($to)) {
1072
+					$to = implode(',', $to);
1073 1073
 				}
1074 1074
 				$log_message = sprintf(
1075
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1075
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1076 1076
 					$message_type,
1077
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1077
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1078 1078
 					$to,
1079 1079
 					$subject
1080 1080
 				);
1081
-				geodir_error_log( $log_message );
1081
+				geodir_error_log($log_message);
1082 1082
 			}
1083 1083
 		}
1084 1084
 
@@ -1094,27 +1094,27 @@  discard block
 block discarded – undo
1094 1094
  */
1095 1095
 function geodir_taxonomy_breadcrumb() {
1096 1096
 
1097
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1097
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1098 1098
 	$parent = $term->parent;
1099 1099
 
1100
-	while ( $parent ):
1100
+	while ($parent):
1101 1101
 		$parents[]  = $parent;
1102
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1102
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1103 1103
 		$parent     = $new_parent->parent;
1104 1104
 	endwhile;
1105 1105
 
1106
-	if ( ! empty( $parents ) ):
1107
-		$parents = array_reverse( $parents );
1106
+	if (!empty($parents)):
1107
+		$parents = array_reverse($parents);
1108 1108
 
1109
-		foreach ( $parents as $parent ):
1110
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1111
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1112
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1109
+		foreach ($parents as $parent):
1110
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1111
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1112
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1113 1113
 		endforeach;
1114 1114
 
1115 1115
 	endif;
1116 1116
 
1117
-	echo '<li> > ' . $term->name . '</li>';
1117
+	echo '<li> > '.$term->name.'</li>';
1118 1118
 }
1119 1119
 
1120 1120
 
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
 	 *
1137 1137
 	 * @since 1.0.0
1138 1138
 	 */
1139
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1139
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1140 1140
 
1141
-	if ( ! geodir_is_page( 'home' ) ) {
1141
+	if (!geodir_is_page('home')) {
1142 1142
 		$breadcrumb    = '';
1143 1143
 		$url_categoris = '';
1144 1144
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1147,162 +1147,162 @@  discard block
 block discarded – undo
1147 1147
 		 *
1148 1148
 		 * @since 1.0.0
1149 1149
 		 */
1150
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1150
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1151 1151
 
1152 1152
 		$gd_post_type   = geodir_get_current_posttype();
1153
-		$post_type_info = get_post_type_object( $gd_post_type );
1153
+		$post_type_info = get_post_type_object($gd_post_type);
1154 1154
 
1155
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1155
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1156 1156
 
1157
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1157
+		$listing_link = get_post_type_archive_link($gd_post_type);
1158 1158
 
1159
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1160
-		$listing_link = rtrim( $listing_link, '/' );
1159
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1160
+		$listing_link = rtrim($listing_link, '/');
1161 1161
 		$listing_link .= '/';
1162 1162
 
1163 1163
 		$post_type_for_location_link = $listing_link;
1164
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1164
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1165 1165
 
1166 1166
 		global $wp, $gd_session;
1167 1167
 		$location_link = $post_type_for_location_link;
1168 1168
 
1169
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1169
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1170 1170
 			global $post;
1171
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1172
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1171
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1172
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1173 1173
 
1174
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1174
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1175 1175
 				$location_terms = array(
1176 1176
 					'gd_country' => $post->country_slug,
1177 1177
 					'gd_region'  => $post->region_slug,
1178 1178
 					'gd_city'    => $post->city_slug
1179 1179
 				);
1180 1180
 
1181
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1181
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1182 1182
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1183 1183
 				}
1184 1184
 			}
1185 1185
 
1186
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1186
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1187 1187
 
1188 1188
 			$hide_url_part = array();
1189
-			if ( $location_manager ) {
1190
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1191
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1192
-
1193
-				if ( $hide_region_part && $hide_country_part ) {
1194
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1195
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1196
-					$hide_url_part = array( 'gd_region' );
1197
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1198
-					$hide_url_part = array( 'gd_country' );
1189
+			if ($location_manager) {
1190
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1191
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1192
+
1193
+				if ($hide_region_part && $hide_country_part) {
1194
+					$hide_url_part = array('gd_country', 'gd_region');
1195
+				} else if ($hide_region_part && !$hide_country_part) {
1196
+					$hide_url_part = array('gd_region');
1197
+				} else if (!$hide_region_part && $hide_country_part) {
1198
+					$hide_url_part = array('gd_country');
1199 1199
 				}
1200 1200
 			}
1201 1201
 
1202 1202
 			$hide_text_part = array();
1203
-			if ( $geodir_show_location_url == 'country_city' ) {
1204
-				$hide_text_part = array( 'gd_region' );
1203
+			if ($geodir_show_location_url == 'country_city') {
1204
+				$hide_text_part = array('gd_region');
1205 1205
 
1206
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1207
-					unset( $location_terms['gd_region'] );
1206
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1207
+					unset($location_terms['gd_region']);
1208 1208
 				}
1209
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1210
-				$hide_text_part = array( 'gd_country' );
1209
+			} else if ($geodir_show_location_url == 'region_city') {
1210
+				$hide_text_part = array('gd_country');
1211 1211
 
1212
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1213
-					unset( $location_terms['gd_country'] );
1212
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1213
+					unset($location_terms['gd_country']);
1214 1214
 				}
1215
-			} else if ( $geodir_show_location_url == 'city' ) {
1216
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1215
+			} else if ($geodir_show_location_url == 'city') {
1216
+				$hide_text_part = array('gd_country', 'gd_region');
1217 1217
 
1218
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1219
-					unset( $location_terms['gd_country'] );
1218
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1219
+					unset($location_terms['gd_country']);
1220 1220
 				}
1221
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1222
-					unset( $location_terms['gd_region'] );
1221
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1222
+					unset($location_terms['gd_region']);
1223 1223
 				}
1224 1224
 			}
1225 1225
 
1226 1226
 			$is_location_last = '';
1227 1227
 			$is_taxonomy_last = '';
1228 1228
 			$breadcrumb .= '<li>';
1229
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1230
-				$gd_taxonomy = $gd_post_type . 'category';
1231
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1232
-				$gd_taxonomy = $gd_post_type . '_tags';
1229
+			if (get_query_var($gd_post_type.'category')) {
1230
+				$gd_taxonomy = $gd_post_type.'category';
1231
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1232
+				$gd_taxonomy = $gd_post_type.'_tags';
1233 1233
 			}
1234 1234
 
1235
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1236
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1235
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1236
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1237 1237
 				$is_location_last = false;
1238 1238
 			} else {
1239 1239
 				$is_location_last = true;
1240 1240
 			}
1241 1241
 
1242
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1242
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1243 1243
 				$is_taxonomy_last = true;
1244 1244
 			} else {
1245 1245
 				$is_taxonomy_last = false;
1246 1246
 			}
1247 1247
 
1248
-			if ( ! empty( $location_terms ) ) {
1249
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1248
+			if (!empty($location_terms)) {
1249
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1250 1250
 
1251
-				foreach ( $location_terms as $key => $location_term ) {
1252
-					if ( $location_term != '' ) {
1253
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1251
+				foreach ($location_terms as $key => $location_term) {
1252
+					if ($location_term != '') {
1253
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1254 1254
 							continue;
1255 1255
 						}
1256 1256
 
1257
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1258
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1259
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1257
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1258
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1259
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1260 1260
 
1261 1261
 						$location_term_actual_country = '';
1262 1262
 						$location_term_actual_region  = '';
1263 1263
 						$location_term_actual_city    = '';
1264
-						if ( $geodir_get_locations ) {
1265
-							if ( $key == 'gd_country' ) {
1266
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1267
-							} else if ( $key == 'gd_region' ) {
1268
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1269
-							} else if ( $key == 'gd_city' ) {
1270
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1264
+						if ($geodir_get_locations) {
1265
+							if ($key == 'gd_country') {
1266
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1267
+							} else if ($key == 'gd_region') {
1268
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1269
+							} else if ($key == 'gd_city') {
1270
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1271 1271
 							}
1272 1272
 						} else {
1273 1273
 							$location_info = geodir_get_location();
1274 1274
 
1275
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1276
-								if ( $key == 'gd_country' ) {
1277
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1278
-								} else if ( $key == 'gd_region' ) {
1279
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1280
-								} else if ( $key == 'gd_city' ) {
1281
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1275
+							if (!empty($location_info) && isset($location_info->location_id)) {
1276
+								if ($key == 'gd_country') {
1277
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1278
+								} else if ($key == 'gd_region') {
1279
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1280
+								} else if ($key == 'gd_city') {
1281
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1282 1282
 								}
1283 1283
 							}
1284 1284
 						}
1285 1285
 
1286
-						if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1287
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1288
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1289
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1290
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1291
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1292
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1293
-							$breadcrumb .= $separator . $gd_location_link_text;
1286
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1287
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1288
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1289
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1290
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1291
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1292
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1293
+							$breadcrumb .= $separator.$gd_location_link_text;
1294 1294
 						} else {
1295
-							if ( get_option( 'permalink_structure' ) != '' ) {
1296
-								$location_link .= $location_term . '/';
1295
+							if (get_option('permalink_structure') != '') {
1296
+								$location_link .= $location_term.'/';
1297 1297
 							} else {
1298
-								$location_link .= "&$key=" . $location_term;
1298
+								$location_link .= "&$key=".$location_term;
1299 1299
 							}
1300 1300
 
1301
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1301
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1302 1302
 								$gd_location_link_text = $location_term_actual_country;
1303
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1303
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1304 1304
 								$gd_location_link_text = $location_term_actual_region;
1305
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1305
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1306 1306
 								$gd_location_link_text = $location_term_actual_city;
1307 1307
 							}
1308 1308
 
@@ -1312,76 +1312,76 @@  discard block
 block discarded – undo
1312 1312
                             }
1313 1313
                             */
1314 1314
 
1315
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1315
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1316 1316
 						}
1317 1317
 					}
1318 1318
 				}
1319 1319
 			}
1320 1320
 
1321
-			if ( ! empty( $gd_taxonomy ) ) {
1321
+			if (!empty($gd_taxonomy)) {
1322 1322
 				$term_index = 1;
1323 1323
 
1324 1324
 				//if(get_option('geodir_add_categories_url'))
1325 1325
 				{
1326
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1327
-						$cat_link = $listing_link . 'tags/';
1326
+					if (get_query_var($gd_post_type.'_tags')) {
1327
+						$cat_link = $listing_link.'tags/';
1328 1328
 					} else {
1329 1329
 						$cat_link = $listing_link;
1330 1330
 					}
1331 1331
 
1332
-					foreach ( $location_terms as $key => $location_term ) {
1333
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1332
+					foreach ($location_terms as $key => $location_term) {
1333
+						if ($location_manager && in_array($key, $hide_url_part)) {
1334 1334
 							continue;
1335 1335
 						}
1336 1336
 
1337
-						if ( $location_term != '' ) {
1338
-							if ( get_option( 'permalink_structure' ) != '' ) {
1339
-								$cat_link .= $location_term . '/';
1337
+						if ($location_term != '') {
1338
+							if (get_option('permalink_structure') != '') {
1339
+								$cat_link .= $location_term.'/';
1340 1340
 							}
1341 1341
 						}
1342 1342
 					}
1343 1343
 
1344
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1345
-					foreach ( $term_array as $term ) {
1346
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1347
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1344
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1345
+					foreach ($term_array as $term) {
1346
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1347
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1348 1348
 
1349 1349
 						// get term actual name
1350
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1351
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1352
-							$term_link_text = urldecode( $term_info['name'] );
1350
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1351
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1352
+							$term_link_text = urldecode($term_info['name']);
1353 1353
 						} else {
1354 1354
 							continue;
1355 1355
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1356 1356
 						}
1357 1357
 
1358
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1359
-							$breadcrumb .= $separator . $term_link_text;
1358
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1359
+							$breadcrumb .= $separator.$term_link_text;
1360 1360
 						} else {
1361
-							$cat_link .= $term . '/';
1362
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1361
+							$cat_link .= $term.'/';
1362
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1363 1363
 						}
1364
-						$term_index ++;
1364
+						$term_index++;
1365 1365
 					}
1366 1366
 				}
1367 1367
 
1368 1368
 
1369 1369
 			}
1370 1370
 
1371
-			if ( geodir_is_page( 'detail' ) ) {
1372
-				$breadcrumb .= $separator . get_the_title();
1371
+			if (geodir_is_page('detail')) {
1372
+				$breadcrumb .= $separator.get_the_title();
1373 1373
 			}
1374 1374
 
1375 1375
 			$breadcrumb .= '</li>';
1376 1376
 
1377 1377
 
1378
-		} elseif ( geodir_is_page( 'author' ) ) {
1378
+		} elseif (geodir_is_page('author')) {
1379 1379
 			$user_id             = get_current_user_id();
1380
-			$author_link         = get_author_posts_url( $user_id );
1381
-			$default_author_link = geodir_getlink( $author_link, array(
1380
+			$author_link         = get_author_posts_url($user_id);
1381
+			$default_author_link = geodir_getlink($author_link, array(
1382 1382
 				'geodir_dashbord' => 'true',
1383 1383
 				'stype'           => 'gd_place'
1384
-			), false );
1384
+			), false);
1385 1385
 
1386 1386
 			/**
1387 1387
 			 * Filter author page link.
@@ -1391,16 +1391,16 @@  discard block
 block discarded – undo
1391 1391
 			 * @param string $default_author_link Default author link.
1392 1392
 			 * @param int $user_id                Author ID.
1393 1393
 			 */
1394
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1394
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1395 1395
 
1396 1396
 			$breadcrumb .= '<li>';
1397
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1397
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1398 1398
 
1399
-			if ( isset( $_REQUEST['list'] ) ) {
1400
-				$author_link = geodir_getlink( $author_link, array(
1399
+			if (isset($_REQUEST['list'])) {
1400
+				$author_link = geodir_getlink($author_link, array(
1401 1401
 					'geodir_dashbord' => 'true',
1402 1402
 					'stype'           => $_REQUEST['stype']
1403
-				), false );
1403
+				), false);
1404 1404
 
1405 1405
 				/**
1406 1406
 				 * Filter author page link.
@@ -1411,61 +1411,61 @@  discard block
 block discarded – undo
1411 1411
 				 * @param int $user_id        Author ID.
1412 1412
 				 * @param string $_REQUEST    ['stype'] Post type.
1413 1413
 				 */
1414
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1414
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1415 1415
 
1416
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1417
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1416
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1417
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1418 1418
 			} else {
1419
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1419
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1420 1420
 			}
1421 1421
 
1422 1422
 			$breadcrumb .= '</li>';
1423
-		} elseif ( is_category() || is_single() ) {
1423
+		} elseif (is_category() || is_single()) {
1424 1424
 			$category = get_the_category();
1425
-			if ( is_category() ) {
1426
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1425
+			if (is_category()) {
1426
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1427 1427
 			}
1428
-			if ( is_single() ) {
1429
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1430
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1428
+			if (is_single()) {
1429
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1430
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1431 1431
 			}
1432 1432
 			/* End of my version ##################################################### */
1433
-		} else if ( is_page() ) {
1433
+		} else if (is_page()) {
1434 1434
 			$page_title = get_the_title();
1435 1435
 
1436
-			if ( geodir_is_page( 'location' ) ) {
1436
+			if (geodir_is_page('location')) {
1437 1437
 				$location_page_id = geodir_location_page_id();
1438
-				$loc_post         = get_post( $location_page_id );
1438
+				$loc_post         = get_post($location_page_id);
1439 1439
 				$post_name        = $loc_post->post_name;
1440
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1441
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1440
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1441
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1442 1442
 			}
1443 1443
 
1444
-			$breadcrumb .= '<li>' . $separator;
1445
-			$breadcrumb .= stripslashes_deep( $page_title );
1444
+			$breadcrumb .= '<li>'.$separator;
1445
+			$breadcrumb .= stripslashes_deep($page_title);
1446 1446
 			$breadcrumb .= '</li>';
1447
-		} else if ( is_tag() ) {
1448
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1449
-		} else if ( is_day() ) {
1450
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1451
-			the_time( 'F jS, Y' );
1447
+		} else if (is_tag()) {
1448
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1449
+		} else if (is_day()) {
1450
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1451
+			the_time('F jS, Y');
1452 1452
 			$breadcrumb .= '</li>';
1453
-		} else if ( is_month() ) {
1454
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1455
-			the_time( 'F, Y' );
1453
+		} else if (is_month()) {
1454
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1455
+			the_time('F, Y');
1456 1456
 			$breadcrumb .= '</li>';
1457
-		} else if ( is_year() ) {
1458
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1459
-			the_time( 'Y' );
1457
+		} else if (is_year()) {
1458
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1459
+			the_time('Y');
1460 1460
 			$breadcrumb .= '</li>';
1461
-		} else if ( is_author() ) {
1462
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1461
+		} else if (is_author()) {
1462
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1463 1463
 			$breadcrumb .= '</li>';
1464
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1465
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1464
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1465
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1466 1466
 			$breadcrumb .= '</li>';
1467
-		} else if ( is_search() ) {
1468
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1467
+		} else if (is_search()) {
1468
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1469 1469
 			$breadcrumb .= '</li>';
1470 1470
 		}
1471 1471
 		$breadcrumb .= '</ul></div>';
@@ -1478,13 +1478,13 @@  discard block
 block discarded – undo
1478 1478
 		 * @param string $breadcrumb Breadcrumb HTML.
1479 1479
 		 * @param string $separator  Breadcrumb separator.
1480 1480
 		 */
1481
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1481
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1482 1482
 	}
1483 1483
 }
1484 1484
 
1485 1485
 
1486
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1487
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1486
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1487
+if (!function_exists('geodir_allow_wpadmin')) {
1488 1488
 	/**
1489 1489
 	 * Allow only admins to access wp-admin.
1490 1490
 	 *
@@ -1496,12 +1496,12 @@  discard block
 block discarded – undo
1496 1496
 	 */
1497 1497
 	function geodir_allow_wpadmin() {
1498 1498
 		global $wpdb;
1499
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1499
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1500 1500
 		{
1501
-			if ( current_user_can( 'administrator' ) ) {
1501
+			if (current_user_can('administrator')) {
1502 1502
 			} else {
1503 1503
 
1504
-				wp_redirect( home_url() );
1504
+				wp_redirect(home_url());
1505 1505
 				exit;
1506 1506
 			}
1507 1507
 
@@ -1520,23 +1520,23 @@  discard block
 block discarded – undo
1520 1520
  *
1521 1521
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1522 1522
  */
1523
-function fetch_remote_file( $url ) {
1523
+function fetch_remote_file($url) {
1524 1524
 	// extract the file name and extension from the url
1525
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1526
-	$file_name = basename( $url );
1527
-	if ( strpos( $file_name, '?' ) !== false ) {
1528
-		list( $file_name ) = explode( '?', $file_name );
1525
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1526
+	$file_name = basename($url);
1527
+	if (strpos($file_name, '?') !== false) {
1528
+		list($file_name) = explode('?', $file_name);
1529 1529
 	}
1530 1530
 	$dummy        = false;
1531 1531
 	$add_to_cache = false;
1532 1532
 	$key          = null;
1533
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1533
+	if (strpos($url, '/dummy/') !== false) {
1534 1534
 		$dummy = true;
1535
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1536
-		$value = get_transient( 'cached_dummy_images' );
1537
-		if ( $value ) {
1538
-			if ( isset( $value[ $key ] ) ) {
1539
-				return $value[ $key ];
1535
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1536
+		$value = get_transient('cached_dummy_images');
1537
+		if ($value) {
1538
+			if (isset($value[$key])) {
1539
+				return $value[$key];
1540 1540
 			} else {
1541 1541
 				$add_to_cache = true;
1542 1542
 			}
@@ -1547,58 +1547,58 @@  discard block
 block discarded – undo
1547 1547
 
1548 1548
 	// get placeholder file in the upload dir with a unique, sanitized filename
1549 1549
 
1550
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1550
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1551 1551
 
1552
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1553
-	if ( $upload['error'] ) {
1554
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1552
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1553
+	if ($upload['error']) {
1554
+		return new WP_Error('upload_dir_error', $upload['error']);
1555 1555
 	}
1556 1556
 
1557 1557
 
1558
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1558
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1559 1559
 
1560 1560
 	// fetch the remote url and write it to the placeholder file
1561
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1561
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1562 1562
 
1563 1563
 	$log_message = '';
1564
-	if ( is_wp_error( $headers ) ) {
1565
-		echo 'file: ' . $url;
1564
+	if (is_wp_error($headers)) {
1565
+		echo 'file: '.$url;
1566 1566
 
1567
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1567
+		return new WP_Error('import_file_error', $headers->get_error_message());
1568 1568
 	}
1569 1569
 
1570
-	$filesize = filesize( $upload['file'] );
1570
+	$filesize = filesize($upload['file']);
1571 1571
 	// request failed
1572
-	if ( ! $headers ) {
1573
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1572
+	if (!$headers) {
1573
+		$log_message = __('Remote server did not respond', 'geodirectory');
1574 1574
 	} // make sure the fetch was successful
1575
-	elseif ( $headers['response']['code'] != '200' ) {
1576
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1577
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1578
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1579
-	} elseif ( 0 == $filesize ) {
1580
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1581
-	}
1582
-
1583
-	if ( $log_message ) {
1584
-		$del = unlink( $upload['file'] );
1585
-		if ( ! $del ) {
1586
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1575
+	elseif ($headers['response']['code'] != '200') {
1576
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1577
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1578
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1579
+	} elseif (0 == $filesize) {
1580
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1581
+	}
1582
+
1583
+	if ($log_message) {
1584
+		$del = unlink($upload['file']);
1585
+		if (!$del) {
1586
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1587 1587
 		}
1588 1588
 
1589
-		return new WP_Error( 'import_file_error', $log_message );
1589
+		return new WP_Error('import_file_error', $log_message);
1590 1590
 	}
1591 1591
 
1592
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1593
-		$images = get_transient( 'cached_dummy_images' );
1594
-		if ( is_array( $images ) ) {
1595
-			$images[ $key ] = $upload;
1592
+	if ($dummy && $add_to_cache && is_array($upload)) {
1593
+		$images = get_transient('cached_dummy_images');
1594
+		if (is_array($images)) {
1595
+			$images[$key] = $upload;
1596 1596
 		} else {
1597
-			$images = array( $key => $upload );
1597
+			$images = array($key => $upload);
1598 1598
 		}
1599 1599
 
1600 1600
 		//setting the cache using the WP Transient API
1601
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1601
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1602 1602
 	}
1603 1603
 
1604 1604
 	return $upload;
@@ -1612,12 +1612,12 @@  discard block
 block discarded – undo
1612 1612
  * @return string|void Max upload size.
1613 1613
  */
1614 1614
 function geodir_max_upload_size() {
1615
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1615
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1616 1616
 
1617
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1618
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1617
+	if ($max_filesize > 0 && $max_filesize < 1) {
1618
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1619 1619
 	} else {
1620
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1620
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1621 1621
 	}
1622 1622
 
1623 1623
 	/**
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 	 *
1628 1628
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1629 1629
 	 */
1630
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1630
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1631 1631
 }
1632 1632
 
1633 1633
 /**
@@ -1640,8 +1640,8 @@  discard block
 block discarded – undo
1640 1640
  * @return bool If dummy folder exists returns true, else false.
1641 1641
  */
1642 1642
 function geodir_dummy_folder_exists() {
1643
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1644
-	if ( ! is_dir( $path ) ) {
1643
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1644
+	if (!is_dir($path)) {
1645 1645
 		return false;
1646 1646
 	} else {
1647 1647
 		return true;
@@ -1660,17 +1660,17 @@  discard block
 block discarded – undo
1660 1660
  *
1661 1661
  * @return object Author info.
1662 1662
  */
1663
-function geodir_get_author_info( $aid ) {
1663
+function geodir_get_author_info($aid) {
1664 1664
 	global $wpdb;
1665 1665
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1666
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1667
-	$info    = $wpdb->get_results( $infosql );
1668
-	if ( $info ) {
1666
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1667
+	$info    = $wpdb->get_results($infosql);
1668
+	if ($info) {
1669 1669
 		return $info[0];
1670 1670
 	}
1671 1671
 }
1672 1672
 
1673
-if ( ! function_exists( 'adminEmail' ) ) {
1673
+if (!function_exists('adminEmail')) {
1674 1674
 	/**
1675 1675
 	 * Send emails to client on post submission, renew etc.
1676 1676
 	 *
@@ -1683,67 +1683,67 @@  discard block
 block discarded – undo
1683 1683
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1684 1684
 	 * @param string $custom_1     Custom data to be sent.
1685 1685
 	 */
1686
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1686
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1687 1687
 		global $wpdb;
1688
-		if ( $message_type == 'expiration' ) {
1689
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1690
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1691
-		} elseif ( $message_type == 'post_submited' ) {
1692
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1693
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1694
-		} elseif ( $message_type == 'renew' ) {
1695
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1696
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1697
-		} elseif ( $message_type == 'upgrade' ) {
1698
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1699
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1700
-		} elseif ( $message_type == 'claim_approved' ) {
1701
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1702
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1703
-		} elseif ( $message_type == 'claim_rejected' ) {
1704
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1705
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1706
-		} elseif ( $message_type == 'claim_requested' ) {
1707
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1708
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1709
-		} elseif ( $message_type == 'auto_claim' ) {
1710
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1711
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1712
-		} elseif ( $message_type == 'payment_success' ) {
1713
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1714
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1715
-		} elseif ( $message_type == 'payment_fail' ) {
1716
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1717
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1688
+		if ($message_type == 'expiration') {
1689
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1690
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1691
+		} elseif ($message_type == 'post_submited') {
1692
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1693
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1694
+		} elseif ($message_type == 'renew') {
1695
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1696
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1697
+		} elseif ($message_type == 'upgrade') {
1698
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1699
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1700
+		} elseif ($message_type == 'claim_approved') {
1701
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1702
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1703
+		} elseif ($message_type == 'claim_rejected') {
1704
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1705
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1706
+		} elseif ($message_type == 'claim_requested') {
1707
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1708
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1709
+		} elseif ($message_type == 'auto_claim') {
1710
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1711
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1712
+		} elseif ($message_type == 'payment_success') {
1713
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1714
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1715
+		} elseif ($message_type == 'payment_fail') {
1716
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1717
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1718 1718
 		}
1719 1719
 		$transaction_details = $custom_1;
1720
-		$fromEmail           = get_option( 'site_email' );
1720
+		$fromEmail           = get_option('site_email');
1721 1721
 		$fromEmailName       = get_site_emailName();
1722 1722
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1723
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1723
+		$pkg_limit            = get_property_price_info_listing($page_id);
1724 1724
 		$alivedays            = $pkg_limit['days'];
1725
-		$productlink          = get_permalink( $page_id );
1726
-		$post_info            = get_post( $page_id );
1727
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1728
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1725
+		$productlink          = get_permalink($page_id);
1726
+		$post_info            = get_post($page_id);
1727
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1728
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1729 1729
 		$loginurl             = geodir_login_url();
1730
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1730
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1731 1731
 		$siteurl              = home_url();
1732
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1733
-		$user_info            = get_userdata( $user_id );
1732
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1733
+		$user_info            = get_userdata($user_id);
1734 1734
 		$user_email           = $user_info->user_email;
1735
-		$display_name         = geodir_get_client_name( $user_id );
1735
+		$display_name         = geodir_get_client_name($user_id);
1736 1736
 		$user_login           = $user_info->user_login;
1737
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1738
-		if ( $number_of_grace_days == '' ) {
1737
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1738
+		if ($number_of_grace_days == '') {
1739 1739
 			$number_of_grace_days = 1;
1740 1740
 		}
1741
-		if ( $post_info->post_type == 'event' ) {
1741
+		if ($post_info->post_type == 'event') {
1742 1742
 			$post_type = 'event';
1743 1743
 		} else {
1744 1744
 			$post_type = 'listing';
1745 1745
 		}
1746
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1746
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1747 1747
 		$search_array   = array(
1748 1748
 			'[#client_name#]',
1749 1749
 			'[#listing_link#]',
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 			'[#site_name#]',
1760 1760
 			'[#transaction_details#]'
1761 1761
 		);
1762
-		$replace_array  = array(
1762
+		$replace_array = array(
1763 1763
 			$display_name,
1764 1764
 			$listingLink,
1765 1765
 			$post_date,
@@ -1774,11 +1774,11 @@  discard block
 block discarded – undo
1774 1774
 			$fromEmailName,
1775 1775
 			$transaction_details
1776 1776
 		);
1777
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1778
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1779
-		$headers        = 'MIME-Version: 1.0' . "\r\n";
1780
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1781
-		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1777
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1778
+		$subject        = str_replace($search_array, $replace_array, $subject);
1779
+		$headers        = 'MIME-Version: 1.0'."\r\n";
1780
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1781
+		$headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1782 1782
 
1783 1783
 		$to      = $fromEmail;
1784 1784
 		$message = $client_message;
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1797 1797
 		 * @param string $custom_1     Custom data to be sent.
1798 1798
 		 */
1799
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1799
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1800 1800
 		/**
1801 1801
 		 * Filter the admin email subject.
1802 1802
 		 *
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1810 1810
 		 * @param string $custom_1     Custom data to be sent.
1811 1811
 		 */
1812
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1812
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1813 1813
 		/**
1814 1814
 		 * Filter the admin email message.
1815 1815
 		 *
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1823 1823
 		 * @param string $custom_1     Custom data to be sent.
1824 1824
 		 */
1825
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1825
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1826 1826
 		/**
1827 1827
 		 * Filter the admin email headers.
1828 1828
 		 *
@@ -1835,27 +1835,27 @@  discard block
 block discarded – undo
1835 1835
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1836 1836
 		 * @param string $custom_1     Custom data to be sent.
1837 1837
 		 */
1838
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1838
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1839 1839
 
1840 1840
 
1841
-		$sent = wp_mail( $to, $subject, $message, $headers );
1842
-		if ( ! $sent ) {
1843
-			if ( is_array( $to ) ) {
1844
-				$to = implode( ',', $to );
1841
+		$sent = wp_mail($to, $subject, $message, $headers);
1842
+		if (!$sent) {
1843
+			if (is_array($to)) {
1844
+				$to = implode(',', $to);
1845 1845
 			}
1846 1846
 			$log_message = sprintf(
1847
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1847
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1848 1848
 				$message_type,
1849
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1849
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1850 1850
 				$to,
1851 1851
 				$subject
1852 1852
 			);
1853
-			geodir_error_log( $log_message );
1853
+			geodir_error_log($log_message);
1854 1854
 		}
1855 1855
 	}
1856 1856
 }
1857 1857
 
1858
-if ( ! function_exists( 'sendEmail' ) ) {
1858
+if (!function_exists('sendEmail')) {
1859 1859
 	/**
1860 1860
 	 * @todo    could be a duplicate of geodir_sendEmail.
1861 1861
 	 *
@@ -1873,40 +1873,40 @@  discard block
 block discarded – undo
1873 1873
 	 * @param string $post_id       The post ID.
1874 1874
 	 * @param string $user_id       The user ID.
1875 1875
 	 */
1876
-	function sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
1876
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
1877 1877
 		$login_details = '';
1878
-		if ( $message_type == 'send_friend' ) {
1879
-			$subject = stripslashes( __( get_option( 'email_friend_subject' ), 'geodirectory' ) );
1880
-			$message = stripslashes( __( get_option( 'email_friend_content' ), 'geodirectory' ) );
1881
-		} elseif ( $message_type == 'send_enquiry' ) {
1882
-			$subject = __( get_option( 'email_enquiry_subject' ), 'geodirectory' );
1883
-			$message = __( get_option( 'email_enquiry_content' ), 'geodirectory' );
1884
-		} elseif ( $message_type == 'forgot_password' ) {
1885
-			$subject       = __( get_option( 'forgot_password_subject' ), 'geodirectory' );
1886
-			$message       = __( get_option( 'forgot_password_content' ), 'geodirectory' );
1878
+		if ($message_type == 'send_friend') {
1879
+			$subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1880
+			$message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1881
+		} elseif ($message_type == 'send_enquiry') {
1882
+			$subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1883
+			$message = __(get_option('email_enquiry_content'), 'geodirectory');
1884
+		} elseif ($message_type == 'forgot_password') {
1885
+			$subject       = __(get_option('forgot_password_subject'), 'geodirectory');
1886
+			$message       = __(get_option('forgot_password_content'), 'geodirectory');
1887 1887
 			$login_details = $to_message;
1888
-		} elseif ( $message_type == 'registration' ) {
1889
-			$subject       = __( get_option( 'registration_success_email_subject' ), 'geodirectory' );
1890
-			$message       = __( get_option( 'registration_success_email_content' ), 'geodirectory' );
1888
+		} elseif ($message_type == 'registration') {
1889
+			$subject       = __(get_option('registration_success_email_subject'), 'geodirectory');
1890
+			$message       = __(get_option('registration_success_email_content'), 'geodirectory');
1891 1891
 			$login_details = $to_message;
1892 1892
 		}
1893
-		$to_message        = nl2br( $to_message );
1894
-		$sitefromEmail     = get_option( 'site_email' );
1893
+		$to_message        = nl2br($to_message);
1894
+		$sitefromEmail     = get_option('site_email');
1895 1895
 		$sitefromEmailName = get_site_emailName();
1896
-		$productlink       = get_permalink( $post_id );
1897
-		$post_info         = get_post( $post_id );
1898
-		$listingLink       = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1896
+		$productlink       = get_permalink($post_id);
1897
+		$post_info         = get_post($post_id);
1898
+		$listingLink       = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1899 1899
 		$siteurl           = home_url();
1900
-		$siteurl_link      = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1900
+		$siteurl_link      = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
1901 1901
 		$loginurl          = geodir_login_url();
1902
-		$loginurl_link     = '<a href="' . $loginurl . '">login</a>';
1903
-		if ( $fromEmail == '' ) {
1904
-			$fromEmail = get_option( 'site_email' );
1902
+		$loginurl_link     = '<a href="'.$loginurl.'">login</a>';
1903
+		if ($fromEmail == '') {
1904
+			$fromEmail = get_option('site_email');
1905 1905
 		}
1906
-		if ( $fromEmailName == '' ) {
1907
-			$fromEmailName = get_option( 'site_email_name' );
1906
+		if ($fromEmailName == '') {
1907
+			$fromEmailName = get_option('site_email_name');
1908 1908
 		}
1909
-		$search_array  = array(
1909
+		$search_array = array(
1910 1910
 			'[#listing_link#]',
1911 1911
 			'[#site_name_url#]',
1912 1912
 			'[#post_id#]',
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
 			$login_details,
1933 1933
 			$toEmailName
1934 1934
 		);
1935
-		$message       = str_replace( $search_array, $replace_array, $message );
1935
+		$message       = str_replace($search_array, $replace_array, $message);
1936 1936
 
1937 1937
 		$search_array  = array(
1938 1938
 			'[#listing_link#]',
@@ -1954,64 +1954,64 @@  discard block
 block discarded – undo
1954 1954
 			$to_subject,
1955 1955
 			$toEmailName
1956 1956
 		);
1957
-		$subject       = str_replace( $search_array, $replace_array, $subject );
1958
-		$headers       = 'MIME-Version: 1.0' . "\r\n";
1959
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1960
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1961
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1957
+		$subject       = str_replace($search_array, $replace_array, $subject);
1958
+		$headers       = 'MIME-Version: 1.0'."\r\n";
1959
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1960
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
1961
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
1962 1962
 
1963 1963
 		$to = $toEmail;
1964 1964
 
1965
-		$sent = wp_mail( $to, $subject, $message, $headers );
1966
-		if ( ! $sent ) {
1967
-			if ( is_array( $to ) ) {
1968
-				$to = implode( ',', $to );
1965
+		$sent = wp_mail($to, $subject, $message, $headers);
1966
+		if (!$sent) {
1967
+			if (is_array($to)) {
1968
+				$to = implode(',', $to);
1969 1969
 			}
1970 1970
 			$log_message = sprintf(
1971
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1971
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1972 1972
 				$message_type,
1973
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1973
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1974 1974
 				$to,
1975 1975
 				$subject
1976 1976
 			);
1977
-			geodir_error_log( $log_message );
1977
+			geodir_error_log($log_message);
1978 1978
 		}
1979 1979
 
1980 1980
 		///////// ADMIN BCC EMIALS
1981 1981
 		$admin_bcc = false;
1982
-		if ( $message_type == 'registration' ) {
1983
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1984
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1985
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1982
+		if ($message_type == 'registration') {
1983
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1984
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1985
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1986 1986
 		}
1987
-		$adminEmail = get_bloginfo( 'admin_email' );
1987
+		$adminEmail = get_bloginfo('admin_email');
1988 1988
 		$to         = $adminEmail;
1989 1989
 
1990
-		if ( $message_type == 'registration' && get_option( 'bcc_new_user' ) ) {
1990
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1991 1991
 			$subject .= ' - ADMIN BCC COPY';
1992 1992
 			$admin_bcc = true;
1993
-		} elseif ( $message_type == 'send_friend' && get_option( 'bcc_friend' ) ) {
1993
+		} elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1994 1994
 			$subject .= ' - ADMIN BCC COPY';
1995 1995
 			$admin_bcc = true;
1996
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'bcc_enquiry' ) ) {
1996
+		} elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1997 1997
 			$subject .= ' - ADMIN BCC COPY';
1998 1998
 			$admin_bcc = true;
1999 1999
 		}
2000 2000
 
2001
-		if ( $admin_bcc === true ) {
2002
-			$sent = wp_mail( $to, $subject, $message, $headers );
2003
-			if ( ! $sent ) {
2004
-				if ( is_array( $to ) ) {
2005
-					$to = implode( ',', $to );
2001
+		if ($admin_bcc === true) {
2002
+			$sent = wp_mail($to, $subject, $message, $headers);
2003
+			if (!$sent) {
2004
+				if (is_array($to)) {
2005
+					$to = implode(',', $to);
2006 2006
 				}
2007 2007
 				$log_message = sprintf(
2008
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
2008
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
2009 2009
 					$message_type,
2010
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
2010
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
2011 2011
 					$to,
2012 2012
 					$subject
2013 2013
 				);
2014
-				geodir_error_log( $log_message );
2014
+				geodir_error_log($log_message);
2015 2015
 			}
2016 2016
 		}
2017 2017
 
@@ -2033,12 +2033,12 @@  discard block
 block discarded – undo
2033 2033
  *
2034 2034
  * @return array Category IDs.
2035 2035
  */
2036
-function gd_lang_object_ids( $ids_array, $type ) {
2037
-	if ( function_exists( 'icl_object_id' ) ) {
2036
+function gd_lang_object_ids($ids_array, $type) {
2037
+	if (function_exists('icl_object_id')) {
2038 2038
 		$res = array();
2039
-		foreach ( $ids_array as $id ) {
2040
-			$xlat = icl_object_id( $id, $type, false );
2041
-			if ( ! is_null( $xlat ) ) {
2039
+		foreach ($ids_array as $id) {
2040
+			$xlat = icl_object_id($id, $type, false);
2041
+			if (!is_null($xlat)) {
2042 2042
 				$res[] = $xlat;
2043 2043
 			}
2044 2044
 		}
@@ -2062,20 +2062,20 @@  discard block
 block discarded – undo
2062 2062
  *
2063 2063
  * @return array Modified Body CSS classes.
2064 2064
  */
2065
-function geodir_custom_posts_body_class( $classes ) {
2065
+function geodir_custom_posts_body_class($classes) {
2066 2066
 	global $wpdb, $wp;
2067
-	$post_types = geodir_get_posttypes( 'object' );
2068
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2067
+	$post_types = geodir_get_posttypes('object');
2068
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2069 2069
 		$classes[] = 'geodir_custom_posts';
2070 2070
 	}
2071 2071
 
2072 2072
 	// fix body class for signup page
2073
-	if ( geodir_is_page( 'login' ) ) {
2073
+	if (geodir_is_page('login')) {
2074 2074
 		$new_classes   = array();
2075 2075
 		$new_classes[] = 'signup page-geodir-signup';
2076
-		if ( ! empty( $classes ) ) {
2077
-			foreach ( $classes as $class ) {
2078
-				if ( $class && $class != 'home' && $class != 'blog' ) {
2076
+		if (!empty($classes)) {
2077
+			foreach ($classes as $class) {
2078
+				if ($class && $class != 'home' && $class != 'blog') {
2079 2079
 					$new_classes[] = $class;
2080 2080
 				}
2081 2081
 			}
@@ -2083,14 +2083,14 @@  discard block
 block discarded – undo
2083 2083
 		$classes = $new_classes;
2084 2084
 	}
2085 2085
 
2086
-	if ( geodir_is_geodir_page() ) {
2086
+	if (geodir_is_geodir_page()) {
2087 2087
 		$classes[] = 'geodir-page';
2088 2088
 	}
2089 2089
 
2090 2090
 	return $classes;
2091 2091
 }
2092 2092
 
2093
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2093
+add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
2094 2094
 
2095 2095
 
2096 2096
 /**
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 *
2107 2107
 	 * @since 1.0.0
2108 2108
 	 */
2109
-	return apply_filters( 'geodir_map_zoom_level', array(
2109
+	return apply_filters('geodir_map_zoom_level', array(
2110 2110
 		1,
2111 2111
 		2,
2112 2112
 		3,
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
 		17,
2127 2127
 		18,
2128 2128
 		19
2129
-	) );
2129
+	));
2130 2130
 
2131 2131
 }
2132 2132
 
@@ -2139,12 +2139,12 @@  discard block
 block discarded – undo
2139 2139
  *
2140 2140
  * @param string $geodir_option_name Option key.
2141 2141
  */
2142
-function geodir_option_version_backup( $geodir_option_name ) {
2142
+function geodir_option_version_backup($geodir_option_name) {
2143 2143
 	$version_date  = time();
2144
-	$geodir_option = get_option( $geodir_option_name );
2144
+	$geodir_option = get_option($geodir_option_name);
2145 2145
 
2146
-	if ( ! empty( $geodir_option ) ) {
2147
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2146
+	if (!empty($geodir_option)) {
2147
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2148 2148
 	}
2149 2149
 }
2150 2150
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
  *
2159 2159
  * @return int Page ID.
2160 2160
  */
2161
-function get_page_id_geodir_add_listing_page( $page_id ) {
2162
-	if ( geodir_wpml_multilingual_status() ) {
2161
+function get_page_id_geodir_add_listing_page($page_id) {
2162
+	if (geodir_wpml_multilingual_status()) {
2163 2163
 		$post_type = 'post_page';
2164
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2164
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2165 2165
 	}
2166 2166
 
2167 2167
 	return $page_id;
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2176 2176
  */
2177 2177
 function geodir_wpml_multilingual_status() {
2178
-	if ( function_exists( 'icl_object_id' ) ) {
2178
+	if (function_exists('icl_object_id')) {
2179 2179
 		return true;
2180 2180
 	}
2181 2181
 
@@ -2193,19 +2193,19 @@  discard block
 block discarded – undo
2193 2193
  *
2194 2194
  * @return int Element ID when exists. Else the page id.
2195 2195
  */
2196
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2196
+function geodir_get_wpml_element_id($page_id, $post_type) {
2197 2197
 	global $sitepress;
2198
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2199
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2198
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2199
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2200 2200
 
2201
-		if ( $trid > 0 ) {
2202
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2201
+		if ($trid > 0) {
2202
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2203 2203
 
2204 2204
 			$lang = $sitepress->get_current_language();
2205 2205
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2206 2206
 
2207
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2208
-				$page_id = $translations[ $lang ]->element_id;
2207
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2208
+				$page_id = $translations[$lang]->element_id;
2209 2209
 			}
2210 2210
 		}
2211 2211
 	}
@@ -2222,15 +2222,15 @@  discard block
 block discarded – undo
2222 2222
  */
2223 2223
 function geodir_wpml_check_element_id() {
2224 2224
 	global $sitepress;
2225
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2225
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2226 2226
 		$el_type      = 'post_page';
2227
-		$el_id        = get_option( 'geodir_add_listing_page' );
2227
+		$el_id        = get_option('geodir_add_listing_page');
2228 2228
 		$default_lang = $sitepress->get_default_language();
2229
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2229
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2230 2230
 
2231
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2232
-			if ( ! $el_details->source_language_code ) {
2233
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2231
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2232
+			if (!$el_details->source_language_code) {
2233
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2234 2234
 				$sitepress->icl_translations_cache->clear();
2235 2235
 			}
2236 2236
 		}
@@ -2249,41 +2249,41 @@  discard block
 block discarded – undo
2249 2249
  *
2250 2250
  * @return string Orderby SQL.
2251 2251
  */
2252
-function geodir_widget_listings_get_order( $query_args ) {
2252
+function geodir_widget_listings_get_order($query_args) {
2253 2253
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2254 2254
 
2255 2255
 	$query_args = $gd_query_args_widgets;
2256
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2257
-		return $wpdb->posts . ".post_date DESC, ";
2256
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2257
+		return $wpdb->posts.".post_date DESC, ";
2258 2258
 	}
2259 2259
 
2260
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2261
-	$table     = $plugin_prefix . $post_type . '_detail';
2260
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2261
+	$table     = $plugin_prefix.$post_type.'_detail';
2262 2262
 
2263
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2263
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2264 2264
 
2265
-	switch ( $sort_by ) {
2265
+	switch ($sort_by) {
2266 2266
 		case 'latest':
2267 2267
 		case 'newest':
2268
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2268
+			$orderby = $wpdb->posts.".post_date DESC, ";
2269 2269
 			break;
2270 2270
 		case 'featured':
2271
-			$orderby = $table . ".is_featured ASC, ";
2271
+			$orderby = $table.".is_featured ASC, ";
2272 2272
 			break;
2273 2273
 		case 'az':
2274
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2274
+			$orderby = $wpdb->posts.".post_title ASC, ";
2275 2275
 			break;
2276 2276
 		case 'high_review':
2277
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2277
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2278 2278
 			break;
2279 2279
 		case 'high_rating':
2280
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2280
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2281 2281
 			break;
2282 2282
 		case 'random':
2283 2283
 			$orderby = "RAND(), ";
2284 2284
 			break;
2285 2285
 		default:
2286
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2286
+			$orderby = $wpdb->posts.".post_title ASC, ";
2287 2287
 			break;
2288 2288
 	}
2289 2289
 
@@ -2305,15 +2305,15 @@  discard block
 block discarded – undo
2305 2305
  *
2306 2306
  * @return mixed Result object.
2307 2307
  */
2308
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2308
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2309 2309
 	global $wpdb, $plugin_prefix, $table_prefix;
2310 2310
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2311 2311
 	$gd_query_args_widgets            = $query_args;
2312 2312
 
2313
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2314
-	$table     = $plugin_prefix . $post_type . '_detail';
2313
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2314
+	$table     = $plugin_prefix.$post_type.'_detail';
2315 2315
 
2316
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2316
+	$fields = $wpdb->posts.".*, ".$table.".*";
2317 2317
 	/**
2318 2318
 	 * Filter widget listing fields string part that is being used for query.
2319 2319
 	 *
@@ -2323,17 +2323,17 @@  discard block
 block discarded – undo
2323 2323
 	 * @param string $table     Table name.
2324 2324
 	 * @param string $post_type Post type.
2325 2325
 	 */
2326
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2326
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2327 2327
 
2328
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2328
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2329 2329
 
2330 2330
 	########### WPML ###########
2331 2331
 
2332
-	if ( function_exists( 'icl_object_id' ) ) {
2332
+	if (function_exists('icl_object_id')) {
2333 2333
 		global $sitepress;
2334 2334
 		$lang_code = ICL_LANGUAGE_CODE;
2335
-		if ( $lang_code ) {
2336
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2335
+		if ($lang_code) {
2336
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2337 2337
 		}
2338 2338
 	}
2339 2339
 
@@ -2347,15 +2347,15 @@  discard block
 block discarded – undo
2347 2347
 	 * @param string $join      Join clause string.
2348 2348
 	 * @param string $post_type Post type.
2349 2349
 	 */
2350
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2350
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2351 2351
 
2352
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2352
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2353 2353
 
2354
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2354
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2355 2355
 
2356 2356
 	########### WPML ###########
2357
-	if ( function_exists( 'icl_object_id' ) ) {
2358
-		if ( $lang_code ) {
2357
+	if (function_exists('icl_object_id')) {
2358
+		if ($lang_code) {
2359 2359
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2360 2360
 		}
2361 2361
 	}
@@ -2368,8 +2368,8 @@  discard block
 block discarded – undo
2368 2368
 	 * @param string $where     Where clause string.
2369 2369
 	 * @param string $post_type Post type.
2370 2370
 	 */
2371
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2372
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2371
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2372
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2373 2373
 
2374 2374
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2375 2375
 	/**
@@ -2380,15 +2380,15 @@  discard block
 block discarded – undo
2380 2380
 	 * @param string $groupby   Group by clause string.
2381 2381
 	 * @param string $post_type Post type.
2382 2382
 	 */
2383
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2383
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2384 2384
 
2385
-	if ( $count_only ) {
2386
-		$sql  = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2387
-			" . $join . "
2385
+	if ($count_only) {
2386
+		$sql  = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2387
+			" . $join."
2388 2388
 			" . $where;
2389
-		$rows = (int) $wpdb->get_var( $sql );
2389
+		$rows = (int) $wpdb->get_var($sql);
2390 2390
 	} else {
2391
-		$orderby = geodir_widget_listings_get_order( $query_args );
2391
+		$orderby = geodir_widget_listings_get_order($query_args);
2392 2392
 		/**
2393 2393
 		 * Filter widget listing orderby clause string part that is being used for query.
2394 2394
 		 *
@@ -2398,11 +2398,11 @@  discard block
 block discarded – undo
2398 2398
 		 * @param string $table     Table name.
2399 2399
 		 * @param string $post_type Post type.
2400 2400
 		 */
2401
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2402
-		$orderby .= $wpdb->posts . ".post_title ASC";
2403
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2401
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2402
+		$orderby .= $wpdb->posts.".post_title ASC";
2403
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2404 2404
 
2405
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2405
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2406 2406
 		/**
2407 2407
 		 * Filter widget listing limit that is being used for query.
2408 2408
 		 *
@@ -2411,26 +2411,26 @@  discard block
 block discarded – undo
2411 2411
 		 * @param int $limit        Query results limit.
2412 2412
 		 * @param string $post_type Post type.
2413 2413
 		 */
2414
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2414
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2415 2415
 
2416
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2417
-		if ( ! $page ) {
2416
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2417
+		if (!$page) {
2418 2418
 			$page = 1;
2419 2419
 		}
2420 2420
 
2421
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2421
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2422 2422
 
2423
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2424
-			" . $join . "
2425
-			" . $where . "
2426
-			" . $groupby . "
2427
-			" . $orderby . "
2423
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2424
+			" . $join."
2425
+			" . $where."
2426
+			" . $groupby."
2427
+			" . $orderby."
2428 2428
 			" . $limit;
2429
-		$rows = $wpdb->get_results( $sql );
2429
+		$rows = $wpdb->get_results($sql);
2430 2430
 	}
2431 2431
 
2432
-	unset( $GLOBALS['gd_query_args_widgets'] );
2433
-	unset( $gd_query_args_widgets );
2432
+	unset($GLOBALS['gd_query_args_widgets']);
2433
+	unset($gd_query_args_widgets);
2434 2434
 
2435 2435
 	return $rows;
2436 2436
 }
@@ -2447,11 +2447,11 @@  discard block
 block discarded – undo
2447 2447
  *
2448 2448
  * @return string Modified fields SQL.
2449 2449
  */
2450
-function geodir_function_widget_listings_fields( $fields ) {
2450
+function geodir_function_widget_listings_fields($fields) {
2451 2451
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2452 2452
 
2453 2453
 	$query_args = $gd_query_args_widgets;
2454
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2454
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2455 2455
 		return $fields;
2456 2456
 	}
2457 2457
 
@@ -2470,24 +2470,24 @@  discard block
 block discarded – undo
2470 2470
  *
2471 2471
  * @return string Modified join clause SQL.
2472 2472
  */
2473
-function geodir_function_widget_listings_join( $join ) {
2473
+function geodir_function_widget_listings_join($join) {
2474 2474
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2475 2475
 
2476 2476
 	$query_args = $gd_query_args_widgets;
2477
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2477
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2478 2478
 		return $join;
2479 2479
 	}
2480 2480
 
2481
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2482
-	$table     = $plugin_prefix . $post_type . '_detail';
2481
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2482
+	$table     = $plugin_prefix.$post_type.'_detail';
2483 2483
 
2484
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2485
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2484
+	if (!empty($query_args['with_pics_only'])) {
2485
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2486 2486
 	}
2487 2487
 
2488
-	if ( ! empty( $query_args['tax_query'] ) ) {
2489
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2490
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2488
+	if (!empty($query_args['tax_query'])) {
2489
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2490
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2491 2491
 			$join .= $tax_queries['join'];
2492 2492
 		}
2493 2493
 	}
@@ -2507,49 +2507,49 @@  discard block
 block discarded – undo
2507 2507
  *
2508 2508
  * @return string Modified where clause SQL.
2509 2509
  */
2510
-function geodir_function_widget_listings_where( $where ) {
2510
+function geodir_function_widget_listings_where($where) {
2511 2511
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2512 2512
 
2513 2513
 	$query_args = $gd_query_args_widgets;
2514
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2514
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2515 2515
 		return $where;
2516 2516
 	}
2517
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2518
-	$table     = $plugin_prefix . $post_type . '_detail';
2517
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2518
+	$table     = $plugin_prefix.$post_type.'_detail';
2519 2519
 
2520
-	if ( ! empty( $query_args ) ) {
2521
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2522
-			$where = geodir_default_location_where( $where, $table );
2520
+	if (!empty($query_args)) {
2521
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2522
+			$where = geodir_default_location_where($where, $table);
2523 2523
 		}
2524 2524
 
2525
-		if ( ! empty( $query_args['post_author'] ) ) {
2526
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2525
+		if (!empty($query_args['post_author'])) {
2526
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2527 2527
 		}
2528 2528
 
2529
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2530
-			$where .= " AND " . $table . ".is_featured = '1'";
2529
+		if (!empty($query_args['show_featured_only'])) {
2530
+			$where .= " AND ".$table.".is_featured = '1'";
2531 2531
 		}
2532 2532
 
2533
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2534
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2533
+		if (!empty($query_args['show_special_only'])) {
2534
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2535 2535
 		}
2536 2536
 
2537
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2538
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2537
+		if (!empty($query_args['with_pics_only'])) {
2538
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2539 2539
 		}
2540 2540
 
2541
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2542
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2541
+		if (!empty($query_args['featured_image_only'])) {
2542
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2543 2543
 		}
2544 2544
 
2545
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2546
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2545
+		if (!empty($query_args['with_videos_only'])) {
2546
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2547 2547
 		}
2548 2548
 
2549
-		if ( ! empty( $query_args['tax_query'] ) ) {
2550
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2549
+		if (!empty($query_args['tax_query'])) {
2550
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2551 2551
 
2552
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2552
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2553 2553
 				$where .= $tax_queries['where'];
2554 2554
 			}
2555 2555
 		}
@@ -2570,11 +2570,11 @@  discard block
 block discarded – undo
2570 2570
  *
2571 2571
  * @return string Modified orderby clause SQL.
2572 2572
  */
2573
-function geodir_function_widget_listings_orderby( $orderby ) {
2573
+function geodir_function_widget_listings_orderby($orderby) {
2574 2574
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2575 2575
 
2576 2576
 	$query_args = $gd_query_args_widgets;
2577
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2577
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2578 2578
 		return $orderby;
2579 2579
 	}
2580 2580
 
@@ -2593,15 +2593,15 @@  discard block
 block discarded – undo
2593 2593
  *
2594 2594
  * @return int Query limit.
2595 2595
  */
2596
-function geodir_function_widget_listings_limit( $limit ) {
2596
+function geodir_function_widget_listings_limit($limit) {
2597 2597
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2598 2598
 
2599 2599
 	$query_args = $gd_query_args_widgets;
2600
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2600
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2601 2601
 		return $limit;
2602 2602
 	}
2603 2603
 
2604
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2604
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2605 2605
 		$limit = (int) $query_args['posts_per_page'];
2606 2606
 	}
2607 2607
 
@@ -2619,12 +2619,12 @@  discard block
 block discarded – undo
2619 2619
  *
2620 2620
  * @return int Large size width.
2621 2621
  */
2622
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2623
-	$large_size_w = get_option( 'large_size_w' );
2622
+function geodir_media_image_large_width($default = 800, $params = '') {
2623
+	$large_size_w = get_option('large_size_w');
2624 2624
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2625
-	$large_size_w = absint( $large_size_w );
2625
+	$large_size_w = absint($large_size_w);
2626 2626
 
2627
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2627
+	if (!get_option('geodir_use_wp_media_large_size')) {
2628 2628
 		$large_size_w = 800;
2629 2629
 	}
2630 2630
 
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 	 * @param int $default         Default width.
2638 2638
 	 * @param string|array $params Image parameters.
2639 2639
 	 */
2640
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2640
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2641 2641
 
2642 2642
 	return $large_size_w;
2643 2643
 }
@@ -2653,12 +2653,12 @@  discard block
 block discarded – undo
2653 2653
  *
2654 2654
  * @return int Large size height.
2655 2655
  */
2656
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2657
-	$large_size_h = get_option( 'large_size_h' );
2656
+function geodir_media_image_large_height($default = 800, $params = '') {
2657
+	$large_size_h = get_option('large_size_h');
2658 2658
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2659
-	$large_size_h = absint( $large_size_h );
2659
+	$large_size_h = absint($large_size_h);
2660 2660
 
2661
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2661
+	if (!get_option('geodir_use_wp_media_large_size')) {
2662 2662
 		$large_size_h = 800;
2663 2663
 	}
2664 2664
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 	 * @param int $default         Default height.
2672 2672
 	 * @param string|array $params Image parameters.
2673 2673
 	 */
2674
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2674
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2675 2675
 
2676 2676
 	return $large_size_h;
2677 2677
 }
@@ -2688,8 +2688,8 @@  discard block
 block discarded – undo
2688 2688
  *
2689 2689
  * @return string Sanitized name.
2690 2690
  */
2691
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2692
-	if ( $name == '' ) {
2691
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2692
+	if ($name == '') {
2693 2693
 		return null;
2694 2694
 	}
2695 2695
 
@@ -2698,13 +2698,13 @@  discard block
 block discarded – undo
2698 2698
 	$type = $type == 'gd_city' ? 'city' : $type;
2699 2699
 
2700 2700
 	$return = $name;
2701
-	if ( function_exists( 'get_actual_location_name' ) ) {
2702
-		$return = get_actual_location_name( $type, $name, $translate );
2701
+	if (function_exists('get_actual_location_name')) {
2702
+		$return = get_actual_location_name($type, $name, $translate);
2703 2703
 	} else {
2704
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2705
-		$return = preg_replace( '/[_-]/', ' ', $return );
2706
-		$return = geodir_ucwords( $return );
2707
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2704
+		$return = preg_replace('/-(\d+)$/', '', $return);
2705
+		$return = preg_replace('/[_-]/', ' ', $return);
2706
+		$return = geodir_ucwords($return);
2707
+		$return = $translate ? __($return, 'geodirectory') : $return;
2708 2708
 	}
2709 2709
 
2710 2710
 	return $return;
@@ -2719,14 +2719,14 @@  discard block
 block discarded – undo
2719 2719
  *
2720 2720
  * @param int $number Comments number.
2721 2721
  */
2722
-function geodir_comments_number( $number ) {
2722
+function geodir_comments_number($number) {
2723 2723
 
2724
-	if ( $number > 1 ) {
2725
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2726
-	} elseif ( $number == 0 || $number == '' ) {
2727
-		$output = __( 'No Reviews', 'geodirectory' );
2724
+	if ($number > 1) {
2725
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2726
+	} elseif ($number == 0 || $number == '') {
2727
+		$output = __('No Reviews', 'geodirectory');
2728 2728
 	} else { // must be one
2729
-		$output = __( '1 Review', 'geodirectory' );
2729
+		$output = __('1 Review', 'geodirectory');
2730 2730
 	}
2731 2731
 	echo $output;
2732 2732
 }
@@ -2741,18 +2741,18 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function is_page_geodir_home() {
2743 2743
 	global $wpdb;
2744
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2745
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2746
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2744
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2745
+	if (function_exists('geodir_location_geo_home_link')) {
2746
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2747 2747
 	}
2748
-	$home_url = home_url( '', 'http' );
2749
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2750
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2748
+	$home_url = home_url('', 'http');
2749
+	if (function_exists('geodir_location_geo_home_link')) {
2750
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2751 2751
 	}
2752
-	$home_url = str_replace( "www.", "", $home_url );
2753
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2752
+	$home_url = str_replace("www.", "", $home_url);
2753
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2754 2754
 		return true;
2755
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2755
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2756 2756
 		return true;
2757 2757
 	} else {
2758 2758
 		return false;
@@ -2772,18 +2772,18 @@  discard block
 block discarded – undo
2772 2772
  *
2773 2773
  * @return string The canonical URL.
2774 2774
  */
2775
-function geodir_wpseo_homepage_canonical( $url ) {
2775
+function geodir_wpseo_homepage_canonical($url) {
2776 2776
 	global $post;
2777 2777
 
2778
-	if ( is_page_geodir_home() ) {
2778
+	if (is_page_geodir_home()) {
2779 2779
 		return home_url();
2780 2780
 	}
2781 2781
 
2782 2782
 	return $url;
2783 2783
 }
2784 2784
 
2785
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2786
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2785
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2786
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2787 2787
 
2788 2788
 /**
2789 2789
  * Add extra fields to google maps script call.
@@ -2796,20 +2796,20 @@  discard block
 block discarded – undo
2796 2796
  *
2797 2797
  * @return string Modified extra string.
2798 2798
  */
2799
-function geodir_googlemap_script_extra_details_page( $extra ) {
2799
+function geodir_googlemap_script_extra_details_page($extra) {
2800 2800
 	global $post;
2801 2801
 	$add_google_places_api = false;
2802
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2802
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2803 2803
 		$add_google_places_api = true;
2804 2804
 	}
2805
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2805
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2806 2806
 		$extra .= "&amp;libraries=places";
2807 2807
 	}
2808 2808
 
2809 2809
 	return $extra;
2810 2810
 }
2811 2811
 
2812
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2812
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2813 2813
 
2814 2814
 
2815 2815
 /**
@@ -2826,93 +2826,93 @@  discard block
 block discarded – undo
2826 2826
  *                                          after_widget.
2827 2827
  * @param array|string $instance            The settings for the particular instance of the widget.
2828 2828
  */
2829
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2829
+function geodir_popular_post_category_output($args = '', $instance = '') {
2830 2830
 	// prints the widget
2831 2831
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2832
-	extract( $args, EXTR_SKIP );
2832
+	extract($args, EXTR_SKIP);
2833 2833
 
2834 2834
 	echo $before_widget;
2835 2835
 
2836 2836
 	/** This filter is documented in geodirectory_widgets.php */
2837
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2837
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2838 2838
 
2839 2839
 	$gd_post_type = geodir_get_current_posttype();
2840 2840
 
2841
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2842
-	if ( ! empty( $gd_post_type ) ) {
2841
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2842
+	if (!empty($gd_post_type)) {
2843 2843
 		$default_post_type = $gd_post_type;
2844
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2844
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2845 2845
 		$default_post_type = $instance['default_post_type'];
2846 2846
 	} else {
2847 2847
 		$all_gd_post_type  = geodir_get_posttypes();
2848
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2848
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2849 2849
 	}
2850 2850
 
2851 2851
 	$taxonomy = array();
2852
-	if ( ! empty( $gd_post_type ) ) {
2853
-		$taxonomy[] = $gd_post_type . "category";
2852
+	if (!empty($gd_post_type)) {
2853
+		$taxonomy[] = $gd_post_type."category";
2854 2854
 	} else {
2855
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2855
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2856 2856
 	}
2857 2857
 
2858
-	$terms   = get_terms( $taxonomy );
2858
+	$terms   = get_terms($taxonomy);
2859 2859
 	$a_terms = array();
2860 2860
 	$b_terms = array();
2861 2861
 
2862
-	foreach ( $terms as $term ) {
2863
-		if ( $term->count > 0 ) {
2864
-			$a_terms[ $term->taxonomy ][] = $term;
2862
+	foreach ($terms as $term) {
2863
+		if ($term->count > 0) {
2864
+			$a_terms[$term->taxonomy][] = $term;
2865 2865
 		}
2866 2866
 	}
2867 2867
 
2868
-	if ( ! empty( $a_terms ) ) {
2869
-		foreach ( $a_terms as $b_key => $b_val ) {
2870
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2868
+	if (!empty($a_terms)) {
2869
+		foreach ($a_terms as $b_key => $b_val) {
2870
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2871 2871
 		}
2872 2872
 
2873
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2873
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2874 2874
 
2875 2875
 		$tax_change_output = '';
2876
-		if ( count( $b_terms ) > 1 ) {
2876
+		if (count($b_terms) > 1) {
2877 2877
 			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2878
-			foreach ( $b_terms as $key => $val ) {
2879
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2880
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2881
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2878
+			foreach ($b_terms as $key => $val) {
2879
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2880
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2881
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2882 2882
 			}
2883 2883
 			$tax_change_output .= "</select>";
2884 2884
 		}
2885 2885
 
2886
-		if ( ! empty( $b_terms ) ) {
2887
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2888
-			global $cat_count;//make global so we can change via function
2886
+		if (!empty($b_terms)) {
2887
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2888
+			global $cat_count; //make global so we can change via function
2889 2889
 			$cat_count = 0;
2890 2890
 			?>
2891 2891
 			<div class="geodir-category-list-in clearfix">
2892 2892
 				<div class="geodir-cat-list clearfix">
2893 2893
 					<?php
2894
-					echo $before_title . __( $title ) . $after_title;
2894
+					echo $before_title.__($title).$after_title;
2895 2895
 
2896 2896
 					echo $tax_change_output;
2897 2897
 
2898 2898
 					echo '<ul class="geodir-popular-cat-list">';
2899 2899
 
2900
-					geodir_helper_cat_list_output( $terms, $category_limit );
2900
+					geodir_helper_cat_list_output($terms, $category_limit);
2901 2901
 
2902 2902
 					echo '</ul>';
2903 2903
 					?>
2904 2904
 				</div>
2905 2905
 				<?php
2906 2906
 				$hide = '';
2907
-				if ( $cat_count < $category_limit ) {
2907
+				if ($cat_count < $category_limit) {
2908 2908
 					$hide = 'style="display:none;"';
2909 2909
 				}
2910 2910
 				echo "<div class='geodir-cat-list-more' $hide >";
2911
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2912
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2911
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2912
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2913 2913
 				echo "</div>";
2914 2914
 				/* add scripts */
2915
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2915
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2916 2916
 				?>
2917 2917
 			</div>
2918 2918
 			<?php
@@ -2931,25 +2931,25 @@  discard block
 block discarded – undo
2931 2931
  * @param array $terms                      An array of term objects.
2932 2932
  * @param int $category_limit               Number of categories to display by default.
2933 2933
  */
2934
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2934
+function geodir_helper_cat_list_output($terms, $category_limit) {
2935 2935
 	global $geodir_post_category_str, $cat_count;
2936 2936
 	$term_icons = geodir_get_term_icon();
2937 2937
 
2938 2938
 	$geodir_post_category_str = array();
2939 2939
 
2940 2940
 
2941
-	foreach ( $terms as $cat ) {
2942
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2943
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2941
+	foreach ($terms as $cat) {
2942
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2943
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2944 2944
 
2945
-		$cat_count ++;
2945
+		$cat_count++;
2946 2946
 
2947
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2947
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2948 2948
 
2949 2949
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2950 2950
 		$total_post = $cat->count;
2951 2951
 
2952
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2952
+		$term_link = get_term_link($cat, $cat->taxonomy);
2953 2953
 		/**
2954 2954
 		 * Filer the category term link.
2955 2955
 		 *
@@ -2959,11 +2959,11 @@  discard block
 block discarded – undo
2959 2959
 		 * @param int $cat          ->term_id The term id.
2960 2960
 		 * @param string $post_type Wordpress post type.
2961 2961
 		 */
2962
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2962
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2963 2963
 
2964
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2965
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2966
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2964
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2965
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2966
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2967 2967
 		echo '</a></li>';
2968 2968
 	}
2969 2969
 }
@@ -2978,14 +2978,14 @@  discard block
 block discarded – undo
2978 2978
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2979 2979
  * @param array|string $instance The settings for the particular instance of the widget.
2980 2980
  */
2981
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2981
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2982 2982
 	// prints the widget
2983
-	extract( $args, EXTR_SKIP );
2983
+	extract($args, EXTR_SKIP);
2984 2984
 
2985 2985
 	echo $before_widget;
2986 2986
 
2987 2987
 	/** This filter is documented in geodirectory_widgets.php */
2988
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2988
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2989 2989
 	/**
2990 2990
 	 * Filter the widget post type.
2991 2991
 	 *
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
 	 *
2994 2994
 	 * @param string $instance ['post_type'] Post type of listing.
2995 2995
 	 */
2996
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2996
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2997 2997
 	/**
2998 2998
 	 * Filter the widget's term.
2999 2999
 	 *
@@ -3001,7 +3001,7 @@  discard block
 block discarded – undo
3001 3001
 	 *
3002 3002
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3003 3003
 	 */
3004
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3004
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3005 3005
 	/**
3006 3006
 	 * Filter the widget listings limit.
3007 3007
 	 *
@@ -3009,7 +3009,7 @@  discard block
 block discarded – undo
3009 3009
 	 *
3010 3010
 	 * @param string $instance ['post_number'] Number of listings to display.
3011 3011
 	 */
3012
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3012
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3013 3013
 	/**
3014 3014
 	 * Filter the widget listings limit shown at one time.
3015 3015
 	 *
@@ -3017,7 +3017,7 @@  discard block
 block discarded – undo
3017 3017
 	 *
3018 3018
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
3019 3019
 	 */
3020
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
3020
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
3021 3021
 	/**
3022 3022
 	 * Filter the widget slide width.
3023 3023
 	 *
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
 	 *
3026 3026
 	 * @param string $instance ['slide_width'] Width of the slides shown.
3027 3027
 	 */
3028
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
3028
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
3029 3029
 	/**
3030 3030
 	 * Filter widget's "show title" value.
3031 3031
 	 *
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
 	 *
3034 3034
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
3035 3035
 	 */
3036
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
3036
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
3037 3037
 	/**
3038 3038
 	 * Filter widget's "slideshow" value.
3039 3039
 	 *
@@ -3041,7 +3041,7 @@  discard block
 block discarded – undo
3041 3041
 	 *
3042 3042
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
3043 3043
 	 */
3044
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
3044
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
3045 3045
 	/**
3046 3046
 	 * Filter widget's "animationLoop" value.
3047 3047
 	 *
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
 	 *
3050 3050
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
3051 3051
 	 */
3052
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
3052
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
3053 3053
 	/**
3054 3054
 	 * Filter widget's "directionNav" value.
3055 3055
 	 *
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
 	 *
3058 3058
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
3059 3059
 	 */
3060
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
3060
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
3061 3061
 	/**
3062 3062
 	 * Filter widget's "slideshowSpeed" value.
3063 3063
 	 *
@@ -3065,7 +3065,7 @@  discard block
 block discarded – undo
3065 3065
 	 *
3066 3066
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
3067 3067
 	 */
3068
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
3068
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
3069 3069
 	/**
3070 3070
 	 * Filter widget's "animationSpeed" value.
3071 3071
 	 *
@@ -3073,7 +3073,7 @@  discard block
 block discarded – undo
3073 3073
 	 *
3074 3074
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3075 3075
 	 */
3076
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3076
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3077 3077
 	/**
3078 3078
 	 * Filter widget's "animation" value.
3079 3079
 	 *
@@ -3081,7 +3081,7 @@  discard block
 block discarded – undo
3081 3081
 	 *
3082 3082
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3083 3083
 	 */
3084
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3084
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3085 3085
 	/**
3086 3086
 	 * Filter widget's "list_sort" type.
3087 3087
 	 *
@@ -3089,10 +3089,10 @@  discard block
 block discarded – undo
3089 3089
 	 *
3090 3090
 	 * @param string $instance ['list_sort'] Listing sort by type.
3091 3091
 	 */
3092
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3093
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3092
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3093
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3094 3094
 
3095
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3095
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3096 3096
 	?>
3097 3097
 	<script type="text/javascript">
3098 3098
 		jQuery(window).load(function () {
@@ -3107,23 +3107,23 @@  discard block
 block discarded – undo
3107 3107
 				itemWidth: 75,
3108 3108
 				itemMargin: 5,
3109 3109
 				asNavFor: '#geodir_widget_slider',
3110
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3110
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3111 3111
 			});
3112 3112
 
3113 3113
 			jQuery('#geodir_widget_slider').flexslider({
3114
-				animation: "<?php echo $animation;?>",
3114
+				animation: "<?php echo $animation; ?>",
3115 3115
 				selector: ".geodir-slides > li",
3116 3116
 				namespace: "geodir-",
3117 3117
 				controlNav: true,
3118
-				animationLoop: <?php echo $animationLoop;?>,
3119
-				slideshow: <?php echo $slideshow;?>,
3120
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3121
-				animationSpeed: <?php echo $animationSpeed;?>,
3122
-				directionNav: <?php echo $directionNav;?>,
3123
-				maxItems: <?php echo $max_show;?>,
3118
+				animationLoop: <?php echo $animationLoop; ?>,
3119
+				slideshow: <?php echo $slideshow; ?>,
3120
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3121
+				animationSpeed: <?php echo $animationSpeed; ?>,
3122
+				directionNav: <?php echo $directionNav; ?>,
3123
+				maxItems: <?php echo $max_show; ?>,
3124 3124
 				move: 1,
3125
-				<?php if ( $slide_width ) {
3126
-				echo "itemWidth: " . $slide_width . ",";
3125
+				<?php if ($slide_width) {
3126
+				echo "itemWidth: ".$slide_width.",";
3127 3127
 			}?>
3128 3128
 				sync: "#geodir_widget_carousel",
3129 3129
 				start: function (slider) {
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3132 3132
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3133 3133
 				},
3134
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3134
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3135 3135
 			});
3136 3136
 		});
3137 3137
 	</script>
@@ -3142,62 +3142,62 @@  discard block
 block discarded – undo
3142 3142
 		'post_type'      => $post_type,
3143 3143
 		'order_by'       => $list_sort
3144 3144
 	);
3145
-	if ( $show_featured_only ) {
3145
+	if ($show_featured_only) {
3146 3146
 		$query_args['show_featured_only'] = 1;
3147 3147
 	}
3148 3148
 
3149
-	if ( $category != 0 || $category != '' ) {
3150
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3149
+	if ($category != 0 || $category != '') {
3150
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3151 3151
 		$tax_query         = array(
3152 3152
 			'taxonomy' => $category_taxonomy[0],
3153 3153
 			'field'    => 'id',
3154 3154
 			'terms'    => $category
3155 3155
 		);
3156 3156
 
3157
-		$query_args['tax_query'] = array( $tax_query );
3157
+		$query_args['tax_query'] = array($tax_query);
3158 3158
 	}
3159 3159
 
3160 3160
 	// we want listings with featured image only
3161 3161
 	$query_args['featured_image_only'] = 1;
3162 3162
 
3163
-	if ( $post_type == 'gd_event' ) {
3163
+	if ($post_type == 'gd_event') {
3164 3164
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3165 3165
 	}// show only upcoming events
3166 3166
 
3167
-	$widget_listings = geodir_get_widget_listings( $query_args );
3168
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3169
-		if ( $title ) {
3170
-			echo $before_title . $title . $after_title;
3167
+	$widget_listings = geodir_get_widget_listings($query_args);
3168
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3169
+		if ($title) {
3170
+			echo $before_title.$title.$after_title;
3171 3171
 		}
3172 3172
 
3173 3173
 		global $post;
3174 3174
 
3175
-		$current_post = $post;// keep current post info
3175
+		$current_post = $post; // keep current post info
3176 3176
 
3177 3177
 		$widget_main_slides = '';
3178 3178
 		$nav_slides         = '';
3179 3179
 		$widget_slides      = 0;
3180 3180
 
3181
-		foreach ( $widget_listings as $widget_listing ) {
3181
+		foreach ($widget_listings as $widget_listing) {
3182 3182
 			global $gd_widget_listing_type;
3183 3183
 			$post         = $widget_listing;
3184
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3184
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3185 3185
 
3186
-			if ( ! empty( $widget_image ) ) {
3187
-				if ( $widget_image->height >= 200 ) {
3186
+			if (!empty($widget_image)) {
3187
+				if ($widget_image->height >= 200) {
3188 3188
 					$widget_spacer_height = 0;
3189 3189
 				} else {
3190
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3190
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3191 3191
 				}
3192 3192
 
3193
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3193
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3194 3194
 
3195 3195
 				$title = '';
3196
-				if ( $show_title ) {
3197
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3196
+				if ($show_title) {
3197
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3198 3198
 					$post_id        = $post->ID;
3199
-					$post_permalink = get_permalink( $post->ID );
3200
-					$post_title     = get_the_title( $post->ID );
3199
+					$post_permalink = get_permalink($post->ID);
3200
+					$post_title     = get_the_title($post->ID);
3201 3201
 					/**
3202 3202
 					 * Filter the listing slider widget title.
3203 3203
 					 *
@@ -3208,12 +3208,12 @@  discard block
 block discarded – undo
3208 3208
 					 * @param string $post_permalink The post permalink url.
3209 3209
 					 * @param string $post_title     The post title text.
3210 3210
 					 */
3211
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3211
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3212 3212
 				}
3213 3213
 
3214
-				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
3215
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3216
-				$widget_slides ++;
3214
+				$widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
3215
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3216
+				$widget_slides++;
3217 3217
 			}
3218 3218
 		}
3219 3219
 		?>
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3223 3223
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3224 3224
 			</div>
3225
-			<?php if ( $widget_slides > 1 ) { ?>
3225
+			<?php if ($widget_slides > 1) { ?>
3226 3226
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3227 3227
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3228 3228
 				</div>
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
 		</div>
3231 3231
 		<?php
3232 3232
 		$GLOBALS['post'] = $current_post;
3233
-		setup_postdata( $current_post );
3233
+		setup_postdata($current_post);
3234 3234
 	}
3235 3235
 	echo $after_widget;
3236 3236
 }
@@ -3246,46 +3246,46 @@  discard block
 block discarded – undo
3246 3246
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3247 3247
  * @param array|string $instance The settings for the particular instance of the widget.
3248 3248
  */
3249
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3249
+function geodir_loginwidget_output($args = '', $instance = '') {
3250 3250
 	//print_r($args);
3251 3251
 	//print_r($instance);
3252 3252
 	// prints the widget
3253
-	extract( $args, EXTR_SKIP );
3253
+	extract($args, EXTR_SKIP);
3254 3254
 
3255 3255
 	/** This filter is documented in geodirectory_widgets.php */
3256
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3256
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3257 3257
 
3258 3258
 	echo $before_widget;
3259
-	echo $before_title . $title . $after_title;
3259
+	echo $before_title.$title.$after_title;
3260 3260
 
3261
-	if ( is_user_logged_in() ) {
3261
+	if (is_user_logged_in()) {
3262 3262
 		global $current_user;
3263 3263
 
3264
-		$author_link = get_author_posts_url( $current_user->data->ID );
3265
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3264
+		$author_link = get_author_posts_url($current_user->data->ID);
3265
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3266 3266
 
3267 3267
 		echo '<ul class="geodir-loginbox-list">';
3268 3268
 		ob_start();
3269 3269
 		?>
3270 3270
 		<li><a class="signin"
3271
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3271
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3272 3272
 		<?php
3273
-		$post_types                           = geodir_get_posttypes( 'object' );
3274
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3275
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3273
+		$post_types                           = geodir_get_posttypes('object');
3274
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3275
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3276 3276
 
3277
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3277
+		if (!empty($show_add_listing_post_types_main_nav)) {
3278 3278
 			$addlisting_links = '';
3279
-			foreach ( $post_types as $key => $postobj ) {
3279
+			foreach ($post_types as $key => $postobj) {
3280 3280
 
3281
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3281
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3282 3282
 
3283
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3283
+					if ($add_link = geodir_get_addlisting_link($key)) {
3284 3284
 
3285 3285
 						$name = $postobj->labels->name;
3286 3286
 
3287 3287
 						$selected = '';
3288
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3288
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3289 3289
 							$selected = 'selected="selected"';
3290 3290
 						}
3291 3291
 
@@ -3298,22 +3298,22 @@  discard block
 block discarded – undo
3298 3298
 						 * @param string $key       Add listing array key.
3299 3299
 						 * @param int $current_user ->ID Current user ID.
3300 3300
 						 */
3301
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3301
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3302 3302
 
3303
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3303
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3304 3304
 
3305 3305
 					}
3306 3306
 				}
3307 3307
 
3308 3308
 			}
3309 3309
 
3310
-			if ( $addlisting_links != '' ) { ?>
3310
+			if ($addlisting_links != '') { ?>
3311 3311
 
3312 3312
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3313 3313
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3314
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3314
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3315 3315
 						<option value="" disabled="disabled" selected="selected"
3316
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3316
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3317 3317
 						<?php echo $addlisting_links; ?>
3318 3318
 					</select></li> <?php
3319 3319
 
@@ -3321,23 +3321,23 @@  discard block
 block discarded – undo
3321 3321
 
3322 3322
 		}
3323 3323
 		// My Favourites in Dashboard
3324
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3324
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3325 3325
 		$user_favourite                    = geodir_user_favourite_listing_count();
3326 3326
 
3327
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3327
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3328 3328
 			$favourite_links = '';
3329 3329
 
3330
-			foreach ( $post_types as $key => $postobj ) {
3331
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3330
+			foreach ($post_types as $key => $postobj) {
3331
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3332 3332
 					$name           = $postobj->labels->name;
3333
-					$post_type_link = geodir_getlink( $author_link, array(
3333
+					$post_type_link = geodir_getlink($author_link, array(
3334 3334
 						'stype' => $key,
3335 3335
 						'list'  => 'favourite'
3336
-					), false );
3336
+					), false);
3337 3337
 
3338 3338
 					$selected = '';
3339 3339
 
3340
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3340
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3341 3341
 						$selected = 'selected="selected"';
3342 3342
 					}
3343 3343
 					/**
@@ -3349,20 +3349,20 @@  discard block
 block discarded – undo
3349 3349
 					 * @param string $key            Favorite listing array key.
3350 3350
 					 * @param int $current_user      ->ID Current user ID.
3351 3351
 					 */
3352
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3352
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3353 3353
 
3354
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3354
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3355 3355
 				}
3356 3356
 			}
3357 3357
 
3358
-			if ( $favourite_links != '' ) {
3358
+			if ($favourite_links != '') {
3359 3359
 				?>
3360 3360
 				<li>
3361 3361
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3362 3362
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3363
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3363
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3364 3364
 						<option value="" disabled="disabled" selected="selected"
3365
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3365
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3366 3366
 						<?php echo $favourite_links; ?>
3367 3367
 					</select>
3368 3368
 				</li>
@@ -3371,19 +3371,19 @@  discard block
 block discarded – undo
3371 3371
 		}
3372 3372
 
3373 3373
 
3374
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3374
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3375 3375
 		$user_listing                     = geodir_user_post_listing_count();
3376 3376
 
3377
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3377
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3378 3378
 			$listing_links = '';
3379 3379
 
3380
-			foreach ( $post_types as $key => $postobj ) {
3381
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3380
+			foreach ($post_types as $key => $postobj) {
3381
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3382 3382
 					$name         = $postobj->labels->name;
3383
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3383
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3384 3384
 
3385 3385
 					$selected = '';
3386
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3386
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3387 3387
 						$selected = 'selected="selected"';
3388 3388
 					}
3389 3389
 
@@ -3396,20 +3396,20 @@  discard block
 block discarded – undo
3396 3396
 					 * @param string $key          My listing array key.
3397 3397
 					 * @param int $current_user    ->ID Current user ID.
3398 3398
 					 */
3399
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3399
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3400 3400
 
3401
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3401
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3402 3402
 				}
3403 3403
 			}
3404 3404
 
3405
-			if ( $listing_links != '' ) {
3405
+			if ($listing_links != '') {
3406 3406
 				?>
3407 3407
 				<li>
3408 3408
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3409 3409
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3410
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3410
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3411 3411
 						<option value="" disabled="disabled" selected="selected"
3412
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3412
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3413 3413
 						<?php echo $listing_links; ?>
3414 3414
 					</select>
3415 3415
 				</li>
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		 *
3426 3426
 		 * @param string $dashboard_link Dashboard links HTML.
3427 3427
 		 */
3428
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3428
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3429 3429
 		echo '</ul>';
3430 3430
 
3431 3431
 		/**
@@ -3433,7 +3433,7 @@  discard block
 block discarded – undo
3433 3433
 		 *
3434 3434
 		 * @since 1.6.6
3435 3435
 		 */
3436
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3436
+		do_action('geodir_after_loginwidget_form_logged_in');
3437 3437
 
3438 3438
 
3439 3439
 	} else {
@@ -3448,18 +3448,18 @@  discard block
 block discarded – undo
3448 3448
 		<form name="loginform" class="loginform1"
3449 3449
 		      action="<?php echo geodir_login_url(); ?>"
3450 3450
 		      method="post">
3451
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3451
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3452 3452
 			                                    type="text" class="textfield user_login1"/> <span
3453 3453
 					class="user_loginInfo"></span></div>
3454
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3454
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3455 3455
 			                                    name="pwd" type="password"
3456 3456
 			                                    class="textfield user_pass1 input-text"/><span
3457 3457
 					class="user_passInfo"></span></div>
3458 3458
 
3459
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3459
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3460 3460
 			<input type="hidden" name="testcookie" value="1"/>
3461 3461
 
3462
-				<?php do_action( 'login_form' ); ?>
3462
+				<?php do_action('login_form'); ?>
3463 3463
 
3464 3464
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3465 3465
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 					 * @since 1.0.0
3473 3473
 					 */
3474 3474
 					?>
3475
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3475
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3476 3476
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3477 3477
 
3478 3478
 					<?php
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
 					 * @since 1.0.0
3483 3483
 					 */
3484 3484
 					?>
3485
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3485
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3486 3486
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3487 3487
 		</form>
3488 3488
 		<?php
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
 		 *
3492 3492
 		 * @since 1.6.6
3493 3493
 		 */
3494
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3494
+		do_action('geodir_after_loginwidget_form_logged_out');
3495 3495
 	}
3496 3496
 
3497 3497
 	echo $after_widget;
@@ -3513,16 +3513,16 @@  discard block
 block discarded – undo
3513 3513
  *                                         after_widget.
3514 3514
  * @param array|string $instance           The settings for the particular instance of the widget.
3515 3515
  */
3516
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3516
+function geodir_popular_postview_output($args = '', $instance = '') {
3517 3517
 	global $gd_session;
3518 3518
 
3519 3519
 	// prints the widget
3520
-	extract( $args, EXTR_SKIP );
3520
+	extract($args, EXTR_SKIP);
3521 3521
 
3522 3522
 	echo $before_widget;
3523 3523
 
3524 3524
 	/** This filter is documented in geodirectory_widgets.php */
3525
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3525
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3526 3526
 	/**
3527 3527
 	 * Filter the widget post type.
3528 3528
 	 *
@@ -3530,7 +3530,7 @@  discard block
 block discarded – undo
3530 3530
 	 *
3531 3531
 	 * @param string $instance ['post_type'] Post type of listing.
3532 3532
 	 */
3533
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3533
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3534 3534
 	/**
3535 3535
 	 * Filter the widget's term.
3536 3536
 	 *
@@ -3538,7 +3538,7 @@  discard block
 block discarded – undo
3538 3538
 	 *
3539 3539
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3540 3540
 	 */
3541
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3541
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3542 3542
 	/**
3543 3543
 	 * Filter the widget listings limit.
3544 3544
 	 *
@@ -3546,7 +3546,7 @@  discard block
 block discarded – undo
3546 3546
 	 *
3547 3547
 	 * @param string $instance ['post_number'] Number of listings to display.
3548 3548
 	 */
3549
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3549
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3550 3550
 	/**
3551 3551
 	 * Filter widget's "layout" type.
3552 3552
 	 *
@@ -3554,7 +3554,7 @@  discard block
 block discarded – undo
3554 3554
 	 *
3555 3555
 	 * @param string $instance ['layout'] Widget layout type.
3556 3556
 	 */
3557
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3557
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3558 3558
 	/**
3559 3559
 	 * Filter widget's "add_location_filter" value.
3560 3560
 	 *
@@ -3562,7 +3562,7 @@  discard block
 block discarded – undo
3562 3562
 	 *
3563 3563
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3564 3564
 	 */
3565
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3565
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3566 3566
 	/**
3567 3567
 	 * Filter widget's listing width.
3568 3568
 	 *
@@ -3570,7 +3570,7 @@  discard block
 block discarded – undo
3570 3570
 	 *
3571 3571
 	 * @param string $instance ['listing_width'] Listing width.
3572 3572
 	 */
3573
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3573
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3574 3574
 	/**
3575 3575
 	 * Filter widget's "list_sort" type.
3576 3576
 	 *
@@ -3578,25 +3578,25 @@  discard block
 block discarded – undo
3578 3578
 	 *
3579 3579
 	 * @param string $instance ['list_sort'] Listing sort by type.
3580 3580
 	 */
3581
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3582
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3581
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3582
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3583 3583
 
3584 3584
 	// set post type to current viewing post type
3585
-	if ( $use_viewing_post_type ) {
3585
+	if ($use_viewing_post_type) {
3586 3586
 		$current_post_type = geodir_get_current_posttype();
3587
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3587
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3588 3588
 			$post_type = $current_post_type;
3589 3589
 			$category  = array(); // old post type category will not work for current changed post type
3590 3590
 		}
3591 3591
 	}
3592 3592
 	// replace widget title dynamically
3593
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3594
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3593
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3594
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3595 3595
 
3596
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3597
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3596
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3597
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3598 3598
 
3599
-	if ( isset( $instance['character_count'] ) ) {
3599
+	if (isset($instance['character_count'])) {
3600 3600
 		/**
3601 3601
 		 * Filter the widget's excerpt character count.
3602 3602
 		 *
@@ -3604,37 +3604,37 @@  discard block
 block discarded – undo
3604 3604
 		 *
3605 3605
 		 * @param int $instance ['character_count'] Excerpt character count.
3606 3606
 		 */
3607
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3607
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3608 3608
 	} else {
3609 3609
 		$character_count = '';
3610 3610
 	}
3611 3611
 
3612
-	if ( empty( $title ) || $title == 'All' ) {
3613
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3612
+	if (empty($title) || $title == 'All') {
3613
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3614 3614
 	}
3615 3615
 
3616 3616
 	$location_url = array();
3617
-	$city         = get_query_var( 'gd_city' );
3618
-	if ( ! empty( $city ) ) {
3619
-		$country = get_query_var( 'gd_country' );
3620
-		$region  = get_query_var( 'gd_region' );
3617
+	$city         = get_query_var('gd_city');
3618
+	if (!empty($city)) {
3619
+		$country = get_query_var('gd_country');
3620
+		$region  = get_query_var('gd_region');
3621 3621
 
3622
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3622
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3623 3623
 
3624
-		if ( $geodir_show_location_url == 'all' ) {
3625
-			if ( $country != '' ) {
3624
+		if ($geodir_show_location_url == 'all') {
3625
+			if ($country != '') {
3626 3626
 				$location_url[] = $country;
3627 3627
 			}
3628 3628
 
3629
-			if ( $region != '' ) {
3629
+			if ($region != '') {
3630 3630
 				$location_url[] = $region;
3631 3631
 			}
3632
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3633
-			if ( $country != '' ) {
3632
+		} else if ($geodir_show_location_url == 'country_city') {
3633
+			if ($country != '') {
3634 3634
 				$location_url[] = $country;
3635 3635
 			}
3636
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3637
-			if ( $region != '' ) {
3636
+		} else if ($geodir_show_location_url == 'region_city') {
3637
+			if ($region != '') {
3638 3638
 				$location_url[] = $region;
3639 3639
 			}
3640 3640
 		}
@@ -3642,37 +3642,37 @@  discard block
 block discarded – undo
3642 3642
 		$location_url[] = $city;
3643 3643
 	}
3644 3644
 
3645
-	$location_url  = implode( '/', $location_url );
3645
+	$location_url  = implode('/', $location_url);
3646 3646
 	$skip_location = false;
3647
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3647
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3648 3648
 		$skip_location = true;
3649
-		$gd_session->un_set( 'gd_multi_location' );
3649
+		$gd_session->un_set('gd_multi_location');
3650 3650
 	}
3651 3651
 
3652
-	if ( get_option( 'permalink_structure' ) ) {
3653
-		$viewall_url = get_post_type_archive_link( $post_type );
3652
+	if (get_option('permalink_structure')) {
3653
+		$viewall_url = get_post_type_archive_link($post_type);
3654 3654
 	} else {
3655
-		$viewall_url = get_post_type_archive_link( $post_type );
3655
+		$viewall_url = get_post_type_archive_link($post_type);
3656 3656
 	}
3657 3657
 
3658
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3658
+	if (!empty($category) && $category[0] != '0') {
3659 3659
 		global $geodir_add_location_url;
3660 3660
 
3661 3661
 		$geodir_add_location_url = '0';
3662 3662
 
3663
-		if ( $add_location_filter != '0' ) {
3663
+		if ($add_location_filter != '0') {
3664 3664
 			$geodir_add_location_url = '1';
3665 3665
 		}
3666 3666
 
3667
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3667
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3668 3668
 
3669 3669
 		$geodir_add_location_url = null;
3670 3670
 	}
3671
-	if ( $skip_location ) {
3672
-		$gd_session->set( 'gd_multi_location', 1 );
3671
+	if ($skip_location) {
3672
+		$gd_session->set('gd_multi_location', 1);
3673 3673
 	}
3674 3674
 
3675
-	if ( is_wp_error( $viewall_url ) ) {
3675
+	if (is_wp_error($viewall_url)) {
3676 3676
 		$viewall_url = '';
3677 3677
 	}
3678 3678
 
@@ -3684,34 +3684,34 @@  discard block
 block discarded – undo
3684 3684
 		'order_by'       => $list_sort
3685 3685
 	);
3686 3686
 
3687
-	if ( $character_count ) {
3687
+	if ($character_count) {
3688 3688
 		$query_args['excerpt_length'] = $character_count;
3689 3689
 	}
3690 3690
 
3691
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3691
+	if (!empty($instance['show_featured_only'])) {
3692 3692
 		$query_args['show_featured_only'] = 1;
3693 3693
 	}
3694 3694
 
3695
-	if ( ! empty( $instance['show_special_only'] ) ) {
3695
+	if (!empty($instance['show_special_only'])) {
3696 3696
 		$query_args['show_special_only'] = 1;
3697 3697
 	}
3698 3698
 
3699
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3699
+	if (!empty($instance['with_pics_only'])) {
3700 3700
 		$query_args['with_pics_only']      = 0;
3701 3701
 		$query_args['featured_image_only'] = 1;
3702 3702
 	}
3703 3703
 
3704
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3704
+	if (!empty($instance['with_videos_only'])) {
3705 3705
 		$query_args['with_videos_only'] = 1;
3706 3706
 	}
3707
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3707
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3708 3708
 
3709
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3710
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3709
+	if (!empty($category) && $category[0] != '0') {
3710
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3711 3711
 
3712 3712
 		######### WPML #########
3713
-		if ( function_exists( 'icl_object_id' ) ) {
3714
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3713
+		if (function_exists('icl_object_id')) {
3714
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3715 3715
 		}
3716 3716
 		######### WPML #########
3717 3717
 
@@ -3721,14 +3721,14 @@  discard block
 block discarded – undo
3721 3721
 			'terms'    => $category
3722 3722
 		);
3723 3723
 
3724
-		$query_args['tax_query'] = array( $tax_query );
3724
+		$query_args['tax_query'] = array($tax_query);
3725 3725
 	}
3726 3726
 
3727 3727
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3728 3728
 
3729
-	$widget_listings = geodir_get_widget_listings( $query_args );
3729
+	$widget_listings = geodir_get_widget_listings($query_args);
3730 3730
 
3731
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3731
+	if (!empty($widget_listings) || $with_no_results) {
3732 3732
 		?>
3733 3733
 		<div class="geodir_locations geodir_location_listing">
3734 3734
 
@@ -3738,11 +3738,11 @@  discard block
 block discarded – undo
3738 3738
 			 *
3739 3739
 			 * @since 1.0.0
3740 3740
 			 */
3741
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3741
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3742 3742
 			<div class="geodir_list_heading clearfix">
3743
-				<?php echo $before_title . $title . $after_title; ?>
3743
+				<?php echo $before_title.$title.$after_title; ?>
3744 3744
 				<a href="<?php echo $viewall_url; ?>"
3745
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3745
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3746 3746
 			</div>
3747 3747
 			<?php
3748 3748
 			/**
@@ -3750,10 +3750,10 @@  discard block
 block discarded – undo
3750 3750
 			 *
3751 3751
 			 * @since 1.0.0
3752 3752
 			 */
3753
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3753
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3754 3754
 			<?php
3755
-			if ( strstr( $layout, 'gridview' ) ) {
3756
-				$listing_view_exp        = explode( '_', $layout );
3755
+			if (strstr($layout, 'gridview')) {
3756
+				$listing_view_exp        = explode('_', $layout);
3757 3757
 				$gridview_columns_widget = $layout;
3758 3758
 				$layout                  = $listing_view_exp[0];
3759 3759
 			} else {
@@ -3765,8 +3765,8 @@  discard block
 block discarded – undo
3765 3765
 			 *
3766 3766
 			 * @since 1.0.0
3767 3767
 			 */
3768
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3769
-			if ( ! isset( $character_count ) ) {
3768
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3769
+			if (!isset($character_count)) {
3770 3770
 				/**
3771 3771
 				 * Filter the widget's excerpt character count.
3772 3772
 				 *
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 				 *
3775 3775
 				 * @param int $instance ['character_count'] Excerpt character count.
3776 3776
 				 */
3777
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3777
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3778 3778
 			}
3779 3779
 
3780 3780
 			global $post, $map_jason, $map_canvas_arr;
@@ -3789,13 +3789,13 @@  discard block
 block discarded – undo
3789 3789
 			 *
3790 3790
 			 * @since 1.0.0
3791 3791
 			 */
3792
-			include( $template );
3792
+			include($template);
3793 3793
 
3794 3794
 			$geodir_is_widget_listing = false;
3795 3795
 
3796 3796
 			$GLOBALS['post'] = $current_post;
3797
-			if ( ! empty( $current_post ) ) {
3798
-				setup_postdata( $current_post );
3797
+			if (!empty($current_post)) {
3798
+				setup_postdata($current_post);
3799 3799
 			}
3800 3800
 			$map_jason      = $current_map_jason;
3801 3801
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3826,12 +3826,12 @@  discard block
 block discarded – undo
3826 3826
  *
3827 3827
  * @return int Reviews count.
3828 3828
  */
3829
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3829
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3830 3830
 	global $wpdb, $plugin_prefix;
3831 3831
 
3832
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3832
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3833 3833
 
3834
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3834
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3835 3835
 
3836 3836
 	/**
3837 3837
 	 * Filter count review sql query.
@@ -3843,9 +3843,9 @@  discard block
 block discarded – undo
3843 3843
 	 * @param int $taxonomy     The taxonomy Id.
3844 3844
 	 * @param string $post_type The post type.
3845 3845
 	 */
3846
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3846
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3847 3847
 
3848
-	$count = $wpdb->get_var( $sql );
3848
+	$count = $wpdb->get_var($sql);
3849 3849
 
3850 3850
 	return $count;
3851 3851
 }
@@ -3863,7 +3863,7 @@  discard block
 block discarded – undo
3863 3863
  *
3864 3864
  * @return array Term array data.
3865 3865
  */
3866
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3866
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3867 3867
 	/**
3868 3868
 	 * Filter review count option data.
3869 3869
 	 *
@@ -3873,78 +3873,78 @@  discard block
 block discarded – undo
3873 3873
 	 * @param bool $force_update Force update option value?. Default.false.
3874 3874
 	 * @param int $post_ID       The post id to update if any.
3875 3875
 	 */
3876
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3877
-	if ( ! empty( $option_data ) ) {
3876
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3877
+	if (!empty($option_data)) {
3878 3878
 		return $option_data;
3879 3879
 	}
3880 3880
 
3881
-	$option_data = get_option( 'geodir_global_review_count' );
3881
+	$option_data = get_option('geodir_global_review_count');
3882 3882
 
3883
-	if ( ! $option_data || $force_update ) {
3884
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3883
+	if (!$option_data || $force_update) {
3884
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3885 3885
 			global $gd_session;
3886 3886
 			$term_array = (array) $option_data;
3887
-			$post_type  = get_post_type( $post_ID );
3888
-			$taxonomy   = $post_type . 'category';
3889
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3890
-
3891
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3892
-				foreach ( $terms as $term_id ) {
3893
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3894
-					$children               = get_term_children( $term_id, $taxonomy );
3895
-					$term_array[ $term_id ] = $count;
3887
+			$post_type  = get_post_type($post_ID);
3888
+			$taxonomy   = $post_type.'category';
3889
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3890
+
3891
+			if (!empty($terms) && !is_wp_error($terms)) {
3892
+				foreach ($terms as $term_id) {
3893
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3894
+					$children               = get_term_children($term_id, $taxonomy);
3895
+					$term_array[$term_id] = $count;
3896 3896
 				}
3897 3897
 			}
3898 3898
 
3899
-			$session_listing = $gd_session->get( 'listing' );
3899
+			$session_listing = $gd_session->get('listing');
3900 3900
 
3901 3901
 			$terms = array();
3902
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3903
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3904
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3905
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3902
+			if (isset($_POST['post_category'][$taxonomy])) {
3903
+				$terms = (array) $_POST['post_category'][$taxonomy];
3904
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3905
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3906 3906
 			}
3907 3907
 
3908
-			if ( ! empty( $terms ) ) {
3909
-				foreach ( $terms as $term_id ) {
3910
-					if ( $term_id > 0 ) {
3911
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3912
-						$children               = get_term_children( $term_id, $taxonomy );
3913
-						$term_array[ $term_id ] = $count;
3908
+			if (!empty($terms)) {
3909
+				foreach ($terms as $term_id) {
3910
+					if ($term_id > 0) {
3911
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3912
+						$children               = get_term_children($term_id, $taxonomy);
3913
+						$term_array[$term_id] = $count;
3914 3914
 					}
3915 3915
 				}
3916 3916
 			}
3917 3917
 		} else { // Update reviews count for all post categories.
3918 3918
 			$term_array = array();
3919 3919
 			$post_types = geodir_get_posttypes();
3920
-			foreach ( $post_types as $post_type ) {
3920
+			foreach ($post_types as $post_type) {
3921 3921
 
3922
-				$taxonomy = geodir_get_taxonomies( $post_type );
3922
+				$taxonomy = geodir_get_taxonomies($post_type);
3923 3923
 				$taxonomy = $taxonomy[0];
3924 3924
 
3925 3925
 				$args = array(
3926 3926
 					'hide_empty' => false
3927 3927
 				);
3928 3928
 
3929
-				$terms = get_terms( $taxonomy, $args );
3929
+				$terms = get_terms($taxonomy, $args);
3930 3930
 
3931
-				foreach ( $terms as $term ) {
3932
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3933
-					$children = get_term_children( $term->term_id, $taxonomy );
3931
+				foreach ($terms as $term) {
3932
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3933
+					$children = get_term_children($term->term_id, $taxonomy);
3934 3934
 					/*if ( is_array( $children ) ) {
3935 3935
                         foreach ( $children as $child_id ) {
3936 3936
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3937 3937
                             $count = $count + $child_count;
3938 3938
                         }
3939 3939
                     }*/
3940
-					$term_array[ $term->term_id ] = $count;
3940
+					$term_array[$term->term_id] = $count;
3941 3941
 				}
3942 3942
 			}
3943 3943
 		}
3944 3944
 
3945
-		update_option( 'geodir_global_review_count', $term_array );
3945
+		update_option('geodir_global_review_count', $term_array);
3946 3946
 		//clear cache
3947
-		wp_cache_delete( 'geodir_global_review_count' );
3947
+		wp_cache_delete('geodir_global_review_count');
3948 3948
 
3949 3949
 		return $term_array;
3950 3950
 	} else {
@@ -3960,39 +3960,39 @@  discard block
 block discarded – undo
3960 3960
  * @package GeoDirectory
3961 3961
  * @return bool
3962 3962
  */
3963
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3964
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3963
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3964
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3965 3965
 		return; // do not run if importing listings
3966 3966
 	}
3967 3967
 
3968
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3968
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3969 3969
 		return;
3970 3970
 	}
3971 3971
 
3972 3972
 	$post_ID = 0;
3973
-	if ( ! empty( $post ) ) {
3974
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3973
+	if (!empty($post)) {
3974
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3975 3975
 			return;
3976 3976
 		}
3977 3977
 
3978
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3978
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3979 3979
 			return;
3980 3980
 		}
3981 3981
 
3982
-		if ( ! empty( $post->ID ) ) {
3982
+		if (!empty($post->ID)) {
3983 3983
 			$post_ID = $post->ID;
3984 3984
 		}
3985 3985
 	}
3986 3986
 
3987
-	if ( $new_status != $old_status ) {
3988
-		geodir_count_reviews_by_terms( true, $post_ID );
3987
+	if ($new_status != $old_status) {
3988
+		geodir_count_reviews_by_terms(true, $post_ID);
3989 3989
 	}
3990 3990
 
3991 3991
 	return true;
3992 3992
 }
3993 3993
 
3994
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3995
-	geodir_count_reviews_by_terms( true, $post_id );
3994
+function geodir_term_review_count_force_update_single_post($post_id) {
3995
+	geodir_count_reviews_by_terms(true, $post_id);
3996 3996
 }
3997 3997
 
3998 3998
 /*-----------------------------------------------------------------------------------*/
@@ -4009,11 +4009,11 @@  discard block
 block discarded – undo
4009 4009
  *
4010 4010
  * @return int Post count.
4011 4011
  */
4012
-function geodir_count_posts_by_term( $data, $term ) {
4012
+function geodir_count_posts_by_term($data, $term) {
4013 4013
 
4014
-	if ( $data ) {
4015
-		if ( isset( $data[ $term->term_id ] ) ) {
4016
-			return $data[ $term->term_id ];
4014
+	if ($data) {
4015
+		if (isset($data[$term->term_id])) {
4016
+			return $data[$term->term_id];
4017 4017
 		} else {
4018 4018
 			return 0;
4019 4019
 		}
@@ -4030,8 +4030,8 @@  discard block
 block discarded – undo
4030 4030
  * param array $terms An array of term objects.
4031 4031
  * @return array Sorted terms array.
4032 4032
  */
4033
-function geodir_sort_terms_by_count( $terms ) {
4034
-	usort( $terms, "geodir_sort_by_count_obj" );
4033
+function geodir_sort_terms_by_count($terms) {
4034
+	usort($terms, "geodir_sort_by_count_obj");
4035 4035
 
4036 4036
 	return $terms;
4037 4037
 }
@@ -4046,8 +4046,8 @@  discard block
 block discarded – undo
4046 4046
  *
4047 4047
  * @return array Sorted terms array.
4048 4048
  */
4049
-function geodir_sort_terms_by_review_count( $terms ) {
4050
-	usort( $terms, "geodir_sort_by_review_count_obj" );
4049
+function geodir_sort_terms_by_review_count($terms) {
4050
+	usort($terms, "geodir_sort_by_review_count_obj");
4051 4051
 
4052 4052
 	return $terms;
4053 4053
 }
@@ -4063,12 +4063,12 @@  discard block
 block discarded – undo
4063 4063
  *
4064 4064
  * @return array Sorted terms array.
4065 4065
  */
4066
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4067
-	if ( $sort == 'count' ) {
4068
-		return geodir_sort_terms_by_count( $terms );
4066
+function geodir_sort_terms($terms, $sort = 'count') {
4067
+	if ($sort == 'count') {
4068
+		return geodir_sort_terms_by_count($terms);
4069 4069
 	}
4070
-	if ( $sort == 'review_count' ) {
4071
-		return geodir_sort_terms_by_review_count( $terms );
4070
+	if ($sort == 'review_count') {
4071
+		return geodir_sort_terms_by_review_count($terms);
4072 4072
 	}
4073 4073
 }
4074 4074
 
@@ -4086,7 +4086,7 @@  discard block
 block discarded – undo
4086 4086
  *
4087 4087
  * @return bool
4088 4088
  */
4089
-function geodir_sort_by_count( $a, $b ) {
4089
+function geodir_sort_by_count($a, $b) {
4090 4090
 	return $a['count'] < $b['count'];
4091 4091
 }
4092 4092
 
@@ -4101,7 +4101,7 @@  discard block
 block discarded – undo
4101 4101
  *
4102 4102
  * @return bool
4103 4103
  */
4104
-function geodir_sort_by_count_obj( $a, $b ) {
4104
+function geodir_sort_by_count_obj($a, $b) {
4105 4105
 	return $a->count < $b->count;
4106 4106
 }
4107 4107
 
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
  *
4117 4117
  * @return bool
4118 4118
  */
4119
-function geodir_sort_by_review_count_obj( $a, $b ) {
4119
+function geodir_sort_by_review_count_obj($a, $b) {
4120 4120
 	return $a->review_count < $b->review_count;
4121 4121
 }
4122 4122
 
@@ -4133,35 +4133,35 @@  discard block
 block discarded – undo
4133 4133
 	 * @since   1.4.2
4134 4134
 	 * @package GeoDirectory
4135 4135
 	 */
4136
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4136
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4137 4137
 
4138
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4139
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4138
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4139
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4140 4140
 
4141 4141
 	/**
4142 4142
 	 * Define language constants.
4143 4143
 	 *
4144 4144
 	 * @since 1.0.0
4145 4145
 	 */
4146
-	require_once( geodir_plugin_path() . '/language.php' );
4146
+	require_once(geodir_plugin_path().'/language.php');
4147 4147
 
4148
-	$language_file = geodir_plugin_path() . '/db-language.php';
4148
+	$language_file = geodir_plugin_path().'/db-language.php';
4149 4149
 
4150 4150
 	// Load language string file if not created yet
4151
-	if ( ! file_exists( $language_file ) ) {
4151
+	if (!file_exists($language_file)) {
4152 4152
 		geodirectory_load_db_language();
4153 4153
 	}
4154 4154
 
4155
-	if ( file_exists( $language_file ) ) {
4155
+	if (file_exists($language_file)) {
4156 4156
 		/**
4157 4157
 		 * Language strings from database.
4158 4158
 		 *
4159 4159
 		 * @since 1.4.2
4160 4160
 		 */
4161 4161
 		try {
4162
-			require_once( $language_file );
4163
-		} catch ( Exception $e ) {
4164
-			error_log( 'Language Error: ' . $e->getMessage() );
4162
+			require_once($language_file);
4163
+		} catch (Exception $e) {
4164
+			error_log('Language Error: '.$e->getMessage());
4165 4165
 		}
4166 4166
 	}
4167 4167
 }
@@ -4178,19 +4178,19 @@  discard block
 block discarded – undo
4178 4178
  */
4179 4179
 function geodirectory_load_db_language() {
4180 4180
 	global $wp_filesystem;
4181
-	if ( empty( $wp_filesystem ) ) {
4182
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4181
+	if (empty($wp_filesystem)) {
4182
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4183 4183
 		WP_Filesystem();
4184 4184
 		global $wp_filesystem;
4185 4185
 	}
4186 4186
 
4187
-	$language_file = geodir_plugin_path() . '/db-language.php';
4187
+	$language_file = geodir_plugin_path().'/db-language.php';
4188 4188
 
4189
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4189
+	if (is_file($language_file) && !is_writable($language_file)) {
4190 4190
 		return false;
4191 4191
 	} // Not possible to create.
4192 4192
 
4193
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4193
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4194 4194
 		return false;
4195 4195
 	} // Not possible to create.
4196 4196
 
@@ -4203,9 +4203,9 @@  discard block
 block discarded – undo
4203 4203
 	 *
4204 4204
 	 * @param array $contents_strings Array of strings.
4205 4205
 	 */
4206
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4206
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4207 4207
 
4208
-	$contents_strings = array_unique( $contents_strings );
4208
+	$contents_strings = array_unique($contents_strings);
4209 4209
 
4210 4210
 	$contents_head   = array();
4211 4211
 	$contents_head[] = "<?php";
@@ -4222,20 +4222,20 @@  discard block
 block discarded – undo
4222 4222
 	$contents_foot[] = "";
4223 4223
 	$contents_foot[] = "";
4224 4224
 
4225
-	$contents = implode( PHP_EOL, $contents_head );
4225
+	$contents = implode(PHP_EOL, $contents_head);
4226 4226
 
4227
-	if ( ! empty( $contents_strings ) ) {
4228
-		foreach ( $contents_strings as $string ) {
4229
-			if ( is_scalar( $string ) && $string != '' ) {
4230
-				$string = str_replace( "'", "\'", $string );
4231
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4227
+	if (!empty($contents_strings)) {
4228
+		foreach ($contents_strings as $string) {
4229
+			if (is_scalar($string) && $string != '') {
4230
+				$string = str_replace("'", "\'", $string);
4231
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4232 4232
 			}
4233 4233
 		}
4234 4234
 	}
4235 4235
 
4236
-	$contents .= implode( PHP_EOL, $contents_foot );
4236
+	$contents .= implode(PHP_EOL, $contents_foot);
4237 4237
 
4238
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4238
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4239 4239
 		return false;
4240 4240
 	} // Failure; could not write file.
4241 4241
 
@@ -4255,45 +4255,45 @@  discard block
 block discarded – undo
4255 4255
  *
4256 4256
  * @return array Translation texts.
4257 4257
  */
4258
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4258
+function geodir_load_custom_field_translation($translation_texts = array()) {
4259 4259
 	global $wpdb;
4260 4260
 
4261 4261
 	// Custom fields table
4262
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4263
-	$rows = $wpdb->get_results( $sql );
4262
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4263
+	$rows = $wpdb->get_results($sql);
4264 4264
 
4265
-	if ( ! empty( $rows ) ) {
4266
-		foreach ( $rows as $row ) {
4267
-			if ( ! empty( $row->admin_title ) ) {
4268
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4265
+	if (!empty($rows)) {
4266
+		foreach ($rows as $row) {
4267
+			if (!empty($row->admin_title)) {
4268
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4269 4269
 			}
4270 4270
 
4271
-			if ( ! empty( $row->admin_desc ) ) {
4272
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4271
+			if (!empty($row->admin_desc)) {
4272
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4273 4273
 			}
4274 4274
 
4275
-			if ( ! empty( $row->site_title ) ) {
4276
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4275
+			if (!empty($row->site_title)) {
4276
+				$translation_texts[] = stripslashes_deep($row->site_title);
4277 4277
 			}
4278 4278
 
4279
-			if ( ! empty( $row->clabels ) ) {
4280
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4279
+			if (!empty($row->clabels)) {
4280
+				$translation_texts[] = stripslashes_deep($row->clabels);
4281 4281
 			}
4282 4282
 
4283
-			if ( ! empty( $row->required_msg ) ) {
4284
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4283
+			if (!empty($row->required_msg)) {
4284
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4285 4285
 			}
4286 4286
 
4287
-			if ( ! empty( $row->default_value ) ) {
4288
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4287
+			if (!empty($row->default_value)) {
4288
+				$translation_texts[] = stripslashes_deep($row->default_value);
4289 4289
 			}
4290 4290
 
4291
-			if ( ! empty( $row->option_values ) ) {
4292
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4291
+			if (!empty($row->option_values)) {
4292
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4293 4293
 
4294
-				if ( ! empty( $option_values ) ) {
4295
-					foreach ( $option_values as $option_value ) {
4296
-						if ( ! empty( $option_value['label'] ) ) {
4294
+				if (!empty($option_values)) {
4295
+					foreach ($option_values as $option_value) {
4296
+						if (!empty($option_value['label'])) {
4297 4297
 							$translation_texts[] = $option_value['label'];
4298 4298
 						}
4299 4299
 					}
@@ -4303,48 +4303,48 @@  discard block
 block discarded – undo
4303 4303
 	}
4304 4304
 
4305 4305
 	// Custom sorting fields table
4306
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4307
-	$rows = $wpdb->get_results( $sql );
4306
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4307
+	$rows = $wpdb->get_results($sql);
4308 4308
 
4309
-	if ( ! empty( $rows ) ) {
4310
-		foreach ( $rows as $row ) {
4311
-			if ( ! empty( $row->site_title ) ) {
4312
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4309
+	if (!empty($rows)) {
4310
+		foreach ($rows as $row) {
4311
+			if (!empty($row->site_title)) {
4312
+				$translation_texts[] = stripslashes_deep($row->site_title);
4313 4313
 			}
4314 4314
 
4315
-			if ( ! empty( $row->asc_title ) ) {
4316
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4315
+			if (!empty($row->asc_title)) {
4316
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4317 4317
 			}
4318 4318
 
4319
-			if ( ! empty( $row->desc_title ) ) {
4320
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4319
+			if (!empty($row->desc_title)) {
4320
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4321 4321
 			}
4322 4322
 		}
4323 4323
 	}
4324 4324
 
4325 4325
 	// Advance search filter fields table
4326
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4327
-		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4328
-		$rows = $wpdb->get_results( $sql );
4329
-
4330
-		if ( ! empty( $rows ) ) {
4331
-			foreach ( $rows as $row ) {
4332
-				if ( ! empty( $row->field_site_name ) ) {
4333
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4326
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4327
+		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4328
+		$rows = $wpdb->get_results($sql);
4329
+
4330
+		if (!empty($rows)) {
4331
+			foreach ($rows as $row) {
4332
+				if (!empty($row->field_site_name)) {
4333
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4334 4334
 				}
4335 4335
 
4336
-				if ( ! empty( $row->front_search_title ) ) {
4337
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4336
+				if (!empty($row->front_search_title)) {
4337
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4338 4338
 				}
4339 4339
 
4340
-				if ( ! empty( $row->field_desc ) ) {
4341
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4340
+				if (!empty($row->field_desc)) {
4341
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4342 4342
 				}
4343 4343
 			}
4344 4344
 		}
4345 4345
 	}
4346 4346
 
4347
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4347
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4348 4348
 
4349 4349
 	return $translation_texts;
4350 4350
 }
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
 	 *
4367 4367
 	 * @param array $geodir_allowed_mime_types and file extensions.
4368 4368
 	 */
4369
-	return apply_filters( 'geodir_allowed_mime_types', array(
4369
+	return apply_filters('geodir_allowed_mime_types', array(
4370 4370
 			'Image'       => array( // Image formats.
4371 4371
 				'jpg'  => 'image/jpeg',
4372 4372
 				'jpe'  => 'image/jpeg',
@@ -4434,18 +4434,18 @@  discard block
 block discarded – undo
4434 4434
  *
4435 4435
  * @return string User display name.
4436 4436
  */
4437
-function geodir_get_client_name( $user_id ) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
 	$client_name = '';
4439 4439
 
4440
-	$user_data = get_userdata( $user_id );
4440
+	$user_data = get_userdata($user_id);
4441 4441
 
4442
-	if ( ! empty( $user_data ) ) {
4443
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4444
-			$client_name = trim( $user_data->display_name );
4445
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4446
-			$client_name = trim( $user_data->user_nicename );
4442
+	if (!empty($user_data)) {
4443
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4444
+			$client_name = trim($user_data->display_name);
4445
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4446
+			$client_name = trim($user_data->user_nicename);
4447 4447
 		} else {
4448
-			$client_name = trim( $user_data->user_login );
4448
+			$client_name = trim($user_data->user_login);
4449 4449
 		}
4450 4450
 	}
4451 4451
 
@@ -4453,19 +4453,19 @@  discard block
 block discarded – undo
4453 4453
 }
4454 4454
 
4455 4455
 
4456
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4456
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4457 4457
 /*
4458 4458
  * Add location variables to wpseo replacements.
4459 4459
  *
4460 4460
  * @since 1.5.4
4461 4461
  */
4462
-function geodir_wpseo_replacements( $vars ) {
4462
+function geodir_wpseo_replacements($vars) {
4463 4463
 
4464 4464
 	global $wp;
4465 4465
 	$title = '';
4466 4466
 	// location variables
4467 4467
 	$gd_post_type   = geodir_get_current_posttype();
4468
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4468
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4469 4469
 	/**
4470 4470
 	 * Filter the title variables location variables array
4471 4471
 	 *
@@ -4475,105 +4475,105 @@  discard block
 block discarded – undo
4475 4475
 	 * @param array $location_array The array of location variables.
4476 4476
 	 * @param array $vars           The page title variables.
4477 4477
 	 */
4478
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4478
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4479 4479
 	$location_titles = array();
4480
-	if ( get_query_var( 'gd_country_full' ) ) {
4481
-		if ( get_query_var( 'gd_country_full' ) ) {
4482
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4480
+	if (get_query_var('gd_country_full')) {
4481
+		if (get_query_var('gd_country_full')) {
4482
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4483 4483
 		}
4484
-		if ( get_query_var( 'gd_region_full' ) ) {
4485
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4484
+		if (get_query_var('gd_region_full')) {
4485
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4486 4486
 		}
4487
-		if ( get_query_var( 'gd_city_full' ) ) {
4488
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4487
+		if (get_query_var('gd_city_full')) {
4488
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4489 4489
 		}
4490 4490
 	}
4491 4491
 	$location_single = '';
4492
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4493
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4494
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4492
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4493
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4494
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4495 4495
 
4496 4496
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4497 4497
 
4498
-	if ( function_exists( 'get_actual_location_name' ) ) {
4499
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4500
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4501
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4498
+	if (function_exists('get_actual_location_name')) {
4499
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4500
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4501
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4502 4502
 	}
4503 4503
 
4504
-	if ( $gd_city != '' ) {
4505
-		if ( $gd_city_actual != '' ) {
4504
+	if ($gd_city != '') {
4505
+		if ($gd_city_actual != '') {
4506 4506
 			$gd_city = $gd_city_actual;
4507 4507
 		} else {
4508
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4509
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4510
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4508
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4509
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4510
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4511 4511
 		}
4512 4512
 		$location_single = $gd_city;
4513 4513
 
4514
-	} else if ( $gd_region != '' ) {
4515
-		if ( $gd_region_actual != '' ) {
4514
+	} else if ($gd_region != '') {
4515
+		if ($gd_region_actual != '') {
4516 4516
 			$gd_region = $gd_region_actual;
4517 4517
 		} else {
4518
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4519
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4520
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4518
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4519
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4520
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4521 4521
 		}
4522 4522
 
4523 4523
 		$location_single = $gd_region;
4524
-	} else if ( $gd_country != '' ) {
4525
-		if ( $gd_country_actual != '' ) {
4524
+	} else if ($gd_country != '') {
4525
+		if ($gd_country_actual != '') {
4526 4526
 			$gd_country = $gd_country_actual;
4527 4527
 		} else {
4528
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4529
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4530
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4528
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4529
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4530
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4531 4531
 		}
4532 4532
 
4533 4533
 		$location_single = $gd_country;
4534 4534
 	}
4535 4535
 
4536
-	if ( ! empty( $location_array ) ) {
4536
+	if (!empty($location_array)) {
4537 4537
 
4538
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4539
-		$location_array       = array_reverse( $location_array );
4538
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4539
+		$location_array       = array_reverse($location_array);
4540 4540
 
4541
-		foreach ( $location_array as $location_type => $location ) {
4542
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4543
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4541
+		foreach ($location_array as $location_type => $location) {
4542
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4543
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4544 4544
 
4545
-			$location_name = geodir_ucwords( $gd_location_link_text );
4546
-			$location_name = __( $location_name, 'geodirectory' );
4545
+			$location_name = geodir_ucwords($gd_location_link_text);
4546
+			$location_name = __($location_name, 'geodirectory');
4547 4547
 
4548
-			if ( $actual_location_name ) {
4549
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4550
-				$location_name = get_actual_location_name( $location_type, $location, true );
4548
+			if ($actual_location_name) {
4549
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4550
+				$location_name = get_actual_location_name($location_type, $location, true);
4551 4551
 			}
4552 4552
 
4553 4553
 			$location_titles[] = $location_name;
4554 4554
 		}
4555
-		if ( ! empty( $location_titles ) ) {
4556
-			$location_titles = array_unique( $location_titles );
4555
+		if (!empty($location_titles)) {
4556
+			$location_titles = array_unique($location_titles);
4557 4557
 		}
4558 4558
 	}
4559 4559
 
4560 4560
 
4561
-	if ( ! empty( $location_titles ) ) {
4562
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4561
+	if (!empty($location_titles)) {
4562
+		$vars['%%location%%'] = implode(", ", $location_titles);
4563 4563
 	}
4564 4564
 
4565 4565
 
4566
-	if ( ! empty( $location_titles ) ) {
4567
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4566
+	if (!empty($location_titles)) {
4567
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4568 4568
 	}
4569 4569
 
4570 4570
 
4571
-	if ( $location_single ) {
4572
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4571
+	if ($location_single) {
4572
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4573 4573
 	}
4574 4574
 
4575 4575
 
4576
-	if ( $location_single ) {
4576
+	if ($location_single) {
4577 4577
 		$vars['%%location_single%%'] = $location_single;
4578 4578
 	}
4579 4579
 
@@ -4586,13 +4586,13 @@  discard block
 block discarded – undo
4586 4586
 	 * @param string $vars          The title with variables.
4587 4587
 	 * @param array $location_array The array of location variables.
4588 4588
 	 */
4589
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4589
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4590 4590
 }
4591 4591
 
4592 4592
 
4593
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4594
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4595
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4593
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4594
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4595
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4596 4596
 
4597 4597
 /**
4598 4598
  * Filter the title variables.
@@ -4634,14 +4634,14 @@  discard block
 block discarded – undo
4634 4634
  *
4635 4635
  * @return string Title after filtered variables.
4636 4636
  */
4637
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4637
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4638 4638
 	global $wp, $post;
4639 4639
 
4640
-	if ( ! $gd_page || ! $title ) {
4640
+	if (!$gd_page || !$title) {
4641 4641
 		return $title; // if no a GD page then bail.
4642 4642
 	}
4643 4643
 
4644
-	if ( $sep == '' ) {
4644
+	if ($sep == '') {
4645 4645
 		/**
4646 4646
 		 * Filter the page title separator.
4647 4647
 		 *
@@ -4650,100 +4650,100 @@  discard block
 block discarded – undo
4650 4650
 		 *
4651 4651
 		 * @param string $sep The separator, default: `|`.
4652 4652
 		 */
4653
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4653
+		$sep = apply_filters('geodir_page_title_separator', '|');
4654 4654
 	}
4655 4655
 
4656
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4657
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4656
+	if (strpos($title, '%%title%%') !== false) {
4657
+		$title = str_replace("%%title%%", $post->post_title, $title);
4658 4658
 	}
4659 4659
 
4660
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4661
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4660
+	if (strpos($title, '%%sitename%%') !== false) {
4661
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4662 4662
 	}
4663 4663
 
4664
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4665
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4664
+	if (strpos($title, '%%sitedesc%%') !== false) {
4665
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4666 4666
 	}
4667 4667
 
4668
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4669
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4668
+	if (strpos($title, '%%excerpt%%') !== false) {
4669
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4670 4670
 	}
4671 4671
 
4672
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4673
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4674
-	} else if ( $gd_page == 'add-listing' ) {
4675
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4676
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4677
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4672
+	if ($gd_page == 'search' || $gd_page == 'author') {
4673
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4674
+	} else if ($gd_page == 'add-listing') {
4675
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4676
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4677
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4678 4678
 		$post_type = $post->post_type;
4679 4679
 	} else {
4680
-		$post_type = get_query_var( 'post_type' );
4680
+		$post_type = get_query_var('post_type');
4681 4681
 	}
4682 4682
 
4683
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4683
+	if (strpos($title, '%%pt_single%%') !== false) {
4684 4684
 		$singular_name = '';
4685
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4686
-			$singular_name = __( $singular_name, 'geodirectory' );
4685
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4686
+			$singular_name = __($singular_name, 'geodirectory');
4687 4687
 		}
4688 4688
 
4689
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4689
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4690 4690
 	}
4691 4691
 
4692
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4692
+	if (strpos($title, '%%pt_plural%%') !== false) {
4693 4693
 		$plural_name = '';
4694
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4695
-			$plural_name = __( $plural_name, 'geodirectory' );
4694
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4695
+			$plural_name = __($plural_name, 'geodirectory');
4696 4696
 		}
4697 4697
 
4698
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4698
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4699 4699
 	}
4700 4700
 
4701
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4701
+	if (strpos($title, '%%category%%') !== false) {
4702 4702
 		$cat_name = '';
4703 4703
 
4704
-		if ( $gd_page == 'detail' ) {
4705
-			if ( $post->default_category ) {
4706
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4707
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4704
+		if ($gd_page == 'detail') {
4705
+			if ($post->default_category) {
4706
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4707
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4708 4708
 			}
4709
-		} else if ( $gd_page == 'listing' ) {
4709
+		} else if ($gd_page == 'listing') {
4710 4710
 			$queried_object = get_queried_object();
4711
-			if ( isset( $queried_object->name ) ) {
4711
+			if (isset($queried_object->name)) {
4712 4712
 				$cat_name = $queried_object->name;
4713 4713
 			}
4714 4714
 		}
4715
-		$title = str_replace( "%%category%%", $cat_name, $title );
4715
+		$title = str_replace("%%category%%", $cat_name, $title);
4716 4716
 	}
4717 4717
 
4718
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4718
+	if (strpos($title, '%%tag%%') !== false) {
4719 4719
 		$cat_name = '';
4720 4720
 
4721
-		if ( $gd_page == 'detail' ) {
4722
-			if ( $post->default_category ) {
4723
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4724
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4721
+		if ($gd_page == 'detail') {
4722
+			if ($post->default_category) {
4723
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4724
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4725 4725
 			}
4726
-		} else if ( $gd_page == 'listing' ) {
4726
+		} else if ($gd_page == 'listing') {
4727 4727
 			$queried_object = get_queried_object();
4728
-			if ( isset( $queried_object->name ) ) {
4728
+			if (isset($queried_object->name)) {
4729 4729
 				$cat_name = $queried_object->name;
4730 4730
 			}
4731 4731
 		}
4732
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4732
+		$title = str_replace("%%tag%%", $cat_name, $title);
4733 4733
 	}
4734 4734
 
4735
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4736
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4737
-		$title = str_replace( "%%id%%", $ID, $title );
4735
+	if (strpos($title, '%%id%%') !== false) {
4736
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4737
+		$title = str_replace("%%id%%", $ID, $title);
4738 4738
 	}
4739 4739
 
4740
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4741
-		$title = str_replace( "%%sep%%", $sep, $title );
4740
+	if (strpos($title, '%%sep%%') !== false) {
4741
+		$title = str_replace("%%sep%%", $sep, $title);
4742 4742
 	}
4743 4743
 
4744 4744
 	// location variables
4745 4745
 	$gd_post_type   = geodir_get_current_posttype();
4746
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4746
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4747 4747
 	/**
4748 4748
 	 * Filter the title variables location variables array
4749 4749
 	 *
@@ -4755,166 +4755,166 @@  discard block
 block discarded – undo
4755 4755
 	 * @param string $gd_page       The page being filtered.
4756 4756
 	 * @param string $sep           The separator, default: `|`.
4757 4757
 	 */
4758
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4758
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4759 4759
 	$location_titles = array();
4760
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4761
-		if ( get_query_var( 'gd_country_full' ) ) {
4762
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4760
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4761
+		if (get_query_var('gd_country_full')) {
4762
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4763 4763
 		}
4764
-		if ( get_query_var( 'gd_region_full' ) ) {
4765
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4764
+		if (get_query_var('gd_region_full')) {
4765
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4766 4766
 		}
4767
-		if ( get_query_var( 'gd_city_full' ) ) {
4768
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4767
+		if (get_query_var('gd_city_full')) {
4768
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4769 4769
 		}
4770 4770
 	}
4771 4771
 	$location_single = '';
4772
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4773
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4774
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4772
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4773
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4774
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4775 4775
 
4776 4776
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4777 4777
 
4778
-	if ( function_exists( 'get_actual_location_name' ) ) {
4779
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4780
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4781
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4778
+	if (function_exists('get_actual_location_name')) {
4779
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4780
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4781
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4782 4782
 	}
4783 4783
 
4784
-	if ( $gd_city != '' ) {
4785
-		if ( $gd_city_actual != '' ) {
4784
+	if ($gd_city != '') {
4785
+		if ($gd_city_actual != '') {
4786 4786
 			$gd_city = $gd_city_actual;
4787 4787
 		} else {
4788
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4789
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4790
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4788
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4789
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4790
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4791 4791
 		}
4792 4792
 		$location_single = $gd_city;
4793 4793
 
4794
-	} else if ( $gd_region != '' ) {
4795
-		if ( $gd_region_actual != '' ) {
4794
+	} else if ($gd_region != '') {
4795
+		if ($gd_region_actual != '') {
4796 4796
 			$gd_region = $gd_region_actual;
4797 4797
 		} else {
4798
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4799
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4800
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4798
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4799
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4800
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4801 4801
 		}
4802 4802
 
4803 4803
 		$location_single = $gd_region;
4804
-	} else if ( $gd_country != '' ) {
4805
-		if ( $gd_country_actual != '' ) {
4804
+	} else if ($gd_country != '') {
4805
+		if ($gd_country_actual != '') {
4806 4806
 			$gd_country = $gd_country_actual;
4807 4807
 		} else {
4808
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4809
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4810
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4808
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4809
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4810
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4811 4811
 		}
4812 4812
 
4813 4813
 		$location_single = $gd_country;
4814 4814
 	}
4815 4815
 
4816
-	if ( ! empty( $location_array ) ) {
4816
+	if (!empty($location_array)) {
4817 4817
 
4818
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4819
-		$location_array       = array_reverse( $location_array );
4818
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4819
+		$location_array       = array_reverse($location_array);
4820 4820
 
4821
-		foreach ( $location_array as $location_type => $location ) {
4822
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4823
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4821
+		foreach ($location_array as $location_type => $location) {
4822
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4823
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4824 4824
 
4825
-			$location_name = geodir_ucwords( $gd_location_link_text );
4826
-			$location_name = __( $location_name, 'geodirectory' );
4825
+			$location_name = geodir_ucwords($gd_location_link_text);
4826
+			$location_name = __($location_name, 'geodirectory');
4827 4827
 
4828
-			if ( $actual_location_name ) {
4829
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4830
-				$location_name = get_actual_location_name( $location_type, $location, true );
4828
+			if ($actual_location_name) {
4829
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4830
+				$location_name = get_actual_location_name($location_type, $location, true);
4831 4831
 			}
4832 4832
 
4833 4833
 			$location_titles[] = $location_name;
4834 4834
 		}
4835
-		if ( ! empty( $location_titles ) ) {
4836
-			$location_titles = array_unique( $location_titles );
4835
+		if (!empty($location_titles)) {
4836
+			$location_titles = array_unique($location_titles);
4837 4837
 		}
4838 4838
 	}
4839 4839
 
4840 4840
 
4841
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4841
+	if (strpos($title, '%%location%%') !== false) {
4842 4842
 		$location = '';
4843
-		if ( $location_titles ) {
4844
-			$location = implode( ", ", $location_titles );
4843
+		if ($location_titles) {
4844
+			$location = implode(", ", $location_titles);
4845 4845
 		}
4846
-		$title = str_replace( "%%location%%", $location, $title );
4846
+		$title = str_replace("%%location%%", $location, $title);
4847 4847
 	}
4848 4848
 
4849
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4849
+	if (strpos($title, '%%in_location%%') !== false) {
4850 4850
 		$location = '';
4851
-		if ( $location_titles ) {
4852
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4851
+		if ($location_titles) {
4852
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4853 4853
 		}
4854
-		$title = str_replace( "%%in_location%%", $location, $title );
4854
+		$title = str_replace("%%in_location%%", $location, $title);
4855 4855
 	}
4856 4856
 
4857
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4858
-		if ( $location_single ) {
4859
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4857
+	if (strpos($title, '%%in_location_single%%') !== false) {
4858
+		if ($location_single) {
4859
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4860 4860
 		}
4861
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4861
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4862 4862
 	}
4863 4863
 
4864
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4865
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4864
+	if (strpos($title, '%%location_single%%') !== false) {
4865
+		$title = str_replace("%%location_single%%", $location_single, $title);
4866 4866
 	}
4867 4867
 
4868 4868
 
4869
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4869
+	if (strpos($title, '%%search_term%%') !== false) {
4870 4870
 		$search_term = '';
4871
-		if ( isset( $_REQUEST['s'] ) ) {
4872
-			$search_term = esc_attr( $_REQUEST['s'] );
4871
+		if (isset($_REQUEST['s'])) {
4872
+			$search_term = esc_attr($_REQUEST['s']);
4873 4873
 		}
4874
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4874
+		$title = str_replace("%%search_term%%", $search_term, $title);
4875 4875
 	}
4876 4876
 
4877
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4877
+	if (strpos($title, '%%search_near%%') !== false) {
4878 4878
 		$search_term = '';
4879
-		if ( isset( $_REQUEST['snear'] ) ) {
4880
-			$search_term = esc_attr( $_REQUEST['snear'] );
4879
+		if (isset($_REQUEST['snear'])) {
4880
+			$search_term = esc_attr($_REQUEST['snear']);
4881 4881
 		}
4882
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4882
+		$title = str_replace("%%search_near%%", $search_term, $title);
4883 4883
 	}
4884 4884
 
4885
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4886
-		if ( is_author() ) {
4887
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4885
+	if (strpos($title, '%%name%%') !== false) {
4886
+		if (is_author()) {
4887
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4888 4888
 			$author_name = $curauth->display_name;
4889 4889
 		} else {
4890 4890
 			$author_name = get_the_author();
4891 4891
 		}
4892
-		if ( ! $author_name || $author_name === '' ) {
4892
+		if (!$author_name || $author_name === '') {
4893 4893
 			$queried_object = get_queried_object();
4894 4894
 
4895
-			if ( isset( $queried_object->data->user_nicename ) ) {
4895
+			if (isset($queried_object->data->user_nicename)) {
4896 4896
 				$author_name = $queried_object->data->display_name;
4897 4897
 			}
4898 4898
 		}
4899
-		$title = str_replace( "%%name%%", $author_name, $title );
4899
+		$title = str_replace("%%name%%", $author_name, $title);
4900 4900
 	}
4901 4901
 
4902
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4903
-		$page  = geodir_title_meta_page( $sep );
4904
-		$title = str_replace( "%%page%%", $page, $title );
4902
+	if (strpos($title, '%%page%%') !== false) {
4903
+		$page  = geodir_title_meta_page($sep);
4904
+		$title = str_replace("%%page%%", $page, $title);
4905 4905
 	}
4906
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4906
+	if (strpos($title, '%%pagenumber%%') !== false) {
4907 4907
 		$pagenumber = geodir_title_meta_pagenumber();
4908
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4908
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4909 4909
 	}
4910
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4910
+	if (strpos($title, '%%pagetotal%%') !== false) {
4911 4911
 		$pagetotal = geodir_title_meta_pagetotal();
4912
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4912
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4913 4913
 	}
4914 4914
 
4915
-	$title = wptexturize( $title );
4916
-	$title = convert_chars( $title );
4917
-	$title = esc_html( $title );
4915
+	$title = wptexturize($title);
4916
+	$title = convert_chars($title);
4917
+	$title = esc_html($title);
4918 4918
 
4919 4919
 	/**
4920 4920
 	 * Filter the title variables after standard ones have been filtered.
@@ -4928,7 +4928,7 @@  discard block
 block discarded – undo
4928 4928
 	 * @param string $sep           The separator, default: `|`.
4929 4929
 	 */
4930 4930
 
4931
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4931
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4932 4932
 }
4933 4933
 
4934 4934
 /**
@@ -4941,82 +4941,82 @@  discard block
 block discarded – undo
4941 4941
  *
4942 4942
  * @return array Translation texts.
4943 4943
  */
4944
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4945
-	$gd_post_types = geodir_get_posttypes( 'array' );
4944
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4945
+	$gd_post_types = geodir_get_posttypes('array');
4946 4946
 
4947
-	if ( ! empty( $gd_post_types ) ) {
4948
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4949
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4950
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4951
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4947
+	if (!empty($gd_post_types)) {
4948
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4949
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4950
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4951
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4952 4952
 
4953
-			if ( ! empty( $labels ) ) {
4954
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4953
+			if (!empty($labels)) {
4954
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4955 4955
 					$translation_texts[] = $labels['name'];
4956 4956
 				}
4957
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4957
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4958 4958
 					$translation_texts[] = $labels['singular_name'];
4959 4959
 				}
4960
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4960
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4961 4961
 					$translation_texts[] = $labels['add_new'];
4962 4962
 				}
4963
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4963
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4964 4964
 					$translation_texts[] = $labels['add_new_item'];
4965 4965
 				}
4966
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4966
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4967 4967
 					$translation_texts[] = $labels['edit_item'];
4968 4968
 				}
4969
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4969
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4970 4970
 					$translation_texts[] = $labels['new_item'];
4971 4971
 				}
4972
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4972
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4973 4973
 					$translation_texts[] = $labels['view_item'];
4974 4974
 				}
4975
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4975
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4976 4976
 					$translation_texts[] = $labels['search_items'];
4977 4977
 				}
4978
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4978
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4979 4979
 					$translation_texts[] = $labels['not_found'];
4980 4980
 				}
4981
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4981
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4982 4982
 					$translation_texts[] = $labels['not_found_in_trash'];
4983 4983
 				}
4984
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4984
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4985 4985
 					$translation_texts[] = $labels['label_post_profile'];
4986 4986
 				}
4987
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4987
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4988 4988
 					$translation_texts[] = $labels['label_post_info'];
4989 4989
 				}
4990
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4990
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4991 4991
 					$translation_texts[] = $labels['label_post_images'];
4992 4992
 				}
4993
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4993
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4994 4994
 					$translation_texts[] = $labels['label_post_map'];
4995 4995
 				}
4996
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4996
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4997 4997
 					$translation_texts[] = $labels['label_reviews'];
4998 4998
 				}
4999
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4999
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
5000 5000
 					$translation_texts[] = $labels['label_related_listing'];
5001 5001
 				}
5002 5002
 			}
5003 5003
 
5004
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
5005
-				$translation_texts[] = normalize_whitespace( $description );
5004
+			if ($description != '' && !in_array($description, $translation_texts)) {
5005
+				$translation_texts[] = normalize_whitespace($description);
5006 5006
 			}
5007 5007
 
5008
-			if ( ! empty( $seo ) ) {
5009
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
5010
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
5008
+			if (!empty($seo)) {
5009
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
5010
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
5011 5011
 				}
5012 5012
 
5013
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
5014
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
5013
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
5014
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
5015 5015
 				}
5016 5016
 			}
5017 5017
 		}
5018 5018
 	}
5019
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
5019
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
5020 5020
 
5021 5021
 	return $translation_texts;
5022 5022
 }
@@ -5031,27 +5031,27 @@  discard block
 block discarded – undo
5031 5031
  *
5032 5032
  * @return array Location terms.
5033 5033
  */
5034
-function geodir_remove_location_terms( $location_terms = array() ) {
5035
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
5034
+function geodir_remove_location_terms($location_terms = array()) {
5035
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
5036 5036
 
5037
-	if ( ! empty( $location_terms ) && $location_manager ) {
5038
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
5039
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
5037
+	if (!empty($location_terms) && $location_manager) {
5038
+		$hide_country_part = get_option('geodir_location_hide_country_part');
5039
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
5040 5040
 
5041
-		if ( $hide_region_part && $hide_country_part ) {
5042
-			if ( isset( $location_terms['gd_country'] ) ) {
5043
-				unset( $location_terms['gd_country'] );
5041
+		if ($hide_region_part && $hide_country_part) {
5042
+			if (isset($location_terms['gd_country'])) {
5043
+				unset($location_terms['gd_country']);
5044 5044
 			}
5045
-			if ( isset( $location_terms['gd_region'] ) ) {
5046
-				unset( $location_terms['gd_region'] );
5045
+			if (isset($location_terms['gd_region'])) {
5046
+				unset($location_terms['gd_region']);
5047 5047
 			}
5048
-		} else if ( $hide_region_part && ! $hide_country_part ) {
5049
-			if ( isset( $location_terms['gd_region'] ) ) {
5050
-				unset( $location_terms['gd_region'] );
5048
+		} else if ($hide_region_part && !$hide_country_part) {
5049
+			if (isset($location_terms['gd_region'])) {
5050
+				unset($location_terms['gd_region']);
5051 5051
 			}
5052
-		} else if ( ! $hide_region_part && $hide_country_part ) {
5053
-			if ( isset( $location_terms['gd_country'] ) ) {
5054
-				unset( $location_terms['gd_country'] );
5052
+		} else if (!$hide_region_part && $hide_country_part) {
5053
+			if (isset($location_terms['gd_country'])) {
5054
+				unset($location_terms['gd_country']);
5055 5055
 			}
5056 5056
 		}
5057 5057
 	}
@@ -5069,33 +5069,33 @@  discard block
 block discarded – undo
5069 5069
  * @param WP_Post $post Post object.
5070 5070
  * @param bool $update  Whether this is an existing listing being updated or not.
5071 5071
  */
5072
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5073
-	if ( ! $update ) {
5072
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5073
+	if (!$update) {
5074 5074
 		return;
5075 5075
 	}
5076 5076
 
5077
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5078
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5077
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5078
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5079 5079
 	$inline_save = $action == 'inline-save' ? true : false;
5080 5080
 
5081
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5081
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5082 5082
 		return;
5083 5083
 	}
5084 5084
 
5085
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5085
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5086 5086
 		return;
5087 5087
 	}
5088 5088
 
5089 5089
 	$user_id = (int) get_current_user_id();
5090 5090
 
5091
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5092
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5091
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5092
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5093 5093
 
5094
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5095
-			$from_email   = get_option( 'site_email' );
5094
+		if ($user_id == $author_id && !is_super_admin()) {
5095
+			$from_email   = get_option('site_email');
5096 5096
 			$from_name    = get_site_emailName();
5097
-			$to_email     = get_option( 'admin_email' );
5098
-			$to_name      = get_option( 'name' );
5097
+			$to_email     = get_option('admin_email');
5098
+			$to_name      = get_option('name');
5099 5099
 			$message_type = 'listing_edited';
5100 5100
 
5101 5101
 			$notify_edited = true;
@@ -5107,9 +5107,9 @@  discard block
 block discarded – undo
5107 5107
 			 * @param bool $notify_edited Notify on listing edited by author?
5108 5108
 			 * @param object $post        The current post object.
5109 5109
 			 */
5110
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5110
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5111 5111
 
5112
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5112
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5113 5113
 		}
5114 5114
 	}
5115 5115
 }
@@ -5124,14 +5124,14 @@  discard block
 block discarded – undo
5124 5124
  *
5125 5125
  * @return string|null The current page start & end numbering.
5126 5126
  */
5127
-function geodir_title_meta_page( $sep ) {
5127
+function geodir_title_meta_page($sep) {
5128 5128
 	$replacement = null;
5129 5129
 
5130
-	$max = geodir_title_meta_pagenumbering( 'max' );
5131
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5130
+	$max = geodir_title_meta_pagenumbering('max');
5131
+	$nr  = geodir_title_meta_pagenumbering('nr');
5132 5132
 
5133
-	if ( $max > 1 && $nr > 1 ) {
5134
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5133
+	if ($max > 1 && $nr > 1) {
5134
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5135 5135
 	}
5136 5136
 
5137 5137
 	return $replacement;
@@ -5148,8 +5148,8 @@  discard block
 block discarded – undo
5148 5148
 function geodir_title_meta_pagenumber() {
5149 5149
 	$replacement = null;
5150 5150
 
5151
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5152
-	if ( isset( $nr ) && $nr > 0 ) {
5151
+	$nr = geodir_title_meta_pagenumbering('nr');
5152
+	if (isset($nr) && $nr > 0) {
5153 5153
 		$replacement = (string) $nr;
5154 5154
 	}
5155 5155
 
@@ -5167,8 +5167,8 @@  discard block
 block discarded – undo
5167 5167
 function geodir_title_meta_pagetotal() {
5168 5168
 	$replacement = null;
5169 5169
 
5170
-	$max = geodir_title_meta_pagenumbering( 'max' );
5171
-	if ( isset( $max ) && $max > 0 ) {
5170
+	$max = geodir_title_meta_pagenumbering('max');
5171
+	if (isset($max) && $max > 0) {
5172 5172
 		$replacement = (string) $max;
5173 5173
 	}
5174 5174
 
@@ -5188,36 +5188,36 @@  discard block
 block discarded – undo
5188 5188
  *
5189 5189
  * @return int|null The current page numbering.
5190 5190
  */
5191
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5191
+function geodir_title_meta_pagenumbering($request = 'nr') {
5192 5192
 	global $wp_query, $post;
5193 5193
 	$max_num_pages = null;
5194 5194
 	$page_number   = null;
5195 5195
 
5196 5196
 	$max_num_pages = 1;
5197 5197
 
5198
-	if ( ! is_singular() ) {
5199
-		$page_number = get_query_var( 'paged' );
5200
-		if ( $page_number === 0 || $page_number === '' ) {
5198
+	if (!is_singular()) {
5199
+		$page_number = get_query_var('paged');
5200
+		if ($page_number === 0 || $page_number === '') {
5201 5201
 			$page_number = 1;
5202 5202
 		}
5203 5203
 
5204
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5204
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5205 5205
 			$max_num_pages = $wp_query->max_num_pages;
5206 5206
 		}
5207 5207
 	} else {
5208
-		$page_number = get_query_var( 'page' );
5209
-		if ( $page_number === 0 || $page_number === '' ) {
5208
+		$page_number = get_query_var('page');
5209
+		if ($page_number === 0 || $page_number === '') {
5210 5210
 			$page_number = 1;
5211 5211
 		}
5212 5212
 
5213
-		if ( isset( $post->post_content ) ) {
5214
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5213
+		if (isset($post->post_content)) {
5214
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5215 5215
 		}
5216 5216
 	}
5217 5217
 
5218 5218
 	$return = null;
5219 5219
 
5220
-	switch ( $request ) {
5220
+	switch ($request) {
5221 5221
 		case 'nr':
5222 5222
 			$return = $page_number;
5223 5223
 			break;
@@ -5238,14 +5238,14 @@  discard block
 block discarded – undo
5238 5238
  *
5239 5239
  * @return array Terms.
5240 5240
  */
5241
-function geodir_filter_empty_terms( $terms ) {
5242
-	if ( empty( $terms ) ) {
5241
+function geodir_filter_empty_terms($terms) {
5242
+	if (empty($terms)) {
5243 5243
 		return $terms;
5244 5244
 	}
5245 5245
 
5246 5246
 	$return = array();
5247
-	foreach ( $terms as $term ) {
5248
-		if ( isset( $term->count ) && $term->count > 0 ) {
5247
+	foreach ($terms as $term) {
5248
+		if (isset($term->count) && $term->count > 0) {
5249 5249
 			$return[] = $term;
5250 5250
 		} else {
5251 5251
 			/**
@@ -5256,7 +5256,7 @@  discard block
 block discarded – undo
5256 5256
 			 * @param array $return The array of terms to return.
5257 5257
 			 * @param object $term  The term object.
5258 5258
 			 */
5259
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5259
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5260 5260
 		}
5261 5261
 	}
5262 5262
 
@@ -5273,12 +5273,12 @@  discard block
 block discarded – undo
5273 5273
  *
5274 5274
  * @return array
5275 5275
  */
5276
-function geodir_remove_hentry( $class ) {
5277
-	if ( geodir_is_page( 'detail' ) ) {
5278
-		$class = array_diff( $class, array( 'hentry' ) );
5276
+function geodir_remove_hentry($class) {
5277
+	if (geodir_is_page('detail')) {
5278
+		$class = array_diff($class, array('hentry'));
5279 5279
 	}
5280 5280
 
5281 5281
 	return $class;
5282 5282
 }
5283 5283
 
5284
-add_filter( 'post_class', 'geodir_remove_hentry' );
5285 5284
\ No newline at end of file
5285
+add_filter('post_class', 'geodir_remove_hentry');
5286 5286
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/ajax_handler_functions.php 3 patches
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_on_wp_loaded()
18 18
 {
19
-    /**
20
-     * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
-     *
22
-     * @since 1.0.0
23
-     */
24
-    do_action('giodir_handle_request_plugins_loaded');
25
-    global $wpdb;
19
+	/**
20
+	 * Called on the wp_loaded WP hook and used to send the send inquiry and send to friend forms.
21
+	 *
22
+	 * @since 1.0.0
23
+	 */
24
+	do_action('giodir_handle_request_plugins_loaded');
25
+	global $wpdb;
26 26
 
27 27
 
28
-    if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
-        geodir_send_inquiry($_REQUEST); // function in custom_functions.php
28
+	if (isset($_POST['sendact']) && $_POST['sendact'] == 'send_inqury') {
29
+		geodir_send_inquiry($_REQUEST); // function in custom_functions.php
30 30
 
31
-    } elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
-        geodir_send_friend($_REQUEST); // function in custom_functions.php
31
+	} elseif (isset($_POST['sendact']) && $_POST['sendact'] == 'email_frnd') {
32
+		geodir_send_friend($_REQUEST); // function in custom_functions.php
33 33
 
34
-    }
34
+	}
35 35
 
36 36
 }
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
48
-        geodir_user_signup();
49
-    }
47
+	if(geodir_is_page('login')) {
48
+		geodir_user_signup();
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,47 +59,47 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function geodir_on_init()
61 61
 {
62
-    /**
63
-     * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
-     *
65
-     * @since 1.0.0
66
-     */
67
-    do_action('giodir_handle_request');
68
-    global $wpdb;
69
-
70
-
71
-
72
-
73
-    if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
-        show_admin_bar(false);
75
-    }
76
-
77
-
78
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
-        /**
80
-         * Contains map marker functions.
81
-         *
82
-         * @since 1.0.0
83
-         * @package GeoDirectory
84
-         */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
-        die;
87
-    }
88
-
89
-    if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
-        if (isset($_REQUEST['ga_start'])) {
91
-            $ga_start = $_REQUEST['ga_start'];
92
-        } else {
93
-            $ga_start = '';
94
-        }
95
-        if (isset($_REQUEST['ga_end'])) {
96
-            $ga_end = $_REQUEST['ga_end'];
97
-        } else {
98
-            $ga_end = '';
99
-        }
100
-        geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
-        die;
102
-    }
62
+	/**
63
+	 * Called on the wp_init WP hook at the start of the geodir_on_init() function.
64
+	 *
65
+	 * @since 1.0.0
66
+	 */
67
+	do_action('giodir_handle_request');
68
+	global $wpdb;
69
+
70
+
71
+
72
+
73
+	if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && !current_user_can('manage_options') && !class_exists('BuddyPress')) {
74
+		show_admin_bar(false);
75
+	}
76
+
77
+
78
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'get_markers') {
79
+		/**
80
+		 * Contains map marker functions.
81
+		 *
82
+		 * @since 1.0.0
83
+		 * @package GeoDirectory
84
+		 */
85
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
86
+		die;
87
+	}
88
+
89
+	if (isset($_REQUEST['ptype']) && $_REQUEST['ptype'] == 'ga') {
90
+		if (isset($_REQUEST['ga_start'])) {
91
+			$ga_start = $_REQUEST['ga_start'];
92
+		} else {
93
+			$ga_start = '';
94
+		}
95
+		if (isset($_REQUEST['ga_end'])) {
96
+			$ga_end = $_REQUEST['ga_end'];
97
+		} else {
98
+			$ga_end = '';
99
+		}
100
+		geodir_getGoogleAnalytics($_REQUEST['ga_page'], $ga_start, $ga_end);
101
+		die;
102
+	}
103 103
 
104 104
 
105 105
 }
@@ -118,245 +118,245 @@  discard block
 block discarded – undo
118 118
  * @todo check if nonce is required here and if so add one.
119 119
  */
120 120
 function geodir_ajax_handler() {
121
-    global $wpdb, $gd_session;
121
+	global $wpdb, $gd_session;
122 122
 
123
-    if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
123
+	if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') {
124 124
 		$gd_session->set('gd_listing_view', $_REQUEST['gd_listing_view']);
125
-        echo '1';
126
-    }
127
-
128
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
-    }
134
-
135
-    if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
-        if (current_user_can('manage_options')) {
137
-            /**
138
-             * Contains admin ajax handling functions.
139
-             *
140
-             * @since 1.0.0
141
-             * @package GeoDirectory
142
-             */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
-        } else {
145
-            wp_redirect(geodir_login_url());
146
-            gd_die();
147
-        }
148
-    }
149
-
150
-    if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
-        if (current_user_can('manage_options')) {
152
-            switch ($_REQUEST['geodir_autofill']):
153
-                case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
156
-
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
-                         * Used to delete the dummy post data per post type.
160
-                         *
161
-                         * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
-                         *
163
-                         * @since 1.0.0
164
-                         */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
-                    break;
167
-                case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
170
-
171
-                    global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
-                    $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
-                    $city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
-                    $city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
-                    $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
-                    $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
-
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
180
-                         * Used to insert the dummy post data per post type.
181
-                         *
182
-                         * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
-                         *
184
-                         * @since 1.0.0
185
-                         */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
-
188
-                    break;
189
-            endswitch;
190
-        } else {
191
-            wp_redirect(geodir_login_url());
192
-            exit();
193
-        }
194
-    }
195
-
196
-    if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
-
198
-        if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199
-            $template = locate_template(array("geodirectory/popup-forms.php"));
200
-            if (!$template) {
201
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
202
-            }
203
-            require_once($template);
204
-        }
205
-
206
-        gd_die();
207
-    }
208
-
209
-    /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
125
+		echo '1';
126
+	}
127
+
128
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
+		if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
+			geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+		else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
+			geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+	}
134
+
135
+	if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
136
+		if (current_user_can('manage_options')) {
137
+			/**
138
+			 * Contains admin ajax handling functions.
139
+			 *
140
+			 * @since 1.0.0
141
+			 * @package GeoDirectory
142
+			 */
143
+			include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
144
+		} else {
145
+			wp_redirect(geodir_login_url());
146
+			gd_die();
147
+		}
148
+	}
149
+
150
+	if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) {
151
+		if (current_user_can('manage_options')) {
152
+			switch ($_REQUEST['geodir_autofill']):
153
+				case "geodir_dummy_delete" :
154
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
+						return;
156
+
157
+					if (isset($_REQUEST['posttype']))
158
+						/**
159
+						 * Used to delete the dummy post data per post type.
160
+						 *
161
+						 * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162
+						 *
163
+						 * @since 1.0.0
164
+						 */
165
+						do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
166
+					break;
167
+				case "geodir_dummy_insert" :
168
+					if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
+						return;
170
+
171
+					global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172
+					$dummy_post_index = $_REQUEST['insert_dummy_post_index'];
173
+					$city_bound_lat1 = $_REQUEST['city_bound_lat1'];
174
+					$city_bound_lng1 = $_REQUEST['city_bound_lng1'];
175
+					$city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176
+					$city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177
+
178
+					if (isset($_REQUEST['posttype']))
179
+						/**
180
+						 * Used to insert the dummy post data per post type.
181
+						 *
182
+						 * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183
+						 *
184
+						 * @since 1.0.0
185
+						 */
186
+						do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
187
+
188
+					break;
189
+			endswitch;
190
+		} else {
191
+			wp_redirect(geodir_login_url());
192
+			exit();
193
+		}
194
+	}
195
+
196
+	if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
197
+
198
+		if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199
+			$template = locate_template(array("geodirectory/popup-forms.php"));
200
+			if (!$template) {
201
+				$template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
202
+			}
203
+			require_once($template);
204
+		}
205
+
206
+		gd_die();
207
+	}
208
+
209
+	/*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){
210 210
         include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php');
211 211
     }*/
212 212
 
213
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
214
-        /**
215
-         * Contains map marker functions.
216
-         *
217
-         * @since 1.0.0
218
-         * @package GeoDirectory
219
-         */
220
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
221
-    }
222
-
223
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224
-        if (is_user_logged_in()) {
225
-            switch ($_REQUEST['ajax_action']):
226
-                case "add" :
227
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
228
-                    break;
229
-                case "remove" :
230
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
231
-                    break;
232
-            endswitch;
233
-        } else {
234
-            wp_redirect(geodir_login_url());
235
-            exit();
236
-        }
237
-    }
238
-
239
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
240
-
241
-        $is_current_user_owner = true;
242
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
244
-        }
245
-
246
-        $request = $gd_session->get('listing');
247
-
248
-        if (is_user_logged_in() && $is_current_user_owner) {
249
-
250
-            switch ($_REQUEST['ajax_action']):
251
-                case "add":
252
-                case "update":
253
-
254
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
255
-                        $last_id = geodir_save_listing();
256
-
257
-                        if ($last_id) {
258
-                            //$redirect_to = get_permalink( $last_id );
259
-                            $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
260
-
261
-                        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
263
-                            $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
-                        } else
265
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
266
-
267
-                        wp_redirect($redirect_to);
268
-                    } else {
269
-                        $gd_session->un_set('listing');
270
-                        wp_redirect(home_url());
271
-                    }
272
-
273
-                    break;
274
-                case "cancel" :
275
-
276
-                    $gd_session->un_set('listing');
277
-
278
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
-                        wp_redirect(get_permalink($_REQUEST['pid']));
280
-                    else {
281
-                        geodir_remove_temp_images();
282
-                        wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283
-                    }
284
-
285
-                    break;
286
-
287
-                case "publish" :
288
-
289
-                    if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
290
-
291
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
292
-                            $new_post = array();
293
-                            $new_post['ID'] = $_REQUEST['pid'];
294
-
295
-                            $lastid = wp_update_post($new_post);
296
-
297
-                            $gd_session->un_set('listing');
298
-                            wp_redirect(get_permalink($lastid));
299
-                        } else {
300
-                            $last_id = geodir_save_listing();
301
-
302
-                            if ($last_id) {
303
-                                //$redirect_to = get_permalink( $last_id );
304
-                                $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
305
-                            } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
307
-                                $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
-                            } else
309
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
310
-
311
-                            $gd_session->un_set('listing');
312
-                            wp_redirect($redirect_to);
313
-                        }
314
-                    } else {
315
-                        $gd_session->un_set('listing');
316
-                        wp_redirect(home_url());
317
-                    }
318
-
319
-                    break;
320
-                case "delete" :
321
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
322
-                        global $current_user;
323
-
324
-                        if (get_option('geodir_disable_perm_delete')) {
325
-                            $lastid = wp_trash_post($_REQUEST['pid']);
326
-                        } else {
327
-                            $lastid = wp_delete_post($_REQUEST['pid']);
328
-                        }
329
-
330
-                        if ($lastid && !is_wp_error($lastid))
331
-                            wp_redirect($_SERVER['HTTP_REFERER']);
332
-
333
-                        //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334
-                    }
335
-                    break;
336
-            endswitch;
337
-
338
-            $gd_session->un_set('listing');
339
-        } else {
340
-            $gd_session->un_set('listing');
341
-            wp_redirect(geodir_login_url());
342
-            exit();
343
-        }
344
-    }
345
-
346
-    if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
347
-        /**
348
-         * Contains registration and login functions.
349
-         * @todo Fix the file path.
350
-         *
351
-         * @since 1.0.0
352
-         * @package GeoDirectory
353
-         */
354
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
355
-    }
356
-
357
-
358
-    if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
359
-        $terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
213
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') {
214
+		/**
215
+		 * Contains map marker functions.
216
+		 *
217
+		 * @since 1.0.0
218
+		 * @package GeoDirectory
219
+		 */
220
+		include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
221
+	}
222
+
223
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224
+		if (is_user_logged_in()) {
225
+			switch ($_REQUEST['ajax_action']):
226
+				case "add" :
227
+					geodir_add_to_favorite((int)$_REQUEST['pid']);
228
+					break;
229
+				case "remove" :
230
+					geodir_remove_from_favorite((int)$_REQUEST['pid']);
231
+					break;
232
+			endswitch;
233
+		} else {
234
+			wp_redirect(geodir_login_url());
235
+			exit();
236
+		}
237
+	}
238
+
239
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') {
240
+
241
+		$is_current_user_owner = true;
242
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
+			$is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
244
+		}
245
+
246
+		$request = $gd_session->get('listing');
247
+
248
+		if (is_user_logged_in() && $is_current_user_owner) {
249
+
250
+			switch ($_REQUEST['ajax_action']):
251
+				case "add":
252
+				case "update":
253
+
254
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
255
+						$last_id = geodir_save_listing();
256
+
257
+						if ($last_id) {
258
+							//$redirect_to = get_permalink( $last_id );
259
+							$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
260
+
261
+						} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
263
+							$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
+						} else
265
+							$redirect_to = get_permalink(geodir_add_listing_page_id());
266
+
267
+						wp_redirect($redirect_to);
268
+					} else {
269
+						$gd_session->un_set('listing');
270
+						wp_redirect(home_url());
271
+					}
272
+
273
+					break;
274
+				case "cancel" :
275
+
276
+					$gd_session->un_set('listing');
277
+
278
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
+						wp_redirect(get_permalink($_REQUEST['pid']));
280
+					else {
281
+						geodir_remove_temp_images();
282
+						wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283
+					}
284
+
285
+					break;
286
+
287
+				case "publish" :
288
+
289
+					if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') {
290
+
291
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
292
+							$new_post = array();
293
+							$new_post['ID'] = $_REQUEST['pid'];
294
+
295
+							$lastid = wp_update_post($new_post);
296
+
297
+							$gd_session->un_set('listing');
298
+							wp_redirect(get_permalink($lastid));
299
+						} else {
300
+							$last_id = geodir_save_listing();
301
+
302
+							if ($last_id) {
303
+								//$redirect_to = get_permalink( $last_id );
304
+								$redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id));
305
+							} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
307
+								$redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
+							} else
309
+								$redirect_to = get_permalink(geodir_add_listing_page_id());
310
+
311
+							$gd_session->un_set('listing');
312
+							wp_redirect($redirect_to);
313
+						}
314
+					} else {
315
+						$gd_session->un_set('listing');
316
+						wp_redirect(home_url());
317
+					}
318
+
319
+					break;
320
+				case "delete" :
321
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
322
+						global $current_user;
323
+
324
+						if (get_option('geodir_disable_perm_delete')) {
325
+							$lastid = wp_trash_post($_REQUEST['pid']);
326
+						} else {
327
+							$lastid = wp_delete_post($_REQUEST['pid']);
328
+						}
329
+
330
+						if ($lastid && !is_wp_error($lastid))
331
+							wp_redirect($_SERVER['HTTP_REFERER']);
332
+
333
+						//wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334
+					}
335
+					break;
336
+			endswitch;
337
+
338
+			$gd_session->un_set('listing');
339
+		} else {
340
+			$gd_session->un_set('listing');
341
+			wp_redirect(geodir_login_url());
342
+			exit();
343
+		}
344
+	}
345
+
346
+	if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') {
347
+		/**
348
+		 * Contains registration and login functions.
349
+		 * @todo Fix the file path.
350
+		 *
351
+		 * @since 1.0.0
352
+		 * @package GeoDirectory
353
+		 */
354
+		include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
355
+	}
356
+
357
+
358
+	if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') {
359
+		$terms_o = get_terms(sanitize_text_field($_REQUEST['term']));
360 360
 		
361 361
 		// Skip terms which has no listing
362 362
 		if (!empty($terms_o)) {
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
 			$terms_o = $filter_terms;
371 371
 		}
372 372
 		
373
-        $terms = geodir_sort_terms($terms_o, 'count');
374
-        geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
375
-        exit();
373
+		$terms = geodir_sort_terms($terms_o, 'count');
374
+		geodir_helper_cat_list_output($terms, intval($_REQUEST['limit']));
375
+		exit();
376 376
 
377
-    }
377
+	}
378 378
 
379
-    gd_die();
379
+	gd_die();
380 380
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
47
+    if (geodir_is_page('login')) {
48 48
         geodir_user_signup();
49 49
     }
50 50
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
          * @since 1.0.0
83 83
          * @package GeoDirectory
84 84
          */
85
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
85
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
86 86
         die;
87 87
     }
88 88
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
              * @since 1.0.0
141 141
              * @package GeoDirectory
142 142
              */
143
-            include_once(geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php');
143
+            include_once(geodir_plugin_path().'/geodirectory-admin/geodir_admin_ajax.php');
144 144
         } else {
145 145
             wp_redirect(geodir_login_url());
146 146
             gd_die();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                          *
163 163
                          * @since 1.0.0
164 164
                          */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
165
+                        do_action('geodir_delete_dummy_posts_'.$_REQUEST['posttype']);
166 166
                     break;
167 167
                 case "geodir_dummy_insert" :
168 168
                     if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                          *
184 184
                          * @since 1.0.0
185 185
                          */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
186
+                        do_action('geodir_insert_dummy_posts_'.$_REQUEST['posttype']);
187 187
 
188 188
                     break;
189 189
             endswitch;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') {
199 199
             $template = locate_template(array("geodirectory/popup-forms.php"));
200 200
             if (!$template) {
201
-                $template = geodir_plugin_path() . '/geodirectory-templates/popup-forms.php';
201
+                $template = geodir_plugin_path().'/geodirectory-templates/popup-forms.php';
202 202
             }
203 203
             require_once($template);
204 204
         }
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
          * @since 1.0.0
218 218
          * @package GeoDirectory
219 219
          */
220
-        include_once(geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php');
220
+        include_once(geodir_plugin_path().'/geodirectory-functions/map-functions/get_markers.php');
221 221
     }
222 222
 
223 223
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') {
224 224
         if (is_user_logged_in()) {
225 225
             switch ($_REQUEST['ajax_action']):
226 226
                 case "add" :
227
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
227
+                    geodir_add_to_favorite((int) $_REQUEST['pid']);
228 228
                     break;
229 229
                 case "remove" :
230
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
230
+                    geodir_remove_from_favorite((int) $_REQUEST['pid']);
231 231
                     break;
232 232
             endswitch;
233 233
         } else {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $is_current_user_owner = true;
242 242
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
243
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
243
+            $is_current_user_owner = geodir_listing_belong_to_current_user((int) $_REQUEST['pid']);
244 244
         }
245 245
 
246 246
         $request = $gd_session->get('listing');
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
          * @since 1.0.0
352 352
          * @package GeoDirectory
353 353
          */
354
-        include_once(geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php');
354
+        include_once(geodir_plugin_path().'/geodirectory-functions/geodirectory_reg.php');
355 355
     }
356 356
 
357 357
 
Please login to merge, or discard this patch.
Braces   +31 added lines, -23 removed lines patch added patch discarded remove patch
@@ -126,10 +126,11 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
129
-        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude']))
130
-            geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
-        else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax']))
132
-            geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
129
+        if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) {
130
+                    geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']);
131
+        } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) {
132
+                    geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']);
133
+        }
133 134
     }
134 135
 
135 136
     if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
@@ -151,22 +152,25 @@  discard block
 block discarded – undo
151 152
         if (current_user_can('manage_options')) {
152 153
             switch ($_REQUEST['geodir_autofill']):
153 154
                 case "geodir_dummy_delete" :
154
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename'))
155
-                        return;
155
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) {
156
+                                            return;
157
+                    }
156 158
 
157
-                    if (isset($_REQUEST['posttype']))
158
-                        /**
159
+                    if (isset($_REQUEST['posttype'])) {
160
+                                            /**
159 161
                          * Used to delete the dummy post data per post type.
160 162
                          *
161 163
                          * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype'].
162 164
                          *
163 165
                          * @since 1.0.0
164 166
                          */
165
-                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
167
+                        do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
168
+                    }
166 169
                     break;
167 170
                 case "geodir_dummy_insert" :
168
-                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename'))
169
-                        return;
171
+                    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) {
172
+                                            return;
173
+                    }
170 174
 
171 175
                     global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
172 176
                     $dummy_post_index = $_REQUEST['insert_dummy_post_index'];
@@ -175,15 +179,16 @@  discard block
 block discarded – undo
175 179
                     $city_bound_lat2 = $_REQUEST['city_bound_lat2'];
176 180
                     $city_bound_lng2 = $_REQUEST['city_bound_lng2'];
177 181
 
178
-                    if (isset($_REQUEST['posttype']))
179
-                        /**
182
+                    if (isset($_REQUEST['posttype'])) {
183
+                                            /**
180 184
                          * Used to insert the dummy post data per post type.
181 185
                          *
182 186
                          * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype'].
183 187
                          *
184 188
                          * @since 1.0.0
185 189
                          */
186
-                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
190
+                        do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
191
+                    }
187 192
 
188 193
                     break;
189 194
             endswitch;
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
262 267
                             $redirect_to = get_permalink(geodir_add_listing_page_id());
263 268
                             $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
264
-                        } else
265
-                            $redirect_to = get_permalink(geodir_add_listing_page_id());
269
+                        } else {
270
+                                                    $redirect_to = get_permalink(geodir_add_listing_page_id());
271
+                        }
266 272
 
267 273
                         wp_redirect($redirect_to);
268 274
                     } else {
@@ -275,9 +281,9 @@  discard block
 block discarded – undo
275 281
 
276 282
                     $gd_session->un_set('listing');
277 283
 
278
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid']))
279
-                        wp_redirect(get_permalink($_REQUEST['pid']));
280
-                    else {
284
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) {
285
+                                            wp_redirect(get_permalink($_REQUEST['pid']));
286
+                    } else {
281 287
                         geodir_remove_temp_images();
282 288
                         wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
283 289
                     }
@@ -305,8 +311,9 @@  discard block
 block discarded – undo
305 311
                             } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
306 312
                                 $redirect_to = get_permalink(geodir_add_listing_page_id());
307 313
                                 $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
308
-                            } else
309
-                                $redirect_to = get_permalink(geodir_add_listing_page_id());
314
+                            } else {
315
+                                                            $redirect_to = get_permalink(geodir_add_listing_page_id());
316
+                            }
310 317
 
311 318
                             $gd_session->un_set('listing');
312 319
                             wp_redirect($redirect_to);
@@ -327,8 +334,9 @@  discard block
 block discarded – undo
327 334
                             $lastid = wp_delete_post($_REQUEST['pid']);
328 335
                         }
329 336
 
330
-                        if ($lastid && !is_wp_error($lastid))
331
-                            wp_redirect($_SERVER['HTTP_REFERER']);
337
+                        if ($lastid && !is_wp_error($lastid)) {
338
+                                                    wp_redirect($_SERVER['HTTP_REFERER']);
339
+                        }
332 340
 
333 341
                         //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
334 342
                     }
Please login to merge, or discard this patch.