Test Failed
Pull Request — master (#410)
by Kiran
17:36
created
geodirectory-functions/custom_functions.php 1 patch
Spacing   +706 added lines, -706 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1036,20 +1036,20 @@  discard block
 block discarded – undo
1036 1036
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1037 1037
 
1038 1038
 	$is_geodir_page = geodir_is_geodir_page();
1039
-	if ( ! $is_geodir_page ) {
1039
+	if (!$is_geodir_page) {
1040 1040
 		return;
1041 1041
 	}// if non GD page, bail
1042 1042
 
1043 1043
 	$use_gd_meta = true;
1044
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1044
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1045 1045
 		$use_gd_meta = false;
1046 1046
 
1047
-		if ( geodir_is_page( 'search' ) ) {
1047
+		if (geodir_is_page('search')) {
1048 1048
 			$use_gd_meta = true;
1049 1049
 		}
1050 1050
 	}
1051 1051
 
1052
-	if ( ! $use_gd_meta ) {
1052
+	if (!$use_gd_meta) {
1053 1053
 		return;
1054 1054
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1055 1055
 
@@ -1057,68 +1057,68 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 	$all_postypes = geodir_get_posttypes();
1059 1059
 
1060
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1060
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1061 1061
 
1062 1062
 	$meta_desc = '';
1063 1063
 	$meta_key  = '';
1064
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1064
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1065 1065
 		/**
1066 1066
 		 * Filter SEO meta location description.
1067 1067
 		 *
1068 1068
 		 * @since 1.0.0
1069 1069
 		 */
1070
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1070
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1071 1071
 		$meta_desc .= '';
1072 1072
 	}
1073
-	if ( have_posts() && is_single() OR is_page() ) {
1074
-		while ( have_posts() ) {
1073
+	if (have_posts() && is_single() OR is_page()) {
1074
+		while (have_posts()) {
1075 1075
 			the_post();
1076 1076
 
1077
-			if ( has_excerpt() ) {
1078
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1079
-				if ( empty( $out_excerpt ) ) {
1080
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1077
+			if (has_excerpt()) {
1078
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1079
+				if (empty($out_excerpt)) {
1080
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1081 1081
 				}
1082
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1082
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1083 1083
 			} else {
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1085
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1086
-				if ( empty( $out_excerpt ) ) {
1087
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1085
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1086
+				if (empty($out_excerpt)) {
1087
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1088 1088
 				}
1089
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1089
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1090 1090
 			}
1091 1091
 
1092 1092
 			$meta_desc .= $out_excerpt;
1093 1093
 		}
1094
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1095
-		if ( is_category() ) {
1096
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1097
-		} elseif ( is_tag() ) {
1098
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1094
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1095
+		if (is_category()) {
1096
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1097
+		} elseif (is_tag()) {
1098
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1099 1099
 		}
1100
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1101
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1100
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1101
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1102 1102
 	}
1103 1103
 
1104 1104
 
1105 1105
 	$geodir_post_type       = geodir_get_current_posttype();
1106
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1107
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1108
-
1109
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1110
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1111
-
1112
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1113
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1114
-
1115
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1116
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1117
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1119
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1120
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1121
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1106
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1107
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1108
+
1109
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1110
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1111
+
1112
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1113
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1114
+
1115
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1116
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1117
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1119
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1120
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1121
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1122 1122
 	/**
1123 1123
 	 * Filter the Everywhere text in location description.
1124 1124
 	 *
@@ -1126,108 +1126,108 @@  discard block
 block discarded – undo
1126 1126
 	 * 
1127 1127
 	 * @param string $replace_location Everywhere text.
1128 1128
 	 */
1129
-	$replace_location        = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) );
1129
+	$replace_location        = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory'));
1130 1130
 	$location_id             = null;
1131
-	if ( $geodir_location_manager ) {
1132
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1133
-		$location_id   = (int) $wpdb->get_var( $sql );
1131
+	if ($geodir_location_manager) {
1132
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1133
+		$location_id   = (int) $wpdb->get_var($sql);
1134 1134
 		$location_type = geodir_what_is_current_location();
1135
-		if ( $location_type == 'city' ) {
1136
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1137
-		} elseif ( $location_type == 'region' ) {
1138
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1139
-		} elseif ( $location_type == 'country' ) {
1140
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1141
-			$replace_location = __( $replace_location, 'geodirectory' );
1135
+		if ($location_type == 'city') {
1136
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1137
+		} elseif ($location_type == 'region') {
1138
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1139
+		} elseif ($location_type == 'country') {
1140
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1141
+			$replace_location = __($replace_location, 'geodirectory');
1142 1142
 		}
1143
-		$country          = get_query_var( 'gd_country' );
1144
-		$region           = get_query_var( 'gd_region' );
1145
-		$city             = get_query_var( 'gd_city' );
1143
+		$country          = get_query_var('gd_country');
1144
+		$region           = get_query_var('gd_region');
1145
+		$city             = get_query_var('gd_city');
1146 1146
 		$current_location = '';
1147
-		if ( $country != '' ) {
1148
-			$current_location = get_actual_location_name( 'country', $country, true );
1147
+		if ($country != '') {
1148
+			$current_location = get_actual_location_name('country', $country, true);
1149 1149
 		}
1150
-		if ( $region != '' ) {
1151
-			$current_location = get_actual_location_name( 'region', $region );
1150
+		if ($region != '') {
1151
+			$current_location = get_actual_location_name('region', $region);
1152 1152
 		}
1153
-		if ( $city != '' ) {
1154
-			$current_location = get_actual_location_name( 'city', $city );
1153
+		if ($city != '') {
1154
+			$current_location = get_actual_location_name('city', $city);
1155 1155
 		}
1156 1156
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1157 1157
 	}
1158 1158
 
1159 1159
 	$geodir_meta_keys = '';
1160 1160
 	$geodir_meta_desc = '';
1161
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1162
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1163
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1161
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1162
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1163
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1164 1164
 
1165
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1166
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1165
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1166
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1167 1167
 
1168
-			if ( $geodir_is_category ) {
1169
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1170
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1168
+			if ($geodir_is_category) {
1169
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1170
+				if (isset($category->term_id) && !empty($category->term_id)) {
1171 1171
 					$category_id   = $category->term_id;
1172
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1173
-					if ( $location_id ) {
1174
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1175
-						$cat_loc_option = get_option( $option_name );
1176
-
1177
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1178
-						if ( ! $gd_cat_loc_default ) {
1179
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1180
-							$option        = get_option( $option_name );
1181
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1172
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1173
+					if ($location_id) {
1174
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1175
+						$cat_loc_option = get_option($option_name);
1176
+
1177
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1178
+						if (!$gd_cat_loc_default) {
1179
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1180
+							$option        = get_option($option_name);
1181
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1182 1182
 						}
1183 1183
 					}
1184
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1184
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1185 1185
 				}
1186
-			} else if ( $geodir_is_tag ) {
1187
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1186
+			} else if ($geodir_is_tag) {
1187
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1188 1188
 			}
1189 1189
 		}
1190 1190
 	}
1191 1191
 
1192 1192
 
1193 1193
 	$gd_page = '';
1194
-	if ( geodir_is_page( 'home' ) ) {
1194
+	if (geodir_is_page('home')) {
1195 1195
 		$gd_page   = 'home';
1196
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1197
-	} elseif ( geodir_is_page( 'detail' ) ) {
1196
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1197
+	} elseif (geodir_is_page('detail')) {
1198 1198
 		$gd_page   = 'detail';
1199
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1200
-	} elseif ( geodir_is_page( 'pt' ) ) {
1199
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1200
+	} elseif (geodir_is_page('pt')) {
1201 1201
 		$gd_page   = 'pt';
1202
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1203
-	} elseif ( geodir_is_page( 'listing' ) ) {
1202
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1203
+	} elseif (geodir_is_page('listing')) {
1204 1204
 		$gd_page   = 'listing';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'location' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1206
+	} elseif (geodir_is_page('location')) {
1207 1207
 		$gd_page   = 'location';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1209
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1208
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1209
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1210 1210
 
1211
-	} elseif ( geodir_is_page( 'search' ) ) {
1211
+	} elseif (geodir_is_page('search')) {
1212 1212
 		$gd_page   = 'search';
1213
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1214
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1213
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1214
+	} elseif (geodir_is_page('add-listing')) {
1215 1215
 		$gd_page   = 'add-listing';
1216
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1217
-	} elseif ( geodir_is_page( 'author' ) ) {
1216
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1217
+	} elseif (geodir_is_page('author')) {
1218 1218
 		$gd_page   = 'author';
1219
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1220
-	} elseif ( geodir_is_page( 'login' ) ) {
1219
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1220
+	} elseif (geodir_is_page('login')) {
1221 1221
 		$gd_page   = 'login';
1222
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1223
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1222
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1223
+	} elseif (geodir_is_page('listing-success')) {
1224 1224
 		$gd_page   = 'listing-success';
1225
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1225
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1226 1226
 	}
1227 1227
 
1228 1228
 
1229
-	if ( $meta_desc ) {
1230
-		$meta_desc = stripslashes_deep( $meta_desc );
1229
+	if ($meta_desc) {
1230
+		$meta_desc = stripslashes_deep($meta_desc);
1231 1231
 		/**
1232 1232
 		 * Filter page description to replace variables.
1233 1233
 		 *
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		 * @param string $title   The page description including variables.
1237 1237
 		 * @param string $gd_page The GeoDirectory page type if any.
1238 1238
 		 */
1239
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1239
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1240 1240
 
1241 1241
 		/**
1242 1242
 		 * Filter SEO meta description.
@@ -1245,49 +1245,49 @@  discard block
 block discarded – undo
1245 1245
 		 *
1246 1246
 		 * @param string $meta_desc Meta description content.
1247 1247
 		 */
1248
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1248
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1249 1249
 	}
1250 1250
 
1251 1251
 	// meta keywords
1252
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1253
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1254
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1252
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1253
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1254
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1255 1255
 
1256
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1256
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1257 1257
 	} else {
1258 1258
 		$posttags = get_the_tags();
1259
-		if ( $posttags ) {
1260
-			foreach ( $posttags as $tag ) {
1261
-				$meta_key .= $tag->name . ' ';
1259
+		if ($posttags) {
1260
+			foreach ($posttags as $tag) {
1261
+				$meta_key .= $tag->name.' ';
1262 1262
 			}
1263 1263
 		} else {
1264
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1264
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1265 1265
 			$xt   = 1;
1266 1266
 
1267
-			foreach ( $tags as $tag ) {
1268
-				if ( $xt <= 20 ) {
1269
-					$meta_key .= $tag->name . ", ";
1267
+			foreach ($tags as $tag) {
1268
+				if ($xt <= 20) {
1269
+					$meta_key .= $tag->name.", ";
1270 1270
 				}
1271 1271
 
1272
-				$xt ++;
1272
+				$xt++;
1273 1273
 			}
1274 1274
 		}
1275 1275
 	}
1276 1276
 
1277
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1278
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1279
-	if ( $geodir_meta_keys != '' ) {
1280
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1281
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1282
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1283
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1284
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1277
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1278
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1279
+	if ($geodir_meta_keys != '') {
1280
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1281
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1282
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1283
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1284
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1285 1285
 
1286
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1286
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1287 1287
 	}
1288 1288
 
1289
-	if ( $meta_key ) {
1290
-		$meta_key = stripslashes_deep( $meta_key );
1289
+	if ($meta_key) {
1290
+		$meta_key = stripslashes_deep($meta_key);
1291 1291
 		/**
1292 1292
 		 * Filter SEO meta keywords.
1293 1293
 		 *
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 		 *
1296 1296
 		 * @param string $meta_desc Meta keywords.
1297 1297
 		 */
1298
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1298
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1299 1299
 	}
1300 1300
 
1301 1301
 }
@@ -1315,8 +1315,8 @@  discard block
 block discarded – undo
1315 1315
 
1316 1316
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1317 1317
 
1318
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1319
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1318
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1319
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1320 1320
 	}
1321 1321
 
1322 1322
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1338,57 +1338,57 @@  discard block
 block discarded – undo
1338 1338
 	 * @since 1.0.0
1339 1339
 	 */
1340 1340
 	$arr_tabs['post_profile'] = array(
1341
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1341
+		'heading_text'  => __('Profile', 'geodirectory'),
1342 1342
 		'is_active_tab' => true,
1343
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1343
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1344 1344
 		'tab_content'   => ''
1345 1345
 	);
1346
-	$arr_tabs['post_info']    = array(
1347
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1346
+	$arr_tabs['post_info'] = array(
1347
+		'heading_text'  => __('More Info', 'geodirectory'),
1348 1348
 		'is_active_tab' => false,
1349
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1349
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1350 1350
 		'tab_content'   => ''
1351 1351
 	);
1352 1352
 
1353 1353
 	$arr_tabs['post_images'] = array(
1354
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1354
+		'heading_text'  => __('Photos', 'geodirectory'),
1355 1355
 		'is_active_tab' => false,
1356
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1356
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1357 1357
 		'tab_content'   => ''
1358 1358
 	);
1359 1359
 
1360 1360
 	$arr_tabs['post_video'] = array(
1361
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1361
+		'heading_text'  => __('Video', 'geodirectory'),
1362 1362
 		'is_active_tab' => false,
1363
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1363
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1364 1364
 		'tab_content'   => ''
1365 1365
 	);
1366 1366
 
1367 1367
 	$arr_tabs['special_offers'] = array(
1368
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1368
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1369 1369
 		'is_active_tab' => false,
1370
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1370
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1371 1371
 		'tab_content'   => ''
1372 1372
 	);
1373 1373
 
1374 1374
 	$arr_tabs['post_map'] = array(
1375
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1375
+		'heading_text'  => __('Map', 'geodirectory'),
1376 1376
 		'is_active_tab' => false,
1377
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1377
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1378 1378
 		'tab_content'   => ''
1379 1379
 	);
1380 1380
 
1381 1381
 	$arr_tabs['reviews'] = array(
1382
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1382
+		'heading_text'  => __('Reviews', 'geodirectory'),
1383 1383
 		'is_active_tab' => false,
1384
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1384
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1385 1385
 		'tab_content'   => 'review display'
1386 1386
 	);
1387 1387
 
1388 1388
 	$arr_tabs['related_listing'] = array(
1389
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1389
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1390 1390
 		'is_active_tab' => false,
1391
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1391
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1392 1392
 		'tab_content'   => ''
1393 1393
 	);
1394 1394
 
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 	 *
1398 1398
 	 * @since 1.0.0
1399 1399
 	 */
1400
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1400
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1401 1401
 
1402 1402
 
1403 1403
 }
@@ -1411,13 +1411,13 @@  discard block
 block discarded – undo
1411 1411
  * @return mixed|array Tabs array.
1412 1412
  */
1413 1413
 function geodir_detail_page_tabs_list() {
1414
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1414
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1415 1415
 	$tabs_array    = geodir_detail_page_tabs_array();
1416 1416
 
1417
-	if ( ! empty( $tabs_excluded ) ) {
1418
-		foreach ( $tabs_excluded as $tab ) {
1419
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1420
-				unset( $tabs_array[ $tab ] );
1417
+	if (!empty($tabs_excluded)) {
1418
+		foreach ($tabs_excluded as $tab) {
1419
+			if (array_key_exists($tab, $tabs_array)) {
1420
+				unset($tabs_array[$tab]);
1421 1421
 			}
1422 1422
 		}
1423 1423
 	}
@@ -1441,58 +1441,58 @@  discard block
 block discarded – undo
1441 1441
 function geodir_show_detail_page_tabs() {
1442 1442
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1443 1443
 
1444
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1445
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1446
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1444
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1445
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1446
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1447 1447
 
1448
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1449
-		$post = geodir_get_post_info( $request_post_id );
1450
-		setup_postdata( $post );
1448
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1449
+		$post = geodir_get_post_info($request_post_id);
1450
+		setup_postdata($post);
1451 1451
 	}
1452 1452
 
1453
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1453
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1454 1454
 
1455 1455
 
1456
-	if ( geodir_is_page( 'detail' ) ) {
1457
-		$video                 = geodir_get_video( $post->ID );
1458
-		$special_offers        = geodir_get_special_offers( $post->ID );
1456
+	if (geodir_is_page('detail')) {
1457
+		$video                 = geodir_get_video($post->ID);
1458
+		$special_offers        = geodir_get_special_offers($post->ID);
1459 1459
 		$related_listing_array = array();
1460
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1461
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1460
+		if (get_option('geodir_add_related_listing_posttypes')) {
1461
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1462 1462
 		}
1463 1463
 
1464 1464
 
1465
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1466
-		if ( ! $excluded_tabs ) {
1465
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1466
+		if (!$excluded_tabs) {
1467 1467
 			$excluded_tabs = array();
1468 1468
 		}
1469 1469
 
1470 1470
 		$related_listing = '';
1471
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1471
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1472 1472
 			$request = array(
1473
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1474
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1475
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1476
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1477
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1478
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1473
+				'post_number'         => get_option('geodir_related_post_count'),
1474
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1475
+				'layout'              => get_option('geodir_related_post_listing_view'),
1476
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1477
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1478
+				'character_count'     => get_option('geodir_related_post_excerpt')
1479 1479
 			);
1480 1480
 
1481
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1482
-				$related_listing = geodir_get_detail_page_related_events( $request );
1481
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1482
+				$related_listing = geodir_get_detail_page_related_events($request);
1483 1483
 			} else {
1484
-				$related_listing = geodir_related_posts_display( $request );
1484
+				$related_listing = geodir_related_posts_display($request);
1485 1485
 			}
1486 1486
 
1487 1487
 		}
1488 1488
 
1489
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1489
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1490 1490
 		$thumb_image = '';
1491
-		if ( ! empty( $post_images ) ) {
1492
-			foreach ( $post_images as $image ) {
1493
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1494
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1495
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1491
+		if (!empty($post_images)) {
1492
+			foreach ($post_images as $image) {
1493
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1494
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1495
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1496 1496
 				$thumb_image .= '</a>';
1497 1497
 			}
1498 1498
 		}
@@ -1501,11 +1501,11 @@  discard block
 block discarded – undo
1501 1501
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1502 1502
 		$map_args['width']           = '600';
1503 1503
 		$map_args['height']          = '300';
1504
-		if ( $post->post_mapzoom ) {
1505
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1504
+		if ($post->post_mapzoom) {
1505
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1506 1506
 		}
1507 1507
 		$map_args['autozoom']                 = false;
1508
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1508
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1509 1509
 		$map_args['child_collapse']           = '0';
1510 1510
 		$map_args['enable_cat_filters']       = false;
1511 1511
 		$map_args['enable_text_search']       = false;
@@ -1514,43 +1514,43 @@  discard block
 block discarded – undo
1514 1514
 		$map_args['enable_jason_on_load']     = true;
1515 1515
 		$map_args['enable_map_direction']     = true;
1516 1516
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1517
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1518
-	} else if ( geodir_is_page( 'preview' ) ) {
1519
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1520
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1517
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1518
+	} else if (geodir_is_page('preview')) {
1519
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1520
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1521 1521
 
1522
-		if ( isset( $post->post_images ) ) {
1523
-			$post->post_images = trim( $post->post_images, "," );
1522
+		if (isset($post->post_images)) {
1523
+			$post->post_images = trim($post->post_images, ",");
1524 1524
 		}
1525 1525
 
1526
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1527
-			$post_images = explode( ",", $post->post_images );
1526
+		if (isset($post->post_images) && !empty($post->post_images)) {
1527
+			$post_images = explode(",", $post->post_images);
1528 1528
 		}
1529 1529
 
1530 1530
 		$thumb_image = '';
1531
-		if ( ! empty( $post_images ) ) {
1532
-			foreach ( $post_images as $image ) {
1533
-				if ( $image != '' ) {
1534
-					$thumb_image .= '<a href="' . $image . '">';
1535
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1531
+		if (!empty($post_images)) {
1532
+			foreach ($post_images as $image) {
1533
+				if ($image != '') {
1534
+					$thumb_image .= '<a href="'.$image.'">';
1535
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1536 1536
 					$thumb_image .= '</a>';
1537 1537
 				}
1538 1538
 			}
1539 1539
 		}
1540 1540
 
1541 1541
 		global $map_jason;
1542
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1543
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1544
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1542
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1543
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1544
+		$icon_size        = geodir_get_marker_size($marker_icon);
1545 1545
 		$marker_json['w'] = $icon_size['w'];
1546 1546
 		$marker_json['h'] = $icon_size['h'];
1547
-		$map_jason[]      = json_encode( $marker_json );
1547
+		$map_jason[]      = json_encode($marker_json);
1548 1548
 
1549
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1550
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1551
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1552
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1553
-		if ( ! $mapzoom ) {
1549
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1550
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1551
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1552
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1553
+		if (!$mapzoom) {
1554 1554
 			$mapzoom = 12;
1555 1555
 		}
1556 1556
 
@@ -1573,37 +1573,37 @@  discard block
 block discarded – undo
1573 1573
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1574 1574
 	}
1575 1575
 
1576
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1576
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1577 1577
 
1578 1578
 	$active_tab       = '';
1579 1579
 	$active_tab_name  = '';
1580 1580
 	$default_tab      = '';
1581 1581
 	$default_tab_name = '';
1582
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1583
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1582
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1583
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1584 1584
 			$active_tab      = $tab_index;
1585
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1585
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1586 1586
 		}
1587 1587
 
1588
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1588
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1589 1589
 			$default_tab      = $tab_index;
1590
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1590
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1591 1591
 		}
1592 1592
 	}
1593 1593
 
1594
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1595
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1596
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1594
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1595
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1596
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1597 1597
 		}
1598 1598
 
1599
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1599
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1600 1600
 		$active_tab                                            = $default_tab;
1601 1601
 		$active_tab_name                                       = $default_tab_name;
1602 1602
 	}
1603
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1603
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1604 1604
 	?>
1605 1605
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1606
-		<?php if ( ! $tab_list ){ ?>
1606
+		<?php if (!$tab_list) { ?>
1607 1607
 		<div id="geodir-tab-mobile-menu">
1608 1608
 			<i class="fa fa-bars"></i>
1609 1609
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1618,26 +1618,26 @@  discard block
 block discarded – undo
1618 1618
 			 * @since 1.0.0
1619 1619
 			 * @see   'geodir_after_tab_list'
1620 1620
 			 */
1621
-			do_action( 'geodir_before_tab_list' ); ?>
1621
+			do_action('geodir_before_tab_list'); ?>
1622 1622
 			<?php
1623 1623
 
1624
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1625
-				if ( $detail_page_tab['is_display'] ) {
1624
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1625
+				if ($detail_page_tab['is_display']) {
1626 1626
 
1627
-					if ( ! $tab_list ) {
1627
+					if (!$tab_list) {
1628 1628
 						?>
1629 1629
 						<dt></dt> <!-- added to comply with validation -->
1630
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1630
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1631 1631
 								data-tab="#<?php echo $tab_index; ?>"
1632
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1632
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1633 1633
 						</dd>
1634 1634
 						<?php
1635 1635
 					}
1636 1636
 					ob_start() // start tab content buffering
1637 1637
 					?>
1638 1638
 					<li id="<?php echo $tab_index; ?>Tab">
1639
-						<?php if ( $tab_list ) {
1640
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1639
+						<?php if ($tab_list) {
1640
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1641 1641
 							/**
1642 1642
 							 * Filter the tab list title html.
1643 1643
 							 *
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 							 * @param string $tab_index      The tab index type.
1648 1648
 							 * @param array $detail_page_tab The array of values including title text.
1649 1649
 							 */
1650
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1650
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1651 1651
 						} ?>
1652 1652
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1653 1653
 						<?php
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 						 *
1659 1659
 						 * @param string $tab_index The tab name ID.
1660 1660
 						 */
1661
-						do_action( 'geodir_before_tab_content', $tab_index );
1661
+						do_action('geodir_before_tab_content', $tab_index);
1662 1662
 
1663 1663
 						/**
1664 1664
 						 * Called before the details tab content is output per tab.
@@ -1668,21 +1668,21 @@  discard block
 block discarded – undo
1668 1668
 						 * @since 1.0.0
1669 1669
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1670 1670
 						 */
1671
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1671
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1672 1672
 						/// write a code to generate content of each tab
1673
-						switch ( $tab_index ) {
1673
+						switch ($tab_index) {
1674 1674
 							case 'post_profile':
1675 1675
 								/**
1676 1676
 								 * Called before the listing description content on the details page tab.
1677 1677
 								 *
1678 1678
 								 * @since 1.0.0
1679 1679
 								 */
1680
-								do_action( 'geodir_before_description_on_listing_detail' );
1681
-								if ( geodir_is_page( 'detail' ) ) {
1680
+								do_action('geodir_before_description_on_listing_detail');
1681
+								if (geodir_is_page('detail')) {
1682 1682
 									the_content();
1683 1683
 								} else {
1684 1684
 									/** This action is documented in geodirectory_template_actions.php */
1685
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1685
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1686 1686
 								}
1687 1687
 
1688 1688
 								/**
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
 								 *
1691 1691
 								 * @since 1.0.0
1692 1692
 								 */
1693
-								do_action( 'geodir_after_description_on_listing_detail' );
1693
+								do_action('geodir_after_description_on_listing_detail');
1694 1694
 								break;
1695 1695
 							case 'post_info':
1696 1696
 								echo $geodir_post_detail_fields;
@@ -1700,32 +1700,32 @@  discard block
 block discarded – undo
1700 1700
 								break;
1701 1701
 							case 'post_video':
1702 1702
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1703
-								if ( $preview ) {
1704
-									if ( $video ) {
1705
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1703
+								if ($preview) {
1704
+									if ($video) {
1705
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1706 1706
 									}
1707 1707
 								} else {
1708 1708
 
1709 1709
 									// stop payment manager filtering content length
1710
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1711
-									if ( false !== $filter_priority ) {
1712
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1710
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1711
+									if (false !== $filter_priority) {
1712
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1713 1713
 									}
1714 1714
 
1715 1715
 									/** This action is documented in geodirectory_template_actions.php */
1716
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1716
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1717 1717
 
1718
-									if ( false !== $filter_priority ) {
1719
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+									if (false !== $filter_priority) {
1719
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1720 1720
 									}
1721 1721
 								}
1722 1722
 								break;
1723 1723
 							case 'special_offers':
1724
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1724
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1725 1725
 
1726 1726
 								break;
1727 1727
 							case 'post_map':
1728
-								geodir_draw_map( $map_args );
1728
+								geodir_draw_map($map_args);
1729 1729
 								break;
1730 1730
 							case 'reviews':
1731 1731
 								comments_template();
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 								echo $related_listing;
1735 1735
 								break;
1736 1736
 							default: {
1737
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1737
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1738 1738
 									echo $detail_page_tab['tab_content'];
1739 1739
 								}
1740 1740
 							}
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 						 *
1747 1747
 						 * @since 1.0.0
1748 1748
 						 */
1749
-						do_action( 'geodir_after_tab_content', $tab_index );
1749
+						do_action('geodir_after_tab_content', $tab_index);
1750 1750
 
1751 1751
 						/**
1752 1752
 						 * Called after the details tab content is output per tab.
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 						 * @since 1.0.0
1757 1757
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1758 1758
 						 */
1759
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1759
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1760 1760
 						?> </li>
1761 1761
 					<?php
1762 1762
 					/**
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 					 *
1765 1765
 					 * @since 1.0.0
1766 1766
 					 */
1767
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1767
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1768 1768
 				} // end of if for is_display
1769 1769
 			}// end of foreach
1770 1770
 
@@ -1774,14 +1774,14 @@  discard block
 block discarded – undo
1774 1774
 			 * @since 1.0.0
1775 1775
 			 * @see   'geodir_before_tab_list'
1776 1776
 			 */
1777
-			do_action( 'geodir_after_tab_list' );
1777
+			do_action('geodir_after_tab_list');
1778 1778
 			?>
1779
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1780
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1779
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1780
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1781 1781
 		    style="position:relative;">
1782 1782
 			<?php
1783
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1784
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1783
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1784
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1785 1785
 					echo $detail_page_tab['tab_content'];
1786 1786
 				}// end of if
1787 1787
 			}// end of foreach
@@ -1791,11 +1791,11 @@  discard block
 block discarded – undo
1791 1791
 			 *
1792 1792
 			 * @since 1.0.0
1793 1793
 			 */
1794
-			do_action( 'geodir_add_tab_content' ); ?>
1794
+			do_action('geodir_add_tab_content'); ?>
1795 1795
 		</ul>
1796 1796
 		<!--gd-tabs-content ul end-->
1797 1797
 	</div>
1798
-	<?php if ( ! $tab_list ) { ?>
1798
+	<?php if (!$tab_list) { ?>
1799 1799
 		<script>
1800 1800
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1801 1801
 				hashVal = window.location.hash;
@@ -1827,31 +1827,31 @@  discard block
 block discarded – undo
1827 1827
  *
1828 1828
  * @return mixed Image file.
1829 1829
  */
1830
-function geodir_exif( $file ) {
1831
-	if ( empty( $file ) || ! is_array( $file ) ) {
1830
+function geodir_exif($file) {
1831
+	if (empty($file) || !is_array($file)) {
1832 1832
 		return $file;
1833 1833
 	}
1834 1834
 
1835
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1836
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1835
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1836
+	if (!($file_path && file_exists($file_path))) {
1837 1837
 		return $file;
1838 1838
 	}
1839 1839
 	$file['file'] = $file_path;
1840 1840
 
1841
-	if ( ! file_is_valid_image( $file_path ) ) {
1841
+	if (!file_is_valid_image($file_path)) {
1842 1842
 		return $file; // Bail if file is not an image.
1843 1843
 	}
1844 1844
 
1845
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1845
+	if (!function_exists('wp_get_image_editor')) {
1846 1846
 		return $file;
1847 1847
 	}
1848 1848
 
1849 1849
 	$mime_type = $file['type'];
1850 1850
 	$exif      = array();
1851
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1851
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1852 1852
 		try {
1853
-			$exif = exif_read_data( $file_path );
1854
-		} catch ( Exception $e ) {
1853
+			$exif = exif_read_data($file_path);
1854
+		} catch (Exception $e) {
1855 1855
 			$exif = array();
1856 1856
 		}
1857 1857
 	}
@@ -1860,13 +1860,13 @@  discard block
 block discarded – undo
1860 1860
 	$flip        = false;
1861 1861
 	$modify      = false;
1862 1862
 	$orientation = 0;
1863
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1864
-		switch ( (int) $exif['Orientation'] ) {
1863
+	if (!empty($exif) && isset($exif['Orientation'])) {
1864
+		switch ((int) $exif['Orientation']) {
1865 1865
 			case 1:
1866 1866
 				// do nothing
1867 1867
 				break;
1868 1868
 			case 2:
1869
-				$flip   = array( false, true );
1869
+				$flip   = array(false, true);
1870 1870
 				$modify = true;
1871 1871
 				break;
1872 1872
 			case 3:
@@ -1875,13 +1875,13 @@  discard block
 block discarded – undo
1875 1875
 				$modify      = true;
1876 1876
 				break;
1877 1877
 			case 4:
1878
-				$flip   = array( true, false );
1878
+				$flip   = array(true, false);
1879 1879
 				$modify = true;
1880 1880
 				break;
1881 1881
 			case 5:
1882 1882
 				$orientation = - 90;
1883 1883
 				$rotate      = true;
1884
-				$flip        = array( false, true );
1884
+				$flip        = array(false, true);
1885 1885
 				$modify      = true;
1886 1886
 				break;
1887 1887
 			case 6:
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
 			case 7:
1893 1893
 				$orientation = - 270;
1894 1894
 				$rotate      = true;
1895
-				$flip        = array( false, true );
1895
+				$flip        = array(false, true);
1896 1896
 				$modify      = true;
1897 1897
 				break;
1898 1898
 			case 8:
@@ -1918,31 +1918,31 @@  discard block
 block discarded – undo
1918 1918
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1919 1919
 	 * @param string $quality   Image mime type.
1920 1920
 	 */
1921
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1922
-	if ( $quality !== null ) {
1921
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1922
+	if ($quality !== null) {
1923 1923
 		$modify = true;
1924 1924
 	}
1925 1925
 
1926
-	if ( ! $modify ) {
1926
+	if (!$modify) {
1927 1927
 		return $file; // no change
1928 1928
 	}
1929 1929
 
1930
-	$image = wp_get_image_editor( $file_path );
1931
-	if ( ! is_wp_error( $image ) ) {
1932
-		if ( $rotate ) {
1933
-			$image->rotate( $orientation );
1930
+	$image = wp_get_image_editor($file_path);
1931
+	if (!is_wp_error($image)) {
1932
+		if ($rotate) {
1933
+			$image->rotate($orientation);
1934 1934
 		}
1935 1935
 
1936
-		if ( ! empty( $flip ) ) {
1937
-			$image->flip( $flip[0], $flip[1] );
1936
+		if (!empty($flip)) {
1937
+			$image->flip($flip[0], $flip[1]);
1938 1938
 		}
1939 1939
 
1940
-		if ( $quality !== null ) {
1941
-			$image->set_quality( (int) $quality );
1940
+		if ($quality !== null) {
1941
+			$image->set_quality((int) $quality);
1942 1942
 		}
1943 1943
 
1944
-		$result = $image->save( $file_path );
1945
-		if ( ! is_wp_error( $result ) ) {
1944
+		$result = $image->save($file_path);
1945
+		if (!is_wp_error($result)) {
1946 1946
 			$file['file']     = $result['path'];
1947 1947
 			$file['tmp_name'] = $result['path'];
1948 1948
 		}
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
  *
1971 1971
  * @return string Returns the recent reviews html.
1972 1972
  */
1973
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1973
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1974 1974
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1975 1975
 	$tablecomments = $wpdb->comments;
1976 1976
 	$tableposts    = $wpdb->posts;
@@ -1980,17 +1980,17 @@  discard block
 block discarded – undo
1980 1980
 	$region_filter  = '';
1981 1981
 	$country_filter = '';
1982 1982
 
1983
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1984
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1985
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1983
+	if ($gd_session->get('gd_multi_location')) {
1984
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1985
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1986 1986
 		}
1987 1987
 
1988
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1989
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1988
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1989
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1990 1990
 		}
1991 1991
 
1992
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1993
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1992
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1993
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1994 1994
 		}
1995 1995
 	}
1996 1996
 	
@@ -2001,84 +2001,84 @@  discard block
 block discarded – undo
2001 2001
 		$lang_code = ICL_LANGUAGE_CODE;
2002 2002
 		
2003 2003
 		if ($lang_code) {
2004
-			$join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2005
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2004
+			$join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2005
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2006 2006
 		}
2007 2007
 	}
2008 2008
 	
2009
-	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2009
+	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2010 2010
 	
2011
-	$comments = $wpdb->get_results( $request );
2011
+	$comments = $wpdb->get_results($request);
2012 2012
 	
2013
-	foreach ( $comments as $comment ) {
2013
+	foreach ($comments as $comment) {
2014 2014
 		// Set the extra comment info needed.
2015
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2015
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2016 2016
 		$comment->comment_content      = $comment_extra->comment_content;
2017 2017
 		$comment->comment_author       = $comment_extra->comment_author;
2018 2018
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2019 2019
 
2020 2020
 		$comment_id      = '';
2021 2021
 		$comment_id      = $comment->comment_ID;
2022
-		$comment_content = strip_tags( $comment->comment_content );
2022
+		$comment_content = strip_tags($comment->comment_content);
2023 2023
 
2024
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2024
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2025 2025
 
2026
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2026
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2027 2027
 		$comment_author_email = $comment->comment_author_email;
2028 2028
 		$comment_post_ID      = $comment->post_id;
2029 2029
 
2030
-		$post_title        = get_the_title( $comment_post_ID );
2031
-		$permalink         = get_permalink( $comment_post_ID );
2032
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2033
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2030
+		$post_title        = get_the_title($comment_post_ID);
2031
+		$permalink         = get_permalink($comment_post_ID);
2032
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2033
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2034 2034
 
2035
-		$comment_content_length = strlen( $comment_content );
2036
-		if ( $comment_content_length > $comment_lenth ) {
2037
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2035
+		$comment_content_length = strlen($comment_content);
2036
+		if ($comment_content_length > $comment_lenth) {
2037
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2038 2038
 		} else {
2039 2039
 			$comment_excerpt = $comment_content;
2040 2040
 		}
2041 2041
 
2042
-		if ( $comment->user_id ) {
2043
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2042
+		if ($comment->user_id) {
2043
+			$user_profile_url = get_author_posts_url($comment->user_id);
2044 2044
 		} else {
2045 2045
 			$user_profile_url = '';
2046 2046
 		}
2047 2047
 
2048
-		if ( $comment_id ) {
2048
+		if ($comment_id) {
2049 2049
 			$comments_echo .= '<li class="clearfix">';
2050
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2051
-			if ( function_exists( 'get_avatar' ) ) {
2052
-				if ( ! isset( $comment->comment_type ) ) {
2053
-					if ( $user_profile_url ) {
2054
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2050
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2051
+			if (function_exists('get_avatar')) {
2052
+				if (!isset($comment->comment_type)) {
2053
+					if ($user_profile_url) {
2054
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2055 2055
 					}
2056
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2057
-					if ( $user_profile_url ) {
2056
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2057
+					if ($user_profile_url) {
2058 2058
 						$comments_echo .= '</a>';
2059 2059
 					}
2060
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2061
-					if ( $user_profile_url ) {
2062
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2060
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2061
+					if ($user_profile_url) {
2062
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2063 2063
 					}
2064
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2064
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2065 2065
 				}
2066
-			} elseif ( function_exists( 'gravatar' ) ) {
2067
-				if ( $user_profile_url ) {
2068
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+			} elseif (function_exists('gravatar')) {
2067
+				if ($user_profile_url) {
2068
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2069 2069
 				}
2070 2070
 				$comments_echo .= "<img src=\"";
2071
-				if ( '' == $comment->comment_type ) {
2072
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2073
-					if ( $user_profile_url ) {
2071
+				if ('' == $comment->comment_type) {
2072
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2073
+					if ($user_profile_url) {
2074 2074
 						$comments_echo .= '</a>';
2075 2075
 					}
2076
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2077
-					if ( $user_profile_url ) {
2078
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2076
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2077
+					if ($user_profile_url) {
2078
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2079 2079
 					}
2080
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2081
-					if ( $user_profile_url ) {
2080
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2081
+					if ($user_profile_url) {
2082 2082
 						$comments_echo .= '</a>';
2083 2083
 					}
2084 2084
 				}
@@ -2088,17 +2088,17 @@  discard block
 block discarded – undo
2088 2088
 			$comments_echo .= "</span>\n";
2089 2089
 
2090 2090
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2091
-			if ( $comment->user_id ) {
2092
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2091
+			if ($comment->user_id) {
2092
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2093 2093
 			}
2094
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2095
-			if ( $comment->user_id ) {
2094
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2095
+			if ($comment->user_id) {
2096 2096
 				$comments_echo .= '</a>';
2097 2097
 			}
2098
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2099
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2100
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2101
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2098
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2099
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2100
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2101
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2102 2102
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2103 2103
 			$comments_echo .= '</p>';
2104 2104
 
@@ -2118,25 +2118,25 @@  discard block
 block discarded – undo
2118 2118
  * @return array Returns post categories as an array.
2119 2119
  */
2120 2120
 function geodir_home_map_cats_key_value_array() {
2121
-	$post_types = geodir_get_posttypes( 'object' );
2121
+	$post_types = geodir_get_posttypes('object');
2122 2122
 
2123 2123
 	$return = array();
2124
-	if ( ! empty( $post_types ) ) {
2125
-		foreach ( $post_types as $key => $post_type ) {
2126
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2127
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2128
-			$taxonomies     = geodir_get_taxonomies( $key );
2129
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2130
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2131
-
2132
-			if ( ! empty( $cat_terms ) ) {
2133
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2134
-
2135
-				foreach ( $cat_terms as $cat_term ) {
2136
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2124
+	if (!empty($post_types)) {
2125
+		foreach ($post_types as $key => $post_type) {
2126
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2127
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2128
+			$taxonomies     = geodir_get_taxonomies($key);
2129
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2130
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2131
+
2132
+			if (!empty($cat_terms)) {
2133
+				$return['optgroup_start-'.$key] = $post_type_name;
2134
+
2135
+				foreach ($cat_terms as $cat_term) {
2136
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2137 2137
 				}
2138 2138
 
2139
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2139
+				$return['optgroup_end-'.$key] = $post_type_name;
2140 2140
 			}
2141 2141
 		}
2142 2142
 	}
@@ -2152,14 +2152,14 @@  discard block
 block discarded – undo
2152 2152
  * @package GeoDirectory
2153 2153
  */
2154 2154
 function geodir_twitter_tweet_button() {
2155
-	if ( isset( $_GET['gde'] ) ) {
2156
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2155
+	if (isset($_GET['gde'])) {
2156
+		$link = '?url='.urlencode(geodir_curPageURL());
2157 2157
 	} else {
2158 2158
 		$link = '';
2159 2159
 	}
2160 2160
 	?>
2161 2161
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2162
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2162
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2163 2163
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2164 2164
 	<?php
2165 2165
 }
@@ -2176,10 +2176,10 @@  discard block
 block discarded – undo
2176 2176
 function geodir_fb_like_button() {
2177 2177
 	global $post;
2178 2178
 	?>
2179
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2179
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2180 2180
 		echo 'allowtransparency="true"';
2181 2181
 	} ?> class="facebook"
2182
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2182
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2183 2183
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2184 2184
 	<?php
2185 2185
 }
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
 
2211 2211
 
2212 2212
 function geodir_listing_bounce_map_pin_on_hover() {
2213
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2213
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2214 2214
 		?>
2215 2215
 		<script>
2216 2216
 			jQuery(function ($) {
@@ -2233,44 +2233,44 @@  discard block
 block discarded – undo
2233 2233
 	}
2234 2234
 }
2235 2235
 
2236
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2236
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2237 2237
 
2238
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2239
-function geodir_output_favourite_html_listings( $post_id ) {
2240
-	geodir_favourite_html( '', $post_id );
2238
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2239
+function geodir_output_favourite_html_listings($post_id) {
2240
+	geodir_favourite_html('', $post_id);
2241 2241
 }
2242 2242
 
2243
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2244
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2243
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2244
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2245 2245
 	global $wp_query;
2246 2246
 
2247 2247
 	$show_pin_point = $wp_query->is_main_query();
2248 2248
 
2249
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2250
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2251
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2249
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2250
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2251
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2252 2252
 		?>
2253 2253
 		<span class="geodir-pinpoint"
2254
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2254
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2255 2255
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2256 2256
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2257 2257
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2258
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2258
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2259 2259
 		<?php
2260 2260
 	}
2261 2261
 }
2262 2262
 
2263 2263
 function geodir_search_form_submit_button() {
2264 2264
 
2265
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2265
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2266 2266
 
2267
-	if ( $new_style ) {
2267
+	if ($new_style) {
2268 2268
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2269
-	}else{
2269
+	} else {
2270 2270
 		$default_search_button_label = 'Search';
2271 2271
 	}
2272
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2273
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2272
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2273
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2274 2274
 	}
2275 2275
 
2276 2276
 	/**
@@ -2282,78 +2282,78 @@  discard block
 block discarded – undo
2282 2282
 	 *
2283 2283
 	 * @param string $default_search_button_label The current search button text.
2284 2284
 	 */
2285
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2285
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2286 2286
 
2287 2287
 	$fa_class = '';
2288
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2288
+	if (strpos($default_search_button_label, '&#') !== false) {
2289 2289
 		$fa_class = 'fa';
2290 2290
 	}
2291 2291
 
2292 2292
 
2293
-	if ( $new_style ) {
2293
+	if ($new_style) {
2294 2294
 	?>
2295
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2296
-<?php }else{?>
2297
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2295
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2296
+<?php } else {?>
2297
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2298 2298
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2299 2299
 	<?php }
2300 2300
 }
2301 2301
 
2302
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2302
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2303 2303
 
2304 2304
 function geodir_search_form_post_type_input() {
2305 2305
 	global $geodir_search_post_type;
2306
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2306
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2307 2307
 	$curr_post_type = $geodir_search_post_type;
2308 2308
 
2309
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2309
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2310 2310
 
2311
-		foreach ( $post_types as $post_type => $info ){
2311
+		foreach ($post_types as $post_type => $info) {
2312 2312
 			global $wpdb;
2313
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2314
-			if ( ! $has_posts ) {
2313
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2314
+			if (!$has_posts) {
2315 2315
 				unset($post_types->{$post_type});
2316 2316
 			}
2317 2317
 		}
2318 2318
 
2319
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2319
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2320 2320
 
2321
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2322
-			if ( $new_style ) {
2321
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2322
+			if ($new_style) {
2323 2323
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2324 2324
 			}
2325 2325
 			?>
2326 2326
 			<select name="stype" class="search_by_post">
2327
-				<?php foreach ( $post_types as $post_type => $info ):
2327
+				<?php foreach ($post_types as $post_type => $info):
2328 2328
 					global $wpdb;
2329 2329
 					?>
2330 2330
 
2331
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2332
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2333
-						if ( $post_type == $_REQUEST['stype'] ) {
2331
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2332
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2333
+						if ($post_type == $_REQUEST['stype']) {
2334 2334
 							echo 'selected="selected"';
2335 2335
 						}
2336
-					} elseif ( $curr_post_type == $post_type ) {
2336
+					} elseif ($curr_post_type == $post_type) {
2337 2337
 						echo 'selected="selected"';
2338
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2338
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2339 2339
 
2340 2340
 				<?php endforeach; ?>
2341 2341
 			</select>
2342 2342
 			<?php
2343
-			if ( $new_style ) {
2343
+			if ($new_style) {
2344 2344
 				echo "</div>";
2345 2345
 			}
2346
-		}else{
2347
-			if(! empty( $post_types )){
2348
-				$pt_arr = (array)$post_types;
2349
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2350
-			}else{
2346
+		} else {
2347
+			if (!empty($post_types)) {
2348
+				$pt_arr = (array) $post_types;
2349
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2350
+			} else {
2351 2351
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2352 2352
 			}
2353 2353
 
2354 2354
 		}
2355 2355
 
2356
-	}elseif ( ! empty( $post_types ) ) {
2356
+	}elseif (!empty($post_types)) {
2357 2357
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2358 2358
 	}
2359 2359
 }
@@ -2361,26 +2361,26 @@  discard block
 block discarded – undo
2361 2361
 function geodir_search_form_search_input() {
2362 2362
 
2363 2363
 	$default_search_for_text = SEARCH_FOR_TEXT;
2364
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2365
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2364
+	if (get_option('geodir_search_field_default_text')) {
2365
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2366 2366
 	}
2367 2367
 
2368 2368
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2369
-	if($new_style){
2369
+	if ($new_style) {
2370 2370
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2371 2371
 	}
2372 2372
 	?>
2373 2373
 	<input class="search_text" name="s"
2374
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2375
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2374
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2375
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2376 2376
 	       } else {
2377 2377
 		       echo $default_search_for_text;
2378 2378
 	       } ?>" type="text"
2379
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2380
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2379
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2380
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2381 2381
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2382 2382
 	<?php
2383
-	if($new_style){
2383
+	if ($new_style) {
2384 2384
 		echo "</div>";
2385 2385
 	}
2386 2386
 }
@@ -2388,12 +2388,12 @@  discard block
 block discarded – undo
2388 2388
 function geodir_search_form_near_input() {
2389 2389
 
2390 2390
 	$default_near_text = NEAR_TEXT;
2391
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2392
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2391
+	if (get_option('geodir_near_field_default_text')) {
2392
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2393 2393
 	}
2394 2394
 
2395
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2396
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2395
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2396
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2397 2397
 	} else {
2398 2398
 		$near = $default_near_text;
2399 2399
 	}
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
 	 * @since 1.6.9
2408 2408
 	 * @param string $curr_post_type The current post type.
2409 2409
 	 */
2410
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2410
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2411 2411
 
2412 2412
 
2413 2413
 	/**
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
 	 * @param string $near              The current near value.
2421 2421
 	 * @param string $default_near_text The default near value.
2422 2422
 	 */
2423
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2423
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2424 2424
 	/**
2425 2425
 	 * Filter the default "Near" text value for the search form.
2426 2426
 	 *
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 	 * @param string $near              The current near value.
2432 2432
 	 * @param string $default_near_text The default near value.
2433 2433
 	 */
2434
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2434
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2435 2435
 	/**
2436 2436
 	 * Filter the class for the near search input.
2437 2437
 	 *
@@ -2439,10 +2439,10 @@  discard block
 block discarded – undo
2439 2439
 	 *
2440 2440
 	 * @param string $class The class for the HTML near input, default is blank.
2441 2441
 	 */
2442
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2442
+	$near_class = apply_filters('geodir_search_near_class', '');
2443 2443
 
2444 2444
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2445
-	if($new_style){
2445
+	if ($new_style) {
2446 2446
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2447 2447
 		
2448 2448
 		do_action('geodir_before_near_input');
@@ -2450,30 +2450,30 @@  discard block
 block discarded – undo
2450 2450
 
2451 2451
 	?>
2452 2452
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2453
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2454
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2455
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2453
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2454
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2455
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2456 2456
 	<?php
2457
-	if($new_style){
2457
+	if ($new_style) {
2458 2458
 		do_action('geodir_after_near_input');
2459 2459
 
2460 2460
 		echo "</div>";
2461 2461
 	}
2462 2462
 }
2463 2463
 
2464
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2465
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2466
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2464
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2465
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2466
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2467 2467
 
2468
-function geodir_get_search_post_type($pt=''){
2468
+function geodir_get_search_post_type($pt = '') {
2469 2469
 	global $geodir_search_post_type;
2470 2470
 
2471
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2472
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2471
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2472
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2473 2473
 
2474 2474
 	$geodir_search_post_type = geodir_get_current_posttype();
2475 2475
 
2476
-	if(!$geodir_search_post_type) {
2476
+	if (!$geodir_search_post_type) {
2477 2477
 		$geodir_search_post_type = geodir_get_default_posttype();
2478 2478
 	}
2479 2479
 
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 	return $geodir_search_post_type;
2482 2482
 }
2483 2483
 
2484
-function geodir_search_form(){
2484
+function geodir_search_form() {
2485 2485
 
2486 2486
 	geodir_get_search_post_type();
2487 2487
 
@@ -2491,8 +2491,8 @@  discard block
 block discarded – undo
2491 2491
 	die();
2492 2492
 }
2493 2493
 
2494
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2495
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2494
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2495
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2496 2496
 
2497 2497
 /**
2498 2498
  * Check wpml active or not.
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
         }
2567 2567
     }
2568 2568
 }
2569
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2569
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2570 2570
 
2571 2571
 /**
2572 2572
  * Duplicate post listing manually after listing saved.
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2608 2608
     global $wpdb;
2609 2609
 
2610
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2610
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2611 2611
 
2612 2612
     if (!empty($reviews)) {
2613 2613
         foreach ($reviews as $review) {
@@ -2635,14 +2635,14 @@  discard block
 block discarded – undo
2635 2635
     global $wpdb, $plugin_prefix;
2636 2636
 
2637 2637
     $post_type = get_post_type($master_post_id);
2638
-    $post_table = $plugin_prefix . $post_type . '_detail';
2638
+    $post_table = $plugin_prefix.$post_type.'_detail';
2639 2639
 
2640
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2641
-    $data = (array)$wpdb->get_row($query);
2640
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2641
+    $data = (array) $wpdb->get_row($query);
2642 2642
 
2643
-    if ( !empty( $data ) ) {
2643
+    if (!empty($data)) {
2644 2644
         $data['post_id'] = $tr_post_id;
2645
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2645
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2646 2646
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2647 2647
         return true;
2648 2648
     }
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
     global $sitepress, $wpdb;
2668 2668
     $post_type = get_post_type($master_post_id);
2669 2669
 
2670
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2670
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2671 2671
 
2672 2672
     $taxonomies = get_object_taxonomies($post_type);
2673 2673
     foreach ($taxonomies as $taxonomy) {
@@ -2676,9 +2676,9 @@  discard block
 block discarded – undo
2676 2676
         
2677 2677
         if ($terms) {
2678 2678
             foreach ($terms as $term) {
2679
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2679
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2680 2680
                 
2681
-                if (!is_null($tr_id)){
2681
+                if (!is_null($tr_id)) {
2682 2682
                     // not using get_term - unfiltered get_term
2683 2683
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2684 2684
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2687,14 +2687,14 @@  discard block
 block discarded – undo
2687 2687
                 }
2688 2688
             }
2689 2689
 
2690
-            if (!is_taxonomy_hierarchical($taxonomy)){
2691
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2690
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2691
+                $terms_array = array_unique(array_map('intval', $terms_array));
2692 2692
             }
2693 2693
 
2694 2694
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2695 2695
             
2696
-            if ($taxonomy == $post_type . 'category') {
2697
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2696
+            if ($taxonomy == $post_type.'category') {
2697
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2698 2698
             }
2699 2699
         }
2700 2700
     }
@@ -2715,15 +2715,15 @@  discard block
 block discarded – undo
2715 2715
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2716 2716
     global $wpdb;
2717 2717
 
2718
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2718
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2719 2719
     $wpdb->query($query);
2720 2720
 
2721
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2721
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2722 2722
     $post_images = $wpdb->get_results($query);
2723 2723
 
2724
-    if ( !empty( $post_images ) ) {
2725
-        foreach ( $post_images as $post_image) {
2726
-            $image_data = (array)$post_image;
2724
+    if (!empty($post_images)) {
2725
+        foreach ($post_images as $post_image) {
2726
+            $image_data = (array) $post_image;
2727 2727
             unset($image_data['ID']);
2728 2728
             $image_data['post_id'] = $tr_post_id;
2729 2729
             
@@ -2756,13 +2756,13 @@  discard block
 block discarded – undo
2756 2756
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2757 2757
     global $wpdb, $plugin_prefix, $sitepress;
2758 2758
 
2759
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2759
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2760 2760
 
2761 2761
     if (empty($review)) {
2762 2762
         return false;
2763 2763
     }
2764 2764
     if ($review['post_id'] != $master_post_id) {
2765
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2765
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2766 2766
         geodir_update_postrating($master_post_id, $post_type);
2767 2767
     }
2768 2768
 
@@ -2773,9 +2773,9 @@  discard block
 block discarded – undo
2773 2773
     }
2774 2774
 
2775 2775
     $post_type = get_post_type($master_post_id);
2776
-    $post_table = $plugin_prefix . $post_type . '_detail';
2776
+    $post_table = $plugin_prefix.$post_type.'_detail';
2777 2777
 
2778
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2778
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2779 2779
     if (empty($translated_post)) {
2780 2780
         return false;
2781 2781
     }
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
         unset($review['id']);
2794 2794
     }
2795 2795
 
2796
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2796
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2797 2797
 
2798 2798
     if ($tr_review_id) { // update review
2799 2799
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2806,8 +2806,8 @@  discard block
 block discarded – undo
2806 2806
         geodir_update_postrating($tr_post_id, $post_type);
2807 2807
         
2808 2808
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2809
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2810
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2809
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2810
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2811 2811
 
2812 2812
             if (!empty($likes)) {
2813 2813
                 foreach ($likes as $like) {
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
  * @return bool True if review star disabled, otherwise false.
2910 2910
  */ 
2911 2911
 function geodir_rating_disabled_post_types() {
2912
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2912
+	$post_types = get_option('geodir_disable_rating_cpt');
2913 2913
 	
2914 2914
 	/**
2915 2915
 	 * Filter the post types array which have rating disabled.
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 	 *
2919 2919
 	 * @param array $post_types Array of post types which have rating starts disabled.
2920 2920
 	 */
2921
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2921
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2922 2922
 }
2923 2923
 
2924 2924
 /**
@@ -2930,30 +2930,30 @@  discard block
 block discarded – undo
2930 2930
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2931 2931
  * @return bool True if review star disabled, otherwise false.
2932 2932
  */ 
2933
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2933
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2934 2934
 	$post_types = geodir_rating_disabled_post_types();
2935 2935
 	
2936
-	if ( empty( $post_types ) ) {
2936
+	if (empty($post_types)) {
2937 2937
 		return false;
2938 2938
 	}
2939 2939
 	
2940
-	if ( is_int( $post_type ) ) {
2941
-		$post_type = get_post_type( $post_type );
2940
+	if (is_int($post_type)) {
2941
+		$post_type = get_post_type($post_type);
2942 2942
 	}
2943 2943
 	
2944
-	if ( $taxonomy && !empty( $post_types ) ) {
2944
+	if ($taxonomy && !empty($post_types)) {
2945 2945
 		$posttypes = array();
2946 2946
 		
2947
-		foreach ( $post_types as $posttype ) {
2948
-			$posttypes[] = $posttype . 'category';
2949
-			$posttypes[] = $posttype . '_tags';
2947
+		foreach ($post_types as $posttype) {
2948
+			$posttypes[] = $posttype.'category';
2949
+			$posttypes[] = $posttype.'_tags';
2950 2950
 		}
2951 2951
 		
2952 2952
 		$post_types = $posttypes;
2953 2953
 	}
2954 2954
 
2955 2955
 	$return = false;
2956
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2956
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2957 2957
 		$return = true;
2958 2958
 	}
2959 2959
 
@@ -2968,7 +2968,7 @@  discard block
 block discarded – undo
2968 2968
  * @return bool True if Yoast SEO disabled on GD pages.
2969 2969
  */
2970 2970
 function geodir_disable_yoast_seo_metas() {
2971
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2971
+    return (bool) get_option('geodir_disable_yoast_meta');
2972 2972
 }
2973 2973
 
2974 2974
 /**
@@ -2979,30 +2979,30 @@  discard block
 block discarded – undo
2979 2979
  * @param int $post_id The post ID.
2980 2980
  * @return bool True if allowed.
2981 2981
  */
2982
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
2982
+function geodir_wpml_allowed_to_duplicate($post_id) {
2983 2983
     $allowed = false;
2984 2984
     
2985
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2985
+    if (!geodir_is_wpml() || empty($post_id)) {
2986 2986
         return $allowed;
2987 2987
     }
2988 2988
     
2989
-    $user_id = (int)get_current_user_id();
2989
+    $user_id = (int) get_current_user_id();
2990 2990
     
2991
-    if ( empty( $user_id ) ) {
2991
+    if (empty($user_id)) {
2992 2992
         return $allowed;
2993 2993
     }
2994 2994
     
2995
-    $post_type = get_post_type( $post_id );
2996
-    if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2995
+    $post_type = get_post_type($post_id);
2996
+    if (!is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
2997 2997
         return $allowed;
2998 2998
     }
2999 2999
     
3000
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3000
+    if (geodir_listing_belong_to_current_user($post_id)) {
3001 3001
         $allowed = true;
3002 3002
     }
3003 3003
     
3004
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3005
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3004
+    $disable_cpts = get_option('geodir_wpml_disable_duplicate');
3005
+    if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
3006 3006
         $allowed = false;
3007 3007
     }
3008 3008
     
@@ -3012,7 +3012,7 @@  discard block
 block discarded – undo
3012 3012
      * @param bool $allowed True if allowed.
3013 3013
      * @param int $post_id The post ID.
3014 3014
      */
3015
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3015
+    return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3016 3016
 }
3017 3017
 
3018 3018
 /**
@@ -3027,61 +3027,61 @@  discard block
 block discarded – undo
3027 3027
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3028 3028
  * @return string Filtered html of the geodir_edit_post_link() function.
3029 3029
  */
3030
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3030
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3031 3031
     global $post, $preview, $sitepress;
3032 3032
     
3033
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3033
+    if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3034 3034
         $post_id = $post->ID;
3035
-        $element_type = 'post_' . get_post_type( $post_id );
3036
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3035
+        $element_type = 'post_'.get_post_type($post_id);
3036
+        $original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3037 3037
         
3038
-        if ( $original_post_id == $post_id ) {
3038
+        if ($original_post_id == $post_id) {
3039 3039
             $wpml_languages = $sitepress->get_active_languages();
3040
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3040
+            $post_language = $sitepress->get_language_for_element($post_id, $element_type);
3041 3041
             
3042
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3043
-                unset( $wpml_languages[ $post_language ] );
3042
+            if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3043
+                unset($wpml_languages[$post_language]);
3044 3044
             }
3045 3045
             
3046
-            if ( !empty( $wpml_languages ) ) {
3047
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3048
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3049
-                $duplicates = $sitepress->get_duplicates( $post_id );
3046
+            if (!empty($wpml_languages)) {
3047
+                $trid = $sitepress->get_element_trid($post_id, $element_type);
3048
+                $element_translations = $sitepress->get_element_translations($trid, $element_type);
3049
+                $duplicates = $sitepress->get_duplicates($post_id);
3050 3050
                 
3051
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3051
+                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3052 3052
                 $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3053
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3053
+                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3054 3054
                 
3055 3055
                 $needs_translation = false;
3056 3056
                 
3057
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3057
+                foreach ($wpml_languages as $lang_code => $lang) {
3058 3058
                     $duplicates_text = '';
3059 3059
                     $translated = false;
3060 3060
                     
3061
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3061
+                    if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3062 3062
                         $translated = true;
3063 3063
                         
3064
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3065
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3064
+                        if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3065
+                            $duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3066 3066
                         }
3067 3067
                     } else {
3068 3068
                         $needs_translation = true;
3069 3069
                     }
3070 3070
                     
3071
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3071
+                    $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3072 3072
                     
3073
-                    if ( $translated ) {
3073
+                    if ($translated) {
3074 3074
                         $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3075 3075
                     } else {
3076
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3076
+                        $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3077 3077
                     }
3078 3078
                     
3079 3079
                     $wpml_content .= '</td></tr>';
3080 3080
                 }
3081 3081
                 
3082
-                if ( $needs_translation ) {
3083
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3084
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3082
+                if ($needs_translation) {
3083
+                    $nonce = wp_create_nonce('geodir_duplicate_nonce');
3084
+                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3085 3085
                 }
3086 3086
                 
3087 3087
                 $wpml_content .= '</tbody></table>';
@@ -3103,12 +3103,12 @@  discard block
 block discarded – undo
3103 3103
  * @param array $settings GD design settings array.
3104 3104
  * @return array Filtered GD design settings array..
3105 3105
  */
3106
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3106
+function geodir_wpml_duplicate_settings($settings = array()) {
3107 3107
     $new_settings = array();
3108 3108
     
3109
-    foreach ( $settings as $key => $setting ) {
3109
+    foreach ($settings as $key => $setting) {
3110 3110
         
3111
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3111
+        if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3112 3112
             $new_settings[] = array(
3113 3113
                 'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3114 3114
                 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 2 patches
Indentation   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -215,37 +215,37 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_add_new_location($location_info = array())
217 217
 {
218
-    global $wpdb;
219
-
220
-    if (!empty($location_info)) {
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
218
+	global $wpdb;
219
+
220
+	if (!empty($location_info)) {
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
         
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
247
-
248
-        /* // Not allowed to create country in DB : 2016-12-09
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247
+
248
+		/* // Not allowed to create country in DB : 2016-12-09
249 249
         if ($geodir_location->country) {
250 250
 
251 251
             $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         }
260 260
         */
261 261
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
262
+		if ($geodir_location->is_default)
263
+			update_option('geodir_default_location', $geodir_location);
264 264
 
265
-        return $geodir_location->location_id;
265
+		return $geodir_location->location_id;
266 266
 
267
-    } else {
268
-        return false;
269
-    }
267
+	} else {
268
+		return false;
269
+	}
270 270
 }
271 271
 
272 272
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
283
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
284 284
 }
285 285
 
286 286
 /**
@@ -294,22 +294,22 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
-
299
-    $ch = curl_init();
300
-    curl_setopt($ch, CURLOPT_URL, $url);
301
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
-    $response = curl_exec($ch);
306
-    curl_close($ch);
307
-    $data = json_decode($response);
308
-    $status = $data->status;
309
-    if ($status == "OK") {
310
-        return $data->results[0]->address_components;
311
-    } else
312
-        return false;
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
+
299
+	$ch = curl_init();
300
+	curl_setopt($ch, CURLOPT_URL, $url);
301
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
+	$response = curl_exec($ch);
306
+	curl_close($ch);
307
+	$data = json_decode($response);
308
+	$status = $data->status;
309
+	if ($status == "OK") {
310
+		return $data->results[0]->address_components;
311
+	} else
312
+		return false;
313 313
 }
314 314
 
315 315
 /**
@@ -326,71 +326,71 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
328 328
 {
329
-    global $wp, $gd_session;
330
-    $location_array = array();
331
-    if ($location_array_from == 'session') {
332
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
-            return $location_array;
334
-        }
329
+	global $wp, $gd_session;
330
+	$location_array = array();
331
+	if ($location_array_from == 'session') {
332
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
+			return $location_array;
334
+		}
335 335
 
336
-        $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
347
-    } else {
348
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
-            return $location_array;
350
-        }
344
+		$city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
+		if ($city != '' && $city)
346
+			$location_array['gd_city'] = urldecode($city);
347
+	} else {
348
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
+			return $location_array;
350
+		}
351 351
 
352
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353 353
 
354
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355 355
 
356
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 357
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
358
+		if ($country != '')
359
+			$location_array['gd_country'] = urldecode($country);
360 360
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
361
+		if ($region != '')
362
+			$location_array['gd_region'] = urldecode($region);
363 363
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
364
+		if ($city != '')
365
+			$location_array['gd_city'] = urldecode($city);
366 366
 			
367 367
 		// Fix category link in ajax popular category widget on change post type
368 368
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
369 369
 			$location_array = geodir_get_current_location_terms('session');
370 370
 		}
371
-    }
371
+	}
372 372
 
373 373
 
374 374
 	/**
375 375
 	 * Filter the location terms.
376 376
 	 *
377 377
 	 * @since 1.4.6
378
-     * @package GeoDirectory
378
+	 * @package GeoDirectory
379
+	 *
380
+	 * @param array $location_array {
381
+	 *    Attributes of the location_array.
382
+	 *
383
+	 *    @type string $gd_country The country slug.
384
+	 *    @type string $gd_region The region slug.
385
+	 *    @type string $gd_city The city slug.
379 386
 	 *
380
-     * @param array $location_array {
381
-     *    Attributes of the location_array.
382
-     *
383
-     *    @type string $gd_country The country slug.
384
-     *    @type string $gd_region The region slug.
385
-     *    @type string $gd_city The city slug.
386
-     *
387
-     * }
387
+	 * }
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391 391
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
392 392
 
393
-    return $location_array;
393
+	return $location_array;
394 394
 
395 395
 }
396 396
 
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
  * @return bool|string
404 404
  */
405 405
 function geodir_get_location_link($which_location = 'current') {
406
-    $location_link = get_permalink(geodir_location_page_id());
407
-
408
-    if ($which_location == 'base') {
409
-        return $location_link;
410
-    } else {
411
-        $location_terms = geodir_get_current_location_terms();
412
-
413
-        if (!empty($location_terms)) {
414
-            if (get_option('permalink_structure') != '') {
415
-                $location_terms = implode("/", $location_terms);
416
-                $location_terms = rtrim($location_terms, '/');
417
-                $location_link .= $location_terms;
418
-            } else {
419
-                $location_link = geodir_getlink($location_link, $location_terms);
420
-            }
421
-        }
422
-    }
423
-    return $location_link;
406
+	$location_link = get_permalink(geodir_location_page_id());
407
+
408
+	if ($which_location == 'base') {
409
+		return $location_link;
410
+	} else {
411
+		$location_terms = geodir_get_current_location_terms();
412
+
413
+		if (!empty($location_terms)) {
414
+			if (get_option('permalink_structure') != '') {
415
+				$location_terms = implode("/", $location_terms);
416
+				$location_terms = rtrim($location_terms, '/');
417
+				$location_link .= $location_terms;
418
+			} else {
419
+				$location_link = geodir_getlink($location_link, $location_terms);
420
+			}
421
+		}
422
+	}
423
+	return $location_link;
424 424
 }
425 425
 
426 426
 /**
@@ -433,34 +433,34 @@  discard block
 block discarded – undo
433 433
  * @return array|bool Returns address on success.
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436
-    $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
-
439
-    $ch = curl_init();
440
-    curl_setopt($ch, CURLOPT_URL, $url);
441
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
-    $response = curl_exec($ch);
446
-    curl_close($ch);
447
-    $data = json_decode($response);
436
+	$url = is_ssl() ? 'https:' : 'http:';
437
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
+
439
+	$ch = curl_init();
440
+	curl_setopt($ch, CURLOPT_URL, $url);
441
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
+	$response = curl_exec($ch);
446
+	curl_close($ch);
447
+	$data = json_decode($response);
448 448
     
449
-    if (!empty($data) && !empty($data->address)) {
450
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
449
+	if (!empty($data) && !empty($data->address)) {
450
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
+		$formatted_address = (array)$data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
454
-            if (!in_array($key, $address_fields)) {
455
-                unset($formatted_address[$key]);
456
-            }
457
-        }
458
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
453
+		foreach ( $data->address as $key => $value ) {
454
+			if (!in_array($key, $address_fields)) {
455
+				unset($formatted_address[$key]);
456
+			}
457
+		}
458
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
459 459
         
460
-        return $data;
461
-    } else {
462
-        return false;
463
-    }
460
+		return $data;
461
+	} else {
462
+		return false;
463
+	}
464 464
 }
465 465
 
466 466
 /**
@@ -472,47 +472,47 @@  discard block
 block discarded – undo
472 472
  * @return string Returns the country.
473 473
  */
474 474
 function geodir_get_normal_country($country) {
475
-    global $wpdb;
476
-    if ($result = geodir_get_country_by_name($country)) {
477
-        return $result;
478
-    }
475
+	global $wpdb;
476
+	if ($result = geodir_get_country_by_name($country)) {
477
+		return $result;
478
+	}
479 479
     
480
-    if (defined('POST_LOCATION_TABLE')) {
481
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
482
-        if (!empty($rows)) {
483
-            foreach ($rows as $row) {
484
-                $translated = __($row->country, 'geodirectory');
485
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
486
-                    return $result;
487
-                }
488
-            }
489
-        }
480
+	if (defined('POST_LOCATION_TABLE')) {
481
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
482
+		if (!empty($rows)) {
483
+			foreach ($rows as $row) {
484
+				$translated = __($row->country, 'geodirectory');
485
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
486
+					return $result;
487
+				}
488
+			}
489
+		}
490 490
         
491
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
492
-        if (!empty($rows)) {
493
-            foreach ($rows as $row) {
494
-                $translated = __($row->country, 'geodirectory');
495
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
496
-                    return $result;
497
-                }
498
-            }
499
-        }
500
-    }
491
+		$rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
492
+		if (!empty($rows)) {
493
+			foreach ($rows as $row) {
494
+				$translated = __($row->country, 'geodirectory');
495
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
496
+					return $result;
497
+				}
498
+			}
499
+		}
500
+	}
501 501
     
502
-    $default_location = geodir_get_default_location();
503
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
504
-        return $result;
505
-    }
502
+	$default_location = geodir_get_default_location();
503
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
504
+		return $result;
505
+	}
506 506
     
507
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
508
-        return $result;
509
-    }
507
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
508
+		return $result;
509
+	}
510 510
     
511
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
512
-        return $result;
513
-    }
511
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
512
+		return $result;
513
+	}
514 514
     
515
-    return $country;
515
+	return $country;
516 516
 }
517 517
 
518 518
 /**
@@ -524,16 +524,16 @@  discard block
 block discarded – undo
524 524
  * @return string Country ISO2 code.
525 525
  */
526 526
 function geodir_get_country_iso2($country) {
527
-    global $wpdb;
527
+	global $wpdb;
528 528
     
529
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
530
-        return $result;
531
-    }
532
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
533
-        return $result;
534
-    }
529
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
530
+		return $result;
531
+	}
532
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
533
+		return $result;
534
+	}
535 535
     
536
-    return $country;
536
+	return $country;
537 537
 }
538 538
 
539 539
 /**
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
  * @return string|null Country ISO2 code.
547 547
  */
548 548
 function geodir_get_country_by_name($country, $iso2 = false) {
549
-    global $wpdb;
549
+	global $wpdb;
550 550
     
551
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
552
-        return $result;
553
-    }
554
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
555
-        return $result;
556
-    }
551
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
552
+		return $result;
553
+	}
554
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
555
+		return $result;
556
+	}
557 557
     
558
-    return NULL;
558
+	return NULL;
559 559
 }
560 560
 
561 561
 
@@ -575,158 +575,158 @@  discard block
 block discarded – undo
575 575
  */
576 576
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
577 577
 
578
-    if (empty($content)) {
579
-        return $content;
580
-    }
578
+	if (empty($content)) {
579
+		return $content;
580
+	}
581 581
 
582 582
 
583
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
583
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
584 584
 
585
-    if (!empty($location_replace_vars)) {
586
-        foreach ($location_replace_vars as $search => $replace) {
587
-            if (!empty($search) && strpos($content, $search) !== false) {
588
-                $content = str_replace($search, $replace, $content);
589
-            }
590
-        }
591
-    }
585
+	if (!empty($location_replace_vars)) {
586
+		foreach ($location_replace_vars as $search => $replace) {
587
+			if (!empty($search) && strpos($content, $search) !== false) {
588
+				$content = str_replace($search, $replace, $content);
589
+			}
590
+		}
591
+	}
592 592
 
593
-    return $content;
593
+	return $content;
594 594
 }
595 595
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
596 596
 
597 597
 
598 598
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
599 599
 
600
-    global $wp;
600
+	global $wp;
601 601
     
602
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
603
-
604
-    if (empty($location_array)) {
605
-        $location_array = geodir_get_current_location_terms('query_vars');
606
-    }
607
-
608
-    $location_terms = array();
609
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
610
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
611
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
612
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
613
-
614
-    $location_names = array();
615
-    foreach ($location_terms as $type => $location) {
616
-        $location_name = $location;
617
-
618
-        if (!empty($location_name)) {
619
-            if ($location_manager) {
620
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
621
-                $location_name = get_actual_location_name($location_type, $location, true);
622
-            } else {
623
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
624
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
625
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
626
-            }
627
-        }
628
-
629
-        $location_names[$type] = $location_name;
630
-    }
631
-
632
-    $location_single = '';
633
-    foreach ($location_terms as $type => $location) {
634
-        if (!empty($location)) {
635
-            if (!empty($location_names[$type])) {
636
-                $location_single = $location_names[$type];
637
-            } else {
638
-                if ($location_manager) {
639
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
640
-                    $location_single = get_actual_location_name($location_type, $location, true);
641
-                } else {
642
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
643
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
644
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
645
-                }
646
-            }
647
-            break;
648
-        }
649
-    }
650
-
651
-    $full_location = array();
652
-    if (!empty($location_array)) {
653
-        $location_array = array_reverse($location_array);
654
-
655
-        foreach ($location_array as $type => $location) {
656
-            if (!empty($location_names[$type])) {
657
-                $location_name = $location_names[$type];
658
-            } else {
659
-                if ($location_manager) {
660
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
661
-                    $location_name = get_actual_location_name($location_type, $location, true);
662
-                } else {
663
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
664
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
665
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
666
-                }
667
-            }
602
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
603
+
604
+	if (empty($location_array)) {
605
+		$location_array = geodir_get_current_location_terms('query_vars');
606
+	}
607
+
608
+	$location_terms = array();
609
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
610
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
611
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
612
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
613
+
614
+	$location_names = array();
615
+	foreach ($location_terms as $type => $location) {
616
+		$location_name = $location;
617
+
618
+		if (!empty($location_name)) {
619
+			if ($location_manager) {
620
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
621
+				$location_name = get_actual_location_name($location_type, $location, true);
622
+			} else {
623
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
624
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
625
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
626
+			}
627
+		}
668 628
 
669
-            $full_location[] = $location_name;
670
-        }
629
+		$location_names[$type] = $location_name;
630
+	}
631
+
632
+	$location_single = '';
633
+	foreach ($location_terms as $type => $location) {
634
+		if (!empty($location)) {
635
+			if (!empty($location_names[$type])) {
636
+				$location_single = $location_names[$type];
637
+			} else {
638
+				if ($location_manager) {
639
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
640
+					$location_single = get_actual_location_name($location_type, $location, true);
641
+				} else {
642
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
643
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
644
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
645
+				}
646
+			}
647
+			break;
648
+		}
649
+	}
650
+
651
+	$full_location = array();
652
+	if (!empty($location_array)) {
653
+		$location_array = array_reverse($location_array);
654
+
655
+		foreach ($location_array as $type => $location) {
656
+			if (!empty($location_names[$type])) {
657
+				$location_name = $location_names[$type];
658
+			} else {
659
+				if ($location_manager) {
660
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
661
+					$location_name = get_actual_location_name($location_type, $location, true);
662
+				} else {
663
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
664
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
665
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
666
+				}
667
+			}
668
+
669
+			$full_location[] = $location_name;
670
+		}
671 671
 
672
-        if (!empty($full_location)) {
673
-            $full_location = array_unique($full_location);
674
-        }
675
-    }
676
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
672
+		if (!empty($full_location)) {
673
+			$full_location = array_unique($full_location);
674
+		}
675
+	}
676
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
677 677
     
678
-    if ( empty( $full_location ) ) {
679
-        /**
680
-         * Filter the text in meta description in full location is empty.
681
-         *
682
-         * @since 1.6.22
683
-         * 
684
-         * @param string $full_location Default: Empty.
685
-         * @param array  $location_array The array of location variables.
686
-         * @param string $gd_page       The page being filtered.
687
-         * @param string $sep           The separator.
688
-         */
689
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
690
-    }
678
+	if ( empty( $full_location ) ) {
679
+		/**
680
+		 * Filter the text in meta description in full location is empty.
681
+		 *
682
+		 * @since 1.6.22
683
+		 * 
684
+		 * @param string $full_location Default: Empty.
685
+		 * @param array  $location_array The array of location variables.
686
+		 * @param string $gd_page       The page being filtered.
687
+		 * @param string $sep           The separator.
688
+		 */
689
+		 $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
690
+	}
691 691
     
692
-    if ( empty( $location_single ) ) {
693
-        /**
694
-         * Filter the text in meta description in single location is empty.
695
-         *
696
-         * @since 1.6.22
697
-         * 
698
-         * @param string $location_single Default: Empty.
699
-         * @param array $location_array The array of location variables.
700
-         * @param string $gd_page       The page being filtered.
701
-         * @param string $sep           The separator.
702
-         */
703
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
704
-    }
705
-
706
-    $location_replace_vars = array();
707
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
708
-    $location_replace_vars['%%location%%'] = $full_location;
709
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
710
-    $location_replace_vars['%%location_single%%'] = $location_single;
711
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
712
-
713
-    foreach ($location_names as $type => $name) {
714
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
715
-
716
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
717
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
718
-    }
719
-
720
-    /**
721
-     * Filter the location terms variables to search & replace.
722
-     *
723
-     * @since   1.6.16
724
-     * @package GeoDirectory
725
-     *
726
-     * @param array $location_replace_vars The array of search & replace variables.
727
-     * @param array $location_array The array of location variables.
728
-     * @param string $gd_page       The page being filtered.
729
-     * @param string $sep           The separator.
730
-     */
731
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
692
+	if ( empty( $location_single ) ) {
693
+		/**
694
+		 * Filter the text in meta description in single location is empty.
695
+		 *
696
+		 * @since 1.6.22
697
+		 * 
698
+		 * @param string $location_single Default: Empty.
699
+		 * @param array $location_array The array of location variables.
700
+		 * @param string $gd_page       The page being filtered.
701
+		 * @param string $sep           The separator.
702
+		 */
703
+		 $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
704
+	}
705
+
706
+	$location_replace_vars = array();
707
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
708
+	$location_replace_vars['%%location%%'] = $full_location;
709
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
710
+	$location_replace_vars['%%location_single%%'] = $location_single;
711
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
712
+
713
+	foreach ($location_names as $type => $name) {
714
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
715
+
716
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
717
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
718
+	}
719
+
720
+	/**
721
+	 * Filter the location terms variables to search & replace.
722
+	 *
723
+	 * @since   1.6.16
724
+	 * @package GeoDirectory
725
+	 *
726
+	 * @param array $location_replace_vars The array of search & replace variables.
727
+	 * @param array $location_array The array of location variables.
728
+	 * @param string $gd_page       The page being filtered.
729
+	 * @param string $sep           The separator.
730
+	 */
731
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
732 732
 }
733 733
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
391
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
392 392
 
393 393
     return $location_array;
394 394
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436 436
     $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
438 438
 
439 439
     $ch = curl_init();
440 440
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
     
449 449
     if (!empty($data) && !empty($data->address)) {
450 450
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
451
+        $formatted_address = (array) $data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
453
+        foreach ($data->address as $key => $value) {
454 454
             if (!in_array($key, $address_fields)) {
455 455
                 unset($formatted_address[$key]);
456 456
             }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
     
480 480
     if (defined('POST_LOCATION_TABLE')) {
481
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
482 482
         if (!empty($rows)) {
483 483
             foreach ($rows as $row) {
484 484
                 $translated = __($row->country, 'geodirectory');
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             }
489 489
         }
490 490
         
491
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
491
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
492 492
         if (!empty($rows)) {
493 493
             foreach ($rows as $row) {
494 494
                 $translated = __($row->country, 'geodirectory');
@@ -526,10 +526,10 @@  discard block
 block discarded – undo
526 526
 function geodir_get_country_iso2($country) {
527 527
     global $wpdb;
528 528
     
529
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
529
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
530 530
         return $result;
531 531
     }
532
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
533 533
         return $result;
534 534
     }
535 535
     
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
 function geodir_get_country_by_name($country, $iso2 = false) {
549 549
     global $wpdb;
550 550
     
551
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
551
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
552 552
         return $result;
553 553
     }
554
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
554
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
555 555
         return $result;
556 556
     }
557 557
     
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
596 596
 
597 597
 
598
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
599 599
 
600 600
     global $wp;
601 601
     
@@ -620,8 +620,8 @@  discard block
 block discarded – undo
620 620
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
621 621
                 $location_name = get_actual_location_name($location_type, $location, true);
622 622
             } else {
623
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
624
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
623
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
624
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
625 625
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
626 626
             }
627 627
         }
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
640 640
                     $location_single = get_actual_location_name($location_type, $location, true);
641 641
                 } else {
642
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
643
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
642
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
643
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
644 644
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
645 645
                 }
646 646
             }
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
661 661
                     $location_name = get_actual_location_name($location_type, $location, true);
662 662
                 } else {
663
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
664
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
663
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
664
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
665 665
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
666 666
                 }
667 667
             }
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
             $full_location = array_unique($full_location);
674 674
         }
675 675
     }
676
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
676
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
677 677
     
678
-    if ( empty( $full_location ) ) {
678
+    if (empty($full_location)) {
679 679
         /**
680 680
          * Filter the text in meta description in full location is empty.
681 681
          *
@@ -686,10 +686,10 @@  discard block
 block discarded – undo
686 686
          * @param string $gd_page       The page being filtered.
687 687
          * @param string $sep           The separator.
688 688
          */
689
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
689
+         $full_location = apply_filters('geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep);
690 690
     }
691 691
     
692
-    if ( empty( $location_single ) ) {
692
+    if (empty($location_single)) {
693 693
         /**
694 694
          * Filter the text in meta description in single location is empty.
695 695
          *
@@ -700,21 +700,21 @@  discard block
 block discarded – undo
700 700
          * @param string $gd_page       The page being filtered.
701 701
          * @param string $sep           The separator.
702 702
          */
703
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
703
+         $location_single = apply_filters('geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep);
704 704
     }
705 705
 
706 706
     $location_replace_vars = array();
707 707
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
708 708
     $location_replace_vars['%%location%%'] = $full_location;
709
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
709
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $full_location) : '';
710 710
     $location_replace_vars['%%location_single%%'] = $location_single;
711
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
711
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $location_single) : '';
712 712
 
713 713
     foreach ($location_names as $type => $name) {
714 714
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
715 715
 
716
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
717
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
716
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
717
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? sprintf(_x('in %s', 'in location', 'geodirectory'), $name) : '';
718 718
     }
719 719
 
720 720
     /**
@@ -728,5 +728,5 @@  discard block
 block discarded – undo
728 728
      * @param string $gd_page       The page being filtered.
729 729
      * @param string $sep           The separator.
730 730
      */
731
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
731
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
732 732
 }
733 733
\ No newline at end of file
Please login to merge, or discard this patch.