Test Failed
Push — master ( 361256...2de045 )
by Stiofan
10:57
created
geodirectory-functions/general_functions.php 2 patches
Spacing   +1341 added lines, -1341 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,28 +438,28 @@  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 ( get_option( 'geodir_set_as_home' ) ) {
452
+			if (get_option('geodir_set_as_home')) {
453 453
 				$wp->query_vars['gd_is_geodir_page'] = true;
454 454
 			}
455
-			if ( geodir_is_page( 'home' ) ) {
455
+			if (geodir_is_page('home')) {
456 456
 				$wp->query_vars['gd_is_geodir_page'] = true;
457 457
 			}
458 458
 
459 459
 
460 460
 		}
461 461
 
462
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
462
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
463 463
 			if (
464 464
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
465 465
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -468,26 +468,26 @@  discard block
 block discarded – undo
468 468
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
469 469
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
470 470
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
471
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
472
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
471
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
472
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
473 473
 			) {
474 474
 				$wp->query_vars['gd_is_geodir_page'] = true;
475 475
 			}
476 476
 		}
477 477
 
478
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
479
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
478
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
479
+			$page = get_page_by_path($wp->query_vars['pagename']);
480 480
 
481
-			if ( ! empty( $page ) && (
481
+			if (!empty($page) && (
482 482
 					$page->ID == geodir_add_listing_page_id()
483 483
 					|| $page->ID == geodir_preview_page_id()
484 484
 					|| $page->ID == geodir_success_page_id()
485 485
 					|| $page->ID == geodir_location_page_id()
486
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
488
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
489
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
490
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
486
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
488
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
489
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
490
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
491 491
 				)
492 492
 			) {
493 493
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
 		}
496 496
 
497 497
 
498
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
498
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
499 499
 			$requested_post_type = $wp->query_vars['post_type'];
500 500
 			// check if this post type is geodirectory post types
501 501
 			$post_type_array = geodir_get_posttypes();
502
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
502
+			if (in_array($requested_post_type, $post_type_array)) {
503 503
 				$wp->query_vars['gd_is_geodir_page'] = true;
504 504
 			}
505 505
 		}
506 506
 
507
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
508
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
509
-			if ( ! empty( $geodir_taxonomis ) ) {
510
-				foreach ( $geodir_taxonomis as $taxonomy ) {
511
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
507
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
508
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
509
+			if (!empty($geodir_taxonomis)) {
510
+				foreach ($geodir_taxonomis as $taxonomy) {
511
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
512 512
 						$wp->query_vars['gd_is_geodir_page'] = true;
513 513
 						break;
514 514
 					}
@@ -517,20 +517,20 @@  discard block
 block discarded – undo
517 517
 
518 518
 		}
519 519
 
520
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
520
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
521 521
 			$wp->query_vars['gd_is_geodir_page'] = true;
522 522
 		}
523 523
 
524 524
 
525
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
525
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
526 526
 			$wp->query_vars['gd_is_geodir_page'] = true;
527 527
 		}
528 528
 
529 529
 
530 530
 //check if homepage
531
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
532
-		     && ! isset( $wp->query_vars['page_id'] )
533
-		     && ! isset( $wp->query_vars['pagename'] )
531
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
532
+		     && !isset($wp->query_vars['page_id'])
533
+		     && !isset($wp->query_vars['pagename'])
534 534
 		     && is_page_geodir_home()
535 535
 		) {
536 536
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
  */
555 555
 function geodir_is_geodir_page() {
556 556
 	global $wp;
557
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
557
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
558 558
 		return true;
559 559
 	} else {
560 560
 		return false;
561 561
 	}
562 562
 }
563 563
 
