Test Failed
Push — master ( b6e446...232047 )
by Stiofan
10:23
created
geodirectory-functions/general_functions.php 1 patch
Spacing   +1341 added lines, -1342 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
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
209 209
 		// To build the entire URI we need to prepend the protocol, and the http host
210 210
 		// to the URI string.
211
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
211
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
212 212
 	} else {
213 213
 		/*
214 214
 		 * Since we do not have REQUEST_URI to work with, we will assume we are
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		 *
218 218
 		 * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
219 219
 		 */
220
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
220
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
221 221
 		
222 222
 		// If the query string exists append it to the URI string
223 223
 		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
224
-			$pageURL .= '?' . $_SERVER['QUERY_STRING'];
224
+			$pageURL .= '?'.$_SERVER['QUERY_STRING'];
225 225
 		}
226 226
 	}
227 227
 	
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param string $pageURL The URL of the current page.
234 234
 	 */
235
-	return apply_filters( 'geodir_curPageURL', $pageURL );
235
+	return apply_filters('geodir_curPageURL', $pageURL);
236 236
 }
237 237
 
238 238
 /**
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return string Cleaned variable.
249 249
  */
250
-function geodir_clean( $string ) {
250
+function geodir_clean($string) {
251 251
 
252
-	$string = trim( strip_tags( stripslashes( $string ) ) );
253
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
254
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
255
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
252
+	$string = trim(strip_tags(stripslashes($string)));
253
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
254
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
255
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
256 256
 
257 257
 	return $string;
258 258
 }
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_get_weekday() {
268 268
 	return array(
269
-		__( 'Sunday', 'geodirectory' ),
270
-		__( 'Monday', 'geodirectory' ),
271
-		__( 'Tuesday', 'geodirectory' ),
272
-		__( 'Wednesday', 'geodirectory' ),
273
-		__( 'Thursday', 'geodirectory' ),
274
-		__( 'Friday', 'geodirectory' ),
275
-		__( 'Saturday', 'geodirectory' )
269
+		__('Sunday', 'geodirectory'),
270
+		__('Monday', 'geodirectory'),
271
+		__('Tuesday', 'geodirectory'),
272
+		__('Wednesday', 'geodirectory'),
273
+		__('Thursday', 'geodirectory'),
274
+		__('Friday', 'geodirectory'),
275
+		__('Saturday', 'geodirectory')
276 276
 	);
277 277
 }
278 278
 
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
  */
286 286
 function geodir_get_weeks() {
287 287
 	return array(
288
-		__( 'First', 'geodirectory' ),
289
-		__( 'Second', 'geodirectory' ),
290
-		__( 'Third', 'geodirectory' ),
291
-		__( 'Fourth', 'geodirectory' ),
292
-		__( 'Last', 'geodirectory' )
288
+		__('First', 'geodirectory'),
289
+		__('Second', 'geodirectory'),
290
+		__('Third', 'geodirectory'),
291
+		__('Fourth', 'geodirectory'),
292
+		__('Last', 'geodirectory')
293 293
 	);
294 294
 }
295 295
 
@@ -308,112 +308,112 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return bool If valid returns true. Otherwise false.
310 310
  */
311
-function geodir_is_page( $gdpage = '' ) {
311
+function geodir_is_page($gdpage = '') {
312 312
 
313 313
 	global $wp_query, $post, $wp;
314 314
 	//if(!is_admin()):
315 315
 
316
-	switch ( $gdpage ):
316
+	switch ($gdpage):
317 317
 		case 'add-listing':
318 318
 
319
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
319
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
320 320
 				return true;
321
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
321
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
322 322
 				return true;
323 323
 			}
324 324
 
325 325
 			break;
326 326
 		case 'preview':
327
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
328
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
327
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
328
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
329 329
 			) {
330 330
 				return true;
331 331
 			}
332 332
 			break;
333 333
 		case 'listing-success':
334
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
334
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
335 335
 				return true;
336 336
 			}
337 337
 			break;
338 338
 		case 'detail':
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 			break;
347 347
 		case 'pt':
348
-			$post_type = get_query_var( 'post_type' );
349
-			if ( is_array( $post_type ) ) {
350
-				$post_type = reset( $post_type );
348
+			$post_type = get_query_var('post_type');
349
+			if (is_array($post_type)) {
350
+				$post_type = reset($post_type);
351 351
 			}
352
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
352
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
353 353
 				return true;
354 354
 			}
355 355
 
356 356
 			break;
357 357
 		case 'listing':
358
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
358
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
359 359
 				global $current_term, $taxonomy, $term;
360 360
 
361 361
 				return true;
362 362
 			}
363
-			$post_type = get_query_var( 'post_type' );
364
-			if ( is_array( $post_type ) ) {
365
-				$post_type = reset( $post_type );
363
+			$post_type = get_query_var('post_type');
364
+			if (is_array($post_type)) {
365
+				$post_type = reset($post_type);
366 366
 			}
367
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
367
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
368 368
 				return true;
369 369
 			}
370 370
 
371 371
 			break;
372 372
 		case 'home':
373 373
 
374
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
374
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
375 375
 				return true;
376 376
 			}
377 377
 
378 378
 			break;
379 379
 		case 'location':
380
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
380
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
381 381
 				return true;
382 382
 			}
383 383
 			break;
384 384
 		case 'author':
385
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
385
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
386 386
 				return true;
387 387
 			}
388 388
 
389
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
390
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
389
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
390
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
391 391
 					return true;
392 392
 				}
393 393
 			}
394 394
 			break;
395 395
 		case 'search':
396
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
396
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
397 397
 				return true;
398 398
 			}
399 399
 			break;
400 400
 		case 'info':
401
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
401
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
402 402
 				return true;
403 403
 			}
404 404
 			break;
405 405
 		case 'login':
406
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
406
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
407 407
 				return true;
408 408
 			}
409 409
 			break;
410 410
 		case 'checkout':
411
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
411
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
412 412
 				return true;
413 413
 			}
414 414
 			break;
415 415
 		case 'invoices':
416
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
416
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
417 417
 				return true;
418 418
 			}
419 419
 			break;
@@ -438,25 +438,25 @@  discard block
 block discarded – undo
438 438
  *
439 439
  * @param object $wp WordPress object.
440 440
  */
441
-function geodir_set_is_geodir_page( $wp ) {
442
-	if ( ! is_admin() ) {
441
+function geodir_set_is_geodir_page($wp) {
442
+	if (!is_admin()) {
443 443
 		//$wp->query_vars['gd_is_geodir_page'] = false;
444 444
 		//print_r()
445
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
445
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
446 446
 				'preview',
447 447
 				'page',
448 448
 				'paged',
449 449
 				'cpage'
450
-			) )
450
+			))
451 451
 		) {
452
-			if ( geodir_is_page( 'home' ) ) {
452
+			if (geodir_is_page('home')) {
453 453
 				$wp->query_vars['gd_is_geodir_page'] = true;
454 454
 			}
455 455
 
456 456
 
457 457
 		}
458 458
 
459
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
459
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
460 460
 			if (
461 461
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
462 462
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
466 466
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
467 467
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
468
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
469
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
468
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
469
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
470 470
 			) {
471 471
 				$wp->query_vars['gd_is_geodir_page'] = true;
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
476
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
475
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
476
+			$page = get_page_by_path($wp->query_vars['pagename']);
477 477
 
478
-			if ( ! empty( $page ) && (
478
+			if (!empty($page) && (
479 479
 					$page->ID == geodir_add_listing_page_id()
480 480
 					|| $page->ID == geodir_preview_page_id()
481 481
 					|| $page->ID == geodir_success_page_id()
482 482
 					|| $page->ID == geodir_location_page_id()
483
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
484
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
485
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
486
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
483
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
484
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
485
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
486
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
488 488
 				)
489 489
 			) {
490 490
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 
495
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
495
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
496 496
 			$requested_post_type = $wp->query_vars['post_type'];
497 497
 			// check if this post type is geodirectory post types
498 498
 			$post_type_array = geodir_get_posttypes();
499
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
499
+			if (in_array($requested_post_type, $post_type_array)) {
500 500
 				$wp->query_vars['gd_is_geodir_page'] = true;
501 501
 			}
502 502
 		}
503 503
 
504
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
505
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
506
-			if ( ! empty( $geodir_taxonomis ) ) {
507
-				foreach ( $geodir_taxonomis as $taxonomy ) {
508
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
504
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
505
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
506
+			if (!empty($geodir_taxonomis)) {
507
+				foreach ($geodir_taxonomis as $taxonomy) {
508
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
509 509
 						$wp->query_vars['gd_is_geodir_page'] = true;
510 510
 						break;
511 511
 					}
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 
515 515
 		}
516 516
 
517
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
517
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
518 518
 			$wp->query_vars['gd_is_geodir_page'] = true;
519 519
 		}
520 520
 
521 521
 
522
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
522
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
523 523
 			$wp->query_vars['gd_is_geodir_page'] = true;
524 524
 		}
525 525
 
526 526
 
527 527
 //check if homepage
528
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
529
-		     && ! isset( $wp->query_vars['page_id'] )
530
-		     && ! isset( $wp->query_vars['pagename'] )
528
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
529
+		     && !isset($wp->query_vars['page_id'])
530
+		     && !isset($wp->query_vars['pagename'])
531 531
 		     && is_page_geodir_home()
532 532
 		) {
533 533
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
  */
552 552
 function geodir_is_geodir_page() {
553 553
 	global $wp;
554
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
554
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
555 555
 		return true;
556 556
 	} else {
557 557
 		return false;
558 558
 	}
559 559
 }
560 560
 
561
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
561
+if (!function_exists('geodir_get_imagesize')) {
562 562
 	/**
563 563
 	 * Get image size using the size key .
564 564
 	 *
@@ -569,13 +569,13 @@  discard block
 block discarded – undo
569 569
 	 *
570 570
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
571 571
 	 */
572
-	function geodir_get_imagesize( $size = '' ) {
572
+	function geodir_get_imagesize($size = '') {
573 573
 
574 574
 		$imagesizes = array(
575
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
576
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
577
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
578
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
575
+			'list-thumb'   => array('w' => 283, 'h' => 188),
576
+			'thumbnail'    => array('w' => 125, 'h' => 125),
577
+			'widget-thumb' => array('w' => 50, 'h' => 50),
578
+			'slider-thumb' => array('w' => 100, 'h' => 100)
579 579
 		);
580 580
 
581 581
 		/**
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 		 *
586 586
 		 * @param array $imagesizes Image size array.
587 587
 		 */
588
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
588
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
589 589
 
590
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
590
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
591 591
 			/**
592 592
 			 * Filters image size of the passed key.
593 593
 			 *
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
 			 *
596 596
 			 * @param array $imagesizes [$size] Image size array of the passed key.
597 597
 			 */
598
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
598
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
599 599
 
600
-		} elseif ( ! empty( $size ) ) {
600
+		} elseif (!empty($size)) {
601 601
 
602
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
602
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
603 603
 
604 604
 		}
605 605
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 */
624 624
 
625 625
 
626
-if ( ! function_exists( 'createRandomString' ) ) {
626
+if (!function_exists('createRandomString')) {
627 627
 	/**
628 628
 	 * Creates random string.
629 629
 	 *
@@ -633,21 +633,21 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	function createRandomString() {
635 635
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
636
-		srand( (double) microtime() * 1000000 );
636
+		srand((double) microtime() * 1000000);
637 637
 		$i       = 0;
638 638
 		$rstring = '';
639
-		while ( $i <= 25 ) {
639
+		while ($i <= 25) {
640 640
 			$num     = rand() % 33;
641
-			$tmp     = substr( $chars, $num, 1 );
642
-			$rstring = $rstring . $tmp;
643
-			$i ++;
641
+			$tmp     = substr($chars, $num, 1);
642
+			$rstring = $rstring.$tmp;
643
+			$i++;
644 644
 		}
645 645
 
646 646
 		return $rstring;
647 647
 	}
648 648
 }
649 649
 
650
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
650
+if (!function_exists('geodir_getDistanceRadius')) {
651 651
 	/**
652 652
 	 * Calculates the distance radius.
653 653
 	 *
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @return float The mean radius.
660 660
 	 */
661
-	function geodir_getDistanceRadius( $uom = 'km' ) {
661
+	function geodir_getDistanceRadius($uom = 'km') {
662 662
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
663
-		switch ( geodir_strtolower( $uom ) ):
663
+		switch (geodir_strtolower($uom)):
664 664
 			case 'km'    :
665 665
 				$earthMeanRadius = 6371.009; // km
666 666
 				break;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 }
693 693
 
694 694
 
695
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
695
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
696 696
 	/**
697 697
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
698 698
 	 *
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 	 *
706 706
 	 * @return float The distance.
707 707
 	 */
708
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
708
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
709 709
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
710 710
 
711
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
711
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
712 712
 
713
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
714
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
715
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
716
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
717
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
718
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
713
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
714
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
715
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
716
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
717
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
718
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
719 719
 		$distance       = $earthMeanRadius * $c;
720 720
 
721 721
 		return $distance;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 }
725 725
 
726 726
 
727
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
727
+if (!function_exists('geodir_sendEmail')) {
728 728
 	/**
729 729
 	 * The main function that send transactional emails using the args provided.
730 730
 	 *
@@ -743,93 +743,93 @@  discard block
 block discarded – undo
743 743
 	 * @param string $post_id       The post ID.
744 744
 	 * @param string $user_id       The user ID.
745 745
 	 */
746
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
746
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
747 747
 		$login_details = '';
748 748
 
749 749
 		// strip slashes from subject & message text
750
-		$to_subject = stripslashes_deep( $to_subject );
751
-		$to_message = stripslashes_deep( $to_message );
750
+		$to_subject = stripslashes_deep($to_subject);
751
+		$to_message = stripslashes_deep($to_message);
752 752
 
753
-		if ( $message_type == 'send_friend' ) {
754
-			$subject = get_option( 'geodir_email_friend_subject' );
755
-			$message = get_option( 'geodir_email_friend_content' );
756
-		} elseif ( $message_type == 'send_enquiry' ) {
757
-			$subject = get_option( 'geodir_email_enquiry_subject' );
758
-			$message = get_option( 'geodir_email_enquiry_content' );
753
+		if ($message_type == 'send_friend') {
754
+			$subject = get_option('geodir_email_friend_subject');
755
+			$message = get_option('geodir_email_friend_content');
756
+		} elseif ($message_type == 'send_enquiry') {
757
+			$subject = get_option('geodir_email_enquiry_subject');
758
+			$message = get_option('geodir_email_enquiry_content');
759 759
 
760 760
 			// change to name in some cases
761
-			$post_author = get_post_field( 'post_author', $post_id );
762
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
763
-				$toEmailName = __('Business Owner','geodirectory');
764
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
765
-				$toEmailName = __('Business Owner','geodirectory');
761
+			$post_author = get_post_field('post_author', $post_id);
762
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
763
+				$toEmailName = __('Business Owner', 'geodirectory');
764
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
765
+				$toEmailName = __('Business Owner', 'geodirectory');
766 766
 			}
767 767
 
768 768
 
769
-		} elseif ( $message_type == 'forgot_password' ) {
770
-			$subject       = get_option( 'geodir_forgot_password_subject' );
771
-			$message       = get_option( 'geodir_forgot_password_content' );
769
+		} elseif ($message_type == 'forgot_password') {
770
+			$subject       = get_option('geodir_forgot_password_subject');
771
+			$message       = get_option('geodir_forgot_password_content');
772 772
 			$login_details = $to_message;
773
-		} elseif ( $message_type == 'registration' ) {
774
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
775
-			$message       = get_option( 'geodir_registration_success_email_content' );
773
+		} elseif ($message_type == 'registration') {
774
+			$subject       = get_option('geodir_registration_success_email_subject');
775
+			$message       = get_option('geodir_registration_success_email_content');
776 776
 			$login_details = $to_message;
777
-		} elseif ( $message_type == 'post_submit' ) {
778
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
779
-			$message = get_option( 'geodir_post_submited_success_email_content' );
780
-		} elseif ( $message_type == 'listing_published' ) {
781
-			$subject = get_option( 'geodir_post_published_email_subject' );
782
-			$message = get_option( 'geodir_post_published_email_content' );
783
-		} elseif ( $message_type == 'listing_edited' ) {
784
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
785
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
777
+		} elseif ($message_type == 'post_submit') {
778
+			$subject = get_option('geodir_post_submited_success_email_subject');
779
+			$message = get_option('geodir_post_submited_success_email_content');
780
+		} elseif ($message_type == 'listing_published') {
781
+			$subject = get_option('geodir_post_published_email_subject');
782
+			$message = get_option('geodir_post_published_email_content');
783
+		} elseif ($message_type == 'listing_edited') {
784
+			$subject = get_option('geodir_post_edited_email_subject_admin');
785
+			$message = get_option('geodir_post_edited_email_content_admin');
786 786
 		}
787 787
 
788
-		if ( ! empty( $subject ) ) {
789
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
788
+		if (!empty($subject)) {
789
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
790 790
 		}
791 791
 
792
-		if ( ! empty( $message ) ) {
793
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
792
+		if (!empty($message)) {
793
+			$message = __(stripslashes_deep($message), 'geodirectory');
794 794
 		}
795 795
 
796
-		$to_message        = nl2br( $to_message );
797
-		$sitefromEmail     = get_option( 'site_email' );
796
+		$to_message        = nl2br($to_message);
797
+		$sitefromEmail     = get_option('site_email');
798 798
 		$sitefromEmailName = get_site_emailName();
799
-		$productlink       = get_permalink( $post_id );
799
+		$productlink       = get_permalink($post_id);
800 800
 
801 801
 		$user_login = '';
802
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
802
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
803 803
 			$user_login = $user_info->user_login;
804 804
 		}
805 805
 
806 806
 		$posted_date = '';
807 807
 		$listingLink = '';
808 808
 
809
-		$post_info = get_post( $post_id );
809
+		$post_info = get_post($post_id);
810 810
 
811
-		if ( $post_info ) {
811
+		if ($post_info) {
812 812
 			$posted_date = $post_info->post_date;
813
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
813
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
814 814
 		}
815 815
 		$siteurl       = home_url();
816
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
816
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
817 817
 		$loginurl      = geodir_login_url();
818
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
818
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
819 819
 
820
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
821
-		$post_author_name = geodir_get_client_name( $post_author_id );
822
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
820
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
821
+		$post_author_name = geodir_get_client_name($post_author_id);
822
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
823 823
 
824
-		if ( $fromEmail == '' ) {
825
-			$fromEmail = get_option( 'site_email' );
824
+		if ($fromEmail == '') {
825
+			$fromEmail = get_option('site_email');
826 826
 		}
827 827
 
828
-		if ( $fromEmailName == '' ) {
829
-			$fromEmailName = get_option( 'site_email_name' );
828
+		if ($fromEmailName == '') {
829
+			$fromEmailName = get_option('site_email_name');
830 830
 		}
831 831
 
832
-		$search_array  = array(
832
+		$search_array = array(
833 833
 			'[#listing_link#]',
834 834
 			'[#site_name_url#]',
835 835
 			'[#post_id#]',
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 			$post_author_name,
870 870
 			$current_date
871 871
 		);
872
-		$message       = str_replace( $search_array, $replace_array, $message );
872
+		$message       = str_replace($search_array, $replace_array, $message);
873 873
 
874 874
 		$search_array  = array(
875 875
 			'[#listing_link#]',
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 			$post_author_name,
906 906
 			$current_date
907 907
 		);
908
-		$subject       = str_replace( $search_array, $replace_array, $subject );
908
+		$subject = str_replace($search_array, $replace_array, $subject);
909 909
 
910
-		$headers = 'MIME-Version: 1.0' . "\r\n";
911
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
912
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
913
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
910
+		$headers = 'MIME-Version: 1.0'."\r\n";
911
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
912
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
913
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
914 914
 
915 915
 		$to = $toEmail;
916 916
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		 * @param string $post_id       The post ID.
933 933
 		 * @param string $user_id       The user ID.
934 934
 		 */
935
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
935
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
936 936
 		/**
937 937
 		 * Filter the client email subject.
938 938
 		 *
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 		 * @param string $post_id       The post ID.
952 952
 		 * @param string $user_id       The user ID.
953 953
 		 */
954
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
954
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
955 955
 		/**
956 956
 		 * Filter the client email message.
957 957
 		 *
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 		 * @param string $post_id       The post ID.
971 971
 		 * @param string $user_id       The user ID.
972 972
 		 */
973
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
973
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
974 974
 		/**
975 975
 		 * Filter the client email headers.
976 976
 		 *
@@ -989,39 +989,38 @@  discard block
 block discarded – undo
989 989
 		 * @param string $post_id       The post ID.
990 990
 		 * @param string $user_id       The user ID.
991 991
 		 */
992
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
992
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
993 993
 
994
-		$sent = wp_mail( $to, $subject, $message, $headers );
994
+		$sent = wp_mail($to, $subject, $message, $headers);
995 995
 
996
-		if ( ! $sent ) {
997
-			if ( is_array( $to ) ) {
998
-				$to = implode( ',', $to );
996
+		if (!$sent) {
997
+			if (is_array($to)) {
998
+				$to = implode(',', $to);
999 999
 			}
1000 1000
 			$log_message = sprintf(
1001
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1001
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1002 1002
 				$message_type,
1003
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1003
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1004 1004
 				$to,
1005 1005
 				$subject
1006 1006
 			);
1007
-			geodir_error_log( $log_message );
1007
+			geodir_error_log($log_message);
1008 1008
 		}
1009 1009
 
1010 1010
 		///////// ADMIN BCC EMIALS
1011
-		$adminEmail = get_bloginfo( 'admin_email' );
1011
+		$adminEmail = get_bloginfo('admin_email');
1012 1012
 		$to         = $adminEmail;
1013 1013
 
1014 1014
 		$admin_bcc = false;
1015
-		if ( $message_type == 'registration' ) {
1016
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1017
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1018
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1015
+		if ($message_type == 'registration') {
1016
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1017
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1018
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1019 1019
 		}
1020
-		if ( $message_type == 'post_submit' ) {!
1021
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1022
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1020
+		if ($message_type == 'post_submit') {!$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1021
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1023 1022
 
1024
-			$search_array  = array(
1023
+			$search_array = array(
1025 1024
 				'[#listing_link#]',
1026 1025
 				'[#site_name_url#]',
1027 1026
 				'[#post_id#]',
@@ -1053,7 +1052,7 @@  discard block
 block discarded – undo
1053 1052
 				$user_login,
1054 1053
 				$user_login
1055 1054
 			);
1056
-			$message       = str_replace( $search_array, $replace_array, $message );
1055
+			$message       = str_replace($search_array, $replace_array, $message);
1057 1056
 
1058 1057
 			$search_array  = array(
1059 1058
 				'[#listing_link#]',
@@ -1081,47 +1080,47 @@  discard block
 block discarded – undo
1081 1080
 				$user_login,
1082 1081
 				$user_login
1083 1082
 			);
1084
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1083
+			$subject = str_replace($search_array, $replace_array, $subject);
1085 1084
 
1086 1085
 			$subject .= ' - ADMIN BCC COPY';
1087 1086
 			$admin_bcc = true;
1088 1087
 
1089 1088
 			/** This filter is documented in general_functions.php */
1090
-			$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1089
+			$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1091 1090
 			/** This filter is documented in general_functions.php */
1092
-			$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1091
+			$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1093 1092
 
1094 1093
 
1095 1094
 
1096
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1095
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1097 1096
 			$subject .= ' - ADMIN BCC COPY';
1098 1097
 			$admin_bcc = true;
1099
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1098
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1100 1099
 			$subject .= ' - ADMIN BCC COPY';
1101 1100
 			$admin_bcc = true;
1102
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1101
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1103 1102
 			$subject .= ' - ADMIN BCC COPY';
1104 1103
 			$admin_bcc = true;
1105
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1104
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1106 1105
 			$subject .= ' - ADMIN BCC COPY';
1107 1106
 			$admin_bcc = true;
1108 1107
 		}
1109 1108
 
1110
-		if ( $admin_bcc === true ) {
1111
-			$sent = wp_mail( $to, $subject, $message, $headers );
1109
+		if ($admin_bcc === true) {
1110
+			$sent = wp_mail($to, $subject, $message, $headers);
1112 1111
 
1113
-			if ( ! $sent ) {
1114
-				if ( is_array( $to ) ) {
1115
-					$to = implode( ',', $to );
1112
+			if (!$sent) {
1113
+				if (is_array($to)) {
1114
+					$to = implode(',', $to);
1116 1115
 				}
1117 1116
 				$log_message = sprintf(
1118
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1117
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1119 1118
 					$message_type,
1120
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1119
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1121 1120
 					$to,
1122 1121
 					$subject
1123 1122
 				);
1124
-				geodir_error_log( $log_message );
1123
+				geodir_error_log($log_message);
1125 1124
 			}
1126 1125
 		}
1127 1126
 
@@ -1137,52 +1136,52 @@  discard block
 block discarded – undo
1137 1136
  */
1138 1137
 function geodir_taxonomy_breadcrumb() {
1139 1138
 
1140
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1139
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1141 1140
 	$parent = $term->parent;
1142 1141
 
1143
-	while ( $parent ):
1142
+	while ($parent):
1144 1143
 		$parents[]  = $parent;
1145
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1144
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1146 1145
 		$parent     = $new_parent->parent;
1147 1146
 	endwhile;
1148 1147
 
1149
-	if ( ! empty( $parents ) ):
1150
-		$parents = array_reverse( $parents );
1148
+	if (!empty($parents)):
1149
+		$parents = array_reverse($parents);
1151 1150
 
1152
-		foreach ( $parents as $parent ):
1153
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1154
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1155
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1151
+		foreach ($parents as $parent):
1152
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1153
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1154
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1156 1155
 		endforeach;
1157 1156
 
1158 1157
 	endif;
1159 1158
 
1160
-	echo '<li> > ' . $term->name . '</li>';
1159
+	echo '<li> > '.$term->name.'</li>';
1161 1160
 }
1162 1161
 
1163
-function geodir_wpml_post_type_archive_link($link, $post_type){
1162
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1164 1163
 
1165
-	if(function_exists('icl_object_id')) {
1166
-		$post_types   = get_option( 'geodir_post_types' );
1167
-		$slug         = $post_types[ $post_type ]['rewrite']['slug'];
1164
+	if (function_exists('icl_object_id')) {
1165
+		$post_types   = get_option('geodir_post_types');
1166
+		$slug         = $post_types[$post_type]['rewrite']['slug'];
1168 1167
 
1169 1168
 		//echo $link.'###'.gd_wpml_get_lang_from_url( $link) ;
1170 1169
 
1171 1170
 		// Alter the CPT slug if WPML is set to do so
1172
-		if ( function_exists( 'icl_object_id' ) ) {
1173
-			if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1171
+		if (function_exists('icl_object_id')) {
1172
+			if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1174 1173
 
1175 1174
 				$org_slug = $slug;
1176
-				$slug     = apply_filters( 'wpml_translate_single_string',
1175
+				$slug     = apply_filters('wpml_translate_single_string',
1177 1176
 					$slug,
1178 1177
 					'WordPress',
1179
-					'URL slug: ' . $slug,
1180
-					$language_code );
1178
+					'URL slug: '.$slug,
1179
+					$language_code);
1181 1180
 
1182
-				if ( ! $slug ) {
1181
+				if (!$slug) {
1183 1182
 					$slug = $org_slug;
1184 1183
 				} else {
1185
-					$link = str_replace( $org_slug, $slug, $link );
1184
+					$link = str_replace($org_slug, $slug, $link);
1186 1185
 				}
1187 1186
 
1188 1187
 			}
@@ -1213,9 +1212,9 @@  discard block
 block discarded – undo
1213 1212
 	 *
1214 1213
 	 * @since 1.0.0
1215 1214
 	 */
1216
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1215
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1217 1216
 
1218
-	if ( ! geodir_is_page( 'home' ) ) {
1217
+	if (!geodir_is_page('home')) {
1219 1218
 		$breadcrumb    = '';
1220 1219
 		$url_categoris = '';
1221 1220
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1224,162 +1223,162 @@  discard block
 block discarded – undo
1224 1223
 		 *
1225 1224
 		 * @since 1.0.0
1226 1225
 		 */
1227
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1226
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1228 1227
 
1229 1228
 		$gd_post_type   = geodir_get_current_posttype();
1230
-		$post_type_info = get_post_type_object( $gd_post_type );
1229
+		$post_type_info = get_post_type_object($gd_post_type);
1231 1230
 
1232
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1231
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1233 1232
 
1234
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1233
+		$listing_link = get_post_type_archive_link($gd_post_type);
1235 1234
 
1236
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1237
-		$listing_link = rtrim( $listing_link, '/' );
1235
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1236
+		$listing_link = rtrim($listing_link, '/');
1238 1237
 		$listing_link .= '/';
1239 1238
 
1240 1239
 		$post_type_for_location_link = $listing_link;
1241
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1240
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1242 1241
 
1243 1242
 		global $wp, $gd_session;
1244 1243
 		$location_link = $post_type_for_location_link;
1245 1244
 
1246
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1245
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1247 1246
 			global $post;
1248
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1249
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1247
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1248
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1250 1249
 
1251
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1250
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1252 1251
 				$location_terms = array(
1253 1252
 					'gd_country' => $post->country_slug,
1254 1253
 					'gd_region'  => $post->region_slug,
1255 1254
 					'gd_city'    => $post->city_slug
1256 1255
 				);
1257 1256
 
1258
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1257
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1259 1258
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1260 1259
 				}
1261 1260
 			}
1262 1261
 
1263
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1262
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1264 1263
 
1265 1264
 			$hide_url_part = array();
1266
-			if ( $location_manager ) {
1267
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1268
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1269
-
1270
-				if ( $hide_region_part && $hide_country_part ) {
1271
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1272
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1273
-					$hide_url_part = array( 'gd_region' );
1274
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1275
-					$hide_url_part = array( 'gd_country' );
1265
+			if ($location_manager) {
1266
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1267
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1268
+
1269
+				if ($hide_region_part && $hide_country_part) {
1270
+					$hide_url_part = array('gd_country', 'gd_region');
1271
+				} else if ($hide_region_part && !$hide_country_part) {
1272
+					$hide_url_part = array('gd_region');
1273
+				} else if (!$hide_region_part && $hide_country_part) {
1274
+					$hide_url_part = array('gd_country');
1276 1275
 				}
1277 1276
 			}
1278 1277
 
1279 1278
 			$hide_text_part = array();
1280
-			if ( $geodir_show_location_url == 'country_city' ) {
1281
-				$hide_text_part = array( 'gd_region' );
1279
+			if ($geodir_show_location_url == 'country_city') {
1280
+				$hide_text_part = array('gd_region');
1282 1281
 
1283
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1284
-					unset( $location_terms['gd_region'] );
1282
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1283
+					unset($location_terms['gd_region']);
1285 1284
 				}
1286
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1287
-				$hide_text_part = array( 'gd_country' );
1285
+			} else if ($geodir_show_location_url == 'region_city') {
1286
+				$hide_text_part = array('gd_country');
1288 1287
 
1289
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1290
-					unset( $location_terms['gd_country'] );
1288
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1289
+					unset($location_terms['gd_country']);
1291 1290
 				}
1292
-			} else if ( $geodir_show_location_url == 'city' ) {
1293
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1291
+			} else if ($geodir_show_location_url == 'city') {
1292
+				$hide_text_part = array('gd_country', 'gd_region');
1294 1293
 
1295
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1296
-					unset( $location_terms['gd_country'] );
1294
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1295
+					unset($location_terms['gd_country']);
1297 1296
 				}
1298
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1299
-					unset( $location_terms['gd_region'] );
1297
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1298
+					unset($location_terms['gd_region']);
1300 1299
 				}
1301 1300
 			}
1302 1301
 
1303 1302
 			$is_location_last = '';
1304 1303
 			$is_taxonomy_last = '';
1305 1304
 			$breadcrumb .= '<li>';
1306
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1307
-				$gd_taxonomy = $gd_post_type . 'category';
1308
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1309
-				$gd_taxonomy = $gd_post_type . '_tags';
1305
+			if (get_query_var($gd_post_type.'category')) {
1306
+				$gd_taxonomy = $gd_post_type.'category';
1307
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1308
+				$gd_taxonomy = $gd_post_type.'_tags';
1310 1309
 			}
1311 1310
 
1312
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1313
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1311
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1312
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1314 1313
 				$is_location_last = false;
1315 1314
 			} else {
1316 1315
 				$is_location_last = true;
1317 1316
 			}
1318 1317
 
1319
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1318
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1320 1319
 				$is_taxonomy_last = true;
1321 1320
 			} else {
1322 1321
 				$is_taxonomy_last = false;
1323 1322
 			}
1324 1323
 
1325
-			if ( ! empty( $location_terms ) ) {
1326
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1324
+			if (!empty($location_terms)) {
1325
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1327 1326
 
1328
-				foreach ( $location_terms as $key => $location_term ) {
1329
-					if ( $location_term != '' ) {
1330
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1327
+				foreach ($location_terms as $key => $location_term) {
1328
+					if ($location_term != '') {
1329
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1331 1330
 							continue;
1332 1331
 						}
1333 1332
 
1334
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1335
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1336
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1333
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1334
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1335
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1337 1336
 
1338 1337
 						$location_term_actual_country = '';
1339 1338
 						$location_term_actual_region  = '';
1340 1339
 						$location_term_actual_city    = '';
1341
-						if ( $geodir_get_locations ) {
1342
-							if ( $key == 'gd_country' ) {
1343
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1344
-							} else if ( $key == 'gd_region' ) {
1345
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1346
-							} else if ( $key == 'gd_city' ) {
1347
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1340
+						if ($geodir_get_locations) {
1341
+							if ($key == 'gd_country') {
1342
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1343
+							} else if ($key == 'gd_region') {
1344
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1345
+							} else if ($key == 'gd_city') {
1346
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1348 1347
 							}
1349 1348
 						} else {
1350 1349
 							$location_info = geodir_get_location();
1351 1350
 
1352
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1353
-								if ( $key == 'gd_country' ) {
1354
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1355
-								} else if ( $key == 'gd_region' ) {
1356
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1357
-								} else if ( $key == 'gd_city' ) {
1358
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1351
+							if (!empty($location_info) && isset($location_info->location_id)) {
1352
+								if ($key == 'gd_country') {
1353
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1354
+								} else if ($key == 'gd_region') {
1355
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1356
+								} else if ($key == 'gd_city') {
1357
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1359 1358
 								}
1360 1359
 							}
1361 1360
 						}
1362 1361
 
1363
-						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'] != '' ) ) {
1364
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1365
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1366
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1367
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1368
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1369
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1370
-							$breadcrumb .= $separator . $gd_location_link_text;
1362
+						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'] != '')) {
1363
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1364
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1365
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1366
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1367
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1368
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1369
+							$breadcrumb .= $separator.$gd_location_link_text;
1371 1370
 						} else {
1372
-							if ( get_option( 'permalink_structure' ) != '' ) {
1373
-								$location_link .= $location_term . '/';
1371
+							if (get_option('permalink_structure') != '') {
1372
+								$location_link .= $location_term.'/';
1374 1373
 							} else {
1375
-								$location_link .= "&$key=" . $location_term;
1374
+								$location_link .= "&$key=".$location_term;
1376 1375
 							}
1377 1376
 
1378
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1377
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1379 1378
 								$gd_location_link_text = $location_term_actual_country;
1380
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1379
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1381 1380
 								$gd_location_link_text = $location_term_actual_region;
1382
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1381
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1383 1382
 								$gd_location_link_text = $location_term_actual_city;
1384 1383
 							}
1385 1384
 
@@ -1389,76 +1388,76 @@  discard block
 block discarded – undo
1389 1388
                             }
1390 1389
                             */
1391 1390
 
1392
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1391
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1393 1392
 						}
1394 1393
 					}
1395 1394
 				}
1396 1395
 			}
1397 1396
 
1398
-			if ( ! empty( $gd_taxonomy ) ) {
1397
+			if (!empty($gd_taxonomy)) {
1399 1398
 				$term_index = 1;
1400 1399
 
1401 1400
 				//if(get_option('geodir_add_categories_url'))
1402 1401
 				{
1403
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1404
-						$cat_link = $listing_link . 'tags/';
1402
+					if (get_query_var($gd_post_type.'_tags')) {
1403
+						$cat_link = $listing_link.'tags/';
1405 1404
 					} else {
1406 1405
 						$cat_link = $listing_link;
1407 1406
 					}
1408 1407
 
1409
-					foreach ( $location_terms as $key => $location_term ) {
1410
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1408
+					foreach ($location_terms as $key => $location_term) {
1409
+						if ($location_manager && in_array($key, $hide_url_part)) {
1411 1410
 							continue;
1412 1411
 						}
1413 1412
 
1414
-						if ( $location_term != '' ) {
1415
-							if ( get_option( 'permalink_structure' ) != '' ) {
1416
-								$cat_link .= $location_term . '/';
1413
+						if ($location_term != '') {
1414
+							if (get_option('permalink_structure') != '') {
1415
+								$cat_link .= $location_term.'/';
1417 1416
 							}
1418 1417
 						}
1419 1418
 					}
1420 1419
 
1421
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1422
-					foreach ( $term_array as $term ) {
1423
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1424
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1420
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1421
+					foreach ($term_array as $term) {
1422
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1423
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1425 1424
 
1426 1425
 						// get term actual name
1427
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1428
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1429
-							$term_link_text = urldecode( $term_info['name'] );
1426
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1427
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1428
+							$term_link_text = urldecode($term_info['name']);
1430 1429
 						} else {
1431 1430
 							continue;
1432 1431
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1433 1432
 						}
1434 1433
 
1435
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1436
-							$breadcrumb .= $separator . $term_link_text;
1434
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1435
+							$breadcrumb .= $separator.$term_link_text;
1437 1436
 						} else {
1438
-							$cat_link .= $term . '/';
1439
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1437
+							$cat_link .= $term.'/';
1438
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1440 1439
 						}
1441
-						$term_index ++;
1440
+						$term_index++;
1442 1441
 					}
1443 1442
 				}
1444 1443
 
1445 1444
 
1446 1445
 			}
1447 1446
 
1448
-			if ( geodir_is_page( 'detail' ) ) {
1449
-				$breadcrumb .= $separator . get_the_title();
1447
+			if (geodir_is_page('detail')) {
1448
+				$breadcrumb .= $separator.get_the_title();
1450 1449
 			}
1451 1450
 
1452 1451
 			$breadcrumb .= '</li>';
1453 1452
 
1454 1453
 
1455
-		} elseif ( geodir_is_page( 'author' ) ) {
1454
+		} elseif (geodir_is_page('author')) {
1456 1455
 			$user_id             = get_current_user_id();
1457
-			$author_link         = get_author_posts_url( $user_id );
1458
-			$default_author_link = geodir_getlink( $author_link, array(
1456
+			$author_link         = get_author_posts_url($user_id);
1457
+			$default_author_link = geodir_getlink($author_link, array(
1459 1458
 				'geodir_dashbord' => 'true',
1460 1459
 				'stype'           => 'gd_place'
1461
-			), false );
1460
+			), false);
1462 1461
 
1463 1462
 			/**
1464 1463
 			 * Filter author page link.
@@ -1468,16 +1467,16 @@  discard block
 block discarded – undo
1468 1467
 			 * @param string $default_author_link Default author link.
1469 1468
 			 * @param int $user_id                Author ID.
1470 1469
 			 */
1471
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1470
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1472 1471
 
1473 1472
 			$breadcrumb .= '<li>';
1474
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1473
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1475 1474
 
1476
-			if ( isset( $_REQUEST['list'] ) ) {
1477
-				$author_link = geodir_getlink( $author_link, array(
1475
+			if (isset($_REQUEST['list'])) {
1476
+				$author_link = geodir_getlink($author_link, array(
1478 1477
 					'geodir_dashbord' => 'true',
1479 1478
 					'stype'           => $_REQUEST['stype']
1480
-				), false );
1479
+				), false);
1481 1480
 
1482 1481
 				/**
1483 1482
 				 * Filter author page link.
@@ -1488,61 +1487,61 @@  discard block
 block discarded – undo
1488 1487
 				 * @param int $user_id        Author ID.
1489 1488
 				 * @param string $_REQUEST    ['stype'] Post type.
1490 1489
 				 */
1491
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1490
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1492 1491
 
1493
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1494
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1492
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1493
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1495 1494
 			} else {
1496
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1495
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1497 1496
 			}
1498 1497
 
1499 1498
 			$breadcrumb .= '</li>';
1500
-		} elseif ( is_category() || is_single() ) {
1499
+		} elseif (is_category() || is_single()) {
1501 1500
 			$category = get_the_category();
1502
-			if ( is_category() ) {
1503
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1501
+			if (is_category()) {
1502
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1504 1503
 			}
1505
-			if ( is_single() ) {
1506
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1507
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1504
+			if (is_single()) {
1505
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1506
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1508 1507
 			}
1509 1508
 			/* End of my version ##################################################### */
1510
-		} else if ( is_page() ) {
1509
+		} else if (is_page()) {
1511 1510
 			$page_title = get_the_title();
1512 1511
 
1513
-			if ( geodir_is_page( 'location' ) ) {
1512
+			if (geodir_is_page('location')) {
1514 1513
 				$location_page_id = geodir_location_page_id();
1515
-				$loc_post         = get_post( $location_page_id );
1514
+				$loc_post         = get_post($location_page_id);
1516 1515
 				$post_name        = $loc_post->post_name;
1517
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1518
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1516
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1517
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1519 1518
 			}
1520 1519
 
1521
-			$breadcrumb .= '<li>' . $separator;
1522
-			$breadcrumb .= stripslashes_deep( $page_title );
1520
+			$breadcrumb .= '<li>'.$separator;
1521
+			$breadcrumb .= stripslashes_deep($page_title);
1523 1522
 			$breadcrumb .= '</li>';
1524
-		} else if ( is_tag() ) {
1525
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1526
-		} else if ( is_day() ) {
1527
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1528
-			the_time( 'F jS, Y' );
1523
+		} else if (is_tag()) {
1524
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1525
+		} else if (is_day()) {
1526
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1527
+			the_time('F jS, Y');
1529 1528
 			$breadcrumb .= '</li>';
1530
-		} else if ( is_month() ) {
1531
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1532
-			the_time( 'F, Y' );
1529
+		} else if (is_month()) {
1530
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1531
+			the_time('F, Y');
1533 1532
 			$breadcrumb .= '</li>';
1534
-		} else if ( is_year() ) {
1535
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1536
-			the_time( 'Y' );
1533
+		} else if (is_year()) {
1534
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1535
+			the_time('Y');
1537 1536
 			$breadcrumb .= '</li>';
1538
-		} else if ( is_author() ) {
1539
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1537
+		} else if (is_author()) {
1538
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1540 1539
 			$breadcrumb .= '</li>';
1541
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1542
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1540
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1541
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1543 1542
 			$breadcrumb .= '</li>';
1544
-		} else if ( is_search() ) {
1545
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1543
+		} else if (is_search()) {
1544
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1546 1545
 			$breadcrumb .= '</li>';
1547 1546
 		}
1548 1547
 		$breadcrumb .= '</ul></div>';
@@ -1555,13 +1554,13 @@  discard block
 block discarded – undo
1555 1554
 		 * @param string $breadcrumb Breadcrumb HTML.
1556 1555
 		 * @param string $separator  Breadcrumb separator.
1557 1556
 		 */
1558
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1557
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1559 1558
 	}
1560 1559
 }
1561 1560
 
1562 1561
 
1563
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1564
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1562
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1563
+if (!function_exists('geodir_allow_wpadmin')) {
1565 1564
 	/**
1566 1565
 	 * Allow only admins to access wp-admin.
1567 1566
 	 *
@@ -1573,12 +1572,12 @@  discard block
 block discarded – undo
1573 1572
 	 */
1574 1573
 	function geodir_allow_wpadmin() {
1575 1574
 		global $wpdb;
1576
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1575
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1577 1576
 		{
1578
-			if ( current_user_can( 'administrator' ) ) {
1577
+			if (current_user_can('administrator')) {
1579 1578
 			} else {
1580 1579
 
1581
-				wp_redirect( home_url() );
1580
+				wp_redirect(home_url());
1582 1581
 				exit;
1583 1582
 			}
1584 1583
 
@@ -1597,23 +1596,23 @@  discard block
 block discarded – undo
1597 1596
  *
1598 1597
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1599 1598
  */
1600
-function fetch_remote_file( $url ) {
1599
+function fetch_remote_file($url) {
1601 1600
 	// extract the file name and extension from the url
1602
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1603
-	$file_name = basename( $url );
1604
-	if ( strpos( $file_name, '?' ) !== false ) {
1605
-		list( $file_name ) = explode( '?', $file_name );
1601
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1602
+	$file_name = basename($url);
1603
+	if (strpos($file_name, '?') !== false) {
1604
+		list($file_name) = explode('?', $file_name);
1606 1605
 	}
1607 1606
 	$dummy        = false;
1608 1607
 	$add_to_cache = false;
1609 1608
 	$key          = null;
1610
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1609
+	if (strpos($url, '/dummy/') !== false) {
1611 1610
 		$dummy = true;
1612
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1613
-		$value = get_transient( 'cached_dummy_images' );
1614
-		if ( $value ) {
1615
-			if ( isset( $value[ $key ] ) ) {
1616
-				return $value[ $key ];
1611
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1612
+		$value = get_transient('cached_dummy_images');
1613
+		if ($value) {
1614
+			if (isset($value[$key])) {
1615
+				return $value[$key];
1617 1616
 			} else {
1618 1617
 				$add_to_cache = true;
1619 1618
 			}
@@ -1624,58 +1623,58 @@  discard block
 block discarded – undo
1624 1623
 
1625 1624
 	// get placeholder file in the upload dir with a unique, sanitized filename
1626 1625
 
1627
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1626
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1628 1627
 
1629
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1630
-	if ( $upload['error'] ) {
1631
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1628
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1629
+	if ($upload['error']) {
1630
+		return new WP_Error('upload_dir_error', $upload['error']);
1632 1631
 	}
1633 1632
 
1634 1633
 
1635
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1634
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1636 1635
 
1637 1636
 	// fetch the remote url and write it to the placeholder file
1638
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1637
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1639 1638
 
1640 1639
 	$log_message = '';
1641
-	if ( is_wp_error( $headers ) ) {
1642
-		echo 'file: ' . $url;
1640
+	if (is_wp_error($headers)) {
1641
+		echo 'file: '.$url;
1643 1642
 
1644
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1643
+		return new WP_Error('import_file_error', $headers->get_error_message());
1645 1644
 	}
1646 1645
 
1647
-	$filesize = filesize( $upload['file'] );
1646
+	$filesize = filesize($upload['file']);
1648 1647
 	// request failed
1649
-	if ( ! $headers ) {
1650
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1648
+	if (!$headers) {
1649
+		$log_message = __('Remote server did not respond', 'geodirectory');
1651 1650
 	} // make sure the fetch was successful
1652
-	elseif ( $headers['response']['code'] != '200' ) {
1653
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1654
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1655
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1656
-	} elseif ( 0 == $filesize ) {
1657
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1658
-	}
1659
-
1660
-	if ( $log_message ) {
1661
-		$del = unlink( $upload['file'] );
1662
-		if ( ! $del ) {
1663
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1651
+	elseif ($headers['response']['code'] != '200') {
1652
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1653
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1654
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1655
+	} elseif (0 == $filesize) {
1656
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1657
+	}
1658
+
1659
+	if ($log_message) {
1660
+		$del = unlink($upload['file']);
1661
+		if (!$del) {
1662
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1664 1663
 		}
1665 1664
 
1666
-		return new WP_Error( 'import_file_error', $log_message );
1665
+		return new WP_Error('import_file_error', $log_message);
1667 1666
 	}
1668 1667
 
1669
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1670
-		$images = get_transient( 'cached_dummy_images' );
1671
-		if ( is_array( $images ) ) {
1672
-			$images[ $key ] = $upload;
1668
+	if ($dummy && $add_to_cache && is_array($upload)) {
1669
+		$images = get_transient('cached_dummy_images');
1670
+		if (is_array($images)) {
1671
+			$images[$key] = $upload;
1673 1672
 		} else {
1674
-			$images = array( $key => $upload );
1673
+			$images = array($key => $upload);
1675 1674
 		}
1676 1675
 
1677 1676
 		//setting the cache using the WP Transient API
1678
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1677
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1679 1678
 	}
1680 1679
 
1681 1680
 	return $upload;
@@ -1689,12 +1688,12 @@  discard block
 block discarded – undo
1689 1688
  * @return string|void Max upload size.
1690 1689
  */
1691 1690
 function geodir_max_upload_size() {
1692
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1691
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1693 1692
 
1694
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1695
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1693
+	if ($max_filesize > 0 && $max_filesize < 1) {
1694
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1696 1695
 	} else {
1697
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1696
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1698 1697
 	}
1699 1698
 
1700 1699
 	/**
@@ -1704,7 +1703,7 @@  discard block
 block discarded – undo
1704 1703
 	 *
1705 1704
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1706 1705
 	 */
1707
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1706
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1708 1707
 }
1709 1708
 
1710 1709
 /**
@@ -1717,8 +1716,8 @@  discard block
 block discarded – undo
1717 1716
  * @return bool If dummy folder exists returns true, else false.
1718 1717
  */
1719 1718
 function geodir_dummy_folder_exists() {
1720
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1721
-	if ( ! is_dir( $path ) ) {
1719
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1720
+	if (!is_dir($path)) {
1722 1721
 		return false;
1723 1722
 	} else {
1724 1723
 		return true;
@@ -1737,17 +1736,17 @@  discard block
 block discarded – undo
1737 1736
  *
1738 1737
  * @return object Author info.
1739 1738
  */
1740
-function geodir_get_author_info( $aid ) {
1739
+function geodir_get_author_info($aid) {
1741 1740
 	global $wpdb;
1742 1741
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1743
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1744
-	$info    = $wpdb->get_results( $infosql );
1745
-	if ( $info ) {
1742
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1743
+	$info    = $wpdb->get_results($infosql);
1744
+	if ($info) {
1746 1745
 		return $info[0];
1747 1746
 	}
1748 1747
 }
1749 1748
 
1750
-if ( ! function_exists( 'adminEmail' ) ) {
1749
+if (!function_exists('adminEmail')) {
1751 1750
 	/**
1752 1751
 	 * Send emails to client on post submission, renew etc.
1753 1752
 	 *
@@ -1760,67 +1759,67 @@  discard block
 block discarded – undo
1760 1759
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1761 1760
 	 * @param string $custom_1     Custom data to be sent.
1762 1761
 	 */
1763
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1762
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1764 1763
 		global $wpdb;
1765
-		if ( $message_type == 'expiration' ) {
1766
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1767
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1768
-		} elseif ( $message_type == 'post_submited' ) {
1769
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1770
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1771
-		} elseif ( $message_type == 'renew' ) {
1772
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1773
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1774
-		} elseif ( $message_type == 'upgrade' ) {
1775
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1776
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1777
-		} elseif ( $message_type == 'claim_approved' ) {
1778
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1779
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1780
-		} elseif ( $message_type == 'claim_rejected' ) {
1781
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1782
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1783
-		} elseif ( $message_type == 'claim_requested' ) {
1784
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1785
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1786
-		} elseif ( $message_type == 'auto_claim' ) {
1787
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1788
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1789
-		} elseif ( $message_type == 'payment_success' ) {
1790
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1791
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1792
-		} elseif ( $message_type == 'payment_fail' ) {
1793
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1794
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1764
+		if ($message_type == 'expiration') {
1765
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1766
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1767
+		} elseif ($message_type == 'post_submited') {
1768
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1769
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1770
+		} elseif ($message_type == 'renew') {
1771
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1772
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1773
+		} elseif ($message_type == 'upgrade') {
1774
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1775
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1776
+		} elseif ($message_type == 'claim_approved') {
1777
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1778
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1779
+		} elseif ($message_type == 'claim_rejected') {
1780
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1781
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1782
+		} elseif ($message_type == 'claim_requested') {
1783
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1784
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1785
+		} elseif ($message_type == 'auto_claim') {
1786
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1787
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1788
+		} elseif ($message_type == 'payment_success') {
1789
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1790
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1791
+		} elseif ($message_type == 'payment_fail') {
1792
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1793
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1795 1794
 		}
1796 1795
 		$transaction_details = $custom_1;
1797
-		$fromEmail           = get_option( 'site_email' );
1796
+		$fromEmail           = get_option('site_email');
1798 1797
 		$fromEmailName       = get_site_emailName();
1799 1798
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1800
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1799
+		$pkg_limit            = get_property_price_info_listing($page_id);
1801 1800
 		$alivedays            = $pkg_limit['days'];
1802
-		$productlink          = get_permalink( $page_id );
1803
-		$post_info            = get_post( $page_id );
1804
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1805
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1801
+		$productlink          = get_permalink($page_id);
1802
+		$post_info            = get_post($page_id);
1803
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1804
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1806 1805
 		$loginurl             = geodir_login_url();
1807
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1806
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1808 1807
 		$siteurl              = home_url();
1809
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1810
-		$user_info            = get_userdata( $user_id );
1808
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1809
+		$user_info            = get_userdata($user_id);
1811 1810
 		$user_email           = $user_info->user_email;
1812
-		$display_name         = geodir_get_client_name( $user_id );
1811
+		$display_name         = geodir_get_client_name($user_id);
1813 1812
 		$user_login           = $user_info->user_login;
1814
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1815
-		if ( $number_of_grace_days == '' ) {
1813
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1814
+		if ($number_of_grace_days == '') {
1816 1815
 			$number_of_grace_days = 1;
1817 1816
 		}
1818
-		if ( $post_info->post_type == 'event' ) {
1817
+		if ($post_info->post_type == 'event') {
1819 1818
 			$post_type = 'event';
1820 1819
 		} else {
1821 1820
 			$post_type = 'listing';
1822 1821
 		}
1823
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1822
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1824 1823
 		$search_array   = array(
1825 1824
 			'[#client_name#]',
1826 1825
 			'[#listing_link#]',
@@ -1836,7 +1835,7 @@  discard block
 block discarded – undo
1836 1835
 			'[#site_name#]',
1837 1836
 			'[#transaction_details#]'
1838 1837
 		);
1839
-		$replace_array  = array(
1838
+		$replace_array = array(
1840 1839
 			$display_name,
1841 1840
 			$listingLink,
1842 1841
 			$post_date,
@@ -1851,11 +1850,11 @@  discard block
 block discarded – undo
1851 1850
 			$fromEmailName,
1852 1851
 			$transaction_details
1853 1852
 		);
1854
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1855
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1856
-		$headers        = 'MIME-Version: 1.0' . "\r\n";
1857
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1858
-		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1853
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1854
+		$subject        = str_replace($search_array, $replace_array, $subject);
1855
+		$headers        = 'MIME-Version: 1.0'."\r\n";
1856
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1857
+		$headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1859 1858
 
1860 1859
 		$to      = $fromEmail;
1861 1860
 		$message = $client_message;
@@ -1873,7 +1872,7 @@  discard block
 block discarded – undo
1873 1872
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1874 1873
 		 * @param string $custom_1     Custom data to be sent.
1875 1874
 		 */
1876
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1875
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1877 1876
 		/**
1878 1877
 		 * Filter the admin email subject.
1879 1878
 		 *
@@ -1886,7 +1885,7 @@  discard block
 block discarded – undo
1886 1885
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1887 1886
 		 * @param string $custom_1     Custom data to be sent.
1888 1887
 		 */
1889
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1888
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1890 1889
 		/**
1891 1890
 		 * Filter the admin email message.
1892 1891
 		 *
@@ -1899,7 +1898,7 @@  discard block
 block discarded – undo
1899 1898
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1900 1899
 		 * @param string $custom_1     Custom data to be sent.
1901 1900
 		 */
1902
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1901
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1903 1902
 		/**
1904 1903
 		 * Filter the admin email headers.
1905 1904
 		 *
@@ -1912,22 +1911,22 @@  discard block
 block discarded – undo
1912 1911
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1913 1912
 		 * @param string $custom_1     Custom data to be sent.
1914 1913
 		 */
1915
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1914
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1916 1915
 
1917 1916
 
1918
-		$sent = wp_mail( $to, $subject, $message, $headers );
1919
-		if ( ! $sent ) {
1920
-			if ( is_array( $to ) ) {
1921
-				$to = implode( ',', $to );
1917
+		$sent = wp_mail($to, $subject, $message, $headers);
1918
+		if (!$sent) {
1919
+			if (is_array($to)) {
1920
+				$to = implode(',', $to);
1922 1921
 			}
1923 1922
 			$log_message = sprintf(
1924
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1923
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1925 1924
 				$message_type,
1926
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1925
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1927 1926
 				$to,
1928 1927
 				$subject
1929 1928
 			);
1930
-			geodir_error_log( $log_message );
1929
+			geodir_error_log($log_message);
1931 1930
 		}
1932 1931
 	}
1933 1932
 }
@@ -1947,12 +1946,12 @@  discard block
 block discarded – undo
1947 1946
  *
1948 1947
  * @return array Category IDs.
1949 1948
  */
1950
-function gd_lang_object_ids( $ids_array, $type ) {
1951
-	if ( function_exists( 'icl_object_id' ) ) {
1949
+function gd_lang_object_ids($ids_array, $type) {
1950
+	if (function_exists('icl_object_id')) {
1952 1951
 		$res = array();
1953
-		foreach ( $ids_array as $id ) {
1954
-			$xlat = icl_object_id( $id, $type, false );
1955
-			if ( ! is_null( $xlat ) ) {
1952
+		foreach ($ids_array as $id) {
1953
+			$xlat = icl_object_id($id, $type, false);
1954
+			if (!is_null($xlat)) {
1956 1955
 				$res[] = $xlat;
1957 1956
 			}
1958 1957
 		}
@@ -1976,20 +1975,20 @@  discard block
 block discarded – undo
1976 1975
  *
1977 1976
  * @return array Modified Body CSS classes.
1978 1977
  */
1979
-function geodir_custom_posts_body_class( $classes ) {
1978
+function geodir_custom_posts_body_class($classes) {
1980 1979
 	global $wpdb, $wp;
1981
-	$post_types = geodir_get_posttypes( 'object' );
1982
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
1980
+	$post_types = geodir_get_posttypes('object');
1981
+	if (!empty($post_types) && count((array) $post_types) > 1) {
1983 1982
 		$classes[] = 'geodir_custom_posts';
1984 1983
 	}
1985 1984
 
1986 1985
 	// fix body class for signup page
1987
-	if ( geodir_is_page( 'login' ) ) {
1986
+	if (geodir_is_page('login')) {
1988 1987
 		$new_classes   = array();
1989 1988
 		$new_classes[] = 'signup page-geodir-signup';
1990
-		if ( ! empty( $classes ) ) {
1991
-			foreach ( $classes as $class ) {
1992
-				if ( $class && $class != 'home' && $class != 'blog' ) {
1989
+		if (!empty($classes)) {
1990
+			foreach ($classes as $class) {
1991
+				if ($class && $class != 'home' && $class != 'blog') {
1993 1992
 					$new_classes[] = $class;
1994 1993
 				}
1995 1994
 			}
@@ -1997,14 +1996,14 @@  discard block
 block discarded – undo
1997 1996
 		$classes = $new_classes;
1998 1997
 	}
1999 1998
 
2000
-	if ( geodir_is_geodir_page() ) {
1999
+	if (geodir_is_geodir_page()) {
2001 2000
 		$classes[] = 'geodir-page';
2002 2001
 	}
2003 2002
 
2004 2003
 	return $classes;
2005 2004
 }
2006 2005
 
2007
-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
2006
+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
2008 2007
 
2009 2008
 
2010 2009
 /**
@@ -2020,7 +2019,7 @@  discard block
 block discarded – undo
2020 2019
 	 *
2021 2020
 	 * @since 1.0.0
2022 2021
 	 */
2023
-	return apply_filters( 'geodir_map_zoom_level', array(
2022
+	return apply_filters('geodir_map_zoom_level', array(
2024 2023
 		1,
2025 2024
 		2,
2026 2025
 		3,
@@ -2040,7 +2039,7 @@  discard block
 block discarded – undo
2040 2039
 		17,
2041 2040
 		18,
2042 2041
 		19
2043
-	) );
2042
+	));
2044 2043
 
2045 2044
 }
2046 2045
 
@@ -2053,12 +2052,12 @@  discard block
 block discarded – undo
2053 2052
  *
2054 2053
  * @param string $geodir_option_name Option key.
2055 2054
  */
2056
-function geodir_option_version_backup( $geodir_option_name ) {
2055
+function geodir_option_version_backup($geodir_option_name) {
2057 2056
 	$version_date  = time();
2058
-	$geodir_option = get_option( $geodir_option_name );
2057
+	$geodir_option = get_option($geodir_option_name);
2059 2058
 
2060
-	if ( ! empty( $geodir_option ) ) {
2061
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2059
+	if (!empty($geodir_option)) {
2060
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2062 2061
 	}
2063 2062
 }
2064 2063
 
@@ -2072,10 +2071,10 @@  discard block
 block discarded – undo
2072 2071
  *
2073 2072
  * @return int Page ID.
2074 2073
  */
2075
-function get_page_id_geodir_add_listing_page( $page_id ) {
2076
-	if ( geodir_wpml_multilingual_status() ) {
2074
+function get_page_id_geodir_add_listing_page($page_id) {
2075
+	if (geodir_wpml_multilingual_status()) {
2077 2076
 		$post_type = 'post_page';
2078
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2077
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2079 2078
 	}
2080 2079
 
2081 2080
 	return $page_id;
@@ -2089,7 +2088,7 @@  discard block
 block discarded – undo
2089 2088
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2090 2089
  */
2091 2090
 function geodir_wpml_multilingual_status() {
2092
-	if ( function_exists( 'icl_object_id' ) ) {
2091
+	if (function_exists('icl_object_id')) {
2093 2092
 		return true;
2094 2093
 	}
2095 2094
 
@@ -2107,19 +2106,19 @@  discard block
 block discarded – undo
2107 2106
  *
2108 2107
  * @return int Element ID when exists. Else the page id.
2109 2108
  */
2110
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2109
+function geodir_get_wpml_element_id($page_id, $post_type) {
2111 2110
 	global $sitepress;
2112
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2113
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2111
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2112
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2114 2113
 
2115
-		if ( $trid > 0 ) {
2116
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2114
+		if ($trid > 0) {
2115
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2117 2116
 
2118 2117
 			$lang = $sitepress->get_current_language();
2119 2118
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2120 2119
 
2121
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2122
-				$page_id = $translations[ $lang ]->element_id;
2120
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2121
+				$page_id = $translations[$lang]->element_id;
2123 2122
 			}
2124 2123
 		}
2125 2124
 	}
@@ -2136,15 +2135,15 @@  discard block
 block discarded – undo
2136 2135
  */
2137 2136
 function geodir_wpml_check_element_id() {
2138 2137
 	global $sitepress;
2139
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2138
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2140 2139
 		$el_type      = 'post_page';
2141
-		$el_id        = get_option( 'geodir_add_listing_page' );
2140
+		$el_id        = get_option('geodir_add_listing_page');
2142 2141
 		$default_lang = $sitepress->get_default_language();
2143
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2142
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2144 2143
 
2145
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2146
-			if ( ! $el_details->source_language_code ) {
2147
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2144
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2145
+			if (!$el_details->source_language_code) {
2146
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2148 2147
 				$sitepress->icl_translations_cache->clear();
2149 2148
 			}
2150 2149
 		}
@@ -2163,41 +2162,41 @@  discard block
 block discarded – undo
2163 2162
  *
2164 2163
  * @return string Orderby SQL.
2165 2164
  */
2166
-function geodir_widget_listings_get_order( $query_args ) {
2165
+function geodir_widget_listings_get_order($query_args) {
2167 2166
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2168 2167
 
2169 2168
 	$query_args = $gd_query_args_widgets;
2170
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2171
-		return $wpdb->posts . ".post_date DESC, ";
2169
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2170
+		return $wpdb->posts.".post_date DESC, ";
2172 2171
 	}
2173 2172
 
2174
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2175
-	$table     = $plugin_prefix . $post_type . '_detail';
2173
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2174
+	$table     = $plugin_prefix.$post_type.'_detail';
2176 2175
 
2177
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2176
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2178 2177
 
2179
-	switch ( $sort_by ) {
2178
+	switch ($sort_by) {
2180 2179
 		case 'latest':
2181 2180
 		case 'newest':
2182
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2181
+			$orderby = $wpdb->posts.".post_date DESC, ";
2183 2182
 			break;
2184 2183
 		case 'featured':
2185
-			$orderby = $table . ".is_featured ASC, ";
2184
+			$orderby = $table.".is_featured ASC, ";
2186 2185
 			break;
2187 2186
 		case 'az':
2188
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2187
+			$orderby = $wpdb->posts.".post_title ASC, ";
2189 2188
 			break;
2190 2189
 		case 'high_review':
2191
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2190
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2192 2191
 			break;
2193 2192
 		case 'high_rating':
2194
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2193
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2195 2194
 			break;
2196 2195
 		case 'random':
2197 2196
 			$orderby = "RAND(), ";
2198 2197
 			break;
2199 2198
 		default:
2200
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2199
+			$orderby = $wpdb->posts.".post_title ASC, ";
2201 2200
 			break;
2202 2201
 	}
2203 2202
 
@@ -2219,15 +2218,15 @@  discard block
 block discarded – undo
2219 2218
  *
2220 2219
  * @return mixed Result object.
2221 2220
  */
2222
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2221
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2223 2222
 	global $wpdb, $plugin_prefix, $table_prefix;
2224 2223
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2225 2224
 	$gd_query_args_widgets            = $query_args;
2226 2225
 
2227
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2228
-	$table     = $plugin_prefix . $post_type . '_detail';
2226
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2227
+	$table     = $plugin_prefix.$post_type.'_detail';
2229 2228
 
2230
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2229
+	$fields = $wpdb->posts.".*, ".$table.".*";
2231 2230
 	/**
2232 2231
 	 * Filter widget listing fields string part that is being used for query.
2233 2232
 	 *
@@ -2237,17 +2236,17 @@  discard block
 block discarded – undo
2237 2236
 	 * @param string $table     Table name.
2238 2237
 	 * @param string $post_type Post type.
2239 2238
 	 */
2240
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2239
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2241 2240
 
2242
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2241
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2243 2242
 
2244 2243
 	########### WPML ###########
2245 2244
 
2246
-	if ( function_exists( 'icl_object_id' ) ) {
2245
+	if (function_exists('icl_object_id')) {
2247 2246
 		global $sitepress;
2248 2247
 		$lang_code = ICL_LANGUAGE_CODE;
2249
-		if ( $lang_code ) {
2250
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2248
+		if ($lang_code) {
2249
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2251 2250
 		}
2252 2251
 	}
2253 2252
 
@@ -2261,15 +2260,15 @@  discard block
 block discarded – undo
2261 2260
 	 * @param string $join      Join clause string.
2262 2261
 	 * @param string $post_type Post type.
2263 2262
 	 */
2264
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2263
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2265 2264
 
2266
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2265
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2267 2266
 
2268
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2267
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2269 2268
 
2270 2269
 	########### WPML ###########
2271
-	if ( function_exists( 'icl_object_id' ) ) {
2272
-		if ( $lang_code ) {
2270
+	if (function_exists('icl_object_id')) {
2271
+		if ($lang_code) {
2273 2272
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2274 2273
 		}
2275 2274
 	}
@@ -2282,8 +2281,8 @@  discard block
 block discarded – undo
2282 2281
 	 * @param string $where     Where clause string.
2283 2282
 	 * @param string $post_type Post type.
2284 2283
 	 */
2285
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2286
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2284
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2285
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2287 2286
 
2288 2287
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2289 2288
 	/**
@@ -2294,15 +2293,15 @@  discard block
 block discarded – undo
2294 2293
 	 * @param string $groupby   Group by clause string.
2295 2294
 	 * @param string $post_type Post type.
2296 2295
 	 */
2297
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2296
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2298 2297
 
2299
-	if ( $count_only ) {
2300
-		$sql  = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2301
-			" . $join . "
2298
+	if ($count_only) {
2299
+		$sql  = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2300
+			" . $join."
2302 2301
 			" . $where;
2303
-		$rows = (int) $wpdb->get_var( $sql );
2302
+		$rows = (int) $wpdb->get_var($sql);
2304 2303
 	} else {
2305
-		$orderby = geodir_widget_listings_get_order( $query_args );
2304
+		$orderby = geodir_widget_listings_get_order($query_args);
2306 2305
 		/**
2307 2306
 		 * Filter widget listing orderby clause string part that is being used for query.
2308 2307
 		 *
@@ -2312,11 +2311,11 @@  discard block
 block discarded – undo
2312 2311
 		 * @param string $table     Table name.
2313 2312
 		 * @param string $post_type Post type.
2314 2313
 		 */
2315
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2316
-		$orderby .= $wpdb->posts . ".post_title ASC";
2317
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2314
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2315
+		$orderby .= $wpdb->posts.".post_title ASC";
2316
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2318 2317
 
2319
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2318
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2320 2319
 		/**
2321 2320
 		 * Filter widget listing limit that is being used for query.
2322 2321
 		 *
@@ -2325,26 +2324,26 @@  discard block
 block discarded – undo
2325 2324
 		 * @param int $limit        Query results limit.
2326 2325
 		 * @param string $post_type Post type.
2327 2326
 		 */
2328
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2327
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2329 2328
 
2330
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2331
-		if ( ! $page ) {
2329
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2330
+		if (!$page) {
2332 2331
 			$page = 1;
2333 2332
 		}
2334 2333
 
2335
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2334
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2336 2335
 
2337
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2338
-			" . $join . "
2339
-			" . $where . "
2340
-			" . $groupby . "
2341
-			" . $orderby . "
2336
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2337
+			" . $join."
2338
+			" . $where."
2339
+			" . $groupby."
2340
+			" . $orderby."
2342 2341
 			" . $limit;
2343
-		$rows = $wpdb->get_results( $sql );
2342
+		$rows = $wpdb->get_results($sql);
2344 2343
 	}
2345 2344
 
2346
-	unset( $GLOBALS['gd_query_args_widgets'] );
2347
-	unset( $gd_query_args_widgets );
2345
+	unset($GLOBALS['gd_query_args_widgets']);
2346
+	unset($gd_query_args_widgets);
2348 2347
 
2349 2348
 	return $rows;
2350 2349
 }
@@ -2361,11 +2360,11 @@  discard block
 block discarded – undo
2361 2360
  *
2362 2361
  * @return string Modified fields SQL.
2363 2362
  */
2364
-function geodir_function_widget_listings_fields( $fields ) {
2363
+function geodir_function_widget_listings_fields($fields) {
2365 2364
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2366 2365
 
2367 2366
 	$query_args = $gd_query_args_widgets;
2368
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2367
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2369 2368
 		return $fields;
2370 2369
 	}
2371 2370
 
@@ -2384,24 +2383,24 @@  discard block
 block discarded – undo
2384 2383
  *
2385 2384
  * @return string Modified join clause SQL.
2386 2385
  */
2387
-function geodir_function_widget_listings_join( $join ) {
2386
+function geodir_function_widget_listings_join($join) {
2388 2387
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2389 2388
 
2390 2389
 	$query_args = $gd_query_args_widgets;
2391
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2390
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2392 2391
 		return $join;
2393 2392
 	}
2394 2393
 
2395
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2396
-	$table     = $plugin_prefix . $post_type . '_detail';
2394
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2395
+	$table     = $plugin_prefix.$post_type.'_detail';
2397 2396
 
2398
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2399
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2397
+	if (!empty($query_args['with_pics_only'])) {
2398
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2400 2399
 	}
2401 2400
 
2402
-	if ( ! empty( $query_args['tax_query'] ) ) {
2403
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2404
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2401
+	if (!empty($query_args['tax_query'])) {
2402
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2403
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2405 2404
 			$join .= $tax_queries['join'];
2406 2405
 		}
2407 2406
 	}
@@ -2421,49 +2420,49 @@  discard block
 block discarded – undo
2421 2420
  *
2422 2421
  * @return string Modified where clause SQL.
2423 2422
  */
2424
-function geodir_function_widget_listings_where( $where ) {
2423
+function geodir_function_widget_listings_where($where) {
2425 2424
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2426 2425
 
2427 2426
 	$query_args = $gd_query_args_widgets;
2428
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2427
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2429 2428
 		return $where;
2430 2429
 	}
2431
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2432
-	$table     = $plugin_prefix . $post_type . '_detail';
2430
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2431
+	$table     = $plugin_prefix.$post_type.'_detail';
2433 2432
 
2434
-	if ( ! empty( $query_args ) ) {
2435
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2436
-			$where = geodir_default_location_where( $where, $table );
2433
+	if (!empty($query_args)) {
2434
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2435
+			$where = geodir_default_location_where($where, $table);
2437 2436
 		}
2438 2437
 
2439
-		if ( ! empty( $query_args['post_author'] ) ) {
2440
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2438
+		if (!empty($query_args['post_author'])) {
2439
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2441 2440
 		}
2442 2441
 
2443
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2444
-			$where .= " AND " . $table . ".is_featured = '1'";
2442
+		if (!empty($query_args['show_featured_only'])) {
2443
+			$where .= " AND ".$table.".is_featured = '1'";
2445 2444
 		}
2446 2445
 
2447
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2448
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2446
+		if (!empty($query_args['show_special_only'])) {
2447
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2449 2448
 		}
2450 2449
 
2451
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2452
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2450
+		if (!empty($query_args['with_pics_only'])) {
2451
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2453 2452
 		}
2454 2453
 
2455
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2456
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2454
+		if (!empty($query_args['featured_image_only'])) {
2455
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2457 2456
 		}
2458 2457
 
2459
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2460
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2458
+		if (!empty($query_args['with_videos_only'])) {
2459
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2461 2460
 		}
2462 2461
 
2463
-		if ( ! empty( $query_args['tax_query'] ) ) {
2464
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2462
+		if (!empty($query_args['tax_query'])) {
2463
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2465 2464
 
2466
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2465
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2467 2466
 				$where .= $tax_queries['where'];
2468 2467
 			}
2469 2468
 		}
@@ -2484,11 +2483,11 @@  discard block
 block discarded – undo
2484 2483
  *
2485 2484
  * @return string Modified orderby clause SQL.
2486 2485
  */
2487
-function geodir_function_widget_listings_orderby( $orderby ) {
2486
+function geodir_function_widget_listings_orderby($orderby) {
2488 2487
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2489 2488
 
2490 2489
 	$query_args = $gd_query_args_widgets;
2491
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2490
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2492 2491
 		return $orderby;
2493 2492
 	}
2494 2493
 
@@ -2507,15 +2506,15 @@  discard block
 block discarded – undo
2507 2506
  *
2508 2507
  * @return int Query limit.
2509 2508
  */
2510
-function geodir_function_widget_listings_limit( $limit ) {
2509
+function geodir_function_widget_listings_limit($limit) {
2511 2510
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2512 2511
 
2513 2512
 	$query_args = $gd_query_args_widgets;
2514
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2513
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2515 2514
 		return $limit;
2516 2515
 	}
2517 2516
 
2518
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2517
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2519 2518
 		$limit = (int) $query_args['posts_per_page'];
2520 2519
 	}
2521 2520
 
@@ -2533,12 +2532,12 @@  discard block
 block discarded – undo
2533 2532
  *
2534 2533
  * @return int Large size width.
2535 2534
  */
2536
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2537
-	$large_size_w = get_option( 'large_size_w' );
2535
+function geodir_media_image_large_width($default = 800, $params = '') {
2536
+	$large_size_w = get_option('large_size_w');
2538 2537
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2539
-	$large_size_w = absint( $large_size_w );
2538
+	$large_size_w = absint($large_size_w);
2540 2539
 
2541
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2540
+	if (!get_option('geodir_use_wp_media_large_size')) {
2542 2541
 		$large_size_w = 800;
2543 2542
 	}
2544 2543
 
@@ -2551,7 +2550,7 @@  discard block
 block discarded – undo
2551 2550
 	 * @param int $default         Default width.
2552 2551
 	 * @param string|array $params Image parameters.
2553 2552
 	 */
2554
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2553
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2555 2554
 
2556 2555
 	return $large_size_w;
2557 2556
 }
@@ -2567,12 +2566,12 @@  discard block
 block discarded – undo
2567 2566
  *
2568 2567
  * @return int Large size height.
2569 2568
  */
2570
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2571
-	$large_size_h = get_option( 'large_size_h' );
2569
+function geodir_media_image_large_height($default = 800, $params = '') {
2570
+	$large_size_h = get_option('large_size_h');
2572 2571
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2573
-	$large_size_h = absint( $large_size_h );
2572
+	$large_size_h = absint($large_size_h);
2574 2573
 
2575
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2574
+	if (!get_option('geodir_use_wp_media_large_size')) {
2576 2575
 		$large_size_h = 800;
2577 2576
 	}
2578 2577
 
@@ -2585,7 +2584,7 @@  discard block
 block discarded – undo
2585 2584
 	 * @param int $default         Default height.
2586 2585
 	 * @param string|array $params Image parameters.
2587 2586
 	 */
2588
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2587
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2589 2588
 
2590 2589
 	return $large_size_h;
2591 2590
 }
@@ -2602,8 +2601,8 @@  discard block
 block discarded – undo
2602 2601
  *
2603 2602
  * @return string Sanitized name.
2604 2603
  */
2605
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2606
-	if ( $name == '' ) {
2604
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2605
+	if ($name == '') {
2607 2606
 		return null;
2608 2607
 	}
2609 2608
 
@@ -2612,13 +2611,13 @@  discard block
 block discarded – undo
2612 2611
 	$type = $type == 'gd_city' ? 'city' : $type;
2613 2612
 
2614 2613
 	$return = $name;
2615
-	if ( function_exists( 'get_actual_location_name' ) ) {
2616
-		$return = get_actual_location_name( $type, $name, $translate );
2614
+	if (function_exists('get_actual_location_name')) {
2615
+		$return = get_actual_location_name($type, $name, $translate);
2617 2616
 	} else {
2618
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2619
-		$return = preg_replace( '/[_-]/', ' ', $return );
2620
-		$return = geodir_ucwords( $return );
2621
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2617
+		$return = preg_replace('/-(\d+)$/', '', $return);
2618
+		$return = preg_replace('/[_-]/', ' ', $return);
2619
+		$return = geodir_ucwords($return);
2620
+		$return = $translate ? __($return, 'geodirectory') : $return;
2622 2621
 	}
2623 2622
 
2624 2623
 	return $return;
@@ -2633,14 +2632,14 @@  discard block
 block discarded – undo
2633 2632
  *
2634 2633
  * @param int $number Comments number.
2635 2634
  */
2636
-function geodir_comments_number( $number ) {
2635
+function geodir_comments_number($number) {
2637 2636
 
2638
-	if ( $number > 1 ) {
2639
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2640
-	} elseif ( $number == 0 || $number == '' ) {
2641
-		$output = __( 'No Reviews', 'geodirectory' );
2637
+	if ($number > 1) {
2638
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2639
+	} elseif ($number == 0 || $number == '') {
2640
+		$output = __('No Reviews', 'geodirectory');
2642 2641
 	} else { // must be one
2643
-		$output = __( '1 Review', 'geodirectory' );
2642
+		$output = __('1 Review', 'geodirectory');
2644 2643
 	}
2645 2644
 	echo $output;
2646 2645
 }
@@ -2655,18 +2654,18 @@  discard block
 block discarded – undo
2655 2654
  */
2656 2655
 function is_page_geodir_home() {
2657 2656
 	global $wpdb;
2658
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2659
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2660
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2657
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2658
+	if (function_exists('geodir_location_geo_home_link')) {
2659
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2661 2660
 	}
2662
-	$home_url = home_url( '', 'http' );
2663
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2664
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2661
+	$home_url = home_url('', 'http');
2662
+	if (function_exists('geodir_location_geo_home_link')) {
2663
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2665 2664
 	}
2666
-	$home_url = str_replace( "www.", "", $home_url );
2667
-	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' ) ) ) {
2665
+	$home_url = str_replace("www.", "", $home_url);
2666
+	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'))) {
2668 2667
 		return true;
2669
-	} 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' ) ) {
2668
+	} 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')) {
2670 2669
 		return true;
2671 2670
 	} else {
2672 2671
 		return false;
@@ -2686,18 +2685,18 @@  discard block
 block discarded – undo
2686 2685
  *
2687 2686
  * @return string The canonical URL.
2688 2687
  */
2689
-function geodir_wpseo_homepage_canonical( $url ) {
2688
+function geodir_wpseo_homepage_canonical($url) {
2690 2689
 	global $post;
2691 2690
 
2692
-	if ( is_page_geodir_home() ) {
2691
+	if (is_page_geodir_home()) {
2693 2692
 		return home_url();
2694 2693
 	}
2695 2694
 
2696 2695
 	return $url;
2697 2696
 }
2698 2697
 
2699
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2700
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2698
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2699
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2701 2700
 
2702 2701
 /**
2703 2702
  * Add extra fields to google maps script call.
@@ -2710,20 +2709,20 @@  discard block
 block discarded – undo
2710 2709
  *
2711 2710
  * @return string Modified extra string.
2712 2711
  */
2713
-function geodir_googlemap_script_extra_details_page( $extra ) {
2712
+function geodir_googlemap_script_extra_details_page($extra) {
2714 2713
 	global $post;
2715 2714
 	$add_google_places_api = false;
2716
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2715
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2717 2716
 		$add_google_places_api = true;
2718 2717
 	}
2719
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2718
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2720 2719
 		$extra .= "&amp;libraries=places";
2721 2720
 	}
2722 2721
 
2723 2722
 	return $extra;
2724 2723
 }
2725 2724
 
2726
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2725
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2727 2726
 
2728 2727
 
2729 2728
 /**
@@ -2741,99 +2740,99 @@  discard block
 block discarded – undo
2741 2740
  *                                          after_widget.
2742 2741
  * @param array|string $instance            The settings for the particular instance of the widget.
2743 2742
  */
2744
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2743
+function geodir_popular_post_category_output($args = '', $instance = '') {
2745 2744
 	// prints the widget
2746 2745
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2747
-	extract( $args, EXTR_SKIP );
2746
+	extract($args, EXTR_SKIP);
2748 2747
 
2749 2748
 	echo $before_widget;
2750 2749
 
2751 2750
 	/** This filter is documented in geodirectory_widgets.php */
2752
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2751
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2753 2752
 
2754 2753
 	$gd_post_type = geodir_get_current_posttype();
2755 2754
 
2756
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2757
-	if ( ! empty( $gd_post_type ) ) {
2755
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2756
+	if (!empty($gd_post_type)) {
2758 2757
 		$default_post_type = $gd_post_type;
2759
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2758
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2760 2759
 		$default_post_type = $instance['default_post_type'];
2761 2760
 	} else {
2762 2761
 		$all_gd_post_type  = geodir_get_posttypes();
2763
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2762
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2764 2763
 	}
2765
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2764
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2766 2765
 
2767 2766
 	$taxonomy = array();
2768
-	if ( ! empty( $gd_post_type ) ) {
2769
-		$taxonomy[] = $gd_post_type . "category";
2767
+	if (!empty($gd_post_type)) {
2768
+		$taxonomy[] = $gd_post_type."category";
2770 2769
 	} else {
2771
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2770
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2772 2771
 	}
2773 2772
     
2774
-	$term_args = array( 'taxonomy' => $taxonomy );
2775
-	if ( $parent_only ) {
2773
+	$term_args = array('taxonomy' => $taxonomy);
2774
+	if ($parent_only) {
2776 2775
 		$term_args['parent'] = 0;
2777 2776
 	}
2778 2777
 
2779
-	$terms   = get_terms( $term_args );
2778
+	$terms   = get_terms($term_args);
2780 2779
 	$a_terms = array();
2781 2780
 	$b_terms = array();
2782 2781
 
2783
-	foreach ( $terms as $term ) {
2784
-		if ( $term->count > 0 ) {
2785
-			$a_terms[ $term->taxonomy ][] = $term;
2782
+	foreach ($terms as $term) {
2783
+		if ($term->count > 0) {
2784
+			$a_terms[$term->taxonomy][] = $term;
2786 2785
 		}
2787 2786
 	}
2788 2787
 
2789
-	if ( ! empty( $a_terms ) ) {
2790
-		foreach ( $a_terms as $b_key => $b_val ) {
2791
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2788
+	if (!empty($a_terms)) {
2789
+		foreach ($a_terms as $b_key => $b_val) {
2790
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2792 2791
 		}
2793 2792
 
2794
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2793
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2795 2794
 
2796 2795
 		$tax_change_output = '';
2797
-		if ( count( $b_terms ) > 1 ) {
2798
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2799
-			foreach ( $b_terms as $key => $val ) {
2800
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2801
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2802
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2796
+		if (count($b_terms) > 1) {
2797
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2798
+			foreach ($b_terms as $key => $val) {
2799
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2800
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2801
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2803 2802
 			}
2804 2803
 			$tax_change_output .= "</select>";
2805 2804
 		}
2806 2805
 
2807
-		if ( ! empty( $b_terms ) ) {
2808
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2809
-			global $cat_count;//make global so we can change via function
2806
+		if (!empty($b_terms)) {
2807
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2808
+			global $cat_count; //make global so we can change via function
2810 2809
 			$cat_count = 0;
2811 2810
 			?>
2812 2811
 			<div class="geodir-category-list-in clearfix">
2813 2812
 				<div class="geodir-cat-list clearfix">
2814 2813
 					<?php
2815
-					echo $before_title . __( $title ) . $after_title;
2814
+					echo $before_title.__($title).$after_title;
2816 2815
 
2817 2816
 					echo $tax_change_output;
2818 2817
 
2819 2818
 					echo '<ul class="geodir-popular-cat-list">';
2820 2819
 
2821
-					geodir_helper_cat_list_output( $terms, $category_limit );
2820
+					geodir_helper_cat_list_output($terms, $category_limit);
2822 2821
 
2823 2822
 					echo '</ul>';
2824 2823
 					?>
2825 2824
 				</div>
2826 2825
 				<?php
2827 2826
 				$hide = '';
2828
-				if ( $cat_count < $category_limit ) {
2827
+				if ($cat_count < $category_limit) {
2829 2828
 					$hide = 'style="display:none;"';
2830 2829
 				}
2831 2830
 				echo "<div class='geodir-cat-list-more' $hide >";
2832
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2833
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2831
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2832
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2834 2833
 				echo "</div>";
2835 2834
 				/* add scripts */
2836
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2835
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2837 2836
 				?>
2838 2837
 			</div>
2839 2838
 			<?php
@@ -2852,25 +2851,25 @@  discard block
 block discarded – undo
2852 2851
  * @param array $terms                      An array of term objects.
2853 2852
  * @param int $category_limit               Number of categories to display by default.
2854 2853
  */
2855
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2854
+function geodir_helper_cat_list_output($terms, $category_limit) {
2856 2855
 	global $geodir_post_category_str, $cat_count;
2857 2856
 	$term_icons = geodir_get_term_icon();
2858 2857
 
2859 2858
 	$geodir_post_category_str = array();
2860 2859
 
2861 2860
 
2862
-	foreach ( $terms as $cat ) {
2863
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2864
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2861
+	foreach ($terms as $cat) {
2862
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2863
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2865 2864
 
2866
-		$cat_count ++;
2865
+		$cat_count++;
2867 2866
 
2868
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2867
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2869 2868
 
2870 2869
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2871 2870
 		$total_post = $cat->count;
2872 2871
 
2873
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2872
+		$term_link = get_term_link($cat, $cat->taxonomy);
2874 2873
 		/**
2875 2874
 		 * Filer the category term link.
2876 2875
 		 *
@@ -2880,11 +2879,11 @@  discard block
 block discarded – undo
2880 2879
 		 * @param int $cat          ->term_id The term id.
2881 2880
 		 * @param string $post_type Wordpress post type.
2882 2881
 		 */
2883
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2882
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2884 2883
 
2885
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2886
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2887
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2884
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2885
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2886
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2888 2887
 		echo '</a></li>';
2889 2888
 	}
2890 2889
 }
@@ -2899,14 +2898,14 @@  discard block
 block discarded – undo
2899 2898
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2900 2899
  * @param array|string $instance The settings for the particular instance of the widget.
2901 2900
  */
2902
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2901
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2903 2902
 	// prints the widget
2904
-	extract( $args, EXTR_SKIP );
2903
+	extract($args, EXTR_SKIP);
2905 2904
 
2906 2905
 	echo $before_widget;
2907 2906
 
2908 2907
 	/** This filter is documented in geodirectory_widgets.php */
2909
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2908
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2910 2909
 	/**
2911 2910
 	 * Filter the widget post type.
2912 2911
 	 *
@@ -2914,7 +2913,7 @@  discard block
 block discarded – undo
2914 2913
 	 *
2915 2914
 	 * @param string $instance ['post_type'] Post type of listing.
2916 2915
 	 */
2917
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2916
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2918 2917
 	/**
2919 2918
 	 * Filter the widget's term.
2920 2919
 	 *
@@ -2922,7 +2921,7 @@  discard block
 block discarded – undo
2922 2921
 	 *
2923 2922
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
2924 2923
 	 */
2925
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
2924
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2926 2925
 	/**
2927 2926
 	 * Filter widget's "add_location_filter" value.
2928 2927
 	 *
@@ -2930,7 +2929,7 @@  discard block
 block discarded – undo
2930 2929
 	 *
2931 2930
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2932 2931
 	 */
2933
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
2932
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2934 2933
 	/**
2935 2934
 	 * Filter the widget listings limit.
2936 2935
 	 *
@@ -2938,7 +2937,7 @@  discard block
 block discarded – undo
2938 2937
 	 *
2939 2938
 	 * @param string $instance ['post_number'] Number of listings to display.
2940 2939
 	 */
2941
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
2940
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2942 2941
 	/**
2943 2942
 	 * Filter the widget listings limit shown at one time.
2944 2943
 	 *
@@ -2946,7 +2945,7 @@  discard block
 block discarded – undo
2946 2945
 	 *
2947 2946
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
2948 2947
 	 */
2949
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
2948
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2950 2949
 	/**
2951 2950
 	 * Filter the widget slide width.
2952 2951
 	 *
@@ -2954,7 +2953,7 @@  discard block
 block discarded – undo
2954 2953
 	 *
2955 2954
 	 * @param string $instance ['slide_width'] Width of the slides shown.
2956 2955
 	 */
2957
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
2956
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2958 2957
 	/**
2959 2958
 	 * Filter widget's "show title" value.
2960 2959
 	 *
@@ -2962,7 +2961,7 @@  discard block
 block discarded – undo
2962 2961
 	 *
2963 2962
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
2964 2963
 	 */
2965
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
2964
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2966 2965
 	/**
2967 2966
 	 * Filter widget's "slideshow" value.
2968 2967
 	 *
@@ -2970,7 +2969,7 @@  discard block
 block discarded – undo
2970 2969
 	 *
2971 2970
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
2972 2971
 	 */
2973
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
2972
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2974 2973
 	/**
2975 2974
 	 * Filter widget's "animationLoop" value.
2976 2975
 	 *
@@ -2978,7 +2977,7 @@  discard block
 block discarded – undo
2978 2977
 	 *
2979 2978
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
2980 2979
 	 */
2981
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
2980
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2982 2981
 	/**
2983 2982
 	 * Filter widget's "directionNav" value.
2984 2983
 	 *
@@ -2986,7 +2985,7 @@  discard block
 block discarded – undo
2986 2985
 	 *
2987 2986
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2988 2987
 	 */
2989
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
2988
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2990 2989
 	/**
2991 2990
 	 * Filter widget's "slideshowSpeed" value.
2992 2991
 	 *
@@ -2994,7 +2993,7 @@  discard block
 block discarded – undo
2994 2993
 	 *
2995 2994
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2996 2995
 	 */
2997
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
2996
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2998 2997
 	/**
2999 2998
 	 * Filter widget's "animationSpeed" value.
3000 2999
 	 *
@@ -3002,7 +3001,7 @@  discard block
 block discarded – undo
3002 3001
 	 *
3003 3002
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3004 3003
 	 */
3005
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3004
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3006 3005
 	/**
3007 3006
 	 * Filter widget's "animation" value.
3008 3007
 	 *
@@ -3010,7 +3009,7 @@  discard block
 block discarded – undo
3010 3009
 	 *
3011 3010
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3012 3011
 	 */
3013
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3012
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3014 3013
 	/**
3015 3014
 	 * Filter widget's "list_sort" type.
3016 3015
 	 *
@@ -3018,10 +3017,10 @@  discard block
 block discarded – undo
3018 3017
 	 *
3019 3018
 	 * @param string $instance ['list_sort'] Listing sort by type.
3020 3019
 	 */
3021
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3022
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3020
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3021
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3023 3022
 
3024
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3023
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3025 3024
 	?>
3026 3025
 	<script type="text/javascript">
3027 3026
 		jQuery(window).load(function () {
@@ -3039,23 +3038,23 @@  discard block
 block discarded – undo
3039 3038
 				itemWidth: 75,
3040 3039
 				itemMargin: 5,
3041 3040
 				asNavFor: '#geodir_widget_slider',
3042
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3041
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3043 3042
 			});
3044 3043
 
3045 3044
 			jQuery('#geodir_widget_slider').flexslider({
3046
-				animation: "<?php echo $animation;?>",
3045
+				animation: "<?php echo $animation; ?>",
3047 3046
 				selector: ".geodir-slides > li",
3048 3047
 				namespace: "geodir-",
3049 3048
 				controlNav: true,
3050
-				animationLoop: <?php echo $animationLoop;?>,
3051
-				slideshow: <?php echo $slideshow;?>,
3052
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3053
-				animationSpeed: <?php echo $animationSpeed;?>,
3054
-				directionNav: <?php echo $directionNav;?>,
3055
-				maxItems: <?php echo $max_show;?>,
3049
+				animationLoop: <?php echo $animationLoop; ?>,
3050
+				slideshow: <?php echo $slideshow; ?>,
3051
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3052
+				animationSpeed: <?php echo $animationSpeed; ?>,
3053
+				directionNav: <?php echo $directionNav; ?>,
3054
+				maxItems: <?php echo $max_show; ?>,
3056 3055
 				move: 1,
3057
-				<?php if ( $slide_width ) {
3058
-				echo "itemWidth: " . $slide_width . ",";
3056
+				<?php if ($slide_width) {
3057
+				echo "itemWidth: ".$slide_width.",";
3059 3058
 			}?>
3060 3059
 				sync: "#geodir_widget_carousel",
3061 3060
 				start: function (slider) {
@@ -3067,7 +3066,7 @@  discard block
 block discarded – undo
3067 3066
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3068 3067
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3069 3068
 				},
3070
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3069
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3071 3070
 			});
3072 3071
 		});
3073 3072
 	</script>
@@ -3080,62 +3079,62 @@  discard block
 block discarded – undo
3080 3079
 		'order_by'       => $list_sort
3081 3080
 	);
3082 3081
 
3083
-	if ( $show_featured_only ) {
3082
+	if ($show_featured_only) {
3084 3083
 		$query_args['show_featured_only'] = 1;
3085 3084
 	}
3086 3085
 
3087
-	if ( $category != 0 || $category != '' ) {
3088
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3086
+	if ($category != 0 || $category != '') {
3087
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3089 3088
 		$tax_query         = array(
3090 3089
 			'taxonomy' => $category_taxonomy[0],
3091 3090
 			'field'    => 'id',
3092 3091
 			'terms'    => $category
3093 3092
 		);
3094 3093
 
3095
-		$query_args['tax_query'] = array( $tax_query );
3094
+		$query_args['tax_query'] = array($tax_query);
3096 3095
 	}
3097 3096
 
3098 3097
 	// we want listings with featured image only
3099 3098
 	$query_args['featured_image_only'] = 1;
3100 3099
 
3101
-	if ( $post_type == 'gd_event' ) {
3100
+	if ($post_type == 'gd_event') {
3102 3101
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3103 3102
 	}// show only upcoming events
3104 3103
 
3105
-	$widget_listings = geodir_get_widget_listings( $query_args );
3106
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3107
-		if ( $title ) {
3108
-			echo $before_title . $title . $after_title;
3104
+	$widget_listings = geodir_get_widget_listings($query_args);
3105
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3106
+		if ($title) {
3107
+			echo $before_title.$title.$after_title;
3109 3108
 		}
3110 3109
 
3111 3110
 		global $post;
3112 3111
 
3113
-		$current_post = $post;// keep current post info
3112
+		$current_post = $post; // keep current post info
3114 3113
 
3115 3114
 		$widget_main_slides = '';
3116 3115
 		$nav_slides         = '';
3117 3116
 		$widget_slides      = 0;
3118 3117
 
3119
-		foreach ( $widget_listings as $widget_listing ) {
3118
+		foreach ($widget_listings as $widget_listing) {
3120 3119
 			global $gd_widget_listing_type;
3121 3120
 			$post         = $widget_listing;
3122
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3121
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3123 3122
 
3124
-			if ( ! empty( $widget_image ) ) {
3125
-				if ( $widget_image->height >= 200 ) {
3123
+			if (!empty($widget_image)) {
3124
+				if ($widget_image->height >= 200) {
3126 3125
 					$widget_spacer_height = 0;
3127 3126
 				} else {
3128
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3127
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3129 3128
 				}
3130 3129
 
3131
-				$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" />';
3130
+				$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" />';
3132 3131
 
3133 3132
 				$title = '';
3134
-				if ( $show_title ) {
3135
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3133
+				if ($show_title) {
3134
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3136 3135
 					$post_id        = $post->ID;
3137
-					$post_permalink = get_permalink( $post->ID );
3138
-					$post_title     = get_the_title( $post->ID );
3136
+					$post_permalink = get_permalink($post->ID);
3137
+					$post_title     = get_the_title($post->ID);
3139 3138
 					/**
3140 3139
 					 * Filter the listing slider widget title.
3141 3140
 					 *
@@ -3146,12 +3145,12 @@  discard block
 block discarded – undo
3146 3145
 					 * @param string $post_permalink The post permalink url.
3147 3146
 					 * @param string $post_title     The post title text.
3148 3147
 					 */
3149
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3148
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3150 3149
 				}
3151 3150
 
3152
-				$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>';
3153
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3154
-				$widget_slides ++;
3151
+				$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>';
3152
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3153
+				$widget_slides++;
3155 3154
 			}
3156 3155
 		}
3157 3156
 		?>
@@ -3160,7 +3159,7 @@  discard block
 block discarded – undo
3160 3159
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3161 3160
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3162 3161
 			</div>
3163
-			<?php if ( $widget_slides > 1 ) { ?>
3162
+			<?php if ($widget_slides > 1) { ?>
3164 3163
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3165 3164
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3166 3165
 				</div>
@@ -3168,7 +3167,7 @@  discard block
 block discarded – undo
3168 3167
 		</div>
3169 3168
 		<?php
3170 3169
 		$GLOBALS['post'] = $current_post;
3171
-		setup_postdata( $current_post );
3170
+		setup_postdata($current_post);
3172 3171
 	}
3173 3172
 	echo $after_widget;
3174 3173
 }
@@ -3184,46 +3183,46 @@  discard block
 block discarded – undo
3184 3183
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3185 3184
  * @param array|string $instance The settings for the particular instance of the widget.
3186 3185
  */
3187
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3186
+function geodir_loginwidget_output($args = '', $instance = '') {
3188 3187
 	//print_r($args);
3189 3188
 	//print_r($instance);
3190 3189
 	// prints the widget
3191
-	extract( $args, EXTR_SKIP );
3190
+	extract($args, EXTR_SKIP);
3192 3191
 
3193 3192
 	/** This filter is documented in geodirectory_widgets.php */
3194
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3193
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3195 3194
 
3196 3195
 	echo $before_widget;
3197
-	echo $before_title . $title . $after_title;
3196
+	echo $before_title.$title.$after_title;
3198 3197
 
3199
-	if ( is_user_logged_in() ) {
3198
+	if (is_user_logged_in()) {
3200 3199
 		global $current_user;
3201 3200
 
3202
-		$author_link = get_author_posts_url( $current_user->data->ID );
3203
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3201
+		$author_link = get_author_posts_url($current_user->data->ID);
3202
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3204 3203
 
3205 3204
 		echo '<ul class="geodir-loginbox-list">';
3206 3205
 		ob_start();
3207 3206
 		?>
3208 3207
 		<li><a class="signin"
3209
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3208
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3210 3209
 		<?php
3211
-		$post_types                           = geodir_get_posttypes( 'object' );
3212
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3213
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3210
+		$post_types                           = geodir_get_posttypes('object');
3211
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3212
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3214 3213
 
3215
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3214
+		if (!empty($show_add_listing_post_types_main_nav)) {
3216 3215
 			$addlisting_links = '';
3217
-			foreach ( $post_types as $key => $postobj ) {
3216
+			foreach ($post_types as $key => $postobj) {
3218 3217
 
3219
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3218
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3220 3219
 
3221
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3220
+					if ($add_link = geodir_get_addlisting_link($key)) {
3222 3221
 
3223 3222
 						$name = $postobj->labels->name;
3224 3223
 
3225 3224
 						$selected = '';
3226
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3225
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3227 3226
 							$selected = 'selected="selected"';
3228 3227
 						}
3229 3228
 
@@ -3236,22 +3235,22 @@  discard block
 block discarded – undo
3236 3235
 						 * @param string $key       Add listing array key.
3237 3236
 						 * @param int $current_user ->ID Current user ID.
3238 3237
 						 */
3239
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3238
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3240 3239
 
3241
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3240
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3242 3241
 
3243 3242
 					}
3244 3243
 				}
3245 3244
 
3246 3245
 			}
3247 3246
 
3248
-			if ( $addlisting_links != '' ) { ?>
3247
+			if ($addlisting_links != '') { ?>
3249 3248
 
3250 3249
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3251 3250
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3252
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3251
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3253 3252
 						<option value="" disabled="disabled" selected="selected"
3254
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3253
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3255 3254
 						<?php echo $addlisting_links; ?>
3256 3255
 					</select></li> <?php
3257 3256
 
@@ -3259,23 +3258,23 @@  discard block
 block discarded – undo
3259 3258
 
3260 3259
 		}
3261 3260
 		// My Favourites in Dashboard
3262
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3261
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3263 3262
 		$user_favourite                    = geodir_user_favourite_listing_count();
3264 3263
 
3265
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3264
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3266 3265
 			$favourite_links = '';
3267 3266
 
3268
-			foreach ( $post_types as $key => $postobj ) {
3269
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3267
+			foreach ($post_types as $key => $postobj) {
3268
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3270 3269
 					$name           = $postobj->labels->name;
3271
-					$post_type_link = geodir_getlink( $author_link, array(
3270
+					$post_type_link = geodir_getlink($author_link, array(
3272 3271
 						'stype' => $key,
3273 3272
 						'list'  => 'favourite'
3274
-					), false );
3273
+					), false);
3275 3274
 
3276 3275
 					$selected = '';
3277 3276
 
3278
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3277
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3279 3278
 						$selected = 'selected="selected"';
3280 3279
 					}
3281 3280
 					/**
@@ -3287,20 +3286,20 @@  discard block
 block discarded – undo
3287 3286
 					 * @param string $key            Favorite listing array key.
3288 3287
 					 * @param int $current_user      ->ID Current user ID.
3289 3288
 					 */
3290
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3289
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3291 3290
 
3292
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3291
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3293 3292
 				}
3294 3293
 			}
3295 3294
 
3296
-			if ( $favourite_links != '' ) {
3295
+			if ($favourite_links != '') {
3297 3296
 				?>
3298 3297
 				<li>
3299 3298
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3300 3299
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3301
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3300
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3302 3301
 						<option value="" disabled="disabled" selected="selected"
3303
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3302
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3304 3303
 						<?php echo $favourite_links; ?>
3305 3304
 					</select>
3306 3305
 				</li>
@@ -3309,19 +3308,19 @@  discard block
 block discarded – undo
3309 3308
 		}
3310 3309
 
3311 3310
 
3312
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3311
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3313 3312
 		$user_listing                     = geodir_user_post_listing_count();
3314 3313
 
3315
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3314
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3316 3315
 			$listing_links = '';
3317 3316
 
3318
-			foreach ( $post_types as $key => $postobj ) {
3319
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3317
+			foreach ($post_types as $key => $postobj) {
3318
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3320 3319
 					$name         = $postobj->labels->name;
3321
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3320
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3322 3321
 
3323 3322
 					$selected = '';
3324
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3323
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3325 3324
 						$selected = 'selected="selected"';
3326 3325
 					}
3327 3326
 
@@ -3334,20 +3333,20 @@  discard block
 block discarded – undo
3334 3333
 					 * @param string $key          My listing array key.
3335 3334
 					 * @param int $current_user    ->ID Current user ID.
3336 3335
 					 */
3337
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3336
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3338 3337
 
3339
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3338
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3340 3339
 				}
3341 3340
 			}
3342 3341
 
3343
-			if ( $listing_links != '' ) {
3342
+			if ($listing_links != '') {
3344 3343
 				?>
3345 3344
 				<li>
3346 3345
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3347 3346
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3348
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3347
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3349 3348
 						<option value="" disabled="disabled" selected="selected"
3350
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3349
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3351 3350
 						<?php echo $listing_links; ?>
3352 3351
 					</select>
3353 3352
 				</li>
@@ -3363,7 +3362,7 @@  discard block
 block discarded – undo
3363 3362
 		 *
3364 3363
 		 * @param string $dashboard_link Dashboard links HTML.
3365 3364
 		 */
3366
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3365
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3367 3366
 		echo '</ul>';
3368 3367
 
3369 3368
 		/**
@@ -3371,7 +3370,7 @@  discard block
 block discarded – undo
3371 3370
 		 *
3372 3371
 		 * @since 1.6.6
3373 3372
 		 */
3374
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3373
+		do_action('geodir_after_loginwidget_form_logged_in');
3375 3374
 
3376 3375
 
3377 3376
 	} else {
@@ -3386,18 +3385,18 @@  discard block
 block discarded – undo
3386 3385
 		<form name="loginform" class="loginform1"
3387 3386
 		      action="<?php echo geodir_login_url(); ?>"
3388 3387
 		      method="post">
3389
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3388
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3390 3389
 			                                    type="text" class="textfield user_login1"/> <span
3391 3390
 					class="user_loginInfo"></span></div>
3392
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3391
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3393 3392
 			                                    name="pwd" type="password"
3394 3393
 			                                    class="textfield user_pass1 input-text"/><span
3395 3394
 					class="user_passInfo"></span></div>
3396 3395
 
3397
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3396
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3398 3397
 			<input type="hidden" name="testcookie" value="1"/>
3399 3398
 
3400
-				<?php do_action( 'login_form' ); ?>
3399
+				<?php do_action('login_form'); ?>
3401 3400
 
3402 3401
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3403 3402
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3410,7 +3409,7 @@  discard block
 block discarded – undo
3410 3409
 					 * @since 1.0.0
3411 3410
 					 */
3412 3411
 					?>
3413
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3412
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3414 3413
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3415 3414
 
3416 3415
 					<?php
@@ -3420,7 +3419,7 @@  discard block
 block discarded – undo
3420 3419
 					 * @since 1.0.0
3421 3420
 					 */
3422 3421
 					?>
3423
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3422
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3424 3423
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3425 3424
 		</form>
3426 3425
 		<?php
@@ -3429,7 +3428,7 @@  discard block
 block discarded – undo
3429 3428
 		 *
3430 3429
 		 * @since 1.6.6
3431 3430
 		 */
3432
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3431
+		do_action('geodir_after_loginwidget_form_logged_out');
3433 3432
 	}
3434 3433
 
3435 3434
 	echo $after_widget;
@@ -3451,16 +3450,16 @@  discard block
 block discarded – undo
3451 3450
  *                                         after_widget.
3452 3451
  * @param array|string $instance           The settings for the particular instance of the widget.
3453 3452
  */
3454
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3453
+function geodir_popular_postview_output($args = '', $instance = '') {
3455 3454
 	global $gd_session;
3456 3455
 
3457 3456
 	// prints the widget
3458
-	extract( $args, EXTR_SKIP );
3457
+	extract($args, EXTR_SKIP);
3459 3458
 
3460 3459
 	echo $before_widget;
3461 3460
 
3462 3461
 	/** This filter is documented in geodirectory_widgets.php */
3463
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3462
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3464 3463
 	/**
3465 3464
 	 * Filter the widget post type.
3466 3465
 	 *
@@ -3468,7 +3467,7 @@  discard block
 block discarded – undo
3468 3467
 	 *
3469 3468
 	 * @param string $instance ['post_type'] Post type of listing.
3470 3469
 	 */
3471
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3470
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3472 3471
 	/**
3473 3472
 	 * Filter the widget's term.
3474 3473
 	 *
@@ -3476,7 +3475,7 @@  discard block
 block discarded – undo
3476 3475
 	 *
3477 3476
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3478 3477
 	 */
3479
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3478
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3480 3479
 	/**
3481 3480
 	 * Filter the widget listings limit.
3482 3481
 	 *
@@ -3484,7 +3483,7 @@  discard block
 block discarded – undo
3484 3483
 	 *
3485 3484
 	 * @param string $instance ['post_number'] Number of listings to display.
3486 3485
 	 */
3487
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3486
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3488 3487
 	/**
3489 3488
 	 * Filter widget's "layout" type.
3490 3489
 	 *
@@ -3492,7 +3491,7 @@  discard block
 block discarded – undo
3492 3491
 	 *
3493 3492
 	 * @param string $instance ['layout'] Widget layout type.
3494 3493
 	 */
3495
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3494
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3496 3495
 	/**
3497 3496
 	 * Filter widget's "add_location_filter" value.
3498 3497
 	 *
@@ -3500,7 +3499,7 @@  discard block
 block discarded – undo
3500 3499
 	 *
3501 3500
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3502 3501
 	 */
3503
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3502
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3504 3503
 	/**
3505 3504
 	 * Filter widget's listing width.
3506 3505
 	 *
@@ -3508,7 +3507,7 @@  discard block
 block discarded – undo
3508 3507
 	 *
3509 3508
 	 * @param string $instance ['listing_width'] Listing width.
3510 3509
 	 */
3511
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3510
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3512 3511
 	/**
3513 3512
 	 * Filter widget's "list_sort" type.
3514 3513
 	 *
@@ -3516,25 +3515,25 @@  discard block
 block discarded – undo
3516 3515
 	 *
3517 3516
 	 * @param string $instance ['list_sort'] Listing sort by type.
3518 3517
 	 */
3519
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3520
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3518
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3519
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3521 3520
 
3522 3521
 	// set post type to current viewing post type
3523
-	if ( $use_viewing_post_type ) {
3522
+	if ($use_viewing_post_type) {
3524 3523
 		$current_post_type = geodir_get_current_posttype();
3525
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3524
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3526 3525
 			$post_type = $current_post_type;
3527 3526
 			$category  = array(); // old post type category will not work for current changed post type
3528 3527
 		}
3529 3528
 	}
3530 3529
 	// replace widget title dynamically
3531
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3532
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3530
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3531
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3533 3532
 
3534
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3535
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3533
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3534
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3536 3535
 
3537
-	if ( isset( $instance['character_count'] ) ) {
3536
+	if (isset($instance['character_count'])) {
3538 3537
 		/**
3539 3538
 		 * Filter the widget's excerpt character count.
3540 3539
 		 *
@@ -3542,37 +3541,37 @@  discard block
 block discarded – undo
3542 3541
 		 *
3543 3542
 		 * @param int $instance ['character_count'] Excerpt character count.
3544 3543
 		 */
3545
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3544
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3546 3545
 	} else {
3547 3546
 		$character_count = '';
3548 3547
 	}
3549 3548
 
3550
-	if ( empty( $title ) || $title == 'All' ) {
3551
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3549
+	if (empty($title) || $title == 'All') {
3550
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3552 3551
 	}
3553 3552
 
3554 3553
 	$location_url = array();
3555
-	$city         = get_query_var( 'gd_city' );
3556
-	if ( ! empty( $city ) ) {
3557
-		$country = get_query_var( 'gd_country' );
3558
-		$region  = get_query_var( 'gd_region' );
3554
+	$city         = get_query_var('gd_city');
3555
+	if (!empty($city)) {
3556
+		$country = get_query_var('gd_country');
3557
+		$region  = get_query_var('gd_region');
3559 3558
 
3560
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3559
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3561 3560
 
3562
-		if ( $geodir_show_location_url == 'all' ) {
3563
-			if ( $country != '' ) {
3561
+		if ($geodir_show_location_url == 'all') {
3562
+			if ($country != '') {
3564 3563
 				$location_url[] = $country;
3565 3564
 			}
3566 3565
 
3567
-			if ( $region != '' ) {
3566
+			if ($region != '') {
3568 3567
 				$location_url[] = $region;
3569 3568
 			}
3570
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3571
-			if ( $country != '' ) {
3569
+		} else if ($geodir_show_location_url == 'country_city') {
3570
+			if ($country != '') {
3572 3571
 				$location_url[] = $country;
3573 3572
 			}
3574
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3575
-			if ( $region != '' ) {
3573
+		} else if ($geodir_show_location_url == 'region_city') {
3574
+			if ($region != '') {
3576 3575
 				$location_url[] = $region;
3577 3576
 			}
3578 3577
 		}
@@ -3580,37 +3579,37 @@  discard block
 block discarded – undo
3580 3579
 		$location_url[] = $city;
3581 3580
 	}
3582 3581
 
3583
-	$location_url  = implode( '/', $location_url );
3582
+	$location_url  = implode('/', $location_url);
3584 3583
 	$skip_location = false;
3585
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3584
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3586 3585
 		$skip_location = true;
3587
-		$gd_session->un_set( 'gd_multi_location' );
3586
+		$gd_session->un_set('gd_multi_location');
3588 3587
 	}
3589 3588
 
3590
-	if ( get_option( 'permalink_structure' ) ) {
3591
-		$viewall_url = get_post_type_archive_link( $post_type );
3589
+	if (get_option('permalink_structure')) {
3590
+		$viewall_url = get_post_type_archive_link($post_type);
3592 3591
 	} else {
3593
-		$viewall_url = get_post_type_archive_link( $post_type );
3592
+		$viewall_url = get_post_type_archive_link($post_type);
3594 3593
 	}
3595 3594
 
3596
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3595
+	if (!empty($category) && $category[0] != '0') {
3597 3596
 		global $geodir_add_location_url;
3598 3597
 
3599 3598
 		$geodir_add_location_url = '0';
3600 3599
 
3601
-		if ( $add_location_filter != '0' ) {
3600
+		if ($add_location_filter != '0') {
3602 3601
 			$geodir_add_location_url = '1';
3603 3602
 		}
3604 3603
 
3605
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3604
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3606 3605
 
3607 3606
 		$geodir_add_location_url = null;
3608 3607
 	}
3609
-	if ( $skip_location ) {
3610
-		$gd_session->set( 'gd_multi_location', 1 );
3608
+	if ($skip_location) {
3609
+		$gd_session->set('gd_multi_location', 1);
3611 3610
 	}
3612 3611
 
3613
-	if ( is_wp_error( $viewall_url ) ) {
3612
+	if (is_wp_error($viewall_url)) {
3614 3613
 		$viewall_url = '';
3615 3614
 	}
3616 3615
 
@@ -3622,34 +3621,34 @@  discard block
 block discarded – undo
3622 3621
 		'order_by'       => $list_sort
3623 3622
 	);
3624 3623
 
3625
-	if ( $character_count ) {
3624
+	if ($character_count) {
3626 3625
 		$query_args['excerpt_length'] = $character_count;
3627 3626
 	}
3628 3627
 
3629
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3628
+	if (!empty($instance['show_featured_only'])) {
3630 3629
 		$query_args['show_featured_only'] = 1;
3631 3630
 	}
3632 3631
 
3633
-	if ( ! empty( $instance['show_special_only'] ) ) {
3632
+	if (!empty($instance['show_special_only'])) {
3634 3633
 		$query_args['show_special_only'] = 1;
3635 3634
 	}
3636 3635
 
3637
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3636
+	if (!empty($instance['with_pics_only'])) {
3638 3637
 		$query_args['with_pics_only']      = 0;
3639 3638
 		$query_args['featured_image_only'] = 1;
3640 3639
 	}
3641 3640
 
3642
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3641
+	if (!empty($instance['with_videos_only'])) {
3643 3642
 		$query_args['with_videos_only'] = 1;
3644 3643
 	}
3645
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3644
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3646 3645
 
3647
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3648
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3646
+	if (!empty($category) && $category[0] != '0') {
3647
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3649 3648
 
3650 3649
 		######### WPML #########
3651
-		if ( function_exists( 'icl_object_id' ) ) {
3652
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3650
+		if (function_exists('icl_object_id')) {
3651
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3653 3652
 		}
3654 3653
 		######### WPML #########
3655 3654
 
@@ -3659,14 +3658,14 @@  discard block
 block discarded – undo
3659 3658
 			'terms'    => $category
3660 3659
 		);
3661 3660
 
3662
-		$query_args['tax_query'] = array( $tax_query );
3661
+		$query_args['tax_query'] = array($tax_query);
3663 3662
 	}
3664 3663
 
3665 3664
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3666 3665
 
3667
-	$widget_listings = geodir_get_widget_listings( $query_args );
3666
+	$widget_listings = geodir_get_widget_listings($query_args);
3668 3667
 
3669
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3668
+	if (!empty($widget_listings) || $with_no_results) {
3670 3669
 		?>
3671 3670
 		<div class="geodir_locations geodir_location_listing">
3672 3671
 
@@ -3676,11 +3675,11 @@  discard block
 block discarded – undo
3676 3675
 			 *
3677 3676
 			 * @since 1.0.0
3678 3677
 			 */
3679
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3678
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3680 3679
 			<div class="geodir_list_heading clearfix">
3681
-				<?php echo $before_title . $title . $after_title; ?>
3680
+				<?php echo $before_title.$title.$after_title; ?>
3682 3681
 				<a href="<?php echo $viewall_url; ?>"
3683
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3682
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3684 3683
 			</div>
3685 3684
 			<?php
3686 3685
 			/**
@@ -3688,10 +3687,10 @@  discard block
 block discarded – undo
3688 3687
 			 *
3689 3688
 			 * @since 1.0.0
3690 3689
 			 */
3691
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3690
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3692 3691
 			<?php
3693
-			if ( strstr( $layout, 'gridview' ) ) {
3694
-				$listing_view_exp        = explode( '_', $layout );
3692
+			if (strstr($layout, 'gridview')) {
3693
+				$listing_view_exp        = explode('_', $layout);
3695 3694
 				$gridview_columns_widget = $layout;
3696 3695
 				$layout                  = $listing_view_exp[0];
3697 3696
 			} else {
@@ -3703,8 +3702,8 @@  discard block
 block discarded – undo
3703 3702
 			 *
3704 3703
 			 * @since 1.0.0
3705 3704
 			 */
3706
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3707
-			if ( ! isset( $character_count ) ) {
3705
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3706
+			if (!isset($character_count)) {
3708 3707
 				/**
3709 3708
 				 * Filter the widget's excerpt character count.
3710 3709
 				 *
@@ -3712,7 +3711,7 @@  discard block
 block discarded – undo
3712 3711
 				 *
3713 3712
 				 * @param int $instance ['character_count'] Excerpt character count.
3714 3713
 				 */
3715
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3714
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3716 3715
 			}
3717 3716
 
3718 3717
 			global $post, $map_jason, $map_canvas_arr;
@@ -3727,13 +3726,13 @@  discard block
 block discarded – undo
3727 3726
 			 *
3728 3727
 			 * @since 1.0.0
3729 3728
 			 */
3730
-			include( $template );
3729
+			include($template);
3731 3730
 
3732 3731
 			$geodir_is_widget_listing = false;
3733 3732
 
3734 3733
 			$GLOBALS['post'] = $current_post;
3735
-			if ( ! empty( $current_post ) ) {
3736
-				setup_postdata( $current_post );
3734
+			if (!empty($current_post)) {
3735
+				setup_postdata($current_post);
3737 3736
 			}
3738 3737
 			$map_jason      = $current_map_jason;
3739 3738
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3764,12 +3763,12 @@  discard block
 block discarded – undo
3764 3763
  *
3765 3764
  * @return int Reviews count.
3766 3765
  */
3767
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3766
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3768 3767
 	global $wpdb, $plugin_prefix;
3769 3768
 
3770
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3769
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3771 3770
 
3772
-	$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 . ")";
3771
+	$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.")";
3773 3772
 
3774 3773
 	/**
3775 3774
 	 * Filter count review sql query.
@@ -3781,9 +3780,9 @@  discard block
 block discarded – undo
3781 3780
 	 * @param int $taxonomy     The taxonomy Id.
3782 3781
 	 * @param string $post_type The post type.
3783 3782
 	 */
3784
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3783
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3785 3784
 
3786
-	$count = $wpdb->get_var( $sql );
3785
+	$count = $wpdb->get_var($sql);
3787 3786
 
3788 3787
 	return $count;
3789 3788
 }
@@ -3801,7 +3800,7 @@  discard block
 block discarded – undo
3801 3800
  *
3802 3801
  * @return array Term array data.
3803 3802
  */
3804
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3803
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3805 3804
 	/**
3806 3805
 	 * Filter review count option data.
3807 3806
 	 *
@@ -3811,78 +3810,78 @@  discard block
 block discarded – undo
3811 3810
 	 * @param bool $force_update Force update option value?. Default.false.
3812 3811
 	 * @param int $post_ID       The post id to update if any.
3813 3812
 	 */
3814
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3815
-	if ( ! empty( $option_data ) ) {
3813
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3814
+	if (!empty($option_data)) {
3816 3815
 		return $option_data;
3817 3816
 	}
3818 3817
 
3819
-	$option_data = get_option( 'geodir_global_review_count' );
3818
+	$option_data = get_option('geodir_global_review_count');
3820 3819
 
3821
-	if ( ! $option_data || $force_update ) {
3822
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3820
+	if (!$option_data || $force_update) {
3821
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3823 3822
 			global $gd_session;
3824 3823
 			$term_array = (array) $option_data;
3825
-			$post_type  = get_post_type( $post_ID );
3826
-			$taxonomy   = $post_type . 'category';
3827
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3828
-
3829
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3830
-				foreach ( $terms as $term_id ) {
3831
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3832
-					$children               = get_term_children( $term_id, $taxonomy );
3833
-					$term_array[ $term_id ] = $count;
3824
+			$post_type  = get_post_type($post_ID);
3825
+			$taxonomy   = $post_type.'category';
3826
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3827
+
3828
+			if (!empty($terms) && !is_wp_error($terms)) {
3829
+				foreach ($terms as $term_id) {
3830
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3831
+					$children               = get_term_children($term_id, $taxonomy);
3832
+					$term_array[$term_id] = $count;
3834 3833
 				}
3835 3834
 			}
3836 3835
 
3837
-			$session_listing = $gd_session->get( 'listing' );
3836
+			$session_listing = $gd_session->get('listing');
3838 3837
 
3839 3838
 			$terms = array();
3840
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3841
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3842
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3843
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3839
+			if (isset($_POST['post_category'][$taxonomy])) {
3840
+				$terms = (array) $_POST['post_category'][$taxonomy];
3841
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3842
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3844 3843
 			}
3845 3844
 
3846
-			if ( ! empty( $terms ) ) {
3847
-				foreach ( $terms as $term_id ) {
3848
-					if ( $term_id > 0 ) {
3849
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3850
-						$children               = get_term_children( $term_id, $taxonomy );
3851
-						$term_array[ $term_id ] = $count;
3845
+			if (!empty($terms)) {
3846
+				foreach ($terms as $term_id) {
3847
+					if ($term_id > 0) {
3848
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3849
+						$children               = get_term_children($term_id, $taxonomy);
3850
+						$term_array[$term_id] = $count;
3852 3851
 					}
3853 3852
 				}
3854 3853
 			}
3855 3854
 		} else { // Update reviews count for all post categories.
3856 3855
 			$term_array = array();
3857 3856
 			$post_types = geodir_get_posttypes();
3858
-			foreach ( $post_types as $post_type ) {
3857
+			foreach ($post_types as $post_type) {
3859 3858
 
3860
-				$taxonomy = geodir_get_taxonomies( $post_type );
3859
+				$taxonomy = geodir_get_taxonomies($post_type);
3861 3860
 				$taxonomy = $taxonomy[0];
3862 3861
 
3863 3862
 				$args = array(
3864 3863
 					'hide_empty' => false
3865 3864
 				);
3866 3865
 
3867
-				$terms = get_terms( $taxonomy, $args );
3866
+				$terms = get_terms($taxonomy, $args);
3868 3867
 
3869
-				foreach ( $terms as $term ) {
3870
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3871
-					$children = get_term_children( $term->term_id, $taxonomy );
3868
+				foreach ($terms as $term) {
3869
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3870
+					$children = get_term_children($term->term_id, $taxonomy);
3872 3871
 					/*if ( is_array( $children ) ) {
3873 3872
                         foreach ( $children as $child_id ) {
3874 3873
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3875 3874
                             $count = $count + $child_count;
3876 3875
                         }
3877 3876
                     }*/
3878
-					$term_array[ $term->term_id ] = $count;
3877
+					$term_array[$term->term_id] = $count;
3879 3878
 				}
3880 3879
 			}
3881 3880
 		}
3882 3881
 
3883
-		update_option( 'geodir_global_review_count', $term_array );
3882
+		update_option('geodir_global_review_count', $term_array);
3884 3883
 		//clear cache
3885
-		wp_cache_delete( 'geodir_global_review_count' );
3884
+		wp_cache_delete('geodir_global_review_count');
3886 3885
 
3887 3886
 		return $term_array;
3888 3887
 	} else {
@@ -3898,39 +3897,39 @@  discard block
 block discarded – undo
3898 3897
  * @package GeoDirectory
3899 3898
  * @return bool
3900 3899
  */
3901
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3902
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3900
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3901
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3903 3902
 		return; // do not run if importing listings
3904 3903
 	}
3905 3904
 
3906
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3905
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3907 3906
 		return;
3908 3907
 	}
3909 3908
 
3910 3909
 	$post_ID = 0;
3911
-	if ( ! empty( $post ) ) {
3912
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3910
+	if (!empty($post)) {
3911
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3913 3912
 			return;
3914 3913
 		}
3915 3914
 
3916
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3915
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3917 3916
 			return;
3918 3917
 		}
3919 3918
 
3920
-		if ( ! empty( $post->ID ) ) {
3919
+		if (!empty($post->ID)) {
3921 3920
 			$post_ID = $post->ID;
3922 3921
 		}
3923 3922
 	}
3924 3923
 
3925
-	if ( $new_status != $old_status ) {
3926
-		geodir_count_reviews_by_terms( true, $post_ID );
3924
+	if ($new_status != $old_status) {
3925
+		geodir_count_reviews_by_terms(true, $post_ID);
3927 3926
 	}
3928 3927
 
3929 3928
 	return true;
3930 3929
 }
3931 3930
 
3932
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3933
-	geodir_count_reviews_by_terms( true, $post_id );
3931
+function geodir_term_review_count_force_update_single_post($post_id) {
3932
+	geodir_count_reviews_by_terms(true, $post_id);
3934 3933
 }
3935 3934
 
3936 3935
 /*-----------------------------------------------------------------------------------*/
@@ -3947,11 +3946,11 @@  discard block
 block discarded – undo
3947 3946
  *
3948 3947
  * @return int Post count.
3949 3948
  */
3950
-function geodir_count_posts_by_term( $data, $term ) {
3949
+function geodir_count_posts_by_term($data, $term) {
3951 3950
 
3952
-	if ( $data ) {
3953
-		if ( isset( $data[ $term->term_id ] ) ) {
3954
-			return $data[ $term->term_id ];
3951
+	if ($data) {
3952
+		if (isset($data[$term->term_id])) {
3953
+			return $data[$term->term_id];
3955 3954
 		} else {
3956 3955
 			return 0;
3957 3956
 		}
@@ -3968,8 +3967,8 @@  discard block
 block discarded – undo
3968 3967
  * param array $terms An array of term objects.
3969 3968
  * @return array Sorted terms array.
3970 3969
  */
3971
-function geodir_sort_terms_by_count( $terms ) {
3972
-	usort( $terms, "geodir_sort_by_count_obj" );
3970
+function geodir_sort_terms_by_count($terms) {
3971
+	usort($terms, "geodir_sort_by_count_obj");
3973 3972
 
3974 3973
 	return $terms;
3975 3974
 }
@@ -3984,8 +3983,8 @@  discard block
 block discarded – undo
3984 3983
  *
3985 3984
  * @return array Sorted terms array.
3986 3985
  */
3987
-function geodir_sort_terms_by_review_count( $terms ) {
3988
-	usort( $terms, "geodir_sort_by_review_count_obj" );
3986
+function geodir_sort_terms_by_review_count($terms) {
3987
+	usort($terms, "geodir_sort_by_review_count_obj");
3989 3988
 
3990 3989
 	return $terms;
3991 3990
 }
@@ -4001,12 +4000,12 @@  discard block
 block discarded – undo
4001 4000
  *
4002 4001
  * @return array Sorted terms array.
4003 4002
  */
4004
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4005
-	if ( $sort == 'count' ) {
4006
-		return geodir_sort_terms_by_count( $terms );
4003
+function geodir_sort_terms($terms, $sort = 'count') {
4004
+	if ($sort == 'count') {
4005
+		return geodir_sort_terms_by_count($terms);
4007 4006
 	}
4008
-	if ( $sort == 'review_count' ) {
4009
-		return geodir_sort_terms_by_review_count( $terms );
4007
+	if ($sort == 'review_count') {
4008
+		return geodir_sort_terms_by_review_count($terms);
4010 4009
 	}
4011 4010
 }
4012 4011
 
@@ -4024,7 +4023,7 @@  discard block
 block discarded – undo
4024 4023
  *
4025 4024
  * @return bool
4026 4025
  */
4027
-function geodir_sort_by_count( $a, $b ) {
4026
+function geodir_sort_by_count($a, $b) {
4028 4027
 	return $a['count'] < $b['count'];
4029 4028
 }
4030 4029
 
@@ -4039,7 +4038,7 @@  discard block
 block discarded – undo
4039 4038
  *
4040 4039
  * @return bool
4041 4040
  */
4042
-function geodir_sort_by_count_obj( $a, $b ) {
4041
+function geodir_sort_by_count_obj($a, $b) {
4043 4042
 	return $a->count < $b->count;
4044 4043
 }
4045 4044
 
@@ -4054,7 +4053,7 @@  discard block
 block discarded – undo
4054 4053
  *
4055 4054
  * @return bool
4056 4055
  */
4057
-function geodir_sort_by_review_count_obj( $a, $b ) {
4056
+function geodir_sort_by_review_count_obj($a, $b) {
4058 4057
 	return $a->review_count < $b->review_count;
4059 4058
 }
4060 4059
 
@@ -4071,35 +4070,35 @@  discard block
 block discarded – undo
4071 4070
 	 * @since   1.4.2
4072 4071
 	 * @package GeoDirectory
4073 4072
 	 */
4074
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4073
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4075 4074
 
4076
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4077
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4075
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4076
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4078 4077
 
4079 4078
 	/**
4080 4079
 	 * Define language constants.
4081 4080
 	 *
4082 4081
 	 * @since 1.0.0
4083 4082
 	 */
4084
-	require_once( geodir_plugin_path() . '/language.php' );
4083
+	require_once(geodir_plugin_path().'/language.php');
4085 4084
 
4086
-	$language_file = geodir_plugin_path() . '/db-language.php';
4085
+	$language_file = geodir_plugin_path().'/db-language.php';
4087 4086
 
4088 4087
 	// Load language string file if not created yet
4089
-	if ( ! file_exists( $language_file ) ) {
4088
+	if (!file_exists($language_file)) {
4090 4089
 		geodirectory_load_db_language();
4091 4090
 	}
4092 4091
 
4093
-	if ( file_exists( $language_file ) ) {
4092
+	if (file_exists($language_file)) {
4094 4093
 		/**
4095 4094
 		 * Language strings from database.
4096 4095
 		 *
4097 4096
 		 * @since 1.4.2
4098 4097
 		 */
4099 4098
 		try {
4100
-			require_once( $language_file );
4101
-		} catch ( Exception $e ) {
4102
-			error_log( 'Language Error: ' . $e->getMessage() );
4099
+			require_once($language_file);
4100
+		} catch (Exception $e) {
4101
+			error_log('Language Error: '.$e->getMessage());
4103 4102
 		}
4104 4103
 	}
4105 4104
 }
@@ -4116,19 +4115,19 @@  discard block
 block discarded – undo
4116 4115
  */
4117 4116
 function geodirectory_load_db_language() {
4118 4117
 	global $wp_filesystem;
4119
-	if ( empty( $wp_filesystem ) ) {
4120
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4118
+	if (empty($wp_filesystem)) {
4119
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4121 4120
 		WP_Filesystem();
4122 4121
 		global $wp_filesystem;
4123 4122
 	}
4124 4123
 
4125
-	$language_file = geodir_plugin_path() . '/db-language.php';
4124
+	$language_file = geodir_plugin_path().'/db-language.php';
4126 4125
 
4127
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4126
+	if (is_file($language_file) && !is_writable($language_file)) {
4128 4127
 		return false;
4129 4128
 	} // Not possible to create.
4130 4129
 
4131
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4130
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4132 4131
 		return false;
4133 4132
 	} // Not possible to create.
4134 4133
 
@@ -4141,9 +4140,9 @@  discard block
 block discarded – undo
4141 4140
 	 *
4142 4141
 	 * @param array $contents_strings Array of strings.
4143 4142
 	 */
4144
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4143
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4145 4144
 
4146
-	$contents_strings = array_unique( $contents_strings );
4145
+	$contents_strings = array_unique($contents_strings);
4147 4146
 
4148 4147
 	$contents_head   = array();
4149 4148
 	$contents_head[] = "<?php";
@@ -4160,20 +4159,20 @@  discard block
 block discarded – undo
4160 4159
 	$contents_foot[] = "";
4161 4160
 	$contents_foot[] = "";
4162 4161
 
4163
-	$contents = implode( PHP_EOL, $contents_head );
4162
+	$contents = implode(PHP_EOL, $contents_head);
4164 4163
 
4165
-	if ( ! empty( $contents_strings ) ) {
4166
-		foreach ( $contents_strings as $string ) {
4167
-			if ( is_scalar( $string ) && $string != '' ) {
4168
-				$string = str_replace( "'", "\'", $string );
4169
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4164
+	if (!empty($contents_strings)) {
4165
+		foreach ($contents_strings as $string) {
4166
+			if (is_scalar($string) && $string != '') {
4167
+				$string = str_replace("'", "\'", $string);
4168
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4170 4169
 			}
4171 4170
 		}
4172 4171
 	}
4173 4172
 
4174
-	$contents .= implode( PHP_EOL, $contents_foot );
4173
+	$contents .= implode(PHP_EOL, $contents_foot);
4175 4174
 
4176
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4175
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4177 4176
 		return false;
4178 4177
 	} // Failure; could not write file.
4179 4178
 
@@ -4193,45 +4192,45 @@  discard block
 block discarded – undo
4193 4192
  *
4194 4193
  * @return array Translation texts.
4195 4194
  */
4196
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4195
+function geodir_load_custom_field_translation($translation_texts = array()) {
4197 4196
 	global $wpdb;
4198 4197
 
4199 4198
 	// Custom fields table
4200
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4201
-	$rows = $wpdb->get_results( $sql );
4199
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4200
+	$rows = $wpdb->get_results($sql);
4202 4201
 
4203
-	if ( ! empty( $rows ) ) {
4204
-		foreach ( $rows as $row ) {
4205
-			if ( ! empty( $row->admin_title ) ) {
4206
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4202
+	if (!empty($rows)) {
4203
+		foreach ($rows as $row) {
4204
+			if (!empty($row->admin_title)) {
4205
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4207 4206
 			}
4208 4207
 
4209
-			if ( ! empty( $row->admin_desc ) ) {
4210
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4208
+			if (!empty($row->admin_desc)) {
4209
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4211 4210
 			}
4212 4211
 
4213
-			if ( ! empty( $row->site_title ) ) {
4214
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4212
+			if (!empty($row->site_title)) {
4213
+				$translation_texts[] = stripslashes_deep($row->site_title);
4215 4214
 			}
4216 4215
 
4217
-			if ( ! empty( $row->clabels ) ) {
4218
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4216
+			if (!empty($row->clabels)) {
4217
+				$translation_texts[] = stripslashes_deep($row->clabels);
4219 4218
 			}
4220 4219
 
4221
-			if ( ! empty( $row->required_msg ) ) {
4222
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4220
+			if (!empty($row->required_msg)) {
4221
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4223 4222
 			}
4224 4223
 
4225
-			if ( ! empty( $row->default_value ) ) {
4226
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4224
+			if (!empty($row->default_value)) {
4225
+				$translation_texts[] = stripslashes_deep($row->default_value);
4227 4226
 			}
4228 4227
 
4229
-			if ( ! empty( $row->option_values ) ) {
4230
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4228
+			if (!empty($row->option_values)) {
4229
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4231 4230
 
4232
-				if ( ! empty( $option_values ) ) {
4233
-					foreach ( $option_values as $option_value ) {
4234
-						if ( ! empty( $option_value['label'] ) ) {
4231
+				if (!empty($option_values)) {
4232
+					foreach ($option_values as $option_value) {
4233
+						if (!empty($option_value['label'])) {
4235 4234
 							$translation_texts[] = $option_value['label'];
4236 4235
 						}
4237 4236
 					}
@@ -4241,48 +4240,48 @@  discard block
 block discarded – undo
4241 4240
 	}
4242 4241
 
4243 4242
 	// Custom sorting fields table
4244
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4245
-	$rows = $wpdb->get_results( $sql );
4243
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4244
+	$rows = $wpdb->get_results($sql);
4246 4245
 
4247
-	if ( ! empty( $rows ) ) {
4248
-		foreach ( $rows as $row ) {
4249
-			if ( ! empty( $row->site_title ) ) {
4250
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4246
+	if (!empty($rows)) {
4247
+		foreach ($rows as $row) {
4248
+			if (!empty($row->site_title)) {
4249
+				$translation_texts[] = stripslashes_deep($row->site_title);
4251 4250
 			}
4252 4251
 
4253
-			if ( ! empty( $row->asc_title ) ) {
4254
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4252
+			if (!empty($row->asc_title)) {
4253
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4255 4254
 			}
4256 4255
 
4257
-			if ( ! empty( $row->desc_title ) ) {
4258
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4256
+			if (!empty($row->desc_title)) {
4257
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4259 4258
 			}
4260 4259
 		}
4261 4260
 	}
4262 4261
 
4263 4262
 	// Advance search filter fields table
4264
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4265
-		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4266
-		$rows = $wpdb->get_results( $sql );
4267
-
4268
-		if ( ! empty( $rows ) ) {
4269
-			foreach ( $rows as $row ) {
4270
-				if ( ! empty( $row->field_site_name ) ) {
4271
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4263
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4264
+		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4265
+		$rows = $wpdb->get_results($sql);
4266
+
4267
+		if (!empty($rows)) {
4268
+			foreach ($rows as $row) {
4269
+				if (!empty($row->field_site_name)) {
4270
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4272 4271
 				}
4273 4272
 
4274
-				if ( ! empty( $row->front_search_title ) ) {
4275
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4273
+				if (!empty($row->front_search_title)) {
4274
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4276 4275
 				}
4277 4276
 
4278
-				if ( ! empty( $row->field_desc ) ) {
4279
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4277
+				if (!empty($row->field_desc)) {
4278
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4280 4279
 				}
4281 4280
 			}
4282 4281
 		}
4283 4282
 	}
4284 4283
 
4285
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4284
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4286 4285
 
4287 4286
 	return $translation_texts;
4288 4287
 }
@@ -4304,7 +4303,7 @@  discard block
 block discarded – undo
4304 4303
 	 *
4305 4304
 	 * @param array $geodir_allowed_mime_types and file extensions.
4306 4305
 	 */
4307
-	return apply_filters( 'geodir_allowed_mime_types', array(
4306
+	return apply_filters('geodir_allowed_mime_types', array(
4308 4307
 			'Image'       => array( // Image formats.
4309 4308
 				'jpg'  => 'image/jpeg',
4310 4309
 				'jpe'  => 'image/jpeg',
@@ -4372,18 +4371,18 @@  discard block
 block discarded – undo
4372 4371
  *
4373 4372
  * @return string User display name.
4374 4373
  */
4375
-function geodir_get_client_name( $user_id ) {
4374
+function geodir_get_client_name($user_id) {
4376 4375
 	$client_name = '';
4377 4376
 
4378
-	$user_data = get_userdata( $user_id );
4377
+	$user_data = get_userdata($user_id);
4379 4378
 
4380
-	if ( ! empty( $user_data ) ) {
4381
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4382
-			$client_name = trim( $user_data->display_name );
4383
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4384
-			$client_name = trim( $user_data->user_nicename );
4379
+	if (!empty($user_data)) {
4380
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4381
+			$client_name = trim($user_data->display_name);
4382
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4383
+			$client_name = trim($user_data->user_nicename);
4385 4384
 		} else {
4386
-			$client_name = trim( $user_data->user_login );
4385
+			$client_name = trim($user_data->user_login);
4387 4386
 		}
4388 4387
 	}
4389 4388
 
@@ -4391,19 +4390,19 @@  discard block
 block discarded – undo
4391 4390
 }
4392 4391
 
4393 4392
 
4394
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4393
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4395 4394
 /*
4396 4395
  * Add location variables to wpseo replacements.
4397 4396
  *
4398 4397
  * @since 1.5.4
4399 4398
  */
4400
-function geodir_wpseo_replacements( $vars ) {
4399
+function geodir_wpseo_replacements($vars) {
4401 4400
 
4402 4401
 	global $wp;
4403 4402
 	$title = '';
4404 4403
 	// location variables
4405 4404
 	$gd_post_type   = geodir_get_current_posttype();
4406
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4405
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4407 4406
 	/**
4408 4407
 	 * Filter the title variables location variables array
4409 4408
 	 *
@@ -4413,105 +4412,105 @@  discard block
 block discarded – undo
4413 4412
 	 * @param array $location_array The array of location variables.
4414 4413
 	 * @param array $vars           The page title variables.
4415 4414
 	 */
4416
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4415
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4417 4416
 	$location_titles = array();
4418
-	if ( get_query_var( 'gd_country_full' ) ) {
4419
-		if ( get_query_var( 'gd_country_full' ) ) {
4420
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4417
+	if (get_query_var('gd_country_full')) {
4418
+		if (get_query_var('gd_country_full')) {
4419
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4421 4420
 		}
4422
-		if ( get_query_var( 'gd_region_full' ) ) {
4423
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4421
+		if (get_query_var('gd_region_full')) {
4422
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4424 4423
 		}
4425
-		if ( get_query_var( 'gd_city_full' ) ) {
4426
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4424
+		if (get_query_var('gd_city_full')) {
4425
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4427 4426
 		}
4428 4427
 	}
4429 4428
 	$location_single = '';
4430
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4431
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4432
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4429
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4430
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4431
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4433 4432
 
4434 4433
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4435 4434
 
4436
-	if ( function_exists( 'get_actual_location_name' ) ) {
4437
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4438
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4439
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4435
+	if (function_exists('get_actual_location_name')) {
4436
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4437
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4438
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4440 4439
 	}
4441 4440
 
4442
-	if ( $gd_city != '' ) {
4443
-		if ( $gd_city_actual != '' ) {
4441
+	if ($gd_city != '') {
4442
+		if ($gd_city_actual != '') {
4444 4443
 			$gd_city = $gd_city_actual;
4445 4444
 		} else {
4446
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4447
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4448
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4445
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4446
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4447
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4449 4448
 		}
4450 4449
 		$location_single = $gd_city;
4451 4450
 
4452
-	} else if ( $gd_region != '' ) {
4453
-		if ( $gd_region_actual != '' ) {
4451
+	} else if ($gd_region != '') {
4452
+		if ($gd_region_actual != '') {
4454 4453
 			$gd_region = $gd_region_actual;
4455 4454
 		} else {
4456
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4457
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4458
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4455
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4456
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4457
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4459 4458
 		}
4460 4459
 
4461 4460
 		$location_single = $gd_region;
4462
-	} else if ( $gd_country != '' ) {
4463
-		if ( $gd_country_actual != '' ) {
4461
+	} else if ($gd_country != '') {
4462
+		if ($gd_country_actual != '') {
4464 4463
 			$gd_country = $gd_country_actual;
4465 4464
 		} else {
4466
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4467
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4468
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4465
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4466
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4467
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4469 4468
 		}
4470 4469
 
4471 4470
 		$location_single = $gd_country;
4472 4471
 	}
4473 4472
 
4474
-	if ( ! empty( $location_array ) ) {
4473
+	if (!empty($location_array)) {
4475 4474
 
4476
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4477
-		$location_array       = array_reverse( $location_array );
4475
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4476
+		$location_array       = array_reverse($location_array);
4478 4477
 
4479
-		foreach ( $location_array as $location_type => $location ) {
4480
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4481
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4478
+		foreach ($location_array as $location_type => $location) {
4479
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4480
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4482 4481
 
4483
-			$location_name = geodir_ucwords( $gd_location_link_text );
4484
-			$location_name = __( $location_name, 'geodirectory' );
4482
+			$location_name = geodir_ucwords($gd_location_link_text);
4483
+			$location_name = __($location_name, 'geodirectory');
4485 4484
 
4486
-			if ( $actual_location_name ) {
4487
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4488
-				$location_name = get_actual_location_name( $location_type, $location, true );
4485
+			if ($actual_location_name) {
4486
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4487
+				$location_name = get_actual_location_name($location_type, $location, true);
4489 4488
 			}
4490 4489
 
4491 4490
 			$location_titles[] = $location_name;
4492 4491
 		}
4493
-		if ( ! empty( $location_titles ) ) {
4494
-			$location_titles = array_unique( $location_titles );
4492
+		if (!empty($location_titles)) {
4493
+			$location_titles = array_unique($location_titles);
4495 4494
 		}
4496 4495
 	}
4497 4496
 
4498 4497
 
4499
-	if ( ! empty( $location_titles ) ) {
4500
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4498
+	if (!empty($location_titles)) {
4499
+		$vars['%%location%%'] = implode(", ", $location_titles);
4501 4500
 	}
4502 4501
 
4503 4502
 
4504
-	if ( ! empty( $location_titles ) ) {
4505
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4503
+	if (!empty($location_titles)) {
4504
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4506 4505
 	}
4507 4506
 
4508 4507
 
4509
-	if ( $location_single ) {
4510
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4508
+	if ($location_single) {
4509
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4511 4510
 	}
4512 4511
 
4513 4512
 
4514
-	if ( $location_single ) {
4513
+	if ($location_single) {
4515 4514
 		$vars['%%location_single%%'] = $location_single;
4516 4515
 	}
4517 4516
 
@@ -4524,13 +4523,13 @@  discard block
 block discarded – undo
4524 4523
 	 * @param string $vars          The title with variables.
4525 4524
 	 * @param array $location_array The array of location variables.
4526 4525
 	 */
4527
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4526
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4528 4527
 }
4529 4528
 
4530 4529
 
4531
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4532
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4533
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4530
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4531
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4532
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4534 4533
 
4535 4534
 /**
4536 4535
  * Filter the title variables.
@@ -4572,14 +4571,14 @@  discard block
 block discarded – undo
4572 4571
  *
4573 4572
  * @return string Title after filtered variables.
4574 4573
  */
4575
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4574
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4576 4575
 	global $wp, $post;
4577 4576
 
4578
-	if ( ! $gd_page || ! $title ) {
4577
+	if (!$gd_page || !$title) {
4579 4578
 		return $title; // if no a GD page then bail.
4580 4579
 	}
4581 4580
 
4582
-	if ( $sep == '' ) {
4581
+	if ($sep == '') {
4583 4582
 		/**
4584 4583
 		 * Filter the page title separator.
4585 4584
 		 *
@@ -4588,100 +4587,100 @@  discard block
 block discarded – undo
4588 4587
 		 *
4589 4588
 		 * @param string $sep The separator, default: `|`.
4590 4589
 		 */
4591
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4590
+		$sep = apply_filters('geodir_page_title_separator', '|');
4592 4591
 	}
4593 4592
 
4594
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4595
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4593
+	if (strpos($title, '%%title%%') !== false) {
4594
+		$title = str_replace("%%title%%", $post->post_title, $title);
4596 4595
 	}
4597 4596
 
4598
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4599
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4597
+	if (strpos($title, '%%sitename%%') !== false) {
4598
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4600 4599
 	}
4601 4600
 
4602
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4603
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4601
+	if (strpos($title, '%%sitedesc%%') !== false) {
4602
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4604 4603
 	}
4605 4604
 
4606
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4607
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4605
+	if (strpos($title, '%%excerpt%%') !== false) {
4606
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4608 4607
 	}
4609 4608
 
4610
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4611
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4612
-	} else if ( $gd_page == 'add-listing' ) {
4613
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4614
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4615
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4609
+	if ($gd_page == 'search' || $gd_page == 'author') {
4610
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4611
+	} else if ($gd_page == 'add-listing') {
4612
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4613
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4614
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4616 4615
 		$post_type = $post->post_type;
4617 4616
 	} else {
4618
-		$post_type = get_query_var( 'post_type' );
4617
+		$post_type = get_query_var('post_type');
4619 4618
 	}
4620 4619
 
4621
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4620
+	if (strpos($title, '%%pt_single%%') !== false) {
4622 4621
 		$singular_name = '';
4623
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4624
-			$singular_name = __( $singular_name, 'geodirectory' );
4622
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4623
+			$singular_name = __($singular_name, 'geodirectory');
4625 4624
 		}
4626 4625
 
4627
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4626
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4628 4627
 	}
4629 4628
 
4630
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4629
+	if (strpos($title, '%%pt_plural%%') !== false) {
4631 4630
 		$plural_name = '';
4632
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4633
-			$plural_name = __( $plural_name, 'geodirectory' );
4631
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4632
+			$plural_name = __($plural_name, 'geodirectory');
4634 4633
 		}
4635 4634
 
4636
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4635
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4637 4636
 	}
4638 4637
 
4639
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4638
+	if (strpos($title, '%%category%%') !== false) {
4640 4639
 		$cat_name = '';
4641 4640
 
4642
-		if ( $gd_page == 'detail' ) {
4643
-			if ( $post->default_category ) {
4644
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4645
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4641
+		if ($gd_page == 'detail') {
4642
+			if ($post->default_category) {
4643
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4644
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4646 4645
 			}
4647
-		} else if ( $gd_page == 'listing' ) {
4646
+		} else if ($gd_page == 'listing') {
4648 4647
 			$queried_object = get_queried_object();
4649
-			if ( isset( $queried_object->name ) ) {
4648
+			if (isset($queried_object->name)) {
4650 4649
 				$cat_name = $queried_object->name;
4651 4650
 			}
4652 4651
 		}
4653
-		$title = str_replace( "%%category%%", $cat_name, $title );
4652
+		$title = str_replace("%%category%%", $cat_name, $title);
4654 4653
 	}
4655 4654
 
4656
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4655
+	if (strpos($title, '%%tag%%') !== false) {
4657 4656
 		$cat_name = '';
4658 4657
 
4659
-		if ( $gd_page == 'detail' ) {
4660
-			if ( $post->default_category ) {
4661
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4662
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4658
+		if ($gd_page == 'detail') {
4659
+			if ($post->default_category) {
4660
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4661
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4663 4662
 			}
4664
-		} else if ( $gd_page == 'listing' ) {
4663
+		} else if ($gd_page == 'listing') {
4665 4664
 			$queried_object = get_queried_object();
4666
-			if ( isset( $queried_object->name ) ) {
4665
+			if (isset($queried_object->name)) {
4667 4666
 				$cat_name = $queried_object->name;
4668 4667
 			}
4669 4668
 		}
4670
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4669
+		$title = str_replace("%%tag%%", $cat_name, $title);
4671 4670
 	}
4672 4671
 
4673
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4674
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4675
-		$title = str_replace( "%%id%%", $ID, $title );
4672
+	if (strpos($title, '%%id%%') !== false) {
4673
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4674
+		$title = str_replace("%%id%%", $ID, $title);
4676 4675
 	}
4677 4676
 
4678
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4679
-		$title = str_replace( "%%sep%%", $sep, $title );
4677
+	if (strpos($title, '%%sep%%') !== false) {
4678
+		$title = str_replace("%%sep%%", $sep, $title);
4680 4679
 	}
4681 4680
 
4682 4681
 	// location variables
4683 4682
 	$gd_post_type   = geodir_get_current_posttype();
4684
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4683
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4685 4684
 	/**
4686 4685
 	 * Filter the title variables location variables array
4687 4686
 	 *
@@ -4693,166 +4692,166 @@  discard block
 block discarded – undo
4693 4692
 	 * @param string $gd_page       The page being filtered.
4694 4693
 	 * @param string $sep           The separator, default: `|`.
4695 4694
 	 */
4696
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4695
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4697 4696
 	$location_titles = array();
4698
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4699
-		if ( get_query_var( 'gd_country_full' ) ) {
4700
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4697
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4698
+		if (get_query_var('gd_country_full')) {
4699
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4701 4700
 		}
4702
-		if ( get_query_var( 'gd_region_full' ) ) {
4703
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4701
+		if (get_query_var('gd_region_full')) {
4702
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4704 4703
 		}
4705
-		if ( get_query_var( 'gd_city_full' ) ) {
4706
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4704
+		if (get_query_var('gd_city_full')) {
4705
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4707 4706
 		}
4708 4707
 	}
4709 4708
 	$location_single = '';
4710
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4711
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4712
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4709
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4710
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4711
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4713 4712
 
4714 4713
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4715 4714
 
4716
-	if ( function_exists( 'get_actual_location_name' ) ) {
4717
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4718
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4719
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4715
+	if (function_exists('get_actual_location_name')) {
4716
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4717
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4718
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4720 4719
 	}
4721 4720
 
4722
-	if ( $gd_city != '' ) {
4723
-		if ( $gd_city_actual != '' ) {
4721
+	if ($gd_city != '') {
4722
+		if ($gd_city_actual != '') {
4724 4723
 			$gd_city = $gd_city_actual;
4725 4724
 		} else {
4726
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4727
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4728
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4725
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4726
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4727
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4729 4728
 		}
4730 4729
 		$location_single = $gd_city;
4731 4730
 
4732
-	} else if ( $gd_region != '' ) {
4733
-		if ( $gd_region_actual != '' ) {
4731
+	} else if ($gd_region != '') {
4732
+		if ($gd_region_actual != '') {
4734 4733
 			$gd_region = $gd_region_actual;
4735 4734
 		} else {
4736
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4737
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4738
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4735
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4736
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4737
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4739 4738
 		}
4740 4739
 
4741 4740
 		$location_single = $gd_region;
4742
-	} else if ( $gd_country != '' ) {
4743
-		if ( $gd_country_actual != '' ) {
4741
+	} else if ($gd_country != '') {
4742
+		if ($gd_country_actual != '') {
4744 4743
 			$gd_country = $gd_country_actual;
4745 4744
 		} else {
4746
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4747
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4748
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4745
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4746
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4747
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4749 4748
 		}
4750 4749
 
4751 4750
 		$location_single = $gd_country;
4752 4751
 	}
4753 4752
 
4754
-	if ( ! empty( $location_array ) ) {
4753
+	if (!empty($location_array)) {
4755 4754
 
4756
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4757
-		$location_array       = array_reverse( $location_array );
4755
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4756
+		$location_array       = array_reverse($location_array);
4758 4757
 
4759
-		foreach ( $location_array as $location_type => $location ) {
4760
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4761
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4758
+		foreach ($location_array as $location_type => $location) {
4759
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4760
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4762 4761
 
4763
-			$location_name = geodir_ucwords( $gd_location_link_text );
4764
-			$location_name = __( $location_name, 'geodirectory' );
4762
+			$location_name = geodir_ucwords($gd_location_link_text);
4763
+			$location_name = __($location_name, 'geodirectory');
4765 4764
 
4766
-			if ( $actual_location_name ) {
4767
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4768
-				$location_name = get_actual_location_name( $location_type, $location, true );
4765
+			if ($actual_location_name) {
4766
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4767
+				$location_name = get_actual_location_name($location_type, $location, true);
4769 4768
 			}
4770 4769
 
4771 4770
 			$location_titles[] = $location_name;
4772 4771
 		}
4773
-		if ( ! empty( $location_titles ) ) {
4774
-			$location_titles = array_unique( $location_titles );
4772
+		if (!empty($location_titles)) {
4773
+			$location_titles = array_unique($location_titles);
4775 4774
 		}
4776 4775
 	}
4777 4776
 
4778 4777
 
4779
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4778
+	if (strpos($title, '%%location%%') !== false) {
4780 4779
 		$location = '';
4781
-		if ( $location_titles ) {
4782
-			$location = implode( ", ", $location_titles );
4780
+		if ($location_titles) {
4781
+			$location = implode(", ", $location_titles);
4783 4782
 		}
4784
-		$title = str_replace( "%%location%%", $location, $title );
4783
+		$title = str_replace("%%location%%", $location, $title);
4785 4784
 	}
4786 4785
 
4787
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4786
+	if (strpos($title, '%%in_location%%') !== false) {
4788 4787
 		$location = '';
4789
-		if ( $location_titles ) {
4790
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4788
+		if ($location_titles) {
4789
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4791 4790
 		}
4792
-		$title = str_replace( "%%in_location%%", $location, $title );
4791
+		$title = str_replace("%%in_location%%", $location, $title);
4793 4792
 	}
4794 4793
 
4795
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4796
-		if ( $location_single ) {
4797
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4794
+	if (strpos($title, '%%in_location_single%%') !== false) {
4795
+		if ($location_single) {
4796
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4798 4797
 		}
4799
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4798
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4800 4799
 	}
4801 4800
 
4802
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4803
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4801
+	if (strpos($title, '%%location_single%%') !== false) {
4802
+		$title = str_replace("%%location_single%%", $location_single, $title);
4804 4803
 	}
4805 4804
 
4806 4805
 
4807
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4806
+	if (strpos($title, '%%search_term%%') !== false) {
4808 4807
 		$search_term = '';
4809
-		if ( isset( $_REQUEST['s'] ) ) {
4810
-			$search_term = esc_attr( $_REQUEST['s'] );
4808
+		if (isset($_REQUEST['s'])) {
4809
+			$search_term = esc_attr($_REQUEST['s']);
4811 4810
 		}
4812
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4811
+		$title = str_replace("%%search_term%%", $search_term, $title);
4813 4812
 	}
4814 4813
 
4815
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4814
+	if (strpos($title, '%%search_near%%') !== false) {
4816 4815
 		$search_term = '';
4817
-		if ( isset( $_REQUEST['snear'] ) ) {
4818
-			$search_term = esc_attr( $_REQUEST['snear'] );
4816
+		if (isset($_REQUEST['snear'])) {
4817
+			$search_term = esc_attr($_REQUEST['snear']);
4819 4818
 		}
4820
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4819
+		$title = str_replace("%%search_near%%", $search_term, $title);
4821 4820
 	}
4822 4821
 
4823
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4824
-		if ( is_author() ) {
4825
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4822
+	if (strpos($title, '%%name%%') !== false) {
4823
+		if (is_author()) {
4824
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4826 4825
 			$author_name = $curauth->display_name;
4827 4826
 		} else {
4828 4827
 			$author_name = get_the_author();
4829 4828
 		}
4830
-		if ( ! $author_name || $author_name === '' ) {
4829
+		if (!$author_name || $author_name === '') {
4831 4830
 			$queried_object = get_queried_object();
4832 4831
 
4833
-			if ( isset( $queried_object->data->user_nicename ) ) {
4832
+			if (isset($queried_object->data->user_nicename)) {
4834 4833
 				$author_name = $queried_object->data->display_name;
4835 4834
 			}
4836 4835
 		}
4837
-		$title = str_replace( "%%name%%", $author_name, $title );
4836
+		$title = str_replace("%%name%%", $author_name, $title);
4838 4837
 	}
4839 4838
 
4840
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4841
-		$page  = geodir_title_meta_page( $sep );
4842
-		$title = str_replace( "%%page%%", $page, $title );
4839
+	if (strpos($title, '%%page%%') !== false) {
4840
+		$page  = geodir_title_meta_page($sep);
4841
+		$title = str_replace("%%page%%", $page, $title);
4843 4842
 	}
4844
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4843
+	if (strpos($title, '%%pagenumber%%') !== false) {
4845 4844
 		$pagenumber = geodir_title_meta_pagenumber();
4846
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4845
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4847 4846
 	}
4848
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4847
+	if (strpos($title, '%%pagetotal%%') !== false) {
4849 4848
 		$pagetotal = geodir_title_meta_pagetotal();
4850
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4849
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4851 4850
 	}
4852 4851
 
4853
-	$title = wptexturize( $title );
4854
-	$title = convert_chars( $title );
4855
-	$title = esc_html( $title );
4852
+	$title = wptexturize($title);
4853
+	$title = convert_chars($title);
4854
+	$title = esc_html($title);
4856 4855
 
4857 4856
 	/**
4858 4857
 	 * Filter the title variables after standard ones have been filtered.
@@ -4866,7 +4865,7 @@  discard block
 block discarded – undo
4866 4865
 	 * @param string $sep           The separator, default: `|`.
4867 4866
 	 */
4868 4867
 
4869
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4868
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4870 4869
 }
4871 4870
 
4872 4871
 /**
@@ -4879,82 +4878,82 @@  discard block
 block discarded – undo
4879 4878
  *
4880 4879
  * @return array Translation texts.
4881 4880
  */
4882
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4883
-	$gd_post_types = geodir_get_posttypes( 'array' );
4881
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4882
+	$gd_post_types = geodir_get_posttypes('array');
4884 4883
 
4885
-	if ( ! empty( $gd_post_types ) ) {
4886
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4887
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4888
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4889
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4884
+	if (!empty($gd_post_types)) {
4885
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4886
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4887
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4888
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4890 4889
 
4891
-			if ( ! empty( $labels ) ) {
4892
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4890
+			if (!empty($labels)) {
4891
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4893 4892
 					$translation_texts[] = $labels['name'];
4894 4893
 				}
4895
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4894
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4896 4895
 					$translation_texts[] = $labels['singular_name'];
4897 4896
 				}
4898
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4897
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4899 4898
 					$translation_texts[] = $labels['add_new'];
4900 4899
 				}
4901
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4900
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4902 4901
 					$translation_texts[] = $labels['add_new_item'];
4903 4902
 				}
4904
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4903
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4905 4904
 					$translation_texts[] = $labels['edit_item'];
4906 4905
 				}
4907
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4906
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4908 4907
 					$translation_texts[] = $labels['new_item'];
4909 4908
 				}
4910
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4909
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4911 4910
 					$translation_texts[] = $labels['view_item'];
4912 4911
 				}
4913
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4912
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4914 4913
 					$translation_texts[] = $labels['search_items'];
4915 4914
 				}
4916
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4915
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4917 4916
 					$translation_texts[] = $labels['not_found'];
4918 4917
 				}
4919
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4918
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4920 4919
 					$translation_texts[] = $labels['not_found_in_trash'];
4921 4920
 				}
4922
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4921
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4923 4922
 					$translation_texts[] = $labels['label_post_profile'];
4924 4923
 				}
4925
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4924
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4926 4925
 					$translation_texts[] = $labels['label_post_info'];
4927 4926
 				}
4928
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4927
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4929 4928
 					$translation_texts[] = $labels['label_post_images'];
4930 4929
 				}
4931
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4930
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4932 4931
 					$translation_texts[] = $labels['label_post_map'];
4933 4932
 				}
4934
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4933
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4935 4934
 					$translation_texts[] = $labels['label_reviews'];
4936 4935
 				}
4937
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4936
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4938 4937
 					$translation_texts[] = $labels['label_related_listing'];
4939 4938
 				}
4940 4939
 			}
4941 4940
 
4942
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4943
-				$translation_texts[] = normalize_whitespace( $description );
4941
+			if ($description != '' && !in_array($description, $translation_texts)) {
4942
+				$translation_texts[] = normalize_whitespace($description);
4944 4943
 			}
4945 4944
 
4946
-			if ( ! empty( $seo ) ) {
4947
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4948
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4945
+			if (!empty($seo)) {
4946
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4947
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4949 4948
 				}
4950 4949
 
4951
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4952
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4950
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4951
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4953 4952
 				}
4954 4953
 			}
4955 4954
 		}
4956 4955
 	}
4957
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4956
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4958 4957
 
4959 4958
 	return $translation_texts;
4960 4959
 }
@@ -4969,27 +4968,27 @@  discard block
 block discarded – undo
4969 4968
  *
4970 4969
  * @return array Location terms.
4971 4970
  */
4972
-function geodir_remove_location_terms( $location_terms = array() ) {
4973
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4971
+function geodir_remove_location_terms($location_terms = array()) {
4972
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4974 4973
 
4975
-	if ( ! empty( $location_terms ) && $location_manager ) {
4976
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4977
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4974
+	if (!empty($location_terms) && $location_manager) {
4975
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4976
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4978 4977
 
4979
-		if ( $hide_region_part && $hide_country_part ) {
4980
-			if ( isset( $location_terms['gd_country'] ) ) {
4981
-				unset( $location_terms['gd_country'] );
4978
+		if ($hide_region_part && $hide_country_part) {
4979
+			if (isset($location_terms['gd_country'])) {
4980
+				unset($location_terms['gd_country']);
4982 4981
 			}
4983
-			if ( isset( $location_terms['gd_region'] ) ) {
4984
-				unset( $location_terms['gd_region'] );
4982
+			if (isset($location_terms['gd_region'])) {
4983
+				unset($location_terms['gd_region']);
4985 4984
 			}
4986
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4987
-			if ( isset( $location_terms['gd_region'] ) ) {
4988
-				unset( $location_terms['gd_region'] );
4985
+		} else if ($hide_region_part && !$hide_country_part) {
4986
+			if (isset($location_terms['gd_region'])) {
4987
+				unset($location_terms['gd_region']);
4989 4988
 			}
4990
-		} else if ( ! $hide_region_part && $hide_country_part ) {
4991
-			if ( isset( $location_terms['gd_country'] ) ) {
4992
-				unset( $location_terms['gd_country'] );
4989
+		} else if (!$hide_region_part && $hide_country_part) {
4990
+			if (isset($location_terms['gd_country'])) {
4991
+				unset($location_terms['gd_country']);
4993 4992
 			}
4994 4993
 		}
4995 4994
 	}
@@ -5007,33 +5006,33 @@  discard block
 block discarded – undo
5007 5006
  * @param WP_Post $post Post object.
5008 5007
  * @param bool $update  Whether this is an existing listing being updated or not.
5009 5008
  */
5010
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5011
-	if ( ! $update ) {
5009
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5010
+	if (!$update) {
5012 5011
 		return;
5013 5012
 	}
5014 5013
 
5015
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5016
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5014
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5015
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5017 5016
 	$inline_save = $action == 'inline-save' ? true : false;
5018 5017
 
5019
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5018
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5020 5019
 		return;
5021 5020
 	}
5022 5021
 
5023
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5022
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5024 5023
 		return;
5025 5024
 	}
5026 5025
 
5027 5026
 	$user_id = (int) get_current_user_id();
5028 5027
 
5029
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5030
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5028
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5029
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5031 5030
 
5032
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5033
-			$from_email   = get_option( 'site_email' );
5031
+		if ($user_id == $author_id && !is_super_admin()) {
5032
+			$from_email   = get_option('site_email');
5034 5033
 			$from_name    = get_site_emailName();
5035
-			$to_email     = get_option( 'admin_email' );
5036
-			$to_name      = get_option( 'name' );
5034
+			$to_email     = get_option('admin_email');
5035
+			$to_name      = get_option('name');
5037 5036
 			$message_type = 'listing_edited';
5038 5037
 
5039 5038
 			$notify_edited = true;
@@ -5045,9 +5044,9 @@  discard block
 block discarded – undo
5045 5044
 			 * @param bool $notify_edited Notify on listing edited by author?
5046 5045
 			 * @param object $post        The current post object.
5047 5046
 			 */
5048
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5047
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5049 5048
 
5050
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5049
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5051 5050
 		}
5052 5051
 	}
5053 5052
 }
@@ -5062,14 +5061,14 @@  discard block
 block discarded – undo
5062 5061
  *
5063 5062
  * @return string|null The current page start & end numbering.
5064 5063
  */
5065
-function geodir_title_meta_page( $sep ) {
5064
+function geodir_title_meta_page($sep) {
5066 5065
 	$replacement = null;
5067 5066
 
5068
-	$max = geodir_title_meta_pagenumbering( 'max' );
5069
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5067
+	$max = geodir_title_meta_pagenumbering('max');
5068
+	$nr  = geodir_title_meta_pagenumbering('nr');
5070 5069
 
5071
-	if ( $max > 1 && $nr > 1 ) {
5072
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5070
+	if ($max > 1 && $nr > 1) {
5071
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5073 5072
 	}
5074 5073
 
5075 5074
 	return $replacement;
@@ -5086,8 +5085,8 @@  discard block
 block discarded – undo
5086 5085
 function geodir_title_meta_pagenumber() {
5087 5086
 	$replacement = null;
5088 5087
 
5089
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5090
-	if ( isset( $nr ) && $nr > 0 ) {
5088
+	$nr = geodir_title_meta_pagenumbering('nr');
5089
+	if (isset($nr) && $nr > 0) {
5091 5090
 		$replacement = (string) $nr;
5092 5091
 	}
5093 5092
 
@@ -5105,8 +5104,8 @@  discard block
 block discarded – undo
5105 5104
 function geodir_title_meta_pagetotal() {
5106 5105
 	$replacement = null;
5107 5106
 
5108
-	$max = geodir_title_meta_pagenumbering( 'max' );
5109
-	if ( isset( $max ) && $max > 0 ) {
5107
+	$max = geodir_title_meta_pagenumbering('max');
5108
+	if (isset($max) && $max > 0) {
5110 5109
 		$replacement = (string) $max;
5111 5110
 	}
5112 5111
 
@@ -5126,36 +5125,36 @@  discard block
 block discarded – undo
5126 5125
  *
5127 5126
  * @return int|null The current page numbering.
5128 5127
  */
5129
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5128
+function geodir_title_meta_pagenumbering($request = 'nr') {
5130 5129
 	global $wp_query, $post;
5131 5130
 	$max_num_pages = null;
5132 5131
 	$page_number   = null;
5133 5132
 
5134 5133
 	$max_num_pages = 1;
5135 5134
 
5136
-	if ( ! is_singular() ) {
5137
-		$page_number = get_query_var( 'paged' );
5138
-		if ( $page_number === 0 || $page_number === '' ) {
5135
+	if (!is_singular()) {
5136
+		$page_number = get_query_var('paged');
5137
+		if ($page_number === 0 || $page_number === '') {
5139 5138
 			$page_number = 1;
5140 5139
 		}
5141 5140
 
5142
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5141
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5143 5142
 			$max_num_pages = $wp_query->max_num_pages;
5144 5143
 		}
5145 5144
 	} else {
5146
-		$page_number = get_query_var( 'page' );
5147
-		if ( $page_number === 0 || $page_number === '' ) {
5145
+		$page_number = get_query_var('page');
5146
+		if ($page_number === 0 || $page_number === '') {
5148 5147
 			$page_number = 1;
5149 5148
 		}
5150 5149
 
5151
-		if ( isset( $post->post_content ) ) {
5152
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5150
+		if (isset($post->post_content)) {
5151
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5153 5152
 		}
5154 5153
 	}
5155 5154
 
5156 5155
 	$return = null;
5157 5156
 
5158
-	switch ( $request ) {
5157
+	switch ($request) {
5159 5158
 		case 'nr':
5160 5159
 			$return = $page_number;
5161 5160
 			break;
@@ -5176,14 +5175,14 @@  discard block
 block discarded – undo
5176 5175
  *
5177 5176
  * @return array Terms.
5178 5177
  */
5179
-function geodir_filter_empty_terms( $terms ) {
5180
-	if ( empty( $terms ) ) {
5178
+function geodir_filter_empty_terms($terms) {
5179
+	if (empty($terms)) {
5181 5180
 		return $terms;
5182 5181
 	}
5183 5182
 
5184 5183
 	$return = array();
5185
-	foreach ( $terms as $term ) {
5186
-		if ( isset( $term->count ) && $term->count > 0 ) {
5184
+	foreach ($terms as $term) {
5185
+		if (isset($term->count) && $term->count > 0) {
5187 5186
 			$return[] = $term;
5188 5187
 		} else {
5189 5188
 			/**
@@ -5194,7 +5193,7 @@  discard block
 block discarded – undo
5194 5193
 			 * @param array $return The array of terms to return.
5195 5194
 			 * @param object $term  The term object.
5196 5195
 			 */
5197
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5196
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5198 5197
 		}
5199 5198
 	}
5200 5199
 
@@ -5211,12 +5210,12 @@  discard block
 block discarded – undo
5211 5210
  *
5212 5211
  * @return array
5213 5212
  */
5214
-function geodir_remove_hentry( $class ) {
5215
-	if ( geodir_is_page( 'detail' ) ) {
5216
-		$class = array_diff( $class, array( 'hentry' ) );
5213
+function geodir_remove_hentry($class) {
5214
+	if (geodir_is_page('detail')) {
5215
+		$class = array_diff($class, array('hentry'));
5217 5216
 	}
5218 5217
 
5219 5218
 	return $class;
5220 5219
 }
5221 5220
 
5222
-add_filter( 'post_class', 'geodir_remove_hentry' );
5223 5221
\ No newline at end of file
5222
+add_filter('post_class', 'geodir_remove_hentry');
5224 5223
\ No newline at end of file
Please login to merge, or discard this patch.