564
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
564
+if (!function_exists('geodir_get_imagesize')) {
565 565
 	/**
566 566
 	 * Get image size using the size key .
567 567
 	 *
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
574 574
 	 */
575
-	function geodir_get_imagesize( $size = '' ) {
575
+	function geodir_get_imagesize($size = '') {
576 576
 
577 577
 		$imagesizes = array(
578
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
579
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
580
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
581
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
578
+			'list-thumb'   => array('w' => 283, 'h' => 188),
579
+			'thumbnail'    => array('w' => 125, 'h' => 125),
580
+			'widget-thumb' => array('w' => 50, 'h' => 50),
581
+			'slider-thumb' => array('w' => 100, 'h' => 100)
582 582
 		);
583 583
 
584 584
 		/**
@@ -588,9 +588,9 @@  discard block
 block discarded – undo
588 588
 		 *
589 589
 		 * @param array $imagesizes Image size array.
590 590
 		 */
591
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
591
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
592 592
 
593
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
593
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
594 594
 			/**
595 595
 			 * Filters image size of the passed key.
596 596
 			 *
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 			 *
599 599
 			 * @param array $imagesizes [$size] Image size array of the passed key.
600 600
 			 */
601
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
601
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
602 602
 
603
-		} elseif ( ! empty( $size ) ) {
603
+		} elseif (!empty($size)) {
604 604
 
605
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
605
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
606 606
 
607 607
 		}
608 608
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 */
627 627
 
628 628
 
629
-if ( ! function_exists( 'createRandomString' ) ) {
629
+if (!function_exists('createRandomString')) {
630 630
 	/**
631 631
 	 * Creates random string.
632 632
 	 *
@@ -636,21 +636,21 @@  discard block
 block discarded – undo
636 636
 	 */
637 637
 	function createRandomString() {
638 638
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
639
-		srand( (double) microtime() * 1000000 );
639
+		srand((double) microtime() * 1000000);
640 640
 		$i       = 0;
641 641
 		$rstring = '';
642
-		while ( $i <= 25 ) {
642
+		while ($i <= 25) {
643 643
 			$num     = rand() % 33;
644
-			$tmp     = substr( $chars, $num, 1 );
645
-			$rstring = $rstring . $tmp;
646
-			$i ++;
644
+			$tmp     = substr($chars, $num, 1);
645
+			$rstring = $rstring.$tmp;
646
+			$i++;
647 647
 		}
648 648
 
649 649
 		return $rstring;
650 650
 	}
651 651
 }
652 652
 
653
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
653
+if (!function_exists('geodir_getDistanceRadius')) {
654 654
 	/**
655 655
 	 * Calculates the distance radius.
656 656
 	 *
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
 	 *
662 662
 	 * @return float The mean radius.
663 663
 	 */
664
-	function geodir_getDistanceRadius( $uom = 'km' ) {
664
+	function geodir_getDistanceRadius($uom = 'km') {
665 665
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
666
-		switch ( geodir_strtolower( $uom ) ):
666
+		switch (geodir_strtolower($uom)):
667 667
 			case 'km'    :
668 668
 				$earthMeanRadius = 6371.009; // km
669 669
 				break;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 }
696 696
 
697 697
 
698
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
698
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
699 699
 	/**
700 700
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
701 701
 	 *
@@ -708,17 +708,17 @@  discard block
 block discarded – undo
708 708
 	 *
709 709
 	 * @return float The distance.
710 710
 	 */
711
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
711
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
712 712
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
713 713
 
714
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
714
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
715 715
 
716
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
717
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
718
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
719
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
720
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
721
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
716
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
717
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
718
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
719
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
720
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
721
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
722 722
 		$distance       = $earthMeanRadius * $c;
723 723
 
724 724
 		return $distance;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 }
728 728
 
729 729
 
730
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
730
+if (!function_exists('geodir_sendEmail')) {
731 731
 	/**
732 732
 	 * The main function that send transactional emails using the args provided.
733 733
 	 *
@@ -746,93 +746,93 @@  discard block
 block discarded – undo
746 746
 	 * @param string $post_id       The post ID.
747 747
 	 * @param string $user_id       The user ID.
748 748
 	 */
749
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
749
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
750 750
 		$login_details = '';
751 751
 
752 752
 		// strip slashes from subject & message text
753
-		$to_subject = stripslashes_deep( $to_subject );
754
-		$to_message = stripslashes_deep( $to_message );
753
+		$to_subject = stripslashes_deep($to_subject);
754
+		$to_message = stripslashes_deep($to_message);
755 755
 
756
-		if ( $message_type == 'send_friend' ) {
757
-			$subject = get_option( 'geodir_email_friend_subject' );
758
-			$message = get_option( 'geodir_email_friend_content' );
759
-		} elseif ( $message_type == 'send_enquiry' ) {
760
-			$subject = get_option( 'geodir_email_enquiry_subject' );
761
-			$message = get_option( 'geodir_email_enquiry_content' );
756
+		if ($message_type == 'send_friend') {
757
+			$subject = get_option('geodir_email_friend_subject');
758
+			$message = get_option('geodir_email_friend_content');
759
+		} elseif ($message_type == 'send_enquiry') {
760
+			$subject = get_option('geodir_email_enquiry_subject');
761
+			$message = get_option('geodir_email_enquiry_content');
762 762
 
763 763
 			// change to name in some cases
764
-			$post_author = get_post_field( 'post_author', $post_id );
765
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
766
-				$toEmailName = __('Business Owner','geodirectory');
767
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
768
-				$toEmailName = __('Business Owner','geodirectory');
764
+			$post_author = get_post_field('post_author', $post_id);
765
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
766
+				$toEmailName = __('Business Owner', 'geodirectory');
767
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
768
+				$toEmailName = __('Business Owner', 'geodirectory');
769 769
 			}
770 770
 
771 771
 
772
-		} elseif ( $message_type == 'forgot_password' ) {
773
-			$subject       = get_option( 'geodir_forgot_password_subject' );
774
-			$message       = get_option( 'geodir_forgot_password_content' );
772
+		} elseif ($message_type == 'forgot_password') {
773
+			$subject       = get_option('geodir_forgot_password_subject');
774
+			$message       = get_option('geodir_forgot_password_content');
775 775
 			$login_details = $to_message;
776
-		} elseif ( $message_type == 'registration' ) {
777
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
778
-			$message       = get_option( 'geodir_registration_success_email_content' );
776
+		} elseif ($message_type == 'registration') {
777
+			$subject       = get_option('geodir_registration_success_email_subject');
778
+			$message       = get_option('geodir_registration_success_email_content');
779 779
 			$login_details = $to_message;
780
-		} elseif ( $message_type == 'post_submit' ) {
781
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
782
-			$message = get_option( 'geodir_post_submited_success_email_content' );
783
-		} elseif ( $message_type == 'listing_published' ) {
784
-			$subject = get_option( 'geodir_post_published_email_subject' );
785
-			$message = get_option( 'geodir_post_published_email_content' );
786
-		} elseif ( $message_type == 'listing_edited' ) {
787
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
788
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
780
+		} elseif ($message_type == 'post_submit') {
781
+			$subject = get_option('geodir_post_submited_success_email_subject');
782
+			$message = get_option('geodir_post_submited_success_email_content');
783
+		} elseif ($message_type == 'listing_published') {
784
+			$subject = get_option('geodir_post_published_email_subject');
785
+			$message = get_option('geodir_post_published_email_content');
786
+		} elseif ($message_type == 'listing_edited') {
787
+			$subject = get_option('geodir_post_edited_email_subject_admin');
788
+			$message = get_option('geodir_post_edited_email_content_admin');
789 789
 		}
790 790
 
791
-		if ( ! empty( $subject ) ) {
792
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
791
+		if (!empty($subject)) {
792
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
793 793
 		}
794 794
 
795
-		if ( ! empty( $message ) ) {
796
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
795
+		if (!empty($message)) {
796
+			$message = __(stripslashes_deep($message), 'geodirectory');
797 797
 		}
798 798
 
799
-		$to_message        = nl2br( $to_message );
800
-		$sitefromEmail     = get_option( 'site_email' );
799
+		$to_message        = nl2br($to_message);
800
+		$sitefromEmail     = get_option('site_email');
801 801
 		$sitefromEmailName = get_site_emailName();
802
-		$productlink       = get_permalink( $post_id );
802
+		$productlink       = get_permalink($post_id);
803 803
 
804 804
 		$user_login = '';
805
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
805
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
806 806
 			$user_login = $user_info->user_login;
807 807
 		}
808 808
 
809 809
 		$posted_date = '';
810 810
 		$listingLink = '';
811 811
 
812
-		$post_info = get_post( $post_id );
812
+		$post_info = get_post($post_id);
813 813
 
814
-		if ( $post_info ) {
814
+		if ($post_info) {
815 815
 			$posted_date = $post_info->post_date;
816
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
816
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
817 817
 		}
818 818
 		$siteurl       = home_url();
819
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
819
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
820 820
 		$loginurl      = geodir_login_url();
821
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
821
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
822 822
 
823
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
824
-		$post_author_name = geodir_get_client_name( $post_author_id );
825
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
823
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
824
+		$post_author_name = geodir_get_client_name($post_author_id);
825
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
826 826
 
827
-		if ( $fromEmail == '' ) {
828
-			$fromEmail = get_option( 'site_email' );
827
+		if ($fromEmail == '') {
828
+			$fromEmail = get_option('site_email');
829 829
 		}
830 830
 
831
-		if ( $fromEmailName == '' ) {
832
-			$fromEmailName = get_option( 'site_email_name' );
831
+		if ($fromEmailName == '') {
832
+			$fromEmailName = get_option('site_email_name');
833 833
 		}
834 834
 
835
-		$search_array  = array(
835
+		$search_array = array(
836 836
 			'[#listing_link#]',
837 837
 			'[#site_name_url#]',
838 838
 			'[#post_id#]',
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 			$post_author_name,
873 873
 			$current_date
874 874
 		);
875
-		$message       = str_replace( $search_array, $replace_array, $message );
875
+		$message       = str_replace($search_array, $replace_array, $message);
876 876
 
877 877
 		$search_array  = array(
878 878
 			'[#listing_link#]',
@@ -908,12 +908,12 @@  discard block
 block discarded – undo
908 908
 			$post_author_name,
909 909
 			$current_date
910 910
 		);
911
-		$subject       = str_replace( $search_array, $replace_array, $subject );
911
+		$subject = str_replace($search_array, $replace_array, $subject);
912 912
 
913
-		$headers = 'MIME-Version: 1.0' . "\r\n";
914
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
915
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
916
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
913
+		$headers = 'MIME-Version: 1.0'."\r\n";
914
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
915
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
916
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
917 917
 
918 918
 		$to = $toEmail;
919 919
 
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 		 * @param string $post_id       The post ID.
936 936
 		 * @param string $user_id       The user ID.
937 937
 		 */
938
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
938
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
939 939
 		/**
940 940
 		 * Filter the client email subject.
941 941
 		 *
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 		 * @param string $post_id       The post ID.
955 955
 		 * @param string $user_id       The user ID.
956 956
 		 */
957
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
957
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
958 958
 		/**
959 959
 		 * Filter the client email message.
960 960
 		 *
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 		 * @param string $post_id       The post ID.
974 974
 		 * @param string $user_id       The user ID.
975 975
 		 */
976
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
976
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
977 977
 		/**
978 978
 		 * Filter the client email headers.
979 979
 		 *
@@ -992,39 +992,39 @@  discard block
 block discarded – undo
992 992
 		 * @param string $post_id       The post ID.
993 993
 		 * @param string $user_id       The user ID.
994 994
 		 */
995
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
995
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
996 996
 
997
-		$sent = wp_mail( $to, $subject, $message, $headers );
997
+		$sent = wp_mail($to, $subject, $message, $headers);
998 998
 
999
-		if ( ! $sent ) {
1000
-			if ( is_array( $to ) ) {
1001
-				$to = implode( ',', $to );
999
+		if (!$sent) {
1000
+			if (is_array($to)) {
1001
+				$to = implode(',', $to);
1002 1002
 			}
1003 1003
 			$log_message = sprintf(
1004
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1004
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1005 1005
 				$message_type,
1006
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1006
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1007 1007
 				$to,
1008 1008
 				$subject
1009 1009
 			);
1010
-			geodir_error_log( $log_message );
1010
+			geodir_error_log($log_message);
1011 1011
 		}
1012 1012
 
1013 1013
 		///////// ADMIN BCC EMIALS
1014
-		$adminEmail = get_bloginfo( 'admin_email' );
1014
+		$adminEmail = get_bloginfo('admin_email');
1015 1015
 		$to         = $adminEmail;
1016 1016
 
1017 1017
 		$admin_bcc = false;
1018
-		if ( $message_type == 'registration' ) {
1019
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1020
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1021
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1018
+		if ($message_type == 'registration') {
1019
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1020
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1021
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1022 1022
 		}
1023
-		if ( $message_type == 'post_submit' ) {
1024
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1025
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1023
+		if ($message_type == 'post_submit') {
1024
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1025
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1026 1026
 
1027
-			$search_array  = array(
1027
+			$search_array = array(
1028 1028
 				'[#listing_link#]',
1029 1029
 				'[#site_name_url#]',
1030 1030
 				'[#post_id#]',
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 				$user_login,
1057 1057
 				$user_login
1058 1058
 			);
1059
-			$message       = str_replace( $search_array, $replace_array, $message );
1059
+			$message       = str_replace($search_array, $replace_array, $message);
1060 1060
 
1061 1061
 			$search_array  = array(
1062 1062
 				'[#listing_link#]',
@@ -1084,40 +1084,40 @@  discard block
 block discarded – undo
1084 1084
 				$user_login,
1085 1085
 				$user_login
1086 1086
 			);
1087
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1087
+			$subject = str_replace($search_array, $replace_array, $subject);
1088 1088
 
1089 1089
 			$subject .= ' - ADMIN BCC COPY';
1090 1090
 			$admin_bcc = true;
1091 1091
 
1092
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1092
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1093 1093
 			$subject .= ' - ADMIN BCC COPY';
1094 1094
 			$admin_bcc = true;
1095
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1095
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1096 1096
 			$subject .= ' - ADMIN BCC COPY';
1097 1097
 			$admin_bcc = true;
1098
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1098
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1099 1099
 			$subject .= ' - ADMIN BCC COPY';
1100 1100
 			$admin_bcc = true;
1101
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1101
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1102 1102
 			$subject .= ' - ADMIN BCC COPY';
1103 1103
 			$admin_bcc = true;
1104 1104
 		}
1105 1105
 
1106
-		if ( $admin_bcc === true ) {
1107
-			$sent = wp_mail( $to, $subject, $message, $headers );
1106
+		if ($admin_bcc === true) {
1107
+			$sent = wp_mail($to, $subject, $message, $headers);
1108 1108
 
1109
-			if ( ! $sent ) {
1110
-				if ( is_array( $to ) ) {
1111
-					$to = implode( ',', $to );
1109
+			if (!$sent) {
1110
+				if (is_array($to)) {
1111
+					$to = implode(',', $to);
1112 1112
 				}
1113 1113
 				$log_message = sprintf(
1114
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1114
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1115 1115
 					$message_type,
1116
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1116
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1117 1117
 					$to,
1118 1118
 					$subject
1119 1119
 				);
1120
-				geodir_error_log( $log_message );
1120
+				geodir_error_log($log_message);
1121 1121
 			}
1122 1122
 		}
1123 1123
 
@@ -1133,52 +1133,52 @@  discard block
 block discarded – undo
1133 1133
  */
1134 1134
 function geodir_taxonomy_breadcrumb() {
1135 1135
 
1136
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1136
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1137 1137
 	$parent = $term->parent;
1138 1138
 
1139
-	while ( $parent ):
1139
+	while ($parent):
1140 1140
 		$parents[]  = $parent;
1141
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1141
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1142 1142
 		$parent     = $new_parent->parent;
1143 1143
 	endwhile;
1144 1144
 
1145
-	if ( ! empty( $parents ) ):
1146
-		$parents = array_reverse( $parents );
1145
+	if (!empty($parents)):
1146
+		$parents = array_reverse($parents);
1147 1147
 
1148
-		foreach ( $parents as $parent ):
1149
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1150
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1151
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1148
+		foreach ($parents as $parent):
1149
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1150
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1151
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1152 1152
 		endforeach;
1153 1153
 
1154 1154
 	endif;
1155 1155
 
1156
-	echo '<li> > ' . $term->name . '</li>';
1156
+	echo '<li> > '.$term->name.'</li>';
1157 1157
 }
1158 1158
 
1159
-function geodir_wpml_post_type_archive_link($link, $post_type){
1159
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1160 1160
 
1161
-	if(function_exists('icl_object_id')) {
1162
-		$post_types   = get_option( 'geodir_post_types' );
1163
-		$slug         = $post_types[ $post_type ]['rewrite']['slug'];
1161
+	if (function_exists('icl_object_id')) {
1162
+		$post_types   = get_option('geodir_post_types');
1163
+		$slug         = $post_types[$post_type]['rewrite']['slug'];
1164 1164
 
1165 1165
 		//echo $link.'###'.gd_wpml_get_lang_from_url( $link) ;
1166 1166
 
1167 1167
 		// Alter the CPT slug if WPML is set to do so
1168
-		if ( function_exists( 'icl_object_id' ) ) {
1169
-			if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1168
+		if (function_exists('icl_object_id')) {
1169
+			if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1170 1170
 
1171 1171
 				$org_slug = $slug;
1172
-				$slug     = apply_filters( 'wpml_translate_single_string',
1172
+				$slug     = apply_filters('wpml_translate_single_string',
1173 1173
 					$slug,
1174 1174
 					'WordPress',
1175
-					'URL slug: ' . $slug,
1176
-					$language_code );
1175
+					'URL slug: '.$slug,
1176
+					$language_code);
1177 1177
 
1178
-				if ( ! $slug ) {
1178
+				if (!$slug) {
1179 1179
 					$slug = $org_slug;
1180 1180
 				} else {
1181
-					$link = str_replace( $org_slug, $slug, $link );
1181
+					$link = str_replace($org_slug, $slug, $link);
1182 1182
 				}
1183 1183
 
1184 1184
 			}
@@ -1209,9 +1209,9 @@  discard block
 block discarded – undo
1209 1209
 	 *
1210 1210
 	 * @since 1.0.0
1211 1211
 	 */
1212
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1212
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1213 1213
 
1214
-	if ( ! geodir_is_page( 'home' ) ) {
1214
+	if (!geodir_is_page('home')) {
1215 1215
 		$breadcrumb    = '';
1216 1216
 		$url_categoris = '';
1217 1217
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1220,162 +1220,162 @@  discard block
 block discarded – undo
1220 1220
 		 *
1221 1221
 		 * @since 1.0.0
1222 1222
 		 */
1223
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1223
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1224 1224
 
1225 1225
 		$gd_post_type   = geodir_get_current_posttype();
1226
-		$post_type_info = get_post_type_object( $gd_post_type );
1226
+		$post_type_info = get_post_type_object($gd_post_type);
1227 1227
 
1228
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1228
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1229 1229
 
1230
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1230
+		$listing_link = get_post_type_archive_link($gd_post_type);
1231 1231
 
1232
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1233
-		$listing_link = rtrim( $listing_link, '/' );
1232
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1233
+		$listing_link = rtrim($listing_link, '/');
1234 1234
 		$listing_link .= '/';
1235 1235
 
1236 1236
 		$post_type_for_location_link = $listing_link;
1237
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1237
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1238 1238
 
1239 1239
 		global $wp, $gd_session;
1240 1240
 		$location_link = $post_type_for_location_link;
1241 1241
 
1242
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1242
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1243 1243
 			global $post;
1244
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1245
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1244
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1245
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1246 1246
 
1247
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1247
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1248 1248
 				$location_terms = array(
1249 1249
 					'gd_country' => $post->country_slug,
1250 1250
 					'gd_region'  => $post->region_slug,
1251 1251
 					'gd_city'    => $post->city_slug
1252 1252
 				);
1253 1253
 
1254
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1254
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1255 1255
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1256 1256
 				}
1257 1257
 			}
1258 1258
 
1259
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1259
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1260 1260
 
1261 1261
 			$hide_url_part = array();
1262
-			if ( $location_manager ) {
1263
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1264
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1265
-
1266
-				if ( $hide_region_part && $hide_country_part ) {
1267
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1268
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1269
-					$hide_url_part = array( 'gd_region' );
1270
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1271
-					$hide_url_part = array( 'gd_country' );
1262
+			if ($location_manager) {
1263
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1264
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1265
+
1266
+				if ($hide_region_part && $hide_country_part) {
1267
+					$hide_url_part = array('gd_country', 'gd_region');
1268
+				} else if ($hide_region_part && !$hide_country_part) {
1269
+					$hide_url_part = array('gd_region');
1270
+				} else if (!$hide_region_part && $hide_country_part) {
1271
+					$hide_url_part = array('gd_country');
1272 1272
 				}
1273 1273
 			}
1274 1274
 
1275 1275
 			$hide_text_part = array();
1276
-			if ( $geodir_show_location_url == 'country_city' ) {
1277
-				$hide_text_part = array( 'gd_region' );
1276
+			if ($geodir_show_location_url == 'country_city') {
1277
+				$hide_text_part = array('gd_region');
1278 1278
 
1279
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1280
-					unset( $location_terms['gd_region'] );
1279
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1280
+					unset($location_terms['gd_region']);
1281 1281
 				}
1282
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1283
-				$hide_text_part = array( 'gd_country' );
1282
+			} else if ($geodir_show_location_url == 'region_city') {
1283
+				$hide_text_part = array('gd_country');
1284 1284
 
1285
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1286
-					unset( $location_terms['gd_country'] );
1285
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1286
+					unset($location_terms['gd_country']);
1287 1287
 				}
1288
-			} else if ( $geodir_show_location_url == 'city' ) {
1289
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1288
+			} else if ($geodir_show_location_url == 'city') {
1289
+				$hide_text_part = array('gd_country', 'gd_region');
1290 1290
 
1291
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1292
-					unset( $location_terms['gd_country'] );
1291
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1292
+					unset($location_terms['gd_country']);
1293 1293
 				}
1294
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1295
-					unset( $location_terms['gd_region'] );
1294
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1295
+					unset($location_terms['gd_region']);
1296 1296
 				}
1297 1297
 			}
1298 1298
 
1299 1299
 			$is_location_last = '';
1300 1300
 			$is_taxonomy_last = '';
1301 1301
 			$breadcrumb .= '<li>';
1302
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1303
-				$gd_taxonomy = $gd_post_type . 'category';
1304
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1305
-				$gd_taxonomy = $gd_post_type . '_tags';
1302
+			if (get_query_var($gd_post_type.'category')) {
1303
+				$gd_taxonomy = $gd_post_type.'category';
1304
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1305
+				$gd_taxonomy = $gd_post_type.'_tags';
1306 1306
 			}
1307 1307
 
1308
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1309
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1308
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1309
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1310 1310
 				$is_location_last = false;
1311 1311
 			} else {
1312 1312
 				$is_location_last = true;
1313 1313
 			}
1314 1314
 
1315
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1315
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1316 1316
 				$is_taxonomy_last = true;
1317 1317
 			} else {
1318 1318
 				$is_taxonomy_last = false;
1319 1319
 			}
1320 1320
 
1321
-			if ( ! empty( $location_terms ) ) {
1322
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1321
+			if (!empty($location_terms)) {
1322
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1323 1323
 
1324
-				foreach ( $location_terms as $key => $location_term ) {
1325
-					if ( $location_term != '' ) {
1326
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1324
+				foreach ($location_terms as $key => $location_term) {
1325
+					if ($location_term != '') {
1326
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1327 1327
 							continue;
1328 1328
 						}
1329 1329
 
1330
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1331
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1332
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1330
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1331
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1332
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1333 1333
 
1334 1334
 						$location_term_actual_country = '';
1335 1335
 						$location_term_actual_region  = '';
1336 1336
 						$location_term_actual_city    = '';
1337
-						if ( $geodir_get_locations ) {
1338
-							if ( $key == 'gd_country' ) {
1339
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1340
-							} else if ( $key == 'gd_region' ) {
1341
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1342
-							} else if ( $key == 'gd_city' ) {
1343
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1337
+						if ($geodir_get_locations) {
1338
+							if ($key == 'gd_country') {
1339
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1340
+							} else if ($key == 'gd_region') {
1341
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1342
+							} else if ($key == 'gd_city') {
1343
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1344 1344
 							}
1345 1345
 						} else {
1346 1346
 							$location_info = geodir_get_location();
1347 1347
 
1348
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1349
-								if ( $key == 'gd_country' ) {
1350
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1351
-								} else if ( $key == 'gd_region' ) {
1352
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1353
-								} else if ( $key == 'gd_city' ) {
1354
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1348
+							if (!empty($location_info) && isset($location_info->location_id)) {
1349
+								if ($key == 'gd_country') {
1350
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1351
+								} else if ($key == 'gd_region') {
1352
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1353
+								} else if ($key == 'gd_city') {
1354
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1355 1355
 								}
1356 1356
 							}
1357 1357
 						}
1358 1358
 
1359
-						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'] != '' ) ) {
1360
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1361
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1362
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1363
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1364
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1365
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1366
-							$breadcrumb .= $separator . $gd_location_link_text;
1359
+						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'] != '')) {
1360
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1361
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1362
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1363
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1364
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1365
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1366
+							$breadcrumb .= $separator.$gd_location_link_text;
1367 1367
 						} else {
1368
-							if ( get_option( 'permalink_structure' ) != '' ) {
1369
-								$location_link .= $location_term . '/';
1368
+							if (get_option('permalink_structure') != '') {
1369
+								$location_link .= $location_term.'/';
1370 1370
 							} else {
1371
-								$location_link .= "&$key=" . $location_term;
1371
+								$location_link .= "&$key=".$location_term;
1372 1372
 							}
1373 1373
 
1374
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1374
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1375 1375
 								$gd_location_link_text = $location_term_actual_country;
1376
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1376
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1377 1377
 								$gd_location_link_text = $location_term_actual_region;
1378
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1378
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1379 1379
 								$gd_location_link_text = $location_term_actual_city;
1380 1380
 							}
1381 1381
 
@@ -1385,76 +1385,76 @@  discard block
 block discarded – undo
1385 1385
                             }
1386 1386
                             */
1387 1387
 
1388
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1388
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1389 1389
 						}
1390 1390
 					}
1391 1391
 				}
1392 1392
 			}
1393 1393
 
1394
-			if ( ! empty( $gd_taxonomy ) ) {
1394
+			if (!empty($gd_taxonomy)) {
1395 1395
 				$term_index = 1;
1396 1396
 
1397 1397
 				//if(get_option('geodir_add_categories_url'))
1398 1398
 				{
1399
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1400
-						$cat_link = $listing_link . 'tags/';
1399
+					if (get_query_var($gd_post_type.'_tags')) {
1400
+						$cat_link = $listing_link.'tags/';
1401 1401
 					} else {
1402 1402
 						$cat_link = $listing_link;
1403 1403
 					}
1404 1404
 
1405
-					foreach ( $location_terms as $key => $location_term ) {
1406
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1405
+					foreach ($location_terms as $key => $location_term) {
1406
+						if ($location_manager && in_array($key, $hide_url_part)) {
1407 1407
 							continue;
1408 1408
 						}
1409 1409
 
1410
-						if ( $location_term != '' ) {
1411
-							if ( get_option( 'permalink_structure' ) != '' ) {
1412
-								$cat_link .= $location_term . '/';
1410
+						if ($location_term != '') {
1411
+							if (get_option('permalink_structure') != '') {
1412
+								$cat_link .= $location_term.'/';
1413 1413
 							}
1414 1414
 						}
1415 1415
 					}
1416 1416
 
1417
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1418
-					foreach ( $term_array as $term ) {
1419
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1420
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1417
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1418
+					foreach ($term_array as $term) {
1419
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1420
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1421 1421
 
1422 1422
 						// get term actual name
1423
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1424
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1425
-							$term_link_text = urldecode( $term_info['name'] );
1423
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1424
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1425
+							$term_link_text = urldecode($term_info['name']);
1426 1426
 						} else {
1427 1427
 							continue;
1428 1428
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1429 1429
 						}
1430 1430
 
1431
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1432
-							$breadcrumb .= $separator . $term_link_text;
1431
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1432
+							$breadcrumb .= $separator.$term_link_text;
1433 1433
 						} else {
1434
-							$cat_link .= $term . '/';
1435
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1434
+							$cat_link .= $term.'/';
1435
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1436 1436
 						}
1437
-						$term_index ++;
1437
+						$term_index++;
1438 1438
 					}
1439 1439
 				}
1440 1440
 
1441 1441
 
1442 1442
 			}
1443 1443
 
1444
-			if ( geodir_is_page( 'detail' ) ) {
1445
-				$breadcrumb .= $separator . get_the_title();
1444
+			if (geodir_is_page('detail')) {
1445
+				$breadcrumb .= $separator.get_the_title();
1446 1446
 			}
1447 1447
 
1448 1448
 			$breadcrumb .= '</li>';
1449 1449
 
1450 1450
 
1451
-		} elseif ( geodir_is_page( 'author' ) ) {
1451
+		} elseif (geodir_is_page('author')) {
1452 1452
 			$user_id             = get_current_user_id();
1453
-			$author_link         = get_author_posts_url( $user_id );
1454
-			$default_author_link = geodir_getlink( $author_link, array(
1453
+			$author_link         = get_author_posts_url($user_id);
1454
+			$default_author_link = geodir_getlink($author_link, array(
1455 1455
 				'geodir_dashbord' => 'true',
1456 1456
 				'stype'           => 'gd_place'
1457
-			), false );
1457
+			), false);
1458 1458
 
1459 1459
 			/**
1460 1460
 			 * Filter author page link.
@@ -1464,16 +1464,16 @@  discard block
 block discarded – undo
1464 1464
 			 * @param string $default_author_link Default author link.
1465 1465
 			 * @param int $user_id                Author ID.
1466 1466
 			 */
1467
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1467
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1468 1468
 
1469 1469
 			$breadcrumb .= '<li>';
1470
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1470
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1471 1471
 
1472
-			if ( isset( $_REQUEST['list'] ) ) {
1473
-				$author_link = geodir_getlink( $author_link, array(
1472
+			if (isset($_REQUEST['list'])) {
1473
+				$author_link = geodir_getlink($author_link, array(
1474 1474
 					'geodir_dashbord' => 'true',
1475 1475
 					'stype'           => $_REQUEST['stype']
1476
-				), false );
1476
+				), false);
1477 1477
 
1478 1478
 				/**
1479 1479
 				 * Filter author page link.
@@ -1484,61 +1484,61 @@  discard block
 block discarded – undo
1484 1484
 				 * @param int $user_id        Author ID.
1485 1485
 				 * @param string $_REQUEST    ['stype'] Post type.
1486 1486
 				 */
1487
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1487
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1488 1488
 
1489
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1490
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1489
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1490
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1491 1491
 			} else {
1492
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1492
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1493 1493
 			}
1494 1494
 
1495 1495
 			$breadcrumb .= '</li>';
1496
-		} elseif ( is_category() || is_single() ) {
1496
+		} elseif (is_category() || is_single()) {
1497 1497
 			$category = get_the_category();
1498
-			if ( is_category() ) {
1499
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1498
+			if (is_category()) {
1499
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1500 1500
 			}
1501
-			if ( is_single() ) {
1502
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1503
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1501
+			if (is_single()) {
1502
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1503
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1504 1504
 			}
1505 1505
 			/* End of my version ##################################################### */
1506
-		} else if ( is_page() ) {
1506
+		} else if (is_page()) {
1507 1507
 			$page_title = get_the_title();
1508 1508
 
1509
-			if ( geodir_is_page( 'location' ) ) {
1509
+			if (geodir_is_page('location')) {
1510 1510
 				$location_page_id = geodir_location_page_id();
1511
-				$loc_post         = get_post( $location_page_id );
1511
+				$loc_post         = get_post($location_page_id);
1512 1512
 				$post_name        = $loc_post->post_name;
1513
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1514
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1513
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1514
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1515 1515
 			}
1516 1516
 
1517
-			$breadcrumb .= '<li>' . $separator;
1518
-			$breadcrumb .= stripslashes_deep( $page_title );
1517
+			$breadcrumb .= '<li>'.$separator;
1518
+			$breadcrumb .= stripslashes_deep($page_title);
1519 1519
 			$breadcrumb .= '</li>';
1520
-		} else if ( is_tag() ) {
1521
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1522
-		} else if ( is_day() ) {
1523
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1524
-			the_time( 'F jS, Y' );
1520
+		} else if (is_tag()) {
1521
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1522
+		} else if (is_day()) {
1523
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1524
+			the_time('F jS, Y');
1525 1525
 			$breadcrumb .= '</li>';
1526
-		} else if ( is_month() ) {
1527
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1528
-			the_time( 'F, Y' );
1526
+		} else if (is_month()) {
1527
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1528
+			the_time('F, Y');
1529 1529
 			$breadcrumb .= '</li>';
1530
-		} else if ( is_year() ) {
1531
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1532
-			the_time( 'Y' );
1530
+		} else if (is_year()) {
1531
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1532
+			the_time('Y');
1533 1533
 			$breadcrumb .= '</li>';
1534
-		} else if ( is_author() ) {
1535
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1534
+		} else if (is_author()) {
1535
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1536 1536
 			$breadcrumb .= '</li>';
1537
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1538
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1537
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1538
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1539 1539
 			$breadcrumb .= '</li>';
1540
-		} else if ( is_search() ) {
1541
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1540
+		} else if (is_search()) {
1541
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1542 1542
 			$breadcrumb .= '</li>';
1543 1543
 		}
1544 1544
 		$breadcrumb .= '</ul></div>';
@@ -1551,13 +1551,13 @@  discard block
 block discarded – undo
1551 1551
 		 * @param string $breadcrumb Breadcrumb HTML.
1552 1552
 		 * @param string $separator  Breadcrumb separator.
1553 1553
 		 */
1554
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1554
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1555 1555
 	}
1556 1556
 }
1557 1557
 
1558 1558
 
1559
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1560
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1559
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1560
+if (!function_exists('geodir_allow_wpadmin')) {
1561 1561
 	/**
1562 1562
 	 * Allow only admins to access wp-admin.
1563 1563
 	 *
@@ -1569,12 +1569,12 @@  discard block
 block discarded – undo
1569 1569
 	 */
1570 1570
 	function geodir_allow_wpadmin() {
1571 1571
 		global $wpdb;
1572
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1572
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1573 1573
 		{
1574
-			if ( current_user_can( 'administrator' ) ) {
1574
+			if (current_user_can('administrator')) {
1575 1575
 			} else {
1576 1576
 
1577
-				wp_redirect( home_url() );
1577
+				wp_redirect(home_url());
1578 1578
 				exit;
1579 1579
 			}
1580 1580
 
@@ -1593,23 +1593,23 @@  discard block
 block discarded – undo
1593 1593
  *
1594 1594
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1595 1595
  */
1596
-function fetch_remote_file( $url ) {
1596
+function fetch_remote_file($url) {
1597 1597
 	// extract the file name and extension from the url
1598
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1599
-	$file_name = basename( $url );
1600
-	if ( strpos( $file_name, '?' ) !== false ) {
1601
-		list( $file_name ) = explode( '?', $file_name );
1598
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1599
+	$file_name = basename($url);
1600
+	if (strpos($file_name, '?') !== false) {
1601
+		list($file_name) = explode('?', $file_name);
1602 1602
 	}
1603 1603
 	$dummy        = false;
1604 1604
 	$add_to_cache = false;
1605 1605
 	$key          = null;
1606
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1606
+	if (strpos($url, '/dummy/') !== false) {
1607 1607
 		$dummy = true;
1608
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1609
-		$value = get_transient( 'cached_dummy_images' );
1610
-		if ( $value ) {
1611
-			if ( isset( $value[ $key ] ) ) {
1612
-				return $value[ $key ];
1608
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1609
+		$value = get_transient('cached_dummy_images');
1610
+		if ($value) {
1611
+			if (isset($value[$key])) {
1612
+				return $value[$key];
1613 1613
 			} else {
1614 1614
 				$add_to_cache = true;
1615 1615
 			}
@@ -1620,58 +1620,58 @@  discard block
 block discarded – undo
1620 1620
 
1621 1621
 	// get placeholder file in the upload dir with a unique, sanitized filename
1622 1622
 
1623
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1623
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1624 1624
 
1625
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1626
-	if ( $upload['error'] ) {
1627
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1625
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1626
+	if ($upload['error']) {
1627
+		return new WP_Error('upload_dir_error', $upload['error']);
1628 1628
 	}
1629 1629
 
1630 1630
 
1631
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1631
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1632 1632
 
1633 1633
 	// fetch the remote url and write it to the placeholder file
1634
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1634
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1635 1635
 
1636 1636
 	$log_message = '';
1637
-	if ( is_wp_error( $headers ) ) {
1638
-		echo 'file: ' . $url;
1637
+	if (is_wp_error($headers)) {
1638
+		echo 'file: '.$url;
1639 1639
 
1640
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1640
+		return new WP_Error('import_file_error', $headers->get_error_message());
1641 1641
 	}
1642 1642
 
1643
-	$filesize = filesize( $upload['file'] );
1643
+	$filesize = filesize($upload['file']);
1644 1644
 	// request failed
1645
-	if ( ! $headers ) {
1646
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1645
+	if (!$headers) {
1646
+		$log_message = __('Remote server did not respond', 'geodirectory');
1647 1647
 	} // make sure the fetch was successful
1648
-	elseif ( $headers['response']['code'] != '200' ) {
1649
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1650
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1651
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1652
-	} elseif ( 0 == $filesize ) {
1653
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1654
-	}
1655
-
1656
-	if ( $log_message ) {
1657
-		$del = unlink( $upload['file'] );
1658
-		if ( ! $del ) {
1659
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1648
+	elseif ($headers['response']['code'] != '200') {
1649
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1650
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1651
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1652
+	} elseif (0 == $filesize) {
1653
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1654
+	}
1655
+
1656
+	if ($log_message) {
1657
+		$del = unlink($upload['file']);
1658
+		if (!$del) {
1659
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1660 1660
 		}
1661 1661
 
1662
-		return new WP_Error( 'import_file_error', $log_message );
1662
+		return new WP_Error('import_file_error', $log_message);
1663 1663
 	}
1664 1664
 
1665
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1666
-		$images = get_transient( 'cached_dummy_images' );
1667
-		if ( is_array( $images ) ) {
1668
-			$images[ $key ] = $upload;
1665
+	if ($dummy && $add_to_cache && is_array($upload)) {
1666
+		$images = get_transient('cached_dummy_images');
1667
+		if (is_array($images)) {
1668
+			$images[$key] = $upload;
1669 1669
 		} else {
1670
-			$images = array( $key => $upload );
1670
+			$images = array($key => $upload);
1671 1671
 		}
1672 1672
 
1673 1673
 		//setting the cache using the WP Transient API
1674
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1674
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1675 1675
 	}
1676 1676
 
1677 1677
 	return $upload;
@@ -1685,12 +1685,12 @@  discard block
 block discarded – undo
1685 1685
  * @return string|void Max upload size.
1686 1686
  */
1687 1687
 function geodir_max_upload_size() {
1688
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1688
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1689 1689
 
1690
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1691
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1690
+	if ($max_filesize > 0 && $max_filesize < 1) {
1691
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1692 1692
 	} else {
1693
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1693
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1694 1694
 	}
1695 1695
 
1696 1696
 	/**
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
 	 *
1701 1701
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1702 1702
 	 */
1703
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1703
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1704 1704
 }
1705 1705
 
1706 1706
 /**
@@ -1713,8 +1713,8 @@  discard block
 block discarded – undo
1713 1713
  * @return bool If dummy folder exists returns true, else false.
1714 1714
  */
1715 1715
 function geodir_dummy_folder_exists() {
1716
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1717
-	if ( ! is_dir( $path ) ) {
1716
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1717
+	if (!is_dir($path)) {
1718 1718
 		return false;
1719 1719
 	} else {
1720 1720
 		return true;
@@ -1733,17 +1733,17 @@  discard block
 block discarded – undo
1733 1733
  *
1734 1734
  * @return object Author info.
1735 1735
  */
1736
-function geodir_get_author_info( $aid ) {
1736
+function geodir_get_author_info($aid) {
1737 1737
 	global $wpdb;
1738 1738
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1739
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1740
-	$info    = $wpdb->get_results( $infosql );
1741
-	if ( $info ) {
1739
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1740
+	$info    = $wpdb->get_results($infosql);
1741
+	if ($info) {
1742 1742
 		return $info[0];
1743 1743
 	}
1744 1744
 }
1745 1745
 
1746
-if ( ! function_exists( 'adminEmail' ) ) {
1746
+if (!function_exists('adminEmail')) {
1747 1747
 	/**
1748 1748
 	 * Send emails to client on post submission, renew etc.
1749 1749
 	 *
@@ -1756,67 +1756,67 @@  discard block
 block discarded – undo
1756 1756
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1757 1757
 	 * @param string $custom_1     Custom data to be sent.
1758 1758
 	 */
1759
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1759
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1760 1760
 		global $wpdb;
1761
-		if ( $message_type == 'expiration' ) {
1762
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1763
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1764
-		} elseif ( $message_type == 'post_submited' ) {
1765
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1766
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1767
-		} elseif ( $message_type == 'renew' ) {
1768
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1769
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1770
-		} elseif ( $message_type == 'upgrade' ) {
1771
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1772
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1773
-		} elseif ( $message_type == 'claim_approved' ) {
1774
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1775
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1776
-		} elseif ( $message_type == 'claim_rejected' ) {
1777
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1778
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1779
-		} elseif ( $message_type == 'claim_requested' ) {
1780
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1781
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1782
-		} elseif ( $message_type == 'auto_claim' ) {
1783
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1784
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1785
-		} elseif ( $message_type == 'payment_success' ) {
1786
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1787
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1788
-		} elseif ( $message_type == 'payment_fail' ) {
1789
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1790
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1761
+		if ($message_type == 'expiration') {
1762
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1763
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1764
+		} elseif ($message_type == 'post_submited') {
1765
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1766
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1767
+		} elseif ($message_type == 'renew') {
1768
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1769
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1770
+		} elseif ($message_type == 'upgrade') {
1771
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1772
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1773
+		} elseif ($message_type == 'claim_approved') {
1774
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1775
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1776
+		} elseif ($message_type == 'claim_rejected') {
1777
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1778
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1779
+		} elseif ($message_type == 'claim_requested') {
1780
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1781
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1782
+		} elseif ($message_type == 'auto_claim') {
1783
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1784
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1785
+		} elseif ($message_type == 'payment_success') {
1786
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1787
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1788
+		} elseif ($message_type == 'payment_fail') {
1789
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1790
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1791 1791
 		}
1792 1792
 		$transaction_details = $custom_1;
1793
-		$fromEmail           = get_option( 'site_email' );
1793
+		$fromEmail           = get_option('site_email');
1794 1794
 		$fromEmailName       = get_site_emailName();
1795 1795
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1796
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1796
+		$pkg_limit            = get_property_price_info_listing($page_id);
1797 1797
 		$alivedays            = $pkg_limit['days'];
1798
-		$productlink          = get_permalink( $page_id );
1799
-		$post_info            = get_post( $page_id );
1800
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1801
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1798
+		$productlink          = get_permalink($page_id);
1799
+		$post_info            = get_post($page_id);
1800
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1801
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1802 1802
 		$loginurl             = geodir_login_url();
1803
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1803
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1804 1804
 		$siteurl              = home_url();
1805
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1806
-		$user_info            = get_userdata( $user_id );
1805
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1806
+		$user_info            = get_userdata($user_id);
1807 1807
 		$user_email           = $user_info->user_email;
1808
-		$display_name         = geodir_get_client_name( $user_id );
1808
+		$display_name         = geodir_get_client_name($user_id);
1809 1809
 		$user_login           = $user_info->user_login;
1810
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1811
-		if ( $number_of_grace_days == '' ) {
1810
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1811
+		if ($number_of_grace_days == '') {
1812 1812
 			$number_of_grace_days = 1;
1813 1813
 		}
1814
-		if ( $post_info->post_type == 'event' ) {
1814
+		if ($post_info->post_type == 'event') {
1815 1815
 			$post_type = 'event';
1816 1816
 		} else {
1817 1817
 			$post_type = 'listing';
1818 1818
 		}
1819
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1819
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1820 1820
 		$search_array   = array(
1821 1821
 			'[#client_name#]',
1822 1822
 			'[#listing_link#]',
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
 			'[#site_name#]',
1833 1833
 			'[#transaction_details#]'
1834 1834
 		);
1835
-		$replace_array  = array(
1835
+		$replace_array = array(
1836 1836
 			$display_name,
1837 1837
 			$listingLink,
1838 1838
 			$post_date,
@@ -1847,11 +1847,11 @@  discard block
 block discarded – undo
1847 1847
 			$fromEmailName,
1848 1848
 			$transaction_details
1849 1849
 		);
1850
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1851
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1852
-		$headers        = 'MIME-Version: 1.0' . "\r\n";
1853
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1854
-		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1850
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1851
+		$subject        = str_replace($search_array, $replace_array, $subject);
1852
+		$headers        = 'MIME-Version: 1.0'."\r\n";
1853
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1854
+		$headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1855 1855
 
1856 1856
 		$to      = $fromEmail;
1857 1857
 		$message = $client_message;
@@ -1869,7 +1869,7 @@  discard block
 block discarded – undo
1869 1869
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1870 1870
 		 * @param string $custom_1     Custom data to be sent.
1871 1871
 		 */
1872
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1872
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1873 1873
 		/**
1874 1874
 		 * Filter the admin email subject.
1875 1875
 		 *
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1883 1883
 		 * @param string $custom_1     Custom data to be sent.
1884 1884
 		 */
1885
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1885
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1886 1886
 		/**
1887 1887
 		 * Filter the admin email message.
1888 1888
 		 *
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1896 1896
 		 * @param string $custom_1     Custom data to be sent.
1897 1897
 		 */
1898
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1898
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1899 1899
 		/**
1900 1900
 		 * Filter the admin email headers.
1901 1901
 		 *
@@ -1908,22 +1908,22 @@  discard block
 block discarded – undo
1908 1908
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1909 1909
 		 * @param string $custom_1     Custom data to be sent.
1910 1910
 		 */
1911
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1911
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1912 1912
 
1913 1913
 
1914
-		$sent = wp_mail( $to, $subject, $message, $headers );
1915
-		if ( ! $sent ) {
1916
-			if ( is_array( $to ) ) {
1917
-				$to = implode( ',', $to );
1914
+		$sent = wp_mail($to, $subject, $message, $headers);
1915
+		if (!$sent) {
1916
+			if (is_array($to)) {
1917
+				$to = implode(',', $to);
1918 1918
 			}
1919 1919
 			$log_message = sprintf(
1920
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1920
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1921 1921
 				$message_type,
1922
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1922
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1923 1923
 				$to,
1924 1924
 				$subject
1925 1925
 			);
1926
-			geodir_error_log( $log_message );
1926
+			geodir_error_log($log_message);
1927 1927
 		}
1928 1928
 	}
1929 1929
 }
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
  *
1944 1944
  * @return array Category IDs.
1945 1945
  */
1946
-function gd_lang_object_ids( $ids_array, $type ) {
1947
-	if ( function_exists( 'icl_object_id' ) ) {
1946
+function gd_lang_object_ids($ids_array, $type) {
1947
+	if (function_exists('icl_object_id')) {
1948 1948
 		$res = array();
1949
-		foreach ( $ids_array as $id ) {
1950
-			$xlat = icl_object_id( $id, $type, false );
1951
-			if ( ! is_null( $xlat ) ) {
1949
+		foreach ($ids_array as $id) {
1950
+			$xlat = icl_object_id($id, $type, false);
1951
+			if (!is_null($xlat)) {
1952 1952
 				$res[] = $xlat;
1953 1953
 			}
1954 1954
 		}
@@ -1972,20 +1972,20 @@  discard block
 block discarded – undo
1972 1972
  *
1973 1973
  * @return array Modified Body CSS classes.
1974 1974
  */
1975
-function geodir_custom_posts_body_class( $classes ) {
1975
+function geodir_custom_posts_body_class($classes) {
1976 1976
 	global $wpdb, $wp;
1977
-	$post_types = geodir_get_posttypes( 'object' );
1978
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
1977
+	$post_types = geodir_get_posttypes('object');
1978
+	if (!empty($post_types) && count((array) $post_types) > 1) {
1979 1979
 		$classes[] = 'geodir_custom_posts';
1980 1980
 	}
1981 1981
 
1982 1982
 	// fix body class for signup page
1983
-	if ( geodir_is_page( 'login' ) ) {
1983
+	if (geodir_is_page('login')) {
1984 1984
 		$new_classes   = array();
1985 1985
 		$new_classes[] = 'signup page-geodir-signup';
1986
-		if ( ! empty( $classes ) ) {
1987
-			foreach ( $classes as $class ) {
1988
-				if ( $class && $class != 'home' && $class != 'blog' ) {
1986
+		if (!empty($classes)) {
1987
+			foreach ($classes as $class) {
1988
+				if ($class && $class != 'home' && $class != 'blog') {
1989 1989
 					$new_classes[] = $class;
1990 1990
 				}
1991 1991
 			}
@@ -1993,14 +1993,14 @@  discard block
 block discarded – undo
1993 1993
 		$classes = $new_classes;
1994 1994
 	}
1995 1995
 
1996
-	if ( geodir_is_geodir_page() ) {
1996
+	if (geodir_is_geodir_page()) {
1997 1997
 		$classes[] = 'geodir-page';
1998 1998
 	}
1999 1999
 
2000 2000
 	return $classes;
2001 2001
 }
2002 2002
 
2003
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2003
+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
2004 2004
 
2005 2005
 
2006 2006
 /**
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
 	 *
2017 2017
 	 * @since 1.0.0
2018 2018
 	 */
2019
-	return apply_filters( 'geodir_map_zoom_level', array(
2019
+	return apply_filters('geodir_map_zoom_level', array(
2020 2020
 		1,
2021 2021
 		2,
2022 2022
 		3,
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 		17,
2037 2037
 		18,
2038 2038
 		19
2039
-	) );
2039
+	));
2040 2040
 
2041 2041
 }
2042 2042
 
@@ -2049,12 +2049,12 @@  discard block
 block discarded – undo
2049 2049
  *
2050 2050
  * @param string $geodir_option_name Option key.
2051 2051
  */
2052
-function geodir_option_version_backup( $geodir_option_name ) {
2052
+function geodir_option_version_backup($geodir_option_name) {
2053 2053
 	$version_date  = time();
2054
-	$geodir_option = get_option( $geodir_option_name );
2054
+	$geodir_option = get_option($geodir_option_name);
2055 2055
 
2056
-	if ( ! empty( $geodir_option ) ) {
2057
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2056
+	if (!empty($geodir_option)) {
2057
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2058 2058
 	}
2059 2059
 }
2060 2060
 
@@ -2068,10 +2068,10 @@  discard block
 block discarded – undo
2068 2068
  *
2069 2069
  * @return int Page ID.
2070 2070
  */
2071
-function get_page_id_geodir_add_listing_page( $page_id ) {
2072
-	if ( geodir_wpml_multilingual_status() ) {
2071
+function get_page_id_geodir_add_listing_page($page_id) {
2072
+	if (geodir_wpml_multilingual_status()) {
2073 2073
 		$post_type = 'post_page';
2074
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2074
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2075 2075
 	}
2076 2076
 
2077 2077
 	return $page_id;
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2086 2086
  */
2087 2087
 function geodir_wpml_multilingual_status() {
2088
-	if ( function_exists( 'icl_object_id' ) ) {
2088
+	if (function_exists('icl_object_id')) {
2089 2089
 		return true;
2090 2090
 	}
2091 2091
 
@@ -2103,19 +2103,19 @@  discard block
 block discarded – undo
2103 2103
  *
2104 2104
  * @return int Element ID when exists. Else the page id.
2105 2105
  */
2106
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2106
+function geodir_get_wpml_element_id($page_id, $post_type) {
2107 2107
 	global $sitepress;
2108
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2109
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2108
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2109
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2110 2110
 
2111
-		if ( $trid > 0 ) {
2112
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2111
+		if ($trid > 0) {
2112
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2113 2113
 
2114 2114
 			$lang = $sitepress->get_current_language();
2115 2115
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2116 2116
 
2117
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2118
-				$page_id = $translations[ $lang ]->element_id;
2117
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2118
+				$page_id = $translations[$lang]->element_id;
2119 2119
 			}
2120 2120
 		}
2121 2121
 	}
@@ -2132,15 +2132,15 @@  discard block
 block discarded – undo
2132 2132
  */
2133 2133
 function geodir_wpml_check_element_id() {
2134 2134
 	global $sitepress;
2135
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2135
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2136 2136
 		$el_type      = 'post_page';
2137
-		$el_id        = get_option( 'geodir_add_listing_page' );
2137
+		$el_id        = get_option('geodir_add_listing_page');
2138 2138
 		$default_lang = $sitepress->get_default_language();
2139
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2139
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2140 2140
 
2141
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2142
-			if ( ! $el_details->source_language_code ) {
2143
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2141
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2142
+			if (!$el_details->source_language_code) {
2143
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2144 2144
 				$sitepress->icl_translations_cache->clear();
2145 2145
 			}
2146 2146
 		}
@@ -2159,41 +2159,41 @@  discard block
 block discarded – undo
2159 2159
  *
2160 2160
  * @return string Orderby SQL.
2161 2161
  */
2162
-function geodir_widget_listings_get_order( $query_args ) {
2162
+function geodir_widget_listings_get_order($query_args) {
2163 2163
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2164 2164
 
2165 2165
 	$query_args = $gd_query_args_widgets;
2166
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2167
-		return $wpdb->posts . ".post_date DESC, ";
2166
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2167
+		return $wpdb->posts.".post_date DESC, ";
2168 2168
 	}
2169 2169
 
2170
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2171
-	$table     = $plugin_prefix . $post_type . '_detail';
2170
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2171
+	$table     = $plugin_prefix.$post_type.'_detail';
2172 2172
 
2173
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2173
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2174 2174
 
2175
-	switch ( $sort_by ) {
2175
+	switch ($sort_by) {
2176 2176
 		case 'latest':
2177 2177
 		case 'newest':
2178
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2178
+			$orderby = $wpdb->posts.".post_date DESC, ";
2179 2179
 			break;
2180 2180
 		case 'featured':
2181
-			$orderby = $table . ".is_featured ASC, ";
2181
+			$orderby = $table.".is_featured ASC, ";
2182 2182
 			break;
2183 2183
 		case 'az':
2184
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2184
+			$orderby = $wpdb->posts.".post_title ASC, ";
2185 2185
 			break;
2186 2186
 		case 'high_review':
2187
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2187
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2188 2188
 			break;
2189 2189
 		case 'high_rating':
2190
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2190
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2191 2191
 			break;
2192 2192
 		case 'random':
2193 2193
 			$orderby = "RAND(), ";
2194 2194
 			break;
2195 2195
 		default:
2196
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2196
+			$orderby = $wpdb->posts.".post_title ASC, ";
2197 2197
 			break;
2198 2198
 	}
2199 2199
 
@@ -2215,15 +2215,15 @@  discard block
 block discarded – undo
2215 2215
  *
2216 2216
  * @return mixed Result object.
2217 2217
  */
2218
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2218
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2219 2219
 	global $wpdb, $plugin_prefix, $table_prefix;
2220 2220
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2221 2221
 	$gd_query_args_widgets            = $query_args;
2222 2222
 
2223
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2224
-	$table     = $plugin_prefix . $post_type . '_detail';
2223
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2224
+	$table     = $plugin_prefix.$post_type.'_detail';
2225 2225
 
2226
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2226
+	$fields = $wpdb->posts.".*, ".$table.".*";
2227 2227
 	/**
2228 2228
 	 * Filter widget listing fields string part that is being used for query.
2229 2229
 	 *
@@ -2233,17 +2233,17 @@  discard block
 block discarded – undo
2233 2233
 	 * @param string $table     Table name.
2234 2234
 	 * @param string $post_type Post type.
2235 2235
 	 */
2236
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2236
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2237 2237
 
2238
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2238
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2239 2239
 
2240 2240
 	########### WPML ###########
2241 2241
 
2242
-	if ( function_exists( 'icl_object_id' ) ) {
2242
+	if (function_exists('icl_object_id')) {
2243 2243
 		global $sitepress;
2244 2244
 		$lang_code = ICL_LANGUAGE_CODE;
2245
-		if ( $lang_code ) {
2246
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2245
+		if ($lang_code) {
2246
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2247 2247
 		}
2248 2248
 	}
2249 2249
 
@@ -2257,15 +2257,15 @@  discard block
 block discarded – undo
2257 2257
 	 * @param string $join      Join clause string.
2258 2258
 	 * @param string $post_type Post type.
2259 2259
 	 */
2260
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2260
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2261 2261
 
2262
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2262
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2263 2263
 
2264
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2264
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2265 2265
 
2266 2266
 	########### WPML ###########
2267
-	if ( function_exists( 'icl_object_id' ) ) {
2268
-		if ( $lang_code ) {
2267
+	if (function_exists('icl_object_id')) {
2268
+		if ($lang_code) {
2269 2269
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2270 2270
 		}
2271 2271
 	}
@@ -2278,8 +2278,8 @@  discard block
 block discarded – undo
2278 2278
 	 * @param string $where     Where clause string.
2279 2279
 	 * @param string $post_type Post type.
2280 2280
 	 */
2281
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2282
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2281
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2282
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2283 2283
 
2284 2284
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2285 2285
 	/**
@@ -2290,15 +2290,15 @@  discard block
 block discarded – undo
2290 2290
 	 * @param string $groupby   Group by clause string.
2291 2291
 	 * @param string $post_type Post type.
2292 2292
 	 */
2293
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2293
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2294 2294
 
2295
-	if ( $count_only ) {
2296
-		$sql  = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2297
-			" . $join . "
2295
+	if ($count_only) {
2296
+		$sql  = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2297
+			" . $join."
2298 2298
 			" . $where;
2299
-		$rows = (int) $wpdb->get_var( $sql );
2299
+		$rows = (int) $wpdb->get_var($sql);
2300 2300
 	} else {
2301
-		$orderby = geodir_widget_listings_get_order( $query_args );
2301
+		$orderby = geodir_widget_listings_get_order($query_args);
2302 2302
 		/**
2303 2303
 		 * Filter widget listing orderby clause string part that is being used for query.
2304 2304
 		 *
@@ -2308,11 +2308,11 @@  discard block
 block discarded – undo
2308 2308
 		 * @param string $table     Table name.
2309 2309
 		 * @param string $post_type Post type.
2310 2310
 		 */
2311
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2312
-		$orderby .= $wpdb->posts . ".post_title ASC";
2313
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2311
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2312
+		$orderby .= $wpdb->posts.".post_title ASC";
2313
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2314 2314
 
2315
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2315
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2316 2316
 		/**
2317 2317
 		 * Filter widget listing limit that is being used for query.
2318 2318
 		 *
@@ -2321,26 +2321,26 @@  discard block
 block discarded – undo
2321 2321
 		 * @param int $limit        Query results limit.
2322 2322
 		 * @param string $post_type Post type.
2323 2323
 		 */
2324
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2324
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2325 2325
 
2326
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2327
-		if ( ! $page ) {
2326
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2327
+		if (!$page) {
2328 2328
 			$page = 1;
2329 2329
 		}
2330 2330
 
2331
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2331
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2332 2332
 
2333
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2334
-			" . $join . "
2335
-			" . $where . "
2336
-			" . $groupby . "
2337
-			" . $orderby . "
2333
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2334
+			" . $join."
2335
+			" . $where."
2336
+			" . $groupby."
2337
+			" . $orderby."
2338 2338
 			" . $limit;
2339
-		$rows = $wpdb->get_results( $sql );
2339
+		$rows = $wpdb->get_results($sql);
2340 2340
 	}
2341 2341
 
2342
-	unset( $GLOBALS['gd_query_args_widgets'] );
2343
-	unset( $gd_query_args_widgets );
2342
+	unset($GLOBALS['gd_query_args_widgets']);
2343
+	unset($gd_query_args_widgets);
2344 2344
 
2345 2345
 	return $rows;
2346 2346
 }
@@ -2357,11 +2357,11 @@  discard block
 block discarded – undo
2357 2357
  *
2358 2358
  * @return string Modified fields SQL.
2359 2359
  */
2360
-function geodir_function_widget_listings_fields( $fields ) {
2360
+function geodir_function_widget_listings_fields($fields) {
2361 2361
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2362 2362
 
2363 2363
 	$query_args = $gd_query_args_widgets;
2364
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2364
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2365 2365
 		return $fields;
2366 2366
 	}
2367 2367
 
@@ -2380,24 +2380,24 @@  discard block
 block discarded – undo
2380 2380
  *
2381 2381
  * @return string Modified join clause SQL.
2382 2382
  */
2383
-function geodir_function_widget_listings_join( $join ) {
2383
+function geodir_function_widget_listings_join($join) {
2384 2384
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2385 2385
 
2386 2386
 	$query_args = $gd_query_args_widgets;
2387
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2387
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2388 2388
 		return $join;
2389 2389
 	}
2390 2390
 
2391
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2392
-	$table     = $plugin_prefix . $post_type . '_detail';
2391
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2392
+	$table     = $plugin_prefix.$post_type.'_detail';
2393 2393
 
2394
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2395
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2394
+	if (!empty($query_args['with_pics_only'])) {
2395
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2396 2396
 	}
2397 2397
 
2398
-	if ( ! empty( $query_args['tax_query'] ) ) {
2399
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2400
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2398
+	if (!empty($query_args['tax_query'])) {
2399
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2400
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2401 2401
 			$join .= $tax_queries['join'];
2402 2402
 		}
2403 2403
 	}
@@ -2417,49 +2417,49 @@  discard block
 block discarded – undo
2417 2417
  *
2418 2418
  * @return string Modified where clause SQL.
2419 2419
  */
2420
-function geodir_function_widget_listings_where( $where ) {
2420
+function geodir_function_widget_listings_where($where) {
2421 2421
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2422 2422
 
2423 2423
 	$query_args = $gd_query_args_widgets;
2424
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2424
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2425 2425
 		return $where;
2426 2426
 	}
2427
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2428
-	$table     = $plugin_prefix . $post_type . '_detail';
2427
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2428
+	$table     = $plugin_prefix.$post_type.'_detail';
2429 2429
 
2430
-	if ( ! empty( $query_args ) ) {
2431
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2432
-			$where = geodir_default_location_where( $where, $table );
2430
+	if (!empty($query_args)) {
2431
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2432
+			$where = geodir_default_location_where($where, $table);
2433 2433
 		}
2434 2434
 
2435
-		if ( ! empty( $query_args['post_author'] ) ) {
2436
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2435
+		if (!empty($query_args['post_author'])) {
2436
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2437 2437
 		}
2438 2438
 
2439
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2440
-			$where .= " AND " . $table . ".is_featured = '1'";
2439
+		if (!empty($query_args['show_featured_only'])) {
2440
+			$where .= " AND ".$table.".is_featured = '1'";
2441 2441
 		}
2442 2442
 
2443
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2444
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2443
+		if (!empty($query_args['show_special_only'])) {
2444
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2445 2445
 		}
2446 2446
 
2447
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2448
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2447
+		if (!empty($query_args['with_pics_only'])) {
2448
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2449 2449
 		}
2450 2450
 
2451
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2452
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2451
+		if (!empty($query_args['featured_image_only'])) {
2452
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2453 2453
 		}
2454 2454
 
2455
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2456
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2455
+		if (!empty($query_args['with_videos_only'])) {
2456
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2457 2457
 		}
2458 2458
 
2459
-		if ( ! empty( $query_args['tax_query'] ) ) {
2460
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2459
+		if (!empty($query_args['tax_query'])) {
2460
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2461 2461
 
2462
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2462
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2463 2463
 				$where .= $tax_queries['where'];
2464 2464
 			}
2465 2465
 		}
@@ -2480,11 +2480,11 @@  discard block
 block discarded – undo
2480 2480
  *
2481 2481
  * @return string Modified orderby clause SQL.
2482 2482
  */
2483
-function geodir_function_widget_listings_orderby( $orderby ) {
2483
+function geodir_function_widget_listings_orderby($orderby) {
2484 2484
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2485 2485
 
2486 2486
 	$query_args = $gd_query_args_widgets;
2487
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2487
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2488 2488
 		return $orderby;
2489 2489
 	}
2490 2490
 
@@ -2503,15 +2503,15 @@  discard block
 block discarded – undo
2503 2503
  *
2504 2504
  * @return int Query limit.
2505 2505
  */
2506
-function geodir_function_widget_listings_limit( $limit ) {
2506
+function geodir_function_widget_listings_limit($limit) {
2507 2507
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2508 2508
 
2509 2509
 	$query_args = $gd_query_args_widgets;
2510
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2510
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2511 2511
 		return $limit;
2512 2512
 	}
2513 2513
 
2514
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2514
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2515 2515
 		$limit = (int) $query_args['posts_per_page'];
2516 2516
 	}
2517 2517
 
@@ -2529,12 +2529,12 @@  discard block
 block discarded – undo
2529 2529
  *
2530 2530
  * @return int Large size width.
2531 2531
  */
2532
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2533
-	$large_size_w = get_option( 'large_size_w' );
2532
+function geodir_media_image_large_width($default = 800, $params = '') {
2533
+	$large_size_w = get_option('large_size_w');
2534 2534
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2535
-	$large_size_w = absint( $large_size_w );
2535
+	$large_size_w = absint($large_size_w);
2536 2536
 
2537
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2537
+	if (!get_option('geodir_use_wp_media_large_size')) {
2538 2538
 		$large_size_w = 800;
2539 2539
 	}
2540 2540
 
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
 	 * @param int $default         Default width.
2548 2548
 	 * @param string|array $params Image parameters.
2549 2549
 	 */
2550
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2550
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2551 2551
 
2552 2552
 	return $large_size_w;
2553 2553
 }
@@ -2563,12 +2563,12 @@  discard block
 block discarded – undo
2563 2563
  *
2564 2564
  * @return int Large size height.
2565 2565
  */
2566
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2567
-	$large_size_h = get_option( 'large_size_h' );
2566
+function geodir_media_image_large_height($default = 800, $params = '') {
2567
+	$large_size_h = get_option('large_size_h');
2568 2568
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2569
-	$large_size_h = absint( $large_size_h );
2569
+	$large_size_h = absint($large_size_h);
2570 2570
 
2571
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2571
+	if (!get_option('geodir_use_wp_media_large_size')) {
2572 2572
 		$large_size_h = 800;
2573 2573
 	}
2574 2574
 
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
 	 * @param int $default         Default height.
2582 2582
 	 * @param string|array $params Image parameters.
2583 2583
 	 */
2584
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2584
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2585 2585
 
2586 2586
 	return $large_size_h;
2587 2587
 }
@@ -2598,8 +2598,8 @@  discard block
 block discarded – undo
2598 2598
  *
2599 2599
  * @return string Sanitized name.
2600 2600
  */
2601
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2602
-	if ( $name == '' ) {
2601
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2602
+	if ($name == '') {
2603 2603
 		return null;
2604 2604
 	}
2605 2605
 
@@ -2608,13 +2608,13 @@  discard block
 block discarded – undo
2608 2608
 	$type = $type == 'gd_city' ? 'city' : $type;
2609 2609
 
2610 2610
 	$return = $name;
2611
-	if ( function_exists( 'get_actual_location_name' ) ) {
2612
-		$return = get_actual_location_name( $type, $name, $translate );
2611
+	if (function_exists('get_actual_location_name')) {
2612
+		$return = get_actual_location_name($type, $name, $translate);
2613 2613
 	} else {
2614
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2615
-		$return = preg_replace( '/[_-]/', ' ', $return );
2616
-		$return = geodir_ucwords( $return );
2617
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2614
+		$return = preg_replace('/-(\d+)$/', '', $return);
2615
+		$return = preg_replace('/[_-]/', ' ', $return);
2616
+		$return = geodir_ucwords($return);
2617
+		$return = $translate ? __($return, 'geodirectory') : $return;
2618 2618
 	}
2619 2619
 
2620 2620
 	return $return;
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
  *
2630 2630
  * @param int $number Comments number.
2631 2631
  */
2632
-function geodir_comments_number( $number ) {
2632
+function geodir_comments_number($number) {
2633 2633
 
2634
-	if ( $number > 1 ) {
2635
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2636
-	} elseif ( $number == 0 || $number == '' ) {
2637
-		$output = __( 'No Reviews', 'geodirectory' );
2634
+	if ($number > 1) {
2635
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2636
+	} elseif ($number == 0 || $number == '') {
2637
+		$output = __('No Reviews', 'geodirectory');
2638 2638
 	} else { // must be one
2639
-		$output = __( '1 Review', 'geodirectory' );
2639
+		$output = __('1 Review', 'geodirectory');
2640 2640
 	}
2641 2641
 	echo $output;
2642 2642
 }
@@ -2651,18 +2651,18 @@  discard block
 block discarded – undo
2651 2651
  */
2652 2652
 function is_page_geodir_home() {
2653 2653
 	global $wpdb;
2654
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2655
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2656
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2654
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2655
+	if (function_exists('geodir_location_geo_home_link')) {
2656
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2657 2657
 	}
2658
-	$home_url = home_url( '', 'http' );
2659
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2660
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2658
+	$home_url = home_url('', 'http');
2659
+	if (function_exists('geodir_location_geo_home_link')) {
2660
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2661 2661
 	}
2662
-	$home_url = str_replace( "www.", "", $home_url );
2663
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2662
+	$home_url = str_replace("www.", "", $home_url);
2663
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2664 2664
 		return true;
2665
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2665
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2666 2666
 		return true;
2667 2667
 	} else {
2668 2668
 		return false;
@@ -2682,18 +2682,18 @@  discard block
 block discarded – undo
2682 2682
  *
2683 2683
  * @return string The canonical URL.
2684 2684
  */
2685
-function geodir_wpseo_homepage_canonical( $url ) {
2685
+function geodir_wpseo_homepage_canonical($url) {
2686 2686
 	global $post;
2687 2687
 
2688
-	if ( is_page_geodir_home() ) {
2688
+	if (is_page_geodir_home()) {
2689 2689
 		return home_url();
2690 2690
 	}
2691 2691
 
2692 2692
 	return $url;
2693 2693
 }
2694 2694
 
2695
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2696
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2695
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2696
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2697 2697
 
2698 2698
 /**
2699 2699
  * Add extra fields to google maps script call.
@@ -2706,20 +2706,20 @@  discard block
 block discarded – undo
2706 2706
  *
2707 2707
  * @return string Modified extra string.
2708 2708
  */
2709
-function geodir_googlemap_script_extra_details_page( $extra ) {
2709
+function geodir_googlemap_script_extra_details_page($extra) {
2710 2710
 	global $post;
2711 2711
 	$add_google_places_api = false;
2712
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2712
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2713 2713
 		$add_google_places_api = true;
2714 2714
 	}
2715
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2715
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2716 2716
 		$extra .= "&amp;libraries=places";
2717 2717
 	}
2718 2718
 
2719 2719
 	return $extra;
2720 2720
 }
2721 2721
 
2722
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2722
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2723 2723
 
2724 2724
 
2725 2725
 /**
@@ -2737,99 +2737,99 @@  discard block
 block discarded – undo
2737 2737
  *                                          after_widget.
2738 2738
  * @param array|string $instance            The settings for the particular instance of the widget.
2739 2739
  */
2740
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2740
+function geodir_popular_post_category_output($args = '', $instance = '') {
2741 2741
 	// prints the widget
2742 2742
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2743
-	extract( $args, EXTR_SKIP );
2743
+	extract($args, EXTR_SKIP);
2744 2744
 
2745 2745
 	echo $before_widget;
2746 2746
 
2747 2747
 	/** This filter is documented in geodirectory_widgets.php */
2748
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2748
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2749 2749
 
2750 2750
 	$gd_post_type = geodir_get_current_posttype();
2751 2751
 
2752
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
-	if ( ! empty( $gd_post_type ) ) {
2752
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2753
+	if (!empty($gd_post_type)) {
2754 2754
 		$default_post_type = $gd_post_type;
2755
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2755
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2756 2756
 		$default_post_type = $instance['default_post_type'];
2757 2757
 	} else {
2758 2758
 		$all_gd_post_type  = geodir_get_posttypes();
2759
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2759
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2760 2760
 	}
2761
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2761
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2762 2762
 
2763 2763
 	$taxonomy = array();
2764
-	if ( ! empty( $gd_post_type ) ) {
2765
-		$taxonomy[] = $gd_post_type . "category";
2764
+	if (!empty($gd_post_type)) {
2765
+		$taxonomy[] = $gd_post_type."category";
2766 2766
 	} else {
2767
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2767
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2768 2768
 	}
2769 2769
     
2770
-	$term_args = array( 'taxonomy' => $taxonomy );
2771
-	if ( $parent_only ) {
2770
+	$term_args = array('taxonomy' => $taxonomy);
2771
+	if ($parent_only) {
2772 2772
 		$term_args['parent'] = 0;
2773 2773
 	}
2774 2774
 
2775
-	$terms   = get_terms( $term_args );
2775
+	$terms   = get_terms($term_args);
2776 2776
 	$a_terms = array();
2777 2777
 	$b_terms = array();
2778 2778
 
2779
-	foreach ( $terms as $term ) {
2780
-		if ( $term->count > 0 ) {
2781
-			$a_terms[ $term->taxonomy ][] = $term;
2779
+	foreach ($terms as $term) {
2780
+		if ($term->count > 0) {
2781
+			$a_terms[$term->taxonomy][] = $term;
2782 2782
 		}
2783 2783
 	}
2784 2784
 
2785
-	if ( ! empty( $a_terms ) ) {
2786
-		foreach ( $a_terms as $b_key => $b_val ) {
2787
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2785
+	if (!empty($a_terms)) {
2786
+		foreach ($a_terms as $b_key => $b_val) {
2787
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2788 2788
 		}
2789 2789
 
2790
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2790
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2791 2791
 
2792 2792
 		$tax_change_output = '';
2793
-		if ( count( $b_terms ) > 1 ) {
2794
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
-			foreach ( $b_terms as $key => $val ) {
2796
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2797
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2798
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2793
+		if (count($b_terms) > 1) {
2794
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2795
+			foreach ($b_terms as $key => $val) {
2796
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2797
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2798
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2799 2799
 			}
2800 2800
 			$tax_change_output .= "</select>";
2801 2801
 		}
2802 2802
 
2803
-		if ( ! empty( $b_terms ) ) {
2804
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2805
-			global $cat_count;//make global so we can change via function
2803
+		if (!empty($b_terms)) {
2804
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2805
+			global $cat_count; //make global so we can change via function
2806 2806
 			$cat_count = 0;
2807 2807
 			?>
2808 2808
 			<div class="geodir-category-list-in clearfix">
2809 2809
 				<div class="geodir-cat-list clearfix">
2810 2810
 					<?php
2811
-					echo $before_title . __( $title ) . $after_title;
2811
+					echo $before_title.__($title).$after_title;
2812 2812
 
2813 2813
 					echo $tax_change_output;
2814 2814
 
2815 2815
 					echo '<ul class="geodir-popular-cat-list">';
2816 2816
 
2817
-					geodir_helper_cat_list_output( $terms, $category_limit );
2817
+					geodir_helper_cat_list_output($terms, $category_limit);
2818 2818
 
2819 2819
 					echo '</ul>';
2820 2820
 					?>
2821 2821
 				</div>
2822 2822
 				<?php
2823 2823
 				$hide = '';
2824
-				if ( $cat_count < $category_limit ) {
2824
+				if ($cat_count < $category_limit) {
2825 2825
 					$hide = 'style="display:none;"';
2826 2826
 				}
2827 2827
 				echo "<div class='geodir-cat-list-more' $hide >";
2828
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2829
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2828
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2829
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2830 2830
 				echo "</div>";
2831 2831
 				/* add scripts */
2832
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2832
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2833 2833
 				?>
2834 2834
 			</div>
2835 2835
 			<?php
@@ -2848,25 +2848,25 @@  discard block
 block discarded – undo
2848 2848
  * @param array $terms                      An array of term objects.
2849 2849
  * @param int $category_limit               Number of categories to display by default.
2850 2850
  */
2851
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2851
+function geodir_helper_cat_list_output($terms, $category_limit) {
2852 2852
 	global $geodir_post_category_str, $cat_count;
2853 2853
 	$term_icons = geodir_get_term_icon();
2854 2854
 
2855 2855
 	$geodir_post_category_str = array();
2856 2856
 
2857 2857
 
2858
-	foreach ( $terms as $cat ) {
2859
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2860
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2858
+	foreach ($terms as $cat) {
2859
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2860
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2861 2861
 
2862
-		$cat_count ++;
2862
+		$cat_count++;
2863 2863
 
2864
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2864
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2865 2865
 
2866 2866
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2867 2867
 		$total_post = $cat->count;
2868 2868
 
2869
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2869
+		$term_link = get_term_link($cat, $cat->taxonomy);
2870 2870
 		/**
2871 2871
 		 * Filer the category term link.
2872 2872
 		 *
@@ -2876,11 +2876,11 @@  discard block
 block discarded – undo
2876 2876
 		 * @param int $cat          ->term_id The term id.
2877 2877
 		 * @param string $post_type Wordpress post type.
2878 2878
 		 */
2879
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2879
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2880 2880
 
2881
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2882
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2883
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2881
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2882
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2883
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2884 2884
 		echo '</a></li>';
2885 2885
 	}
2886 2886
 }
@@ -2895,14 +2895,14 @@  discard block
 block discarded – undo
2895 2895
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2896 2896
  * @param array|string $instance The settings for the particular instance of the widget.
2897 2897
  */
2898
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2898
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2899 2899
 	// prints the widget
2900
-	extract( $args, EXTR_SKIP );
2900
+	extract($args, EXTR_SKIP);
2901 2901
 
2902 2902
 	echo $before_widget;
2903 2903
 
2904 2904
 	/** This filter is documented in geodirectory_widgets.php */
2905
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2905
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2906 2906
 	/**
2907 2907
 	 * Filter the widget post type.
2908 2908
 	 *
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
 	 *
2911 2911
 	 * @param string $instance ['post_type'] Post type of listing.
2912 2912
 	 */
2913
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2913
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2914 2914
 	/**
2915 2915
 	 * Filter the widget's term.
2916 2916
 	 *
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 	 *
2919 2919
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
2920 2920
 	 */
2921
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
2921
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2922 2922
 	/**
2923 2923
 	 * Filter widget's "add_location_filter" value.
2924 2924
 	 *
@@ -2926,7 +2926,7 @@  discard block
 block discarded – undo
2926 2926
 	 *
2927 2927
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2928 2928
 	 */
2929
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
2929
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2930 2930
 	/**
2931 2931
 	 * Filter the widget listings limit.
2932 2932
 	 *
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 	 *
2935 2935
 	 * @param string $instance ['post_number'] Number of listings to display.
2936 2936
 	 */
2937
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
2937
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2938 2938
 	/**
2939 2939
 	 * Filter the widget listings limit shown at one time.
2940 2940
 	 *
@@ -2942,7 +2942,7 @@  discard block
 block discarded – undo
2942 2942
 	 *
2943 2943
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
2944 2944
 	 */
2945
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
2945
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2946 2946
 	/**
2947 2947
 	 * Filter the widget slide width.
2948 2948
 	 *
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 	 *
2951 2951
 	 * @param string $instance ['slide_width'] Width of the slides shown.
2952 2952
 	 */
2953
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
2953
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2954 2954
 	/**
2955 2955
 	 * Filter widget's "show title" value.
2956 2956
 	 *
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 	 *
2959 2959
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
2960 2960
 	 */
2961
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
2961
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2962 2962
 	/**
2963 2963
 	 * Filter widget's "slideshow" value.
2964 2964
 	 *
@@ -2966,7 +2966,7 @@  discard block
 block discarded – undo
2966 2966
 	 *
2967 2967
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
2968 2968
 	 */
2969
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
2969
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2970 2970
 	/**
2971 2971
 	 * Filter widget's "animationLoop" value.
2972 2972
 	 *
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
 	 *
2975 2975
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
2976 2976
 	 */
2977
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
2977
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2978 2978
 	/**
2979 2979
 	 * Filter widget's "directionNav" value.
2980 2980
 	 *
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 	 *
2983 2983
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2984 2984
 	 */
2985
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
2985
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2986 2986
 	/**
2987 2987
 	 * Filter widget's "slideshowSpeed" value.
2988 2988
 	 *
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
 	 *
2991 2991
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2992 2992
 	 */
2993
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
2993
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2994 2994
 	/**
2995 2995
 	 * Filter widget's "animationSpeed" value.
2996 2996
 	 *
@@ -2998,7 +2998,7 @@  discard block
 block discarded – undo
2998 2998
 	 *
2999 2999
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3000 3000
 	 */
3001
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3001
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3002 3002
 	/**
3003 3003
 	 * Filter widget's "animation" value.
3004 3004
 	 *
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
 	 *
3007 3007
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3008 3008
 	 */
3009
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3009
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3010 3010
 	/**
3011 3011
 	 * Filter widget's "list_sort" type.
3012 3012
 	 *
@@ -3014,10 +3014,10 @@  discard block
 block discarded – undo
3014 3014
 	 *
3015 3015
 	 * @param string $instance ['list_sort'] Listing sort by type.
3016 3016
 	 */
3017
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3018
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3017
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3018
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3019 3019
 
3020
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3020
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3021 3021
 	?>
3022 3022
 	<script type="text/javascript">
3023 3023
 		jQuery(window).load(function () {
@@ -3035,23 +3035,23 @@  discard block
 block discarded – undo
3035 3035
 				itemWidth: 75,
3036 3036
 				itemMargin: 5,
3037 3037
 				asNavFor: '#geodir_widget_slider',
3038
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3038
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3039 3039
 			});
3040 3040
 
3041 3041
 			jQuery('#geodir_widget_slider').flexslider({
3042
-				animation: "<?php echo $animation;?>",
3042
+				animation: "<?php echo $animation; ?>",
3043 3043
 				selector: ".geodir-slides > li",
3044 3044
 				namespace: "geodir-",
3045 3045
 				controlNav: true,
3046
-				animationLoop: <?php echo $animationLoop;?>,
3047
-				slideshow: <?php echo $slideshow;?>,
3048
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3049
-				animationSpeed: <?php echo $animationSpeed;?>,
3050
-				directionNav: <?php echo $directionNav;?>,
3051
-				maxItems: <?php echo $max_show;?>,
3046
+				animationLoop: <?php echo $animationLoop; ?>,
3047
+				slideshow: <?php echo $slideshow; ?>,
3048
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3049
+				animationSpeed: <?php echo $animationSpeed; ?>,
3050
+				directionNav: <?php echo $directionNav; ?>,
3051
+				maxItems: <?php echo $max_show; ?>,
3052 3052
 				move: 1,
3053
-				<?php if ( $slide_width ) {
3054
-				echo "itemWidth: " . $slide_width . ",";
3053
+				<?php if ($slide_width) {
3054
+				echo "itemWidth: ".$slide_width.",";
3055 3055
 			}?>
3056 3056
 				sync: "#geodir_widget_carousel",
3057 3057
 				start: function (slider) {
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3064 3064
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3065 3065
 				},
3066
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3066
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3067 3067
 			});
3068 3068
 		});
3069 3069
 	</script>
@@ -3076,62 +3076,62 @@  discard block
 block discarded – undo
3076 3076
 		'order_by'       => $list_sort
3077 3077
 	);
3078 3078
 
3079
-	if ( $show_featured_only ) {
3079
+	if ($show_featured_only) {
3080 3080
 		$query_args['show_featured_only'] = 1;
3081 3081
 	}
3082 3082
 
3083
-	if ( $category != 0 || $category != '' ) {
3084
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3083
+	if ($category != 0 || $category != '') {
3084
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3085 3085
 		$tax_query         = array(
3086 3086
 			'taxonomy' => $category_taxonomy[0],
3087 3087
 			'field'    => 'id',
3088 3088
 			'terms'    => $category
3089 3089
 		);
3090 3090
 
3091
-		$query_args['tax_query'] = array( $tax_query );
3091
+		$query_args['tax_query'] = array($tax_query);
3092 3092
 	}
3093 3093
 
3094 3094
 	// we want listings with featured image only
3095 3095
 	$query_args['featured_image_only'] = 1;
3096 3096
 
3097
-	if ( $post_type == 'gd_event' ) {
3097
+	if ($post_type == 'gd_event') {
3098 3098
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3099 3099
 	}// show only upcoming events
3100 3100
 
3101
-	$widget_listings = geodir_get_widget_listings( $query_args );
3102
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3103
-		if ( $title ) {
3104
-			echo $before_title . $title . $after_title;
3101
+	$widget_listings = geodir_get_widget_listings($query_args);
3102
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3103
+		if ($title) {
3104
+			echo $before_title.$title.$after_title;
3105 3105
 		}
3106 3106
 
3107 3107
 		global $post;
3108 3108
 
3109
-		$current_post = $post;// keep current post info
3109
+		$current_post = $post; // keep current post info
3110 3110
 
3111 3111
 		$widget_main_slides = '';
3112 3112
 		$nav_slides         = '';
3113 3113
 		$widget_slides      = 0;
3114 3114
 
3115
-		foreach ( $widget_listings as $widget_listing ) {
3115
+		foreach ($widget_listings as $widget_listing) {
3116 3116
 			global $gd_widget_listing_type;
3117 3117
 			$post         = $widget_listing;
3118
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3118
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3119 3119
 
3120
-			if ( ! empty( $widget_image ) ) {
3121
-				if ( $widget_image->height >= 200 ) {
3120
+			if (!empty($widget_image)) {
3121
+				if ($widget_image->height >= 200) {
3122 3122
 					$widget_spacer_height = 0;
3123 3123
 				} else {
3124
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3124
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3125 3125
 				}
3126 3126
 
3127
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3127
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3128 3128
 
3129 3129
 				$title = '';
3130
-				if ( $show_title ) {
3131
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3130
+				if ($show_title) {
3131
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3132 3132
 					$post_id        = $post->ID;
3133
-					$post_permalink = get_permalink( $post->ID );
3134
-					$post_title     = get_the_title( $post->ID );
3133
+					$post_permalink = get_permalink($post->ID);
3134
+					$post_title     = get_the_title($post->ID);
3135 3135
 					/**
3136 3136
 					 * Filter the listing slider widget title.
3137 3137
 					 *
@@ -3142,12 +3142,12 @@  discard block
 block discarded – undo
3142 3142
 					 * @param string $post_permalink The post permalink url.
3143 3143
 					 * @param string $post_title     The post title text.
3144 3144
 					 */
3145
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3145
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3146 3146
 				}
3147 3147
 
3148
-				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
3149
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3150
-				$widget_slides ++;
3148
+				$widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
3149
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3150
+				$widget_slides++;
3151 3151
 			}
3152 3152
 		}
3153 3153
 		?>
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3157 3157
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3158 3158
 			</div>
3159
-			<?php if ( $widget_slides > 1 ) { ?>
3159
+			<?php if ($widget_slides > 1) { ?>
3160 3160
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3161 3161
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3162 3162
 				</div>
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 		</div>
3165 3165
 		<?php
3166 3166
 		$GLOBALS['post'] = $current_post;
3167
-		setup_postdata( $current_post );
3167
+		setup_postdata($current_post);
3168 3168
 	}
3169 3169
 	echo $after_widget;
3170 3170
 }
@@ -3180,46 +3180,46 @@  discard block
 block discarded – undo
3180 3180
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3181 3181
  * @param array|string $instance The settings for the particular instance of the widget.
3182 3182
  */
3183
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3183
+function geodir_loginwidget_output($args = '', $instance = '') {
3184 3184
 	//print_r($args);
3185 3185
 	//print_r($instance);
3186 3186
 	// prints the widget
3187
-	extract( $args, EXTR_SKIP );
3187
+	extract($args, EXTR_SKIP);
3188 3188
 
3189 3189
 	/** This filter is documented in geodirectory_widgets.php */
3190
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3190
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3191 3191
 
3192 3192
 	echo $before_widget;
3193
-	echo $before_title . $title . $after_title;
3193
+	echo $before_title.$title.$after_title;
3194 3194
 
3195
-	if ( is_user_logged_in() ) {
3195
+	if (is_user_logged_in()) {
3196 3196
 		global $current_user;
3197 3197
 
3198
-		$author_link = get_author_posts_url( $current_user->data->ID );
3199
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3198
+		$author_link = get_author_posts_url($current_user->data->ID);
3199
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3200 3200
 
3201 3201
 		echo '<ul class="geodir-loginbox-list">';
3202 3202
 		ob_start();
3203 3203
 		?>
3204 3204
 		<li><a class="signin"
3205
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3205
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3206 3206
 		<?php
3207
-		$post_types                           = geodir_get_posttypes( 'object' );
3208
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3209
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3207
+		$post_types                           = geodir_get_posttypes('object');
3208
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3209
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3210 3210
 
3211
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3211
+		if (!empty($show_add_listing_post_types_main_nav)) {
3212 3212
 			$addlisting_links = '';
3213
-			foreach ( $post_types as $key => $postobj ) {
3213
+			foreach ($post_types as $key => $postobj) {
3214 3214
 
3215
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3215
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3216 3216
 
3217
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3217
+					if ($add_link = geodir_get_addlisting_link($key)) {
3218 3218
 
3219 3219
 						$name = $postobj->labels->name;
3220 3220
 
3221 3221
 						$selected = '';
3222
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3222
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3223 3223
 							$selected = 'selected="selected"';
3224 3224
 						}
3225 3225
 
@@ -3232,22 +3232,22 @@  discard block
 block discarded – undo
3232 3232
 						 * @param string $key       Add listing array key.
3233 3233
 						 * @param int $current_user ->ID Current user ID.
3234 3234
 						 */
3235
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3235
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3236 3236
 
3237
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3237
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3238 3238
 
3239 3239
 					}
3240 3240
 				}
3241 3241
 
3242 3242
 			}
3243 3243
 
3244
-			if ( $addlisting_links != '' ) { ?>
3244
+			if ($addlisting_links != '') { ?>
3245 3245
 
3246 3246
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3247 3247
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3248
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3248
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3249 3249
 						<option value="" disabled="disabled" selected="selected"
3250
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3250
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3251 3251
 						<?php echo $addlisting_links; ?>
3252 3252
 					</select></li> <?php
3253 3253
 
@@ -3255,23 +3255,23 @@  discard block
 block discarded – undo
3255 3255
 
3256 3256
 		}
3257 3257
 		// My Favourites in Dashboard
3258
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3258
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3259 3259
 		$user_favourite                    = geodir_user_favourite_listing_count();
3260 3260
 
3261
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3261
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3262 3262
 			$favourite_links = '';
3263 3263
 
3264
-			foreach ( $post_types as $key => $postobj ) {
3265
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3264
+			foreach ($post_types as $key => $postobj) {
3265
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3266 3266
 					$name           = $postobj->labels->name;
3267
-					$post_type_link = geodir_getlink( $author_link, array(
3267
+					$post_type_link = geodir_getlink($author_link, array(
3268 3268
 						'stype' => $key,
3269 3269
 						'list'  => 'favourite'
3270
-					), false );
3270
+					), false);
3271 3271
 
3272 3272
 					$selected = '';
3273 3273
 
3274
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3274
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3275 3275
 						$selected = 'selected="selected"';
3276 3276
 					}
3277 3277
 					/**
@@ -3283,20 +3283,20 @@  discard block
 block discarded – undo
3283 3283
 					 * @param string $key            Favorite listing array key.
3284 3284
 					 * @param int $current_user      ->ID Current user ID.
3285 3285
 					 */
3286
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3286
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3287 3287
 
3288
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3288
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3289 3289
 				}
3290 3290
 			}
3291 3291
 
3292
-			if ( $favourite_links != '' ) {
3292
+			if ($favourite_links != '') {
3293 3293
 				?>
3294 3294
 				<li>
3295 3295
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3296 3296
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3297
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3297
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3298 3298
 						<option value="" disabled="disabled" selected="selected"
3299
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3299
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3300 3300
 						<?php echo $favourite_links; ?>
3301 3301
 					</select>
3302 3302
 				</li>
@@ -3305,19 +3305,19 @@  discard block
 block discarded – undo
3305 3305
 		}
3306 3306
 
3307 3307
 
3308
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3308
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3309 3309
 		$user_listing                     = geodir_user_post_listing_count();
3310 3310
 
3311
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3311
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3312 3312
 			$listing_links = '';
3313 3313
 
3314
-			foreach ( $post_types as $key => $postobj ) {
3315
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3314
+			foreach ($post_types as $key => $postobj) {
3315
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3316 3316
 					$name         = $postobj->labels->name;
3317
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3317
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3318 3318
 
3319 3319
 					$selected = '';
3320
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3320
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3321 3321
 						$selected = 'selected="selected"';
3322 3322
 					}
3323 3323
 
@@ -3330,20 +3330,20 @@  discard block
 block discarded – undo
3330 3330
 					 * @param string $key          My listing array key.
3331 3331
 					 * @param int $current_user    ->ID Current user ID.
3332 3332
 					 */
3333
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3333
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3334 3334
 
3335
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3335
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3336 3336
 				}
3337 3337
 			}
3338 3338
 
3339
-			if ( $listing_links != '' ) {
3339
+			if ($listing_links != '') {
3340 3340
 				?>
3341 3341
 				<li>
3342 3342
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3343 3343
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3344
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3344
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3345 3345
 						<option value="" disabled="disabled" selected="selected"
3346
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3346
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3347 3347
 						<?php echo $listing_links; ?>
3348 3348
 					</select>
3349 3349
 				</li>
@@ -3359,7 +3359,7 @@  discard block
 block discarded – undo
3359 3359
 		 *
3360 3360
 		 * @param string $dashboard_link Dashboard links HTML.
3361 3361
 		 */
3362
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3362
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3363 3363
 		echo '</ul>';
3364 3364
 
3365 3365
 		/**
@@ -3367,7 +3367,7 @@  discard block
 block discarded – undo
3367 3367
 		 *
3368 3368
 		 * @since 1.6.6
3369 3369
 		 */
3370
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3370
+		do_action('geodir_after_loginwidget_form_logged_in');
3371 3371
 
3372 3372
 
3373 3373
 	} else {
@@ -3382,18 +3382,18 @@  discard block
 block discarded – undo
3382 3382
 		<form name="loginform" class="loginform1"
3383 3383
 		      action="<?php echo geodir_login_url(); ?>"
3384 3384
 		      method="post">
3385
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3385
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3386 3386
 			                                    type="text" class="textfield user_login1"/> <span
3387 3387
 					class="user_loginInfo"></span></div>
3388
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3388
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3389 3389
 			                                    name="pwd" type="password"
3390 3390
 			                                    class="textfield user_pass1 input-text"/><span
3391 3391
 					class="user_passInfo"></span></div>
3392 3392
 
3393
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3393
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3394 3394
 			<input type="hidden" name="testcookie" value="1"/>
3395 3395
 
3396
-				<?php do_action( 'login_form' ); ?>
3396
+				<?php do_action('login_form'); ?>
3397 3397
 
3398 3398
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3399 3399
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
 					 * @since 1.0.0
3407 3407
 					 */
3408 3408
 					?>
3409
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3409
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3410 3410
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3411 3411
 
3412 3412
 					<?php
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 					 * @since 1.0.0
3417 3417
 					 */
3418 3418
 					?>
3419
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3419
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3420 3420
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3421 3421
 		</form>
3422 3422
 		<?php
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		 *
3426 3426
 		 * @since 1.6.6
3427 3427
 		 */
3428
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3428
+		do_action('geodir_after_loginwidget_form_logged_out');
3429 3429
 	}
3430 3430
 
3431 3431
 	echo $after_widget;
@@ -3447,16 +3447,16 @@  discard block
 block discarded – undo
3447 3447
  *                                         after_widget.
3448 3448
  * @param array|string $instance           The settings for the particular instance of the widget.
3449 3449
  */
3450
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3450
+function geodir_popular_postview_output($args = '', $instance = '') {
3451 3451
 	global $gd_session;
3452 3452
 
3453 3453
 	// prints the widget
3454
-	extract( $args, EXTR_SKIP );
3454
+	extract($args, EXTR_SKIP);
3455 3455
 
3456 3456
 	echo $before_widget;
3457 3457
 
3458 3458
 	/** This filter is documented in geodirectory_widgets.php */
3459
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3459
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3460 3460
 	/**
3461 3461
 	 * Filter the widget post type.
3462 3462
 	 *
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
 	 *
3465 3465
 	 * @param string $instance ['post_type'] Post type of listing.
3466 3466
 	 */
3467
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3467
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3468 3468
 	/**
3469 3469
 	 * Filter the widget's term.
3470 3470
 	 *
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 	 *
3473 3473
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3474 3474
 	 */
3475
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3475
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3476 3476
 	/**
3477 3477
 	 * Filter the widget listings limit.
3478 3478
 	 *
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
 	 *
3481 3481
 	 * @param string $instance ['post_number'] Number of listings to display.
3482 3482
 	 */
3483
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3483
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3484 3484
 	/**
3485 3485
 	 * Filter widget's "layout" type.
3486 3486
 	 *
@@ -3488,7 +3488,7 @@  discard block
 block discarded – undo
3488 3488
 	 *
3489 3489
 	 * @param string $instance ['layout'] Widget layout type.
3490 3490
 	 */
3491
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3491
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3492 3492
 	/**
3493 3493
 	 * Filter widget's "add_location_filter" value.
3494 3494
 	 *
@@ -3496,7 +3496,7 @@  discard block
 block discarded – undo
3496 3496
 	 *
3497 3497
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3498 3498
 	 */
3499
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3499
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3500 3500
 	/**
3501 3501
 	 * Filter widget's listing width.
3502 3502
 	 *
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
 	 *
3505 3505
 	 * @param string $instance ['listing_width'] Listing width.
3506 3506
 	 */
3507
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3507
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3508 3508
 	/**
3509 3509
 	 * Filter widget's "list_sort" type.
3510 3510
 	 *
@@ -3512,25 +3512,25 @@  discard block
 block discarded – undo
3512 3512
 	 *
3513 3513
 	 * @param string $instance ['list_sort'] Listing sort by type.
3514 3514
 	 */
3515
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3516
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3515
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3516
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3517 3517
 
3518 3518
 	// set post type to current viewing post type
3519
-	if ( $use_viewing_post_type ) {
3519
+	if ($use_viewing_post_type) {
3520 3520
 		$current_post_type = geodir_get_current_posttype();
3521
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3521
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3522 3522
 			$post_type = $current_post_type;
3523 3523
 			$category  = array(); // old post type category will not work for current changed post type
3524 3524
 		}
3525 3525
 	}
3526 3526
 	// replace widget title dynamically
3527
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3528
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3527
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3528
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3529 3529
 
3530
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3531
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3530
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3531
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3532 3532
 
3533
-	if ( isset( $instance['character_count'] ) ) {
3533
+	if (isset($instance['character_count'])) {
3534 3534
 		/**
3535 3535
 		 * Filter the widget's excerpt character count.
3536 3536
 		 *
@@ -3538,37 +3538,37 @@  discard block
 block discarded – undo
3538 3538
 		 *
3539 3539
 		 * @param int $instance ['character_count'] Excerpt character count.
3540 3540
 		 */
3541
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3541
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3542 3542
 	} else {
3543 3543
 		$character_count = '';
3544 3544
 	}
3545 3545
 
3546
-	if ( empty( $title ) || $title == 'All' ) {
3547
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3546
+	if (empty($title) || $title == 'All') {
3547
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3548 3548
 	}
3549 3549
 
3550 3550
 	$location_url = array();
3551
-	$city         = get_query_var( 'gd_city' );
3552
-	if ( ! empty( $city ) ) {
3553
-		$country = get_query_var( 'gd_country' );
3554
-		$region  = get_query_var( 'gd_region' );
3551
+	$city         = get_query_var('gd_city');
3552
+	if (!empty($city)) {
3553
+		$country = get_query_var('gd_country');
3554
+		$region  = get_query_var('gd_region');
3555 3555
 
3556
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3556
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3557 3557
 
3558
-		if ( $geodir_show_location_url == 'all' ) {
3559
-			if ( $country != '' ) {
3558
+		if ($geodir_show_location_url == 'all') {
3559
+			if ($country != '') {
3560 3560
 				$location_url[] = $country;
3561 3561
 			}
3562 3562
 
3563
-			if ( $region != '' ) {
3563
+			if ($region != '') {
3564 3564
 				$location_url[] = $region;
3565 3565
 			}
3566
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3567
-			if ( $country != '' ) {
3566
+		} else if ($geodir_show_location_url == 'country_city') {
3567
+			if ($country != '') {
3568 3568
 				$location_url[] = $country;
3569 3569
 			}
3570
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3571
-			if ( $region != '' ) {
3570
+		} else if ($geodir_show_location_url == 'region_city') {
3571
+			if ($region != '') {
3572 3572
 				$location_url[] = $region;
3573 3573
 			}
3574 3574
 		}
@@ -3576,37 +3576,37 @@  discard block
 block discarded – undo
3576 3576
 		$location_url[] = $city;
3577 3577
 	}
3578 3578
 
3579
-	$location_url  = implode( '/', $location_url );
3579
+	$location_url  = implode('/', $location_url);
3580 3580
 	$skip_location = false;
3581
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3581
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3582 3582
 		$skip_location = true;
3583
-		$gd_session->un_set( 'gd_multi_location' );
3583
+		$gd_session->un_set('gd_multi_location');
3584 3584
 	}
3585 3585
 
3586
-	if ( get_option( 'permalink_structure' ) ) {
3587
-		$viewall_url = get_post_type_archive_link( $post_type );
3586
+	if (get_option('permalink_structure')) {
3587
+		$viewall_url = get_post_type_archive_link($post_type);
3588 3588
 	} else {
3589
-		$viewall_url = get_post_type_archive_link( $post_type );
3589
+		$viewall_url = get_post_type_archive_link($post_type);
3590 3590
 	}
3591 3591
 
3592
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3592
+	if (!empty($category) && $category[0] != '0') {
3593 3593
 		global $geodir_add_location_url;
3594 3594
 
3595 3595
 		$geodir_add_location_url = '0';
3596 3596
 
3597
-		if ( $add_location_filter != '0' ) {
3597
+		if ($add_location_filter != '0') {
3598 3598
 			$geodir_add_location_url = '1';
3599 3599
 		}
3600 3600
 
3601
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3601
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3602 3602
 
3603 3603
 		$geodir_add_location_url = null;
3604 3604
 	}
3605
-	if ( $skip_location ) {
3606
-		$gd_session->set( 'gd_multi_location', 1 );
3605
+	if ($skip_location) {
3606
+		$gd_session->set('gd_multi_location', 1);
3607 3607
 	}
3608 3608
 
3609
-	if ( is_wp_error( $viewall_url ) ) {
3609
+	if (is_wp_error($viewall_url)) {
3610 3610
 		$viewall_url = '';
3611 3611
 	}
3612 3612
 
@@ -3618,34 +3618,34 @@  discard block
 block discarded – undo
3618 3618
 		'order_by'       => $list_sort
3619 3619
 	);
3620 3620
 
3621
-	if ( $character_count ) {
3621
+	if ($character_count) {
3622 3622
 		$query_args['excerpt_length'] = $character_count;
3623 3623
 	}
3624 3624
 
3625
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3625
+	if (!empty($instance['show_featured_only'])) {
3626 3626
 		$query_args['show_featured_only'] = 1;
3627 3627
 	}
3628 3628
 
3629
-	if ( ! empty( $instance['show_special_only'] ) ) {
3629
+	if (!empty($instance['show_special_only'])) {
3630 3630
 		$query_args['show_special_only'] = 1;
3631 3631
 	}
3632 3632
 
3633
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3633
+	if (!empty($instance['with_pics_only'])) {
3634 3634
 		$query_args['with_pics_only']      = 0;
3635 3635
 		$query_args['featured_image_only'] = 1;
3636 3636
 	}
3637 3637
 
3638
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3638
+	if (!empty($instance['with_videos_only'])) {
3639 3639
 		$query_args['with_videos_only'] = 1;
3640 3640
 	}
3641
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3641
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3642 3642
 
3643
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3644
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3643
+	if (!empty($category) && $category[0] != '0') {
3644
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3645 3645
 
3646 3646
 		######### WPML #########
3647
-		if ( function_exists( 'icl_object_id' ) ) {
3648
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3647
+		if (function_exists('icl_object_id')) {
3648
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3649 3649
 		}
3650 3650
 		######### WPML #########
3651 3651
 
@@ -3655,14 +3655,14 @@  discard block
 block discarded – undo
3655 3655
 			'terms'    => $category
3656 3656
 		);
3657 3657
 
3658
-		$query_args['tax_query'] = array( $tax_query );
3658
+		$query_args['tax_query'] = array($tax_query);
3659 3659
 	}
3660 3660
 
3661 3661
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3662 3662
 
3663
-	$widget_listings = geodir_get_widget_listings( $query_args );
3663
+	$widget_listings = geodir_get_widget_listings($query_args);
3664 3664
 
3665
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3665
+	if (!empty($widget_listings) || $with_no_results) {
3666 3666
 		?>
3667 3667
 		<div class="geodir_locations geodir_location_listing">
3668 3668
 
@@ -3672,11 +3672,11 @@  discard block
 block discarded – undo
3672 3672
 			 *
3673 3673
 			 * @since 1.0.0
3674 3674
 			 */
3675
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3675
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3676 3676
 			<div class="geodir_list_heading clearfix">
3677
-				<?php echo $before_title . $title . $after_title; ?>
3677
+				<?php echo $before_title.$title.$after_title; ?>
3678 3678
 				<a href="<?php echo $viewall_url; ?>"
3679
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3679
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3680 3680
 			</div>
3681 3681
 			<?php
3682 3682
 			/**
@@ -3684,10 +3684,10 @@  discard block
 block discarded – undo
3684 3684
 			 *
3685 3685
 			 * @since 1.0.0
3686 3686
 			 */
3687
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3687
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3688 3688
 			<?php
3689
-			if ( strstr( $layout, 'gridview' ) ) {
3690
-				$listing_view_exp        = explode( '_', $layout );
3689
+			if (strstr($layout, 'gridview')) {
3690
+				$listing_view_exp        = explode('_', $layout);
3691 3691
 				$gridview_columns_widget = $layout;
3692 3692
 				$layout                  = $listing_view_exp[0];
3693 3693
 			} else {
@@ -3699,8 +3699,8 @@  discard block
 block discarded – undo
3699 3699
 			 *
3700 3700
 			 * @since 1.0.0
3701 3701
 			 */
3702
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3703
-			if ( ! isset( $character_count ) ) {
3702
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3703
+			if (!isset($character_count)) {
3704 3704
 				/**
3705 3705
 				 * Filter the widget's excerpt character count.
3706 3706
 				 *
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
 				 *
3709 3709
 				 * @param int $instance ['character_count'] Excerpt character count.
3710 3710
 				 */
3711
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3711
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3712 3712
 			}
3713 3713
 
3714 3714
 			global $post, $map_jason, $map_canvas_arr;
@@ -3723,13 +3723,13 @@  discard block
 block discarded – undo
3723 3723
 			 *
3724 3724
 			 * @since 1.0.0
3725 3725
 			 */
3726
-			include( $template );
3726
+			include($template);
3727 3727
 
3728 3728
 			$geodir_is_widget_listing = false;
3729 3729
 
3730 3730
 			$GLOBALS['post'] = $current_post;
3731
-			if ( ! empty( $current_post ) ) {
3732
-				setup_postdata( $current_post );
3731
+			if (!empty($current_post)) {
3732
+				setup_postdata($current_post);
3733 3733
 			}
3734 3734
 			$map_jason      = $current_map_jason;
3735 3735
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3760,12 +3760,12 @@  discard block
 block discarded – undo
3760 3760
  *
3761 3761
  * @return int Reviews count.
3762 3762
  */
3763
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3763
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3764 3764
 	global $wpdb, $plugin_prefix;
3765 3765
 
3766
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3766
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3767 3767
 
3768
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3768
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3769 3769
 
3770 3770
 	/**
3771 3771
 	 * Filter count review sql query.
@@ -3777,9 +3777,9 @@  discard block
 block discarded – undo
3777 3777
 	 * @param int $taxonomy     The taxonomy Id.
3778 3778
 	 * @param string $post_type The post type.
3779 3779
 	 */
3780
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3780
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3781 3781
 
3782
-	$count = $wpdb->get_var( $sql );
3782
+	$count = $wpdb->get_var($sql);
3783 3783
 
3784 3784
 	return $count;
3785 3785
 }
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
  *
3798 3798
  * @return array Term array data.
3799 3799
  */
3800
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3800
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3801 3801
 	/**
3802 3802
 	 * Filter review count option data.
3803 3803
 	 *
@@ -3807,78 +3807,78 @@  discard block
 block discarded – undo
3807 3807
 	 * @param bool $force_update Force update option value?. Default.false.
3808 3808
 	 * @param int $post_ID       The post id to update if any.
3809 3809
 	 */
3810
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3811
-	if ( ! empty( $option_data ) ) {
3810
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3811
+	if (!empty($option_data)) {
3812 3812
 		return $option_data;
3813 3813
 	}
3814 3814
 
3815
-	$option_data = get_option( 'geodir_global_review_count' );
3815
+	$option_data = get_option('geodir_global_review_count');
3816 3816
 
3817
-	if ( ! $option_data || $force_update ) {
3818
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3817
+	if (!$option_data || $force_update) {
3818
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3819 3819
 			global $gd_session;
3820 3820
 			$term_array = (array) $option_data;
3821
-			$post_type  = get_post_type( $post_ID );
3822
-			$taxonomy   = $post_type . 'category';
3823
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3824
-
3825
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3826
-				foreach ( $terms as $term_id ) {
3827
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3828
-					$children               = get_term_children( $term_id, $taxonomy );
3829
-					$term_array[ $term_id ] = $count;
3821
+			$post_type  = get_post_type($post_ID);
3822
+			$taxonomy   = $post_type.'category';
3823
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3824
+
3825
+			if (!empty($terms) && !is_wp_error($terms)) {
3826
+				foreach ($terms as $term_id) {
3827
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3828
+					$children               = get_term_children($term_id, $taxonomy);
3829
+					$term_array[$term_id] = $count;
3830 3830
 				}
3831 3831
 			}
3832 3832
 
3833
-			$session_listing = $gd_session->get( 'listing' );
3833
+			$session_listing = $gd_session->get('listing');
3834 3834
 
3835 3835
 			$terms = array();
3836
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3837
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3838
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3839
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3836
+			if (isset($_POST['post_category'][$taxonomy])) {
3837
+				$terms = (array) $_POST['post_category'][$taxonomy];
3838
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3839
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3840 3840
 			}
3841 3841
 
3842
-			if ( ! empty( $terms ) ) {
3843
-				foreach ( $terms as $term_id ) {
3844
-					if ( $term_id > 0 ) {
3845
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3846
-						$children               = get_term_children( $term_id, $taxonomy );
3847
-						$term_array[ $term_id ] = $count;
3842
+			if (!empty($terms)) {
3843
+				foreach ($terms as $term_id) {
3844
+					if ($term_id > 0) {
3845
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3846
+						$children               = get_term_children($term_id, $taxonomy);
3847
+						$term_array[$term_id] = $count;
3848 3848
 					}
3849 3849
 				}
3850 3850
 			}
3851 3851
 		} else { // Update reviews count for all post categories.
3852 3852
 			$term_array = array();
3853 3853
 			$post_types = geodir_get_posttypes();
3854
-			foreach ( $post_types as $post_type ) {
3854
+			foreach ($post_types as $post_type) {
3855 3855
 
3856
-				$taxonomy = geodir_get_taxonomies( $post_type );
3856
+				$taxonomy = geodir_get_taxonomies($post_type);
3857 3857
 				$taxonomy = $taxonomy[0];
3858 3858
 
3859 3859
 				$args = array(
3860 3860
 					'hide_empty' => false
3861 3861
 				);
3862 3862
 
3863
-				$terms = get_terms( $taxonomy, $args );
3863
+				$terms = get_terms($taxonomy, $args);
3864 3864
 
3865
-				foreach ( $terms as $term ) {
3866
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3867
-					$children = get_term_children( $term->term_id, $taxonomy );
3865
+				foreach ($terms as $term) {
3866
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3867
+					$children = get_term_children($term->term_id, $taxonomy);
3868 3868
 					/*if ( is_array( $children ) ) {
3869 3869
                         foreach ( $children as $child_id ) {
3870 3870
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3871 3871
                             $count = $count + $child_count;
3872 3872
                         }
3873 3873
                     }*/
3874
-					$term_array[ $term->term_id ] = $count;
3874
+					$term_array[$term->term_id] = $count;
3875 3875
 				}
3876 3876
 			}
3877 3877
 		}
3878 3878
 
3879
-		update_option( 'geodir_global_review_count', $term_array );
3879
+		update_option('geodir_global_review_count', $term_array);
3880 3880
 		//clear cache
3881
-		wp_cache_delete( 'geodir_global_review_count' );
3881
+		wp_cache_delete('geodir_global_review_count');
3882 3882
 
3883 3883
 		return $term_array;
3884 3884
 	} else {
@@ -3894,39 +3894,39 @@  discard block
 block discarded – undo
3894 3894
  * @package GeoDirectory
3895 3895
  * @return bool
3896 3896
  */
3897
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3898
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3897
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3898
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3899 3899
 		return; // do not run if importing listings
3900 3900
 	}
3901 3901
 
3902
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3902
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3903 3903
 		return;
3904 3904
 	}
3905 3905
 
3906 3906
 	$post_ID = 0;
3907
-	if ( ! empty( $post ) ) {
3908
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3907
+	if (!empty($post)) {
3908
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3909 3909
 			return;
3910 3910
 		}
3911 3911
 
3912
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3912
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3913 3913
 			return;
3914 3914
 		}
3915 3915
 
3916
-		if ( ! empty( $post->ID ) ) {
3916
+		if (!empty($post->ID)) {
3917 3917
 			$post_ID = $post->ID;
3918 3918
 		}
3919 3919
 	}
3920 3920
 
3921
-	if ( $new_status != $old_status ) {
3922
-		geodir_count_reviews_by_terms( true, $post_ID );
3921
+	if ($new_status != $old_status) {
3922
+		geodir_count_reviews_by_terms(true, $post_ID);
3923 3923
 	}
3924 3924
 
3925 3925
 	return true;
3926 3926
 }
3927 3927
 
3928
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3929
-	geodir_count_reviews_by_terms( true, $post_id );
3928
+function geodir_term_review_count_force_update_single_post($post_id) {
3929
+	geodir_count_reviews_by_terms(true, $post_id);
3930 3930
 }
3931 3931
 
3932 3932
 /*-----------------------------------------------------------------------------------*/
@@ -3943,11 +3943,11 @@  discard block
 block discarded – undo
3943 3943
  *
3944 3944
  * @return int Post count.
3945 3945
  */
3946
-function geodir_count_posts_by_term( $data, $term ) {
3946
+function geodir_count_posts_by_term($data, $term) {
3947 3947
 
3948
-	if ( $data ) {
3949
-		if ( isset( $data[ $term->term_id ] ) ) {
3950
-			return $data[ $term->term_id ];
3948
+	if ($data) {
3949
+		if (isset($data[$term->term_id])) {
3950
+			return $data[$term->term_id];
3951 3951
 		} else {
3952 3952
 			return 0;
3953 3953
 		}
@@ -3964,8 +3964,8 @@  discard block
 block discarded – undo
3964 3964
  * param array $terms An array of term objects.
3965 3965
  * @return array Sorted terms array.
3966 3966
  */
3967
-function geodir_sort_terms_by_count( $terms ) {
3968
-	usort( $terms, "geodir_sort_by_count_obj" );
3967
+function geodir_sort_terms_by_count($terms) {
3968
+	usort($terms, "geodir_sort_by_count_obj");
3969 3969
 
3970 3970
 	return $terms;
3971 3971
 }
@@ -3980,8 +3980,8 @@  discard block
 block discarded – undo
3980 3980
  *
3981 3981
  * @return array Sorted terms array.
3982 3982
  */
3983
-function geodir_sort_terms_by_review_count( $terms ) {
3984
-	usort( $terms, "geodir_sort_by_review_count_obj" );
3983
+function geodir_sort_terms_by_review_count($terms) {
3984
+	usort($terms, "geodir_sort_by_review_count_obj");
3985 3985
 
3986 3986
 	return $terms;
3987 3987
 }
@@ -3997,12 +3997,12 @@  discard block
 block discarded – undo
3997 3997
  *
3998 3998
  * @return array Sorted terms array.
3999 3999
  */
4000
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4001
-	if ( $sort == 'count' ) {
4002
-		return geodir_sort_terms_by_count( $terms );
4000
+function geodir_sort_terms($terms, $sort = 'count') {
4001
+	if ($sort == 'count') {
4002
+		return geodir_sort_terms_by_count($terms);
4003 4003
 	}
4004
-	if ( $sort == 'review_count' ) {
4005
-		return geodir_sort_terms_by_review_count( $terms );
4004
+	if ($sort == 'review_count') {
4005
+		return geodir_sort_terms_by_review_count($terms);
4006 4006
 	}
4007 4007
 }
4008 4008
 
@@ -4020,7 +4020,7 @@  discard block
 block discarded – undo
4020 4020
  *
4021 4021
  * @return bool
4022 4022
  */
4023
-function geodir_sort_by_count( $a, $b ) {
4023
+function geodir_sort_by_count($a, $b) {
4024 4024
 	return $a['count'] < $b['count'];
4025 4025
 }
4026 4026
 
@@ -4035,7 +4035,7 @@  discard block
 block discarded – undo
4035 4035
  *
4036 4036
  * @return bool
4037 4037
  */
4038
-function geodir_sort_by_count_obj( $a, $b ) {
4038
+function geodir_sort_by_count_obj($a, $b) {
4039 4039
 	return $a->count < $b->count;
4040 4040
 }
4041 4041
 
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
  *
4051 4051
  * @return bool
4052 4052
  */
4053
-function geodir_sort_by_review_count_obj( $a, $b ) {
4053
+function geodir_sort_by_review_count_obj($a, $b) {
4054 4054
 	return $a->review_count < $b->review_count;
4055 4055
 }
4056 4056
 
@@ -4067,35 +4067,35 @@  discard block
 block discarded – undo
4067 4067
 	 * @since   1.4.2
4068 4068
 	 * @package GeoDirectory
4069 4069
 	 */
4070
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4070
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4071 4071
 
4072
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4073
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4072
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4073
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4074 4074
 
4075 4075
 	/**
4076 4076
 	 * Define language constants.
4077 4077
 	 *
4078 4078
 	 * @since 1.0.0
4079 4079
 	 */
4080
-	require_once( geodir_plugin_path() . '/language.php' );
4080
+	require_once(geodir_plugin_path().'/language.php');
4081 4081
 
4082
-	$language_file = geodir_plugin_path() . '/db-language.php';
4082
+	$language_file = geodir_plugin_path().'/db-language.php';
4083 4083
 
4084 4084
 	// Load language string file if not created yet
4085
-	if ( ! file_exists( $language_file ) ) {
4085
+	if (!file_exists($language_file)) {
4086 4086
 		geodirectory_load_db_language();
4087 4087
 	}
4088 4088
 
4089
-	if ( file_exists( $language_file ) ) {
4089
+	if (file_exists($language_file)) {
4090 4090
 		/**
4091 4091
 		 * Language strings from database.
4092 4092
 		 *
4093 4093
 		 * @since 1.4.2
4094 4094
 		 */
4095 4095
 		try {
4096
-			require_once( $language_file );
4097
-		} catch ( Exception $e ) {
4098
-			error_log( 'Language Error: ' . $e->getMessage() );
4096
+			require_once($language_file);
4097
+		} catch (Exception $e) {
4098
+			error_log('Language Error: '.$e->getMessage());
4099 4099
 		}
4100 4100
 	}
4101 4101
 }
@@ -4112,19 +4112,19 @@  discard block
 block discarded – undo
4112 4112
  */
4113 4113
 function geodirectory_load_db_language() {
4114 4114
 	global $wp_filesystem;
4115
-	if ( empty( $wp_filesystem ) ) {
4116
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4115
+	if (empty($wp_filesystem)) {
4116
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4117 4117
 		WP_Filesystem();
4118 4118
 		global $wp_filesystem;
4119 4119
 	}
4120 4120
 
4121
-	$language_file = geodir_plugin_path() . '/db-language.php';
4121
+	$language_file = geodir_plugin_path().'/db-language.php';
4122 4122
 
4123
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4123
+	if (is_file($language_file) && !is_writable($language_file)) {
4124 4124
 		return false;
4125 4125
 	} // Not possible to create.
4126 4126
 
4127
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4127
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4128 4128
 		return false;
4129 4129
 	} // Not possible to create.
4130 4130
 
@@ -4137,9 +4137,9 @@  discard block
 block discarded – undo
4137 4137
 	 *
4138 4138
 	 * @param array $contents_strings Array of strings.
4139 4139
 	 */
4140
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4140
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4141 4141
 
4142
-	$contents_strings = array_unique( $contents_strings );
4142
+	$contents_strings = array_unique($contents_strings);
4143 4143
 
4144 4144
 	$contents_head   = array();
4145 4145
 	$contents_head[] = "<?php";
@@ -4156,20 +4156,20 @@  discard block
 block discarded – undo
4156 4156
 	$contents_foot[] = "";
4157 4157
 	$contents_foot[] = "";
4158 4158
 
4159
-	$contents = implode( PHP_EOL, $contents_head );
4159
+	$contents = implode(PHP_EOL, $contents_head);
4160 4160
 
4161
-	if ( ! empty( $contents_strings ) ) {
4162
-		foreach ( $contents_strings as $string ) {
4163
-			if ( is_scalar( $string ) && $string != '' ) {
4164
-				$string = str_replace( "'", "\'", $string );
4165
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4161
+	if (!empty($contents_strings)) {
4162
+		foreach ($contents_strings as $string) {
4163
+			if (is_scalar($string) && $string != '') {
4164
+				$string = str_replace("'", "\'", $string);
4165
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4166 4166
 			}
4167 4167
 		}
4168 4168
 	}
4169 4169
 
4170
-	$contents .= implode( PHP_EOL, $contents_foot );
4170
+	$contents .= implode(PHP_EOL, $contents_foot);
4171 4171
 
4172
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4172
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4173 4173
 		return false;
4174 4174
 	} // Failure; could not write file.
4175 4175
 
@@ -4189,45 +4189,45 @@  discard block
 block discarded – undo
4189 4189
  *
4190 4190
  * @return array Translation texts.
4191 4191
  */
4192
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4192
+function geodir_load_custom_field_translation($translation_texts = array()) {
4193 4193
 	global $wpdb;
4194 4194
 
4195 4195
 	// Custom fields table
4196
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4197
-	$rows = $wpdb->get_results( $sql );
4196
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4197
+	$rows = $wpdb->get_results($sql);
4198 4198
 
4199
-	if ( ! empty( $rows ) ) {
4200
-		foreach ( $rows as $row ) {
4201
-			if ( ! empty( $row->admin_title ) ) {
4202
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4199
+	if (!empty($rows)) {
4200
+		foreach ($rows as $row) {
4201
+			if (!empty($row->admin_title)) {
4202
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4203 4203
 			}
4204 4204
 
4205
-			if ( ! empty( $row->admin_desc ) ) {
4206
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4205
+			if (!empty($row->admin_desc)) {
4206
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4207 4207
 			}
4208 4208
 
4209
-			if ( ! empty( $row->site_title ) ) {
4210
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4209
+			if (!empty($row->site_title)) {
4210
+				$translation_texts[] = stripslashes_deep($row->site_title);
4211 4211
 			}
4212 4212
 
4213
-			if ( ! empty( $row->clabels ) ) {
4214
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4213
+			if (!empty($row->clabels)) {
4214
+				$translation_texts[] = stripslashes_deep($row->clabels);
4215 4215
 			}
4216 4216
 
4217
-			if ( ! empty( $row->required_msg ) ) {
4218
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4217
+			if (!empty($row->required_msg)) {
4218
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4219 4219
 			}
4220 4220
 
4221
-			if ( ! empty( $row->default_value ) ) {
4222
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4221
+			if (!empty($row->default_value)) {
4222
+				$translation_texts[] = stripslashes_deep($row->default_value);
4223 4223
 			}
4224 4224
 
4225
-			if ( ! empty( $row->option_values ) ) {
4226
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4225
+			if (!empty($row->option_values)) {
4226
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4227 4227
 
4228
-				if ( ! empty( $option_values ) ) {
4229
-					foreach ( $option_values as $option_value ) {
4230
-						if ( ! empty( $option_value['label'] ) ) {
4228
+				if (!empty($option_values)) {
4229
+					foreach ($option_values as $option_value) {
4230
+						if (!empty($option_value['label'])) {
4231 4231
 							$translation_texts[] = $option_value['label'];
4232 4232
 						}
4233 4233
 					}
@@ -4237,48 +4237,48 @@  discard block
 block discarded – undo
4237 4237
 	}
4238 4238
 
4239 4239
 	// Custom sorting fields table
4240
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4241
-	$rows = $wpdb->get_results( $sql );
4240
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4241
+	$rows = $wpdb->get_results($sql);
4242 4242
 
4243
-	if ( ! empty( $rows ) ) {
4244
-		foreach ( $rows as $row ) {
4245
-			if ( ! empty( $row->site_title ) ) {
4246
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4243
+	if (!empty($rows)) {
4244
+		foreach ($rows as $row) {
4245
+			if (!empty($row->site_title)) {
4246
+				$translation_texts[] = stripslashes_deep($row->site_title);
4247 4247
 			}
4248 4248
 
4249
-			if ( ! empty( $row->asc_title ) ) {
4250
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4249
+			if (!empty($row->asc_title)) {
4250
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4251 4251
 			}
4252 4252
 
4253
-			if ( ! empty( $row->desc_title ) ) {
4254
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4253
+			if (!empty($row->desc_title)) {
4254
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4255 4255
 			}
4256 4256
 		}
4257 4257
 	}
4258 4258
 
4259 4259
 	// Advance search filter fields table
4260
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4261
-		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4262
-		$rows = $wpdb->get_results( $sql );
4263
-
4264
-		if ( ! empty( $rows ) ) {
4265
-			foreach ( $rows as $row ) {
4266
-				if ( ! empty( $row->field_site_name ) ) {
4267
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4260
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4261
+		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4262
+		$rows = $wpdb->get_results($sql);
4263
+
4264
+		if (!empty($rows)) {
4265
+			foreach ($rows as $row) {
4266
+				if (!empty($row->field_site_name)) {
4267
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4268 4268
 				}
4269 4269
 
4270
-				if ( ! empty( $row->front_search_title ) ) {
4271
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4270
+				if (!empty($row->front_search_title)) {
4271
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4272 4272
 				}
4273 4273
 
4274
-				if ( ! empty( $row->field_desc ) ) {
4275
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4274
+				if (!empty($row->field_desc)) {
4275
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4276 4276
 				}
4277 4277
 			}
4278 4278
 		}
4279 4279
 	}
4280 4280
 
4281
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4281
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4282 4282
 
4283 4283
 	return $translation_texts;
4284 4284
 }
@@ -4300,7 +4300,7 @@  discard block
 block discarded – undo
4300 4300
 	 *
4301 4301
 	 * @param array $geodir_allowed_mime_types and file extensions.
4302 4302
 	 */
4303
-	return apply_filters( 'geodir_allowed_mime_types', array(
4303
+	return apply_filters('geodir_allowed_mime_types', array(
4304 4304
 			'Image'       => array( // Image formats.
4305 4305
 				'jpg'  => 'image/jpeg',
4306 4306
 				'jpe'  => 'image/jpeg',
@@ -4368,18 +4368,18 @@  discard block
 block discarded – undo
4368 4368
  *
4369 4369
  * @return string User display name.
4370 4370
  */
4371
-function geodir_get_client_name( $user_id ) {
4371
+function geodir_get_client_name($user_id) {
4372 4372
 	$client_name = '';
4373 4373
 
4374
-	$user_data = get_userdata( $user_id );
4374
+	$user_data = get_userdata($user_id);
4375 4375
 
4376
-	if ( ! empty( $user_data ) ) {
4377
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4378
-			$client_name = trim( $user_data->display_name );
4379
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4380
-			$client_name = trim( $user_data->user_nicename );
4376
+	if (!empty($user_data)) {
4377
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4378
+			$client_name = trim($user_data->display_name);
4379
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4380
+			$client_name = trim($user_data->user_nicename);
4381 4381
 		} else {
4382
-			$client_name = trim( $user_data->user_login );
4382
+			$client_name = trim($user_data->user_login);
4383 4383
 		}
4384 4384
 	}
4385 4385
 
@@ -4387,19 +4387,19 @@  discard block
 block discarded – undo
4387 4387
 }
4388 4388
 
4389 4389
 
4390
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4390
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4391 4391
 /*
4392 4392
  * Add location variables to wpseo replacements.
4393 4393
  *
4394 4394
  * @since 1.5.4
4395 4395
  */
4396
-function geodir_wpseo_replacements( $vars ) {
4396
+function geodir_wpseo_replacements($vars) {
4397 4397
 
4398 4398
 	global $wp;
4399 4399
 	$title = '';
4400 4400
 	// location variables
4401 4401
 	$gd_post_type   = geodir_get_current_posttype();
4402
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4402
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4403 4403
 	/**
4404 4404
 	 * Filter the title variables location variables array
4405 4405
 	 *
@@ -4409,105 +4409,105 @@  discard block
 block discarded – undo
4409 4409
 	 * @param array $location_array The array of location variables.
4410 4410
 	 * @param array $vars           The page title variables.
4411 4411
 	 */
4412
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4412
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4413 4413
 	$location_titles = array();
4414
-	if ( get_query_var( 'gd_country_full' ) ) {
4415
-		if ( get_query_var( 'gd_country_full' ) ) {
4416
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4414
+	if (get_query_var('gd_country_full')) {
4415
+		if (get_query_var('gd_country_full')) {
4416
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4417 4417
 		}
4418
-		if ( get_query_var( 'gd_region_full' ) ) {
4419
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4418
+		if (get_query_var('gd_region_full')) {
4419
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4420 4420
 		}
4421
-		if ( get_query_var( 'gd_city_full' ) ) {
4422
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4421
+		if (get_query_var('gd_city_full')) {
4422
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4423 4423
 		}
4424 4424
 	}
4425 4425
 	$location_single = '';
4426
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4427
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4428
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4426
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4427
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4428
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4429 4429
 
4430 4430
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4431 4431
 
4432
-	if ( function_exists( 'get_actual_location_name' ) ) {
4433
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4434
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4435
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4432
+	if (function_exists('get_actual_location_name')) {
4433
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4434
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4435
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4436 4436
 	}
4437 4437
 
4438
-	if ( $gd_city != '' ) {
4439
-		if ( $gd_city_actual != '' ) {
4438
+	if ($gd_city != '') {
4439
+		if ($gd_city_actual != '') {
4440 4440
 			$gd_city = $gd_city_actual;
4441 4441
 		} else {
4442
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4443
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4444
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4442
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4443
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4444
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4445 4445
 		}
4446 4446
 		$location_single = $gd_city;
4447 4447
 
4448
-	} else if ( $gd_region != '' ) {
4449
-		if ( $gd_region_actual != '' ) {
4448
+	} else if ($gd_region != '') {
4449
+		if ($gd_region_actual != '') {
4450 4450
 			$gd_region = $gd_region_actual;
4451 4451
 		} else {
4452
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4453
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4454
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4452
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4453
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4454
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4455 4455
 		}
4456 4456
 
4457 4457
 		$location_single = $gd_region;
4458
-	} else if ( $gd_country != '' ) {
4459
-		if ( $gd_country_actual != '' ) {
4458
+	} else if ($gd_country != '') {
4459
+		if ($gd_country_actual != '') {
4460 4460
 			$gd_country = $gd_country_actual;
4461 4461
 		} else {
4462
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4463
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4464
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4462
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4463
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4464
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4465 4465
 		}
4466 4466
 
4467 4467
 		$location_single = $gd_country;
4468 4468
 	}
4469 4469
 
4470
-	if ( ! empty( $location_array ) ) {
4470
+	if (!empty($location_array)) {
4471 4471
 
4472
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4473
-		$location_array       = array_reverse( $location_array );
4472
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4473
+		$location_array       = array_reverse($location_array);
4474 4474
 
4475
-		foreach ( $location_array as $location_type => $location ) {
4476
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4477
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4475
+		foreach ($location_array as $location_type => $location) {
4476
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4477
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4478 4478
 
4479
-			$location_name = geodir_ucwords( $gd_location_link_text );
4480
-			$location_name = __( $location_name, 'geodirectory' );
4479
+			$location_name = geodir_ucwords($gd_location_link_text);
4480
+			$location_name = __($location_name, 'geodirectory');
4481 4481
 
4482
-			if ( $actual_location_name ) {
4483
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4484
-				$location_name = get_actual_location_name( $location_type, $location, true );
4482
+			if ($actual_location_name) {
4483
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4484
+				$location_name = get_actual_location_name($location_type, $location, true);
4485 4485
 			}
4486 4486
 
4487 4487
 			$location_titles[] = $location_name;
4488 4488
 		}
4489
-		if ( ! empty( $location_titles ) ) {
4490
-			$location_titles = array_unique( $location_titles );
4489
+		if (!empty($location_titles)) {
4490
+			$location_titles = array_unique($location_titles);
4491 4491
 		}
4492 4492
 	}
4493 4493
 
4494 4494
 
4495
-	if ( ! empty( $location_titles ) ) {
4496
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4495
+	if (!empty($location_titles)) {
4496
+		$vars['%%location%%'] = implode(", ", $location_titles);
4497 4497
 	}
4498 4498
 
4499 4499
 
4500
-	if ( ! empty( $location_titles ) ) {
4501
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4500
+	if (!empty($location_titles)) {
4501
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4502 4502
 	}
4503 4503
 
4504 4504
 
4505
-	if ( $location_single ) {
4506
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4505
+	if ($location_single) {
4506
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4507 4507
 	}
4508 4508
 
4509 4509
 
4510
-	if ( $location_single ) {
4510
+	if ($location_single) {
4511 4511
 		$vars['%%location_single%%'] = $location_single;
4512 4512
 	}
4513 4513
 
@@ -4520,13 +4520,13 @@  discard block
 block discarded – undo
4520 4520
 	 * @param string $vars          The title with variables.
4521 4521
 	 * @param array $location_array The array of location variables.
4522 4522
 	 */
4523
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4523
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4524 4524
 }
4525 4525
 
4526 4526
 
4527
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4528
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4529
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4527
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4528
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4529
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4530 4530
 
4531 4531
 /**
4532 4532
  * Filter the title variables.
@@ -4568,14 +4568,14 @@  discard block
 block discarded – undo
4568 4568
  *
4569 4569
  * @return string Title after filtered variables.
4570 4570
  */
4571
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4571
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4572 4572
 	global $wp, $post;
4573 4573
 
4574
-	if ( ! $gd_page || ! $title ) {
4574
+	if (!$gd_page || !$title) {
4575 4575
 		return $title; // if no a GD page then bail.
4576 4576
 	}
4577 4577
 
4578
-	if ( $sep == '' ) {
4578
+	if ($sep == '') {
4579 4579
 		/**
4580 4580
 		 * Filter the page title separator.
4581 4581
 		 *
@@ -4584,100 +4584,100 @@  discard block
 block discarded – undo
4584 4584
 		 *
4585 4585
 		 * @param string $sep The separator, default: `|`.
4586 4586
 		 */
4587
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4587
+		$sep = apply_filters('geodir_page_title_separator', '|');
4588 4588
 	}
4589 4589
 
4590
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4591
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4590
+	if (strpos($title, '%%title%%') !== false) {
4591
+		$title = str_replace("%%title%%", $post->post_title, $title);
4592 4592
 	}
4593 4593
 
4594
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4595
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4594
+	if (strpos($title, '%%sitename%%') !== false) {
4595
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4596 4596
 	}
4597 4597
 
4598
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4599
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4598
+	if (strpos($title, '%%sitedesc%%') !== false) {
4599
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4600 4600
 	}
4601 4601
 
4602
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4603
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4602
+	if (strpos($title, '%%excerpt%%') !== false) {
4603
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4604 4604
 	}
4605 4605
 
4606
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4607
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4608
-	} else if ( $gd_page == 'add-listing' ) {
4609
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4610
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4611
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4606
+	if ($gd_page == 'search' || $gd_page == 'author') {
4607
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4608
+	} else if ($gd_page == 'add-listing') {
4609
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4610
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4611
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4612 4612
 		$post_type = $post->post_type;
4613 4613
 	} else {
4614
-		$post_type = get_query_var( 'post_type' );
4614
+		$post_type = get_query_var('post_type');
4615 4615
 	}
4616 4616
 
4617
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4617
+	if (strpos($title, '%%pt_single%%') !== false) {
4618 4618
 		$singular_name = '';
4619
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4620
-			$singular_name = __( $singular_name, 'geodirectory' );
4619
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4620
+			$singular_name = __($singular_name, 'geodirectory');
4621 4621
 		}
4622 4622
 
4623
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4623
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4624 4624
 	}
4625 4625
 
4626
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4626
+	if (strpos($title, '%%pt_plural%%') !== false) {
4627 4627
 		$plural_name = '';
4628
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4629
-			$plural_name = __( $plural_name, 'geodirectory' );
4628
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4629
+			$plural_name = __($plural_name, 'geodirectory');
4630 4630
 		}
4631 4631
 
4632
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4632
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4633 4633
 	}
4634 4634
 
4635
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4635
+	if (strpos($title, '%%category%%') !== false) {
4636 4636
 		$cat_name = '';
4637 4637
 
4638
-		if ( $gd_page == 'detail' ) {
4639
-			if ( $post->default_category ) {
4640
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4641
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4638
+		if ($gd_page == 'detail') {
4639
+			if ($post->default_category) {
4640
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4641
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4642 4642
 			}
4643
-		} else if ( $gd_page == 'listing' ) {
4643
+		} else if ($gd_page == 'listing') {
4644 4644
 			$queried_object = get_queried_object();
4645
-			if ( isset( $queried_object->name ) ) {
4645
+			if (isset($queried_object->name)) {
4646 4646
 				$cat_name = $queried_object->name;
4647 4647
 			}
4648 4648
 		}
4649
-		$title = str_replace( "%%category%%", $cat_name, $title );
4649
+		$title = str_replace("%%category%%", $cat_name, $title);
4650 4650
 	}
4651 4651
 
4652
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4652
+	if (strpos($title, '%%tag%%') !== false) {
4653 4653
 		$cat_name = '';
4654 4654
 
4655
-		if ( $gd_page == 'detail' ) {
4656
-			if ( $post->default_category ) {
4657
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4658
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4655
+		if ($gd_page == 'detail') {
4656
+			if ($post->default_category) {
4657
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4658
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4659 4659
 			}
4660
-		} else if ( $gd_page == 'listing' ) {
4660
+		} else if ($gd_page == 'listing') {
4661 4661
 			$queried_object = get_queried_object();
4662
-			if ( isset( $queried_object->name ) ) {
4662
+			if (isset($queried_object->name)) {
4663 4663
 				$cat_name = $queried_object->name;
4664 4664
 			}
4665 4665
 		}
4666
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4666
+		$title = str_replace("%%tag%%", $cat_name, $title);
4667 4667
 	}
4668 4668
 
4669
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4670
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4671
-		$title = str_replace( "%%id%%", $ID, $title );
4669
+	if (strpos($title, '%%id%%') !== false) {
4670
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4671
+		$title = str_replace("%%id%%", $ID, $title);
4672 4672
 	}
4673 4673
 
4674
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4675
-		$title = str_replace( "%%sep%%", $sep, $title );
4674
+	if (strpos($title, '%%sep%%') !== false) {
4675
+		$title = str_replace("%%sep%%", $sep, $title);
4676 4676
 	}
4677 4677
 
4678 4678
 	// location variables
4679 4679
 	$gd_post_type   = geodir_get_current_posttype();
4680
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4680
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4681 4681
 	/**
4682 4682
 	 * Filter the title variables location variables array
4683 4683
 	 *
@@ -4689,166 +4689,166 @@  discard block
 block discarded – undo
4689 4689
 	 * @param string $gd_page       The page being filtered.
4690 4690
 	 * @param string $sep           The separator, default: `|`.
4691 4691
 	 */
4692
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4692
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4693 4693
 	$location_titles = array();
4694
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4695
-		if ( get_query_var( 'gd_country_full' ) ) {
4696
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4694
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4695
+		if (get_query_var('gd_country_full')) {
4696
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4697 4697
 		}
4698
-		if ( get_query_var( 'gd_region_full' ) ) {
4699
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4698
+		if (get_query_var('gd_region_full')) {
4699
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4700 4700
 		}
4701
-		if ( get_query_var( 'gd_city_full' ) ) {
4702
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4701
+		if (get_query_var('gd_city_full')) {
4702
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4703 4703
 		}
4704 4704
 	}
4705 4705
 	$location_single = '';
4706
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4707
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4708
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4706
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4707
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4708
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4709 4709
 
4710 4710
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4711 4711
 
4712
-	if ( function_exists( 'get_actual_location_name' ) ) {
4713
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4714
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4715
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4712
+	if (function_exists('get_actual_location_name')) {
4713
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4714
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4715
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4716 4716
 	}
4717 4717
 
4718
-	if ( $gd_city != '' ) {
4719
-		if ( $gd_city_actual != '' ) {
4718
+	if ($gd_city != '') {
4719
+		if ($gd_city_actual != '') {
4720 4720
 			$gd_city = $gd_city_actual;
4721 4721
 		} else {
4722
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4723
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4724
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4722
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4723
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4724
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4725 4725
 		}
4726 4726
 		$location_single = $gd_city;
4727 4727
 
4728
-	} else if ( $gd_region != '' ) {
4729
-		if ( $gd_region_actual != '' ) {
4728
+	} else if ($gd_region != '') {
4729
+		if ($gd_region_actual != '') {
4730 4730
 			$gd_region = $gd_region_actual;
4731 4731
 		} else {
4732
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4733
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4734
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4732
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4733
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4734
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4735 4735
 		}
4736 4736
 
4737 4737
 		$location_single = $gd_region;
4738
-	} else if ( $gd_country != '' ) {
4739
-		if ( $gd_country_actual != '' ) {
4738
+	} else if ($gd_country != '') {
4739
+		if ($gd_country_actual != '') {
4740 4740
 			$gd_country = $gd_country_actual;
4741 4741
 		} else {
4742
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4743
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4744
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4742
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4743
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4744
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4745 4745
 		}
4746 4746
 
4747 4747
 		$location_single = $gd_country;
4748 4748
 	}
4749 4749
 
4750
-	if ( ! empty( $location_array ) ) {
4750
+	if (!empty($location_array)) {
4751 4751
 
4752
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4753
-		$location_array       = array_reverse( $location_array );
4752
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4753
+		$location_array       = array_reverse($location_array);
4754 4754
 
4755
-		foreach ( $location_array as $location_type => $location ) {
4756
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4757
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4755
+		foreach ($location_array as $location_type => $location) {
4756
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4757
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4758 4758
 
4759
-			$location_name = geodir_ucwords( $gd_location_link_text );
4760
-			$location_name = __( $location_name, 'geodirectory' );
4759
+			$location_name = geodir_ucwords($gd_location_link_text);
4760
+			$location_name = __($location_name, 'geodirectory');
4761 4761
 
4762
-			if ( $actual_location_name ) {
4763
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4764
-				$location_name = get_actual_location_name( $location_type, $location, true );
4762
+			if ($actual_location_name) {
4763
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4764
+				$location_name = get_actual_location_name($location_type, $location, true);
4765 4765
 			}
4766 4766
 
4767 4767
 			$location_titles[] = $location_name;
4768 4768
 		}
4769
-		if ( ! empty( $location_titles ) ) {
4770
-			$location_titles = array_unique( $location_titles );
4769
+		if (!empty($location_titles)) {
4770
+			$location_titles = array_unique($location_titles);
4771 4771
 		}
4772 4772
 	}
4773 4773
 
4774 4774
 
4775
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4775
+	if (strpos($title, '%%location%%') !== false) {
4776 4776
 		$location = '';
4777
-		if ( $location_titles ) {
4778
-			$location = implode( ", ", $location_titles );
4777
+		if ($location_titles) {
4778
+			$location = implode(", ", $location_titles);
4779 4779
 		}
4780
-		$title = str_replace( "%%location%%", $location, $title );
4780
+		$title = str_replace("%%location%%", $location, $title);
4781 4781
 	}
4782 4782
 
4783
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4783
+	if (strpos($title, '%%in_location%%') !== false) {
4784 4784
 		$location = '';
4785
-		if ( $location_titles ) {
4786
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4785
+		if ($location_titles) {
4786
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4787 4787
 		}
4788
-		$title = str_replace( "%%in_location%%", $location, $title );
4788
+		$title = str_replace("%%in_location%%", $location, $title);
4789 4789
 	}
4790 4790
 
4791
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4792
-		if ( $location_single ) {
4793
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4791
+	if (strpos($title, '%%in_location_single%%') !== false) {
4792
+		if ($location_single) {
4793
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4794 4794
 		}
4795
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4795
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4796 4796
 	}
4797 4797
 
4798
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4799
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4798
+	if (strpos($title, '%%location_single%%') !== false) {
4799
+		$title = str_replace("%%location_single%%", $location_single, $title);
4800 4800
 	}
4801 4801
 
4802 4802
 
4803
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4803
+	if (strpos($title, '%%search_term%%') !== false) {
4804 4804
 		$search_term = '';
4805
-		if ( isset( $_REQUEST['s'] ) ) {
4806
-			$search_term = esc_attr( $_REQUEST['s'] );
4805
+		if (isset($_REQUEST['s'])) {
4806
+			$search_term = esc_attr($_REQUEST['s']);
4807 4807
 		}
4808
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4808
+		$title = str_replace("%%search_term%%", $search_term, $title);
4809 4809
 	}
4810 4810
 
4811
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4811
+	if (strpos($title, '%%search_near%%') !== false) {
4812 4812
 		$search_term = '';
4813
-		if ( isset( $_REQUEST['snear'] ) ) {
4814
-			$search_term = esc_attr( $_REQUEST['snear'] );
4813
+		if (isset($_REQUEST['snear'])) {
4814
+			$search_term = esc_attr($_REQUEST['snear']);
4815 4815
 		}
4816
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4816
+		$title = str_replace("%%search_near%%", $search_term, $title);
4817 4817
 	}
4818 4818
 
4819
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4820
-		if ( is_author() ) {
4821
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4819
+	if (strpos($title, '%%name%%') !== false) {
4820
+		if (is_author()) {
4821
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4822 4822
 			$author_name = $curauth->display_name;
4823 4823
 		} else {
4824 4824
 			$author_name = get_the_author();
4825 4825
 		}
4826
-		if ( ! $author_name || $author_name === '' ) {
4826
+		if (!$author_name || $author_name === '') {
4827 4827
 			$queried_object = get_queried_object();
4828 4828
 
4829
-			if ( isset( $queried_object->data->user_nicename ) ) {
4829
+			if (isset($queried_object->data->user_nicename)) {
4830 4830
 				$author_name = $queried_object->data->display_name;
4831 4831
 			}
4832 4832
 		}
4833
-		$title = str_replace( "%%name%%", $author_name, $title );
4833
+		$title = str_replace("%%name%%", $author_name, $title);
4834 4834
 	}
4835 4835
 
4836
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4837
-		$page  = geodir_title_meta_page( $sep );
4838
-		$title = str_replace( "%%page%%", $page, $title );
4836
+	if (strpos($title, '%%page%%') !== false) {
4837
+		$page  = geodir_title_meta_page($sep);
4838
+		$title = str_replace("%%page%%", $page, $title);
4839 4839
 	}
4840
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4840
+	if (strpos($title, '%%pagenumber%%') !== false) {
4841 4841
 		$pagenumber = geodir_title_meta_pagenumber();
4842
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4842
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4843 4843
 	}
4844
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4844
+	if (strpos($title, '%%pagetotal%%') !== false) {
4845 4845
 		$pagetotal = geodir_title_meta_pagetotal();
4846
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4846
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4847 4847
 	}
4848 4848
 
4849
-	$title = wptexturize( $title );
4850
-	$title = convert_chars( $title );
4851
-	$title = esc_html( $title );
4849
+	$title = wptexturize($title);
4850
+	$title = convert_chars($title);
4851
+	$title = esc_html($title);
4852 4852
 
4853 4853
 	/**
4854 4854
 	 * Filter the title variables after standard ones have been filtered.
@@ -4862,7 +4862,7 @@  discard block
 block discarded – undo
4862 4862
 	 * @param string $sep           The separator, default: `|`.
4863 4863
 	 */
4864 4864
 
4865
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4865
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4866 4866
 }
4867 4867
 
4868 4868
 /**
@@ -4875,82 +4875,82 @@  discard block
 block discarded – undo
4875 4875
  *
4876 4876
  * @return array Translation texts.
4877 4877
  */
4878
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4879
-	$gd_post_types = geodir_get_posttypes( 'array' );
4878
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4879
+	$gd_post_types = geodir_get_posttypes('array');
4880 4880
 
4881
-	if ( ! empty( $gd_post_types ) ) {
4882
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4883
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4884
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4885
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4881
+	if (!empty($gd_post_types)) {
4882
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4883
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4884
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4885
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4886 4886
 
4887
-			if ( ! empty( $labels ) ) {
4888
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4887
+			if (!empty($labels)) {
4888
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4889 4889
 					$translation_texts[] = $labels['name'];
4890 4890
 				}
4891
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4891
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4892 4892
 					$translation_texts[] = $labels['singular_name'];
4893 4893
 				}
4894
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4894
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4895 4895
 					$translation_texts[] = $labels['add_new'];
4896 4896
 				}
4897
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4897
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4898 4898
 					$translation_texts[] = $labels['add_new_item'];
4899 4899
 				}
4900
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4900
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4901 4901
 					$translation_texts[] = $labels['edit_item'];
4902 4902
 				}
4903
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4903
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4904 4904
 					$translation_texts[] = $labels['new_item'];
4905 4905
 				}
4906
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4906
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4907 4907
 					$translation_texts[] = $labels['view_item'];
4908 4908
 				}
4909
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4909
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4910 4910
 					$translation_texts[] = $labels['search_items'];
4911 4911
 				}
4912
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4912
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4913 4913
 					$translation_texts[] = $labels['not_found'];
4914 4914
 				}
4915
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4915
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4916 4916
 					$translation_texts[] = $labels['not_found_in_trash'];
4917 4917
 				}
4918
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4918
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4919 4919
 					$translation_texts[] = $labels['label_post_profile'];
4920 4920
 				}
4921
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4921
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4922 4922
 					$translation_texts[] = $labels['label_post_info'];
4923 4923
 				}
4924
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4924
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4925 4925
 					$translation_texts[] = $labels['label_post_images'];
4926 4926
 				}
4927
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4927
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4928 4928
 					$translation_texts[] = $labels['label_post_map'];
4929 4929
 				}
4930
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4930
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4931 4931
 					$translation_texts[] = $labels['label_reviews'];
4932 4932
 				}
4933
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4933
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4934 4934
 					$translation_texts[] = $labels['label_related_listing'];
4935 4935
 				}
4936 4936
 			}
4937 4937
 
4938
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4939
-				$translation_texts[] = normalize_whitespace( $description );
4938
+			if ($description != '' && !in_array($description, $translation_texts)) {
4939
+				$translation_texts[] = normalize_whitespace($description);
4940 4940
 			}
4941 4941
 
4942
-			if ( ! empty( $seo ) ) {
4943
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4944
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4942
+			if (!empty($seo)) {
4943
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4944
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4945 4945
 				}
4946 4946
 
4947
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4948
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4947
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4948
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4949 4949
 				}
4950 4950
 			}
4951 4951
 		}
4952 4952
 	}
4953
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4953
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4954 4954
 
4955 4955
 	return $translation_texts;
4956 4956
 }
@@ -4965,27 +4965,27 @@  discard block
 block discarded – undo
4965 4965
  *
4966 4966
  * @return array Location terms.
4967 4967
  */
4968
-function geodir_remove_location_terms( $location_terms = array() ) {
4969
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4968
+function geodir_remove_location_terms($location_terms = array()) {
4969
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4970 4970
 
4971
-	if ( ! empty( $location_terms ) && $location_manager ) {
4972
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4973
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4971
+	if (!empty($location_terms) && $location_manager) {
4972
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4973
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4974 4974
 
4975
-		if ( $hide_region_part && $hide_country_part ) {
4976
-			if ( isset( $location_terms['gd_country'] ) ) {
4977
-				unset( $location_terms['gd_country'] );
4975
+		if ($hide_region_part && $hide_country_part) {
4976
+			if (isset($location_terms['gd_country'])) {
4977
+				unset($location_terms['gd_country']);
4978 4978
 			}
4979
-			if ( isset( $location_terms['gd_region'] ) ) {
4980
-				unset( $location_terms['gd_region'] );
4979
+			if (isset($location_terms['gd_region'])) {
4980
+				unset($location_terms['gd_region']);
4981 4981
 			}
4982
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4983
-			if ( isset( $location_terms['gd_region'] ) ) {
4984
-				unset( $location_terms['gd_region'] );
4982
+		} else if ($hide_region_part && !$hide_country_part) {
4983
+			if (isset($location_terms['gd_region'])) {
4984
+				unset($location_terms['gd_region']);
4985 4985
 			}
4986
-		} else if ( ! $hide_region_part && $hide_country_part ) {
4987
-			if ( isset( $location_terms['gd_country'] ) ) {
4988
-				unset( $location_terms['gd_country'] );
4986
+		} else if (!$hide_region_part && $hide_country_part) {
4987
+			if (isset($location_terms['gd_country'])) {
4988
+				unset($location_terms['gd_country']);
4989 4989
 			}
4990 4990
 		}
4991 4991
 	}
@@ -5003,33 +5003,33 @@  discard block
 block discarded – undo
5003 5003
  * @param WP_Post $post Post object.
5004 5004
  * @param bool $update  Whether this is an existing listing being updated or not.
5005 5005
  */
5006
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5007
-	if ( ! $update ) {
5006
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5007
+	if (!$update) {
5008 5008
 		return;
5009 5009
 	}
5010 5010
 
5011
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5012
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5011
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5012
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5013 5013
 	$inline_save = $action == 'inline-save' ? true : false;
5014 5014
 
5015
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5015
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5016 5016
 		return;
5017 5017
 	}
5018 5018
 
5019
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5019
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5020 5020
 		return;
5021 5021
 	}
5022 5022
 
5023 5023
 	$user_id = (int) get_current_user_id();
5024 5024
 
5025
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5026
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5025
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5026
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5027 5027
 
5028
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5029
-			$from_email   = get_option( 'site_email' );
5028
+		if ($user_id == $author_id && !is_super_admin()) {
5029
+			$from_email   = get_option('site_email');
5030 5030
 			$from_name    = get_site_emailName();
5031
-			$to_email     = get_option( 'admin_email' );
5032
-			$to_name      = get_option( 'name' );
5031
+			$to_email     = get_option('admin_email');
5032
+			$to_name      = get_option('name');
5033 5033
 			$message_type = 'listing_edited';
5034 5034
 
5035 5035
 			$notify_edited = true;
@@ -5041,9 +5041,9 @@  discard block
 block discarded – undo
5041 5041
 			 * @param bool $notify_edited Notify on listing edited by author?
5042 5042
 			 * @param object $post        The current post object.
5043 5043
 			 */
5044
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5044
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5045 5045
 
5046
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5046
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5047 5047
 		}
5048 5048
 	}
5049 5049
 }
@@ -5058,14 +5058,14 @@  discard block
 block discarded – undo
5058 5058
  *
5059 5059
  * @return string|null The current page start & end numbering.
5060 5060
  */
5061
-function geodir_title_meta_page( $sep ) {
5061
+function geodir_title_meta_page($sep) {
5062 5062
 	$replacement = null;
5063 5063
 
5064
-	$max = geodir_title_meta_pagenumbering( 'max' );
5065
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5064
+	$max = geodir_title_meta_pagenumbering('max');
5065
+	$nr  = geodir_title_meta_pagenumbering('nr');
5066 5066
 
5067
-	if ( $max > 1 && $nr > 1 ) {
5068
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5067
+	if ($max > 1 && $nr > 1) {
5068
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5069 5069
 	}
5070 5070
 
5071 5071
 	return $replacement;
@@ -5082,8 +5082,8 @@  discard block
 block discarded – undo
5082 5082
 function geodir_title_meta_pagenumber() {
5083 5083
 	$replacement = null;
5084 5084
 
5085
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5086
-	if ( isset( $nr ) && $nr > 0 ) {
5085
+	$nr = geodir_title_meta_pagenumbering('nr');
5086
+	if (isset($nr) && $nr > 0) {
5087 5087
 		$replacement = (string) $nr;
5088 5088
 	}
5089 5089
 
@@ -5101,8 +5101,8 @@  discard block
 block discarded – undo
5101 5101
 function geodir_title_meta_pagetotal() {
5102 5102
 	$replacement = null;
5103 5103
 
5104
-	$max = geodir_title_meta_pagenumbering( 'max' );
5105
-	if ( isset( $max ) && $max > 0 ) {
5104
+	$max = geodir_title_meta_pagenumbering('max');
5105
+	if (isset($max) && $max > 0) {
5106 5106
 		$replacement = (string) $max;
5107 5107
 	}
5108 5108
 
@@ -5122,36 +5122,36 @@  discard block
 block discarded – undo
5122 5122
  *
5123 5123
  * @return int|null The current page numbering.
5124 5124
  */
5125
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5125
+function geodir_title_meta_pagenumbering($request = 'nr') {
5126 5126
 	global $wp_query, $post;
5127 5127
 	$max_num_pages = null;
5128 5128
 	$page_number   = null;
5129 5129
 
5130 5130
 	$max_num_pages = 1;
5131 5131
 
5132
-	if ( ! is_singular() ) {
5133
-		$page_number = get_query_var( 'paged' );
5134
-		if ( $page_number === 0 || $page_number === '' ) {
5132
+	if (!is_singular()) {
5133
+		$page_number = get_query_var('paged');
5134
+		if ($page_number === 0 || $page_number === '') {
5135 5135
 			$page_number = 1;
5136 5136
 		}
5137 5137
 
5138
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5138
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5139 5139
 			$max_num_pages = $wp_query->max_num_pages;
5140 5140
 		}
5141 5141
 	} else {
5142
-		$page_number = get_query_var( 'page' );
5143
-		if ( $page_number === 0 || $page_number === '' ) {
5142
+		$page_number = get_query_var('page');
5143
+		if ($page_number === 0 || $page_number === '') {
5144 5144
 			$page_number = 1;
5145 5145
 		}
5146 5146
 
5147
-		if ( isset( $post->post_content ) ) {
5148
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5147
+		if (isset($post->post_content)) {
5148
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5149 5149
 		}
5150 5150
 	}
5151 5151
 
5152 5152
 	$return = null;
5153 5153
 
5154
-	switch ( $request ) {
5154
+	switch ($request) {
5155 5155
 		case 'nr':
5156 5156
 			$return = $page_number;
5157 5157
 			break;
@@ -5172,14 +5172,14 @@  discard block
 block discarded – undo
5172 5172
  *
5173 5173
  * @return array Terms.
5174 5174
  */
5175
-function geodir_filter_empty_terms( $terms ) {
5176
-	if ( empty( $terms ) ) {
5175
+function geodir_filter_empty_terms($terms) {
5176
+	if (empty($terms)) {
5177 5177
 		return $terms;
5178 5178
 	}
5179 5179
 
5180 5180
 	$return = array();
5181
-	foreach ( $terms as $term ) {
5182
-		if ( isset( $term->count ) && $term->count > 0 ) {
5181
+	foreach ($terms as $term) {
5182
+		if (isset($term->count) && $term->count > 0) {
5183 5183
 			$return[] = $term;
5184 5184
 		} else {
5185 5185
 			/**
@@ -5190,7 +5190,7 @@  discard block
 block discarded – undo
5190 5190
 			 * @param array $return The array of terms to return.
5191 5191
 			 * @param object $term  The term object.
5192 5192
 			 */
5193
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5193
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5194 5194
 		}
5195 5195
 	}
5196 5196
 
@@ -5207,12 +5207,12 @@  discard block
 block discarded – undo
5207 5207
  *
5208 5208
  * @return array
5209 5209
  */
5210
-function geodir_remove_hentry( $class ) {
5211
-	if ( geodir_is_page( 'detail' ) ) {
5212
-		$class = array_diff( $class, array( 'hentry' ) );
5210
+function geodir_remove_hentry($class) {
5211
+	if (geodir_is_page('detail')) {
5212
+		$class = array_diff($class, array('hentry'));
5213 5213
 	}
5214 5214
 
5215 5215
 	return $class;
5216 5216
 }
5217 5217
 
5218
-add_filter( 'post_class', 'geodir_remove_hentry' );
5219 5218
\ No newline at end of file
5219
+add_filter('post_class', 'geodir_remove_hentry');
5220 5220
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,8 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
 	if ( is_ssl() ) :
31 31
 		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
-	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
+	else {
33
+		:
34
+		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
35
+	}
34 36
 	endif;
35 37
 }
36 38
 
@@ -764,7 +766,7 @@  discard block
 block discarded – undo
764 766
 			$post_author = get_post_field( 'post_author', $post_id );
765 767
 			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
766 768
 				$toEmailName = __('Business Owner','geodirectory');
767
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
769
+			} elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
768 770
 				$toEmailName = __('Business Owner','geodirectory');
769 771
 			}
770 772
 
@@ -1569,12 +1571,14 @@  discard block
 block discarded – undo
1569 1571
 	 */
1570 1572
 	function geodir_allow_wpadmin() {
1571 1573
 		global $wpdb;
1572
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1574
+		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) {
1575
+			// checking action in request to allow ajax request go through
1573 1576
 		{
1574 1577
 			if ( current_user_can( 'administrator' ) ) {
1575 1578
 			} else {
1576 1579
 
1577
-				wp_redirect( home_url() );
1580
+				wp_redirect( home_url() );
1581
+		}
1578 1582
 				exit;
1579 1583
 			}
1580 1584
 
Please login to merge, or discard this patch.