Test Failed
Pull Request — master (#451)
by Kiran
19:00
created
geodirectory-functions/custom_functions.php 2 patches
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
  * @param object|string $post The post object.
162 162
  * @param string $post_type   The post type.
163 163
  *
164
- * @return object Returns filtered package info as an object.
164
+ * @return string Returns filtered package info as an object.
165 165
  */
166 166
 function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
167 167
 	$package_info['pid']              = 0;
@@ -2507,7 +2507,7 @@  discard block
 block discarded – undo
2507 2507
  *
2508 2508
  * @since 1.5.0
2509 2509
  *
2510
- * @return True if WPML is active else False.
2510
+ * @return boolean if WPML is active else False.
2511 2511
  */
2512 2512
 function geodir_is_wpml() {
2513 2513
 	if (class_exists('SitePress') && function_exists('icl_object_id')) {
@@ -2583,7 +2583,6 @@  discard block
 block discarded – undo
2583 2583
  * @since 1.6.25 "geodir_wpml_listing_duplicated" action added.
2584 2584
  *
2585 2585
  * @param int $post_id The Post ID.
2586
- * @param string $lang Language code for translating post.
2587 2586
  * @param array $request_info The post details in an array.
2588 2587
  */
2589 2588
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
@@ -2673,7 +2672,7 @@  discard block
 block discarded – undo
2673 2672
  * @param int $master_post_id Original Post ID.
2674 2673
  * @param int $tr_post_id Translation Post ID.
2675 2674
  * @param string $lang Language code for translating post.
2676
- * @return bool True for success, False for fail.
2675
+ * @return boolean|null True for success, False for fail.
2677 2676
  */
2678 2677
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2679 2678
 	global $sitepress, $wpdb;
@@ -2916,8 +2915,6 @@  discard block
 block discarded – undo
2916 2915
  *
2917 2916
  * @since 1.6.16
2918 2917
  *
2919
- * @param string $post_type WP post type or WP texonomy. Ex: gd_place.
2920
- * @param bool $taxonomy Whether $post_type is taxonomy or not.
2921 2918
  * @return bool True if review star disabled, otherwise false.
2922 2919
  */
2923 2920
 function geodir_rating_disabled_post_types() {
@@ -3189,7 +3186,7 @@  discard block
 block discarded – undo
3189 3186
  * @param string      $element_type               Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc.
3190 3187
  *                                                You can also pass 'any', to let WPML guess the type, but this will only work for posts.
3191 3188
  * @param bool        $return_original_if_missing Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing).
3192
- * @param string|NULL $language_code              Optional, default is NULL. If missing, it will use the current language.
3189
+ * @param string|NULL $ulanguage_code              Optional, default is NULL. If missing, it will use the current language.
3193 3190
  *                                                If set to a language code, it will return a translation for that language code or
3194 3191
  *                                                the original if the translation is missing and $return_original_if_missing is set to TRUE.
3195 3192
  *
Please login to merge, or discard this patch.
Spacing   +720 added lines, -720 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      = sanitize_text_field($request['inq_name']);
230 230
 	$youremail     = sanitize_email($request['inq_email']);
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
 	$frnd_comments = sanitize_text_field($request['inq_msg']);
233 233
 	$pid           = absint($request['pid']);
234 234
 
235
-	$author_id  = '';
235
+	$author_id = '';
236 236
 
237
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
237
+	if ($pid && 'publish' == get_post_status($pid)) {
238 238
 
239
-		check_ajax_referer( 'send_inquiry_'.$pid );
239
+		check_ajax_referer('send_inquiry_'.$pid);
240 240
 
241 241
 		$p_post = get_post($pid);
242 242
 
243
-		$author_id  = $p_post->post_author;
243
+		$author_id = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else {
246 246
 		gd_die();
247 247
 	}
248 248
 
249
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
250
-	$to_name   = geodir_get_client_name( $author_id );
249
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
250
+	$to_name   = geodir_get_client_name($author_id);
251 251
 
252
-	if ( $to_email == '' ) {
253
-		$to_email = get_option( 'admin_email' );
252
+	if ($to_email == '') {
253
+		$to_email = get_option('admin_email');
254 254
 	}
255 255
 
256 256
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * }
272 272
 	 * @param string $type     The form type, default: `Enquiry`.
273 273
 	 */
274
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
274
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
275 275
 
276 276
 	$client_message = $frnd_comments;
277
-	$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>.';
277
+	$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>.';
278 278
 	/**
279 279
 	 * Filter client message text.
280 280
 	 *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @param string $client_message Client message text.
284 284
 	 */
285
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
285
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
286 286
 
287 287
 	/**
288 288
 	 * Called before the send enquiry email is sent.
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 *
302 302
 	 * }
303 303
 	 */
304
-	do_action( 'geodir_before_send_enquiry_email', $request );
305
-	if ( $to_email ) {
304
+	do_action('geodir_before_send_enquiry_email', $request);
305
+	if ($to_email) {
306 306
 		// strip slashes message
307
-		$client_message = stripslashes_deep( $client_message );
307
+		$client_message = stripslashes_deep($client_message);
308 308
 
309
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
309
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
310 310
 	}
311 311
 
312 312
 	/**
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * }
328 328
 	 */
329
-	do_action( 'geodir_after_send_enquiry_email', $request );
330
-	$url = get_permalink( $pid );
331
-	if ( strstr( $url, '?' ) ) {
332
-		$url = $url . "&send_inquiry=success";
329
+	do_action('geodir_after_send_enquiry_email', $request);
330
+	$url = get_permalink($pid);
331
+	if (strstr($url, '?')) {
332
+		$url = $url."&send_inquiry=success";
333 333
 	} else {
334
-		$url = $url . "?send_inquiry=success";
334
+		$url = $url."?send_inquiry=success";
335 335
 	}
336 336
 	/**
337 337
 	 * Filter redirect url after the send enquiry email is sent.
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @param string $url Redirect url.
342 342
 	 */
343
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
344
-	wp_redirect( $url );
343
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
344
+	wp_redirect($url);
345 345
 	gd_die();
346 346
 
347 347
 }
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
  * }
371 371
  * @global object $wpdb        WordPress Database object.
372 372
  */
373
-function geodir_send_friend( $request ) {
373
+function geodir_send_friend($request) {
374 374
 	global $wpdb;
375 375
 
376 376
 	// strip slashes from text
377
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
377
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
378 378
 
379 379
 	$yourname      = sanitize_text_field($request['yourname']);
380 380
 	$youremail     = sanitize_email($request['youremail']);
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	$pid           = absint($request['pid']);
384 384
 	$to_email      = sanitize_email($request['to_email']);
385 385
 	$to_name       = sanitize_text_field($request['to_name']);
386
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
386
+	if ($pid && 'publish' == get_post_status($pid)) {
387 387
 
388
-		check_ajax_referer( 'send_to_frnd_'.$pid );
388
+		check_ajax_referer('send_to_frnd_'.$pid);
389 389
 
390
-	}else{
390
+	} else {
391 391
 		gd_die();
392 392
 	}
393 393
 
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	 *
411 411
 	 * }
412 412
 	 */
413
-	do_action( 'geodir_before_send_to_friend_email', $request );
414
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
413
+	do_action('geodir_before_send_to_friend_email', $request);
414
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
415 415
 
416 416
 	/**
417 417
 	 * Called after the send to friend email is sent.
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 	 *
433 433
 	 * }
434 434
 	 */
435
-	do_action( 'geodir_after_send_to_friend_email', $request );
435
+	do_action('geodir_after_send_to_friend_email', $request);
436 436
 
437
-	$url = get_permalink( $pid );
438
-	if ( strstr( $url, '?' ) ) {
439
-		$url = $url . "&sendtofrnd=success";
437
+	$url = get_permalink($pid);
438
+	if (strstr($url, '?')) {
439
+		$url = $url."&sendtofrnd=success";
440 440
 	} else {
441
-		$url = $url . "?sendtofrnd=success";
441
+		$url = $url."?sendtofrnd=success";
442 442
 	}
443 443
 	/**
444 444
 	 * Filter redirect url after the send to friend email is sent.
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @param string $url Redirect url.
449 449
 	 */
450
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
451
-	wp_redirect( $url );
450
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
451
+	wp_redirect($url);
452 452
 	gd_die();
453 453
 }
454 454
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
  *
463 463
  * @param string $hash_key
464 464
  */
465
-function geodir_before_tab_content( $hash_key ) {
466
-	switch ( $hash_key ) {
465
+function geodir_before_tab_content($hash_key) {
466
+	switch ($hash_key) {
467 467
 		case 'post_info' :
468 468
 			echo '<div class="geodir-company_info field-group">';
469 469
 			break;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			 *
474 474
 			 * @since 1.0.0
475 475
 			 */
476
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
476
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
477 477
 			break;
478 478
 		case 'reviews' :
479 479
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
  *
498 498
  * @param string $hash_key
499 499
  */
500
-function geodir_after_tab_content( $hash_key ) {
501
-	switch ( $hash_key ) {
500
+function geodir_after_tab_content($hash_key) {
501
+	switch ($hash_key) {
502 502
 		case 'post_info' :
503 503
 			echo '</div>';
504 504
 			break;
@@ -529,25 +529,25 @@  discard block
 block discarded – undo
529 529
  * @global object $wpdb     WordPress Database object.
530 530
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
531 531
  */
532
-function geodir_get_posts_default_sort( $post_type ) {
532
+function geodir_get_posts_default_sort($post_type) {
533 533
 
534 534
 	global $wpdb;
535 535
 
536
-	if ( $post_type != '' ) {
536
+	if ($post_type != '') {
537 537
 
538 538
 		$all_postypes = geodir_get_posttypes();
539 539
 
540
-		if ( ! in_array( $post_type, $all_postypes ) ) {
540
+		if (!in_array($post_type, $all_postypes)) {
541 541
 			return false;
542 542
 		}
543 543
 
544
-		$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(
544
+		$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(
545 545
 			$post_type,
546 546
 			1,
547 547
 			1
548
-		) ) );
548
+		)));
549 549
 
550
-		if ( ! empty( $sort_field_info ) ) {
550
+		if (!empty($sort_field_info)) {
551 551
 			return $sort_field_info;
552 552
 		}
553 553
 
@@ -567,20 +567,20 @@  discard block
 block discarded – undo
567 567
  * @global object $wpdb     WordPress Database object.
568 568
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
569 569
  */
570
-function geodir_get_sort_options( $post_type ) {
570
+function geodir_get_sort_options($post_type) {
571 571
 	global $wpdb;
572 572
 
573
-	if ( $post_type != '' ) {
573
+	if ($post_type != '') {
574 574
 		$all_postypes = geodir_get_posttypes();
575 575
 
576
-		if ( ! in_array( $post_type, $all_postypes ) ) {
576
+		if (!in_array($post_type, $all_postypes)) {
577 577
 			return false;
578 578
 		}
579 579
 
580
-		$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(
580
+		$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(
581 581
 			$post_type,
582 582
 			1
583
-		) ) );
583
+		)));
584 584
 
585 585
 		/**
586 586
 		 * Filter post sort options.
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 		 * @param array $sort_field_info Unfiltered sort field array.
591 591
 		 * @param string $post_type      Post type.
592 592
 		 */
593
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
593
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
594 594
 	}
595 595
 
596 596
 }
@@ -611,63 +611,63 @@  discard block
 block discarded – undo
611 611
 	 *
612 612
 	 * @since 1.4.4
613 613
 	 */
614
-	if ( is_search() ) {
614
+	if (is_search()) {
615 615
 		return;
616 616
 	}
617 617
 
618 618
 	$sort_by = '';
619 619
 
620
-	if ( isset( $_REQUEST['sort_by'] ) ) {
620
+	if (isset($_REQUEST['sort_by'])) {
621 621
 		$sort_by = $_REQUEST['sort_by'];
622 622
 	}
623 623
 
624 624
 	$gd_post_type = geodir_get_current_posttype();
625 625
 
626
-	$sort_options = geodir_get_sort_options( $gd_post_type );
626
+	$sort_options = geodir_get_sort_options($gd_post_type);
627 627
 
628 628
 
629 629
 	$sort_field_options = '';
630 630
 
631
-	if ( ! empty( $sort_options ) ) {
632
-		foreach ( $sort_options as $sort ) {
633
-			$sort = stripslashes_deep( $sort ); // strip slashes
631
+	if (!empty($sort_options)) {
632
+		foreach ($sort_options as $sort) {
633
+			$sort = stripslashes_deep($sort); // strip slashes
634 634
 
635
-			$label = __( $sort->site_title, 'geodirectory' );
635
+			$label = __($sort->site_title, 'geodirectory');
636 636
 
637
-			if ( $sort->field_type == 'random' ) {
637
+			if ($sort->field_type == 'random') {
638 638
 				$key = $sort->field_type;
639
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
640
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
639
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
640
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
641 641
 			}
642 642
 
643
-			if ( $sort->htmlvar_name == 'comment_count' ) {
643
+			if ($sort->htmlvar_name == 'comment_count') {
644 644
 				$sort->htmlvar_name = 'rating_count';
645 645
 			}
646 646
 
647
-			if ( $sort->sort_asc ) {
648
-				$key   = $sort->htmlvar_name . '_asc';
647
+			if ($sort->sort_asc) {
648
+				$key   = $sort->htmlvar_name.'_asc';
649 649
 				$label = $sort->site_title;
650
-				if ( $sort->asc_title ) {
650
+				if ($sort->asc_title) {
651 651
 					$label = $sort->asc_title;
652 652
 				}
653
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
654
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
653
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
654
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
655 655
 			}
656 656
 
657
-			if ( $sort->sort_desc ) {
658
-				$key   = $sort->htmlvar_name . '_desc';
657
+			if ($sort->sort_desc) {
658
+				$key   = $sort->htmlvar_name.'_desc';
659 659
 				$label = $sort->site_title;
660
-				if ( $sort->desc_title ) {
660
+				if ($sort->desc_title) {
661 661
 					$label = $sort->desc_title;
662 662
 				}
663
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
664
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
663
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
664
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
665 665
 			}
666 666
 
667 667
 		}
668 668
 	}
669 669
 
670
-	if ( $sort_field_options != '' ) {
670
+	if ($sort_field_options != '') {
671 671
 
672 672
 		?>
673 673
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
677 677
 
678 678
 				<option
679
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
679
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
680 680
 					echo 'selected="selected"';
681
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
681
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
682 682
 
683 683
 				echo $sort_field_options; ?>
684 684
 
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
  *
707 707
  * @return string Returns the section title.
708 708
  */
709
-function geodir_advance_customfields_heading( $title, $field_type ) {
709
+function geodir_advance_customfields_heading($title, $field_type) {
710 710
 
711
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
711
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
712 712
 		$title = '';
713 713
 	}
714 714
 
@@ -730,19 +730,19 @@  discard block
 block discarded – undo
730 730
  * @global object $gd_session       GeoDirectory Session object.
731 731
  * @return string Returns related posts html.
732 732
  */
733
-function geodir_related_posts_display( $request ) {
734
-	if ( ! empty( $request ) ) {
735
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
736
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
737
-
738
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
739
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
740
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
741
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
742
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
743
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
744
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
745
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
733
+function geodir_related_posts_display($request) {
734
+	if (!empty($request)) {
735
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
736
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
737
+
738
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
739
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
740
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
741
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
742
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
743
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
744
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
745
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
746 746
 
747 747
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
748 748
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
751 751
 
752 752
 		$related_listing_array = array();
753
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
754
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
753
+		if (get_option('geodir_add_related_listing_posttypes')) {
754
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
755 755
 		}
756
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
756
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
757 757
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
758 758
 		}
759 759
 
@@ -765,90 +765,90 @@  discard block
 block discarded – undo
765 765
 		$tax_field         = 'id';
766 766
 		$category          = array();
767 767
 
768
-		if ( isset( $_REQUEST['backandedit'] ) ) {
769
-			$post      = (object) $gd_session->get( 'listing' );
768
+		if (isset($_REQUEST['backandedit'])) {
769
+			$post      = (object) $gd_session->get('listing');
770 770
 			$post_type = $post->listing_type;
771
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
771
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
772 772
 				$post_id = $_REQUEST['pid'];
773 773
 			}
774
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
775
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
774
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
775
+			$post      = geodir_get_post_info($_REQUEST['pid']);
776 776
 			$post_type = $post->post_type;
777 777
 			$post_id   = $_REQUEST['pid'];
778
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
778
+		} elseif (isset($post->post_type) && $post->post_type != '') {
779 779
 			$post_type = $post->post_type;
780 780
 			$post_id   = $post->ID;
781 781
 		}
782 782
 
783
-		if ( $relate_to == 'category' ) {
783
+		if ($relate_to == 'category') {
784 784
 
785
-			$category_taxonomy = $post_type . $relate_to;
786
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
787
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
785
+			$category_taxonomy = $post_type.$relate_to;
786
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
787
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
788 788
 			}
789 789
 
790
-		} elseif ( $relate_to == 'tags' ) {
790
+		} elseif ($relate_to == 'tags') {
791 791
 
792
-			$category_taxonomy = $post_type . '_' . $relate_to;
793
-			if ( $post->post_tags != '' ) {
794
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
792
+			$category_taxonomy = $post_type.'_'.$relate_to;
793
+			if ($post->post_tags != '') {
794
+				$category = explode(',', trim($post->post_tags, ','));
795 795
 			}
796 796
 			$tax_field = 'name';
797 797
 		}
798 798
 
799 799
 		/* --- return false in invalid request --- */
800
-		if ( empty( $category ) ) {
800
+		if (empty($category)) {
801 801
 			return false;
802 802
 		}
803 803
 
804 804
 		$all_postypes = geodir_get_posttypes();
805 805
 
806
-		if ( ! in_array( $post_type, $all_postypes ) ) {
806
+		if (!in_array($post_type, $all_postypes)) {
807 807
 			return false;
808 808
 		}
809 809
 
810 810
 		/* --- return false in invalid request --- */
811 811
 
812 812
 		$location_url = '';
813
-		if ( $add_location_filter != '0' ) {
813
+		if ($add_location_filter != '0') {
814 814
 			$location_url             = array();
815
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
815
+			$geodir_show_location_url = get_option('geodir_show_location_url');
816 816
 
817
-			$gd_city = get_query_var( 'gd_city' );
817
+			$gd_city = get_query_var('gd_city');
818 818
 
819
-			if ( $gd_city ) {
820
-				$gd_country = get_query_var( 'gd_country' );
821
-				$gd_region  = get_query_var( 'gd_region' );
819
+			if ($gd_city) {
820
+				$gd_country = get_query_var('gd_country');
821
+				$gd_region  = get_query_var('gd_region');
822 822
 			} else {
823 823
 				$location = geodir_get_default_location();
824 824
 
825
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
826
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
827
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
825
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
826
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
827
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
828 828
 			}
829 829
 
830
-			if ( $geodir_show_location_url == 'all' ) {
830
+			if ($geodir_show_location_url == 'all') {
831 831
 				$location_url[] = $gd_country;
832 832
 				$location_url[] = $gd_region;
833
-			} else if ( $geodir_show_location_url == 'country_city' ) {
833
+			} else if ($geodir_show_location_url == 'country_city') {
834 834
 				$location_url[] = $gd_country;
835
-			} else if ( $geodir_show_location_url == 'region_city' ) {
835
+			} else if ($geodir_show_location_url == 'region_city') {
836 836
 				$location_url[] = $gd_region;
837 837
 			}
838 838
 
839 839
 			$location_url[] = $gd_city;
840 840
 
841
-			$location_url = implode( '/', $location_url );
841
+			$location_url = implode('/', $location_url);
842 842
 		}
843 843
 
844 844
 
845
-		if ( ! empty( $category ) ) {
845
+		if (!empty($category)) {
846 846
 			global $geodir_add_location_url;
847 847
 			$geodir_add_location_url = '0';
848
-			if ( $add_location_filter != '0' ) {
848
+			if ($add_location_filter != '0') {
849 849
 				$geodir_add_location_url = '1';
850 850
 			}
851
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
851
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
852 852
 			$geodir_add_location_url = null;
853 853
 		}
854 854
 		ob_start();
@@ -858,24 +858,24 @@  discard block
 block discarded – undo
858 858
 		<div class="geodir_locations geodir_location_listing">
859 859
 
860 860
 			<?php
861
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
861
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
862 862
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
863
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
863
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
864 864
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
865
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
865
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
866 866
 				?>
867 867
 				<div class="location_list_heading clearfix">
868
-					<?php echo $before_title . $title . $after_title; ?>
868
+					<?php echo $before_title.$title.$after_title; ?>
869 869
 				</div>
870 870
 				<?php
871 871
 			}
872 872
 			$query_args = array(
873 873
 				'posts_per_page'   => $post_number,
874 874
 				'is_geodir_loop'   => true,
875
-				'gd_location'      => ( $add_location_filter ) ? true : false,
875
+				'gd_location'      => ($add_location_filter) ? true : false,
876 876
 				'post_type'        => $post_type,
877 877
 				'order_by'         => $list_sort,
878
-				'post__not_in'     => array( $post_id ),
878
+				'post__not_in'     => array($post_id),
879 879
 				'excerpt_length'   => $character_count,
880 880
 				'related_listings' => $is_display
881 881
 			);
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 				'terms'    => $category
887 887
 			);
888 888
 
889
-			$query_args['tax_query'] = array( $tax_query );
889
+			$query_args['tax_query'] = array($tax_query);
890 890
 
891 891
 			global $gridview_columns, $post;
892 892
 
@@ -898,21 +898,21 @@  discard block
 block discarded – undo
898 898
 			 * @param array $query_args The query array.
899 899
 			 * @param array $request Related posts request array.
900 900
 			 */
901
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
901
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
902 902
 
903
-			query_posts( $query_args );
903
+			query_posts($query_args);
904 904
 
905
-			if ( strstr( $layout, 'gridview' ) ) {
906
-				$listing_view_exp = explode( '_', $layout );
905
+			if (strstr($layout, 'gridview')) {
906
+				$listing_view_exp = explode('_', $layout);
907 907
 				$gridview_columns = $layout;
908 908
 				$layout           = $listing_view_exp[0];
909
-			} else if ( $layout == 'list' ) {
909
+			} else if ($layout == 'list') {
910 910
 				$gridview_columns = '';
911 911
 			}
912 912
 			$related_posts = true;
913 913
 
914 914
 			$related_nearest = false;
915
-			if ( $list_sort == 'nearest' ) {
915
+			if ($list_sort == 'nearest') {
916 916
 				$related_nearest = true;
917 917
 			}
918 918
 
@@ -922,14 +922,14 @@  discard block
 block discarded – undo
922 922
 			 *
923 923
 			 * @since 1.0.0
924 924
 			 */
925
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
925
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
926 926
 
927 927
 			/**
928 928
 			 * Includes related listing listview template.
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			include( $template );
932
+			include($template);
933 933
 
934 934
 			wp_reset_query();
935 935
 			$post            = $origi_post;
@@ -957,12 +957,12 @@  discard block
 block discarded – undo
957 957
 function geodir_category_count_script() {
958 958
 	global $geodir_post_category_str;
959 959
 
960
-	if ( ! empty( $geodir_post_category_str ) ) {
961
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
960
+	if (!empty($geodir_post_category_str)) {
961
+		$geodir_post_category_str = serialize($geodir_post_category_str);
962 962
 	}
963 963
 
964
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
965
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
964
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
965
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
966 966
 	echo '<script>';
967 967
 	echo $script;
968 968
 	echo '</script>';
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
  * @return string Returns the default language.
978 978
  */
979 979
 function geodir_get_map_default_language() {
980
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
981
-	if ( empty( $geodir_default_map_language ) ) {
980
+	$geodir_default_map_language = get_option('geodir_default_map_language');
981
+	if (empty($geodir_default_map_language)) {
982 982
 		$geodir_default_map_language = 'en';
983 983
 	}
984 984
 
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @param string $geodir_default_map_language Default map language.
991 991
 	 */
992
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
992
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
993 993
 }
994 994
 
995 995
 /**
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
  * @return string Returns the api key.
1001 1001
  */
1002 1002
 function geodir_get_map_api_key() {
1003
-	$key = get_option( 'geodir_google_api_key' );
1003
+	$key = get_option('geodir_google_api_key');
1004 1004
 
1005 1005
 	/**
1006 1006
 	 * Filter Google maps api key.
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	 *
1010 1010
 	 * @param string $key Google maps api key.
1011 1011
 	 */
1012
-	return apply_filters( 'geodir_google_api_key', $key );
1012
+	return apply_filters('geodir_google_api_key', $key);
1013 1013
 }
1014 1014
 
1015 1015
 
@@ -1029,20 +1029,20 @@  discard block
 block discarded – undo
1029 1029
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1030 1030
 
1031 1031
 	$is_geodir_page = geodir_is_geodir_page();
1032
-	if ( ! $is_geodir_page ) {
1032
+	if (!$is_geodir_page) {
1033 1033
 		return;
1034 1034
 	}// if non GD page, bail
1035 1035
 
1036 1036
 	$use_gd_meta = true;
1037
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1037
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1038 1038
 		$use_gd_meta = false;
1039 1039
 
1040
-		if ( geodir_is_page( 'search' ) ) {
1040
+		if (geodir_is_page('search')) {
1041 1041
 			$use_gd_meta = true;
1042 1042
 		}
1043 1043
 	}
1044 1044
 
1045
-	if ( ! $use_gd_meta ) {
1045
+	if (!$use_gd_meta) {
1046 1046
 		return;
1047 1047
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1048 1048
 
@@ -1050,68 +1050,68 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	$all_postypes = geodir_get_posttypes();
1052 1052
 
1053
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1053
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1054 1054
 
1055 1055
 	$meta_desc = '';
1056 1056
 	$meta_key  = '';
1057
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1057
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1058 1058
 		/**
1059 1059
 		 * Filter SEO meta location description.
1060 1060
 		 *
1061 1061
 		 * @since 1.0.0
1062 1062
 		 */
1063
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1063
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1064 1064
 		$meta_desc .= '';
1065 1065
 	}
1066
-	if ( have_posts() && is_single() OR is_page() ) {
1067
-		while ( have_posts() ) {
1066
+	if (have_posts() && is_single() OR is_page()) {
1067
+		while (have_posts()) {
1068 1068
 			the_post();
1069 1069
 
1070
-			if ( has_excerpt() ) {
1071
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1072
-				if ( empty( $out_excerpt ) ) {
1073
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1070
+			if (has_excerpt()) {
1071
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1072
+				if (empty($out_excerpt)) {
1073
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1074 1074
 				}
1075
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1075
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1076 1076
 			} else {
1077
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1078
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1079
-				if ( empty( $out_excerpt ) ) {
1080
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1077
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1078
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1079
+				if (empty($out_excerpt)) {
1080
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1081 1081
 				}
1082
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1082
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1083 1083
 			}
1084 1084
 
1085 1085
 			$meta_desc .= $out_excerpt;
1086 1086
 		}
1087
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1088
-		if ( is_category() ) {
1089
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1090
-		} elseif ( is_tag() ) {
1091
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1087
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1088
+		if (is_category()) {
1089
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1090
+		} elseif (is_tag()) {
1091
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1092 1092
 		}
1093
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1094
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1093
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1094
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1095 1095
 	}
1096 1096
 
1097 1097
 
1098 1098
 	$geodir_post_type       = geodir_get_current_posttype();
1099
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1100
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1101
-
1102
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1103
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1104
-
1105
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1106
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1107
-
1108
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1109
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1110
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1111
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1112
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1113
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1114
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1099
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1100
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1101
+
1102
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1103
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1104
+
1105
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1106
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1107
+
1108
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1109
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1110
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1111
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1112
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1113
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1114
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1115 1115
 	/**
1116 1116
 	 * Filter the Everywhere text in location description.
1117 1117
 	 *
@@ -1119,108 +1119,108 @@  discard block
 block discarded – undo
1119 1119
 	 *
1120 1120
 	 * @param string $replace_location Everywhere text.
1121 1121
 	 */
1122
-	$replace_location        = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) );
1122
+	$replace_location        = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory'));
1123 1123
 	$location_id             = null;
1124
-	if ( $geodir_location_manager ) {
1125
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1126
-		$location_id   = (int) $wpdb->get_var( $sql );
1124
+	if ($geodir_location_manager) {
1125
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1126
+		$location_id   = (int) $wpdb->get_var($sql);
1127 1127
 		$location_type = geodir_what_is_current_location();
1128
-		if ( $location_type == 'city' ) {
1129
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1130
-		} elseif ( $location_type == 'region' ) {
1131
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1132
-		} elseif ( $location_type == 'country' ) {
1133
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1134
-			$replace_location = __( $replace_location, 'geodirectory' );
1135
-		}
1136
-		$country          = get_query_var( 'gd_country' );
1137
-		$region           = get_query_var( 'gd_region' );
1138
-		$city             = get_query_var( 'gd_city' );
1128
+		if ($location_type == 'city') {
1129
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1130
+		} elseif ($location_type == 'region') {
1131
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1132
+		} elseif ($location_type == 'country') {
1133
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1134
+			$replace_location = __($replace_location, 'geodirectory');
1135
+		}
1136
+		$country          = get_query_var('gd_country');
1137
+		$region           = get_query_var('gd_region');
1138
+		$city             = get_query_var('gd_city');
1139 1139
 		$current_location = '';
1140
-		if ( $country != '' ) {
1141
-			$current_location = get_actual_location_name( 'country', $country, true );
1140
+		if ($country != '') {
1141
+			$current_location = get_actual_location_name('country', $country, true);
1142 1142
 		}
1143
-		if ( $region != '' ) {
1144
-			$current_location = get_actual_location_name( 'region', $region );
1143
+		if ($region != '') {
1144
+			$current_location = get_actual_location_name('region', $region);
1145 1145
 		}
1146
-		if ( $city != '' ) {
1147
-			$current_location = get_actual_location_name( 'city', $city );
1146
+		if ($city != '') {
1147
+			$current_location = get_actual_location_name('city', $city);
1148 1148
 		}
1149 1149
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1150 1150
 	}
1151 1151
 
1152 1152
 	$geodir_meta_keys = '';
1153 1153
 	$geodir_meta_desc = '';
1154
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1155
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1156
-			$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;
1154
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1155
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1156
+			$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;
1157 1157
 
1158
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
-			$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;
1158
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
+			$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;
1160 1160
 
1161
-			if ( $geodir_is_category ) {
1162
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1163
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1161
+			if ($geodir_is_category) {
1162
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1163
+				if (isset($category->term_id) && !empty($category->term_id)) {
1164 1164
 					$category_id   = $category->term_id;
1165
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1166
-					if ( $location_id ) {
1167
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1168
-						$cat_loc_option = get_option( $option_name );
1169
-
1170
-						$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;
1171
-						if ( ! $gd_cat_loc_default ) {
1172
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1173
-							$option        = get_option( $option_name );
1174
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1165
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1166
+					if ($location_id) {
1167
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1168
+						$cat_loc_option = get_option($option_name);
1169
+
1170
+						$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;
1171
+						if (!$gd_cat_loc_default) {
1172
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1173
+							$option        = get_option($option_name);
1174
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1175 1175
 						}
1176 1176
 					}
1177
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1177
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1178 1178
 				}
1179
-			} else if ( $geodir_is_tag ) {
1180
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1179
+			} else if ($geodir_is_tag) {
1180
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1181 1181
 			}
1182 1182
 		}
1183 1183
 	}
1184 1184
 
1185 1185
 
1186 1186
 	$gd_page = '';
1187
-	if ( geodir_is_page( 'home' ) ) {
1187
+	if (geodir_is_page('home')) {
1188 1188
 		$gd_page   = 'home';
1189
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1190
-	} elseif ( geodir_is_page( 'detail' ) ) {
1189
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1190
+	} elseif (geodir_is_page('detail')) {
1191 1191
 		$gd_page   = 'detail';
1192
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1193
-	} elseif ( geodir_is_page( 'pt' ) ) {
1192
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1193
+	} elseif (geodir_is_page('pt')) {
1194 1194
 		$gd_page   = 'pt';
1195
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1196
-	} elseif ( geodir_is_page( 'listing' ) ) {
1195
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1196
+	} elseif (geodir_is_page('listing')) {
1197 1197
 		$gd_page   = 'listing';
1198
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1199
-	} elseif ( geodir_is_page( 'location' ) ) {
1198
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1199
+	} elseif (geodir_is_page('location')) {
1200 1200
 		$gd_page   = 'location';
1201
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1202
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1201
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1202
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1203 1203
 
1204
-	} elseif ( geodir_is_page( 'search' ) ) {
1204
+	} elseif (geodir_is_page('search')) {
1205 1205
 		$gd_page   = 'search';
1206
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1207
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1206
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1207
+	} elseif (geodir_is_page('add-listing')) {
1208 1208
 		$gd_page   = 'add-listing';
1209
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1210
-	} elseif ( geodir_is_page( 'author' ) ) {
1209
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1210
+	} elseif (geodir_is_page('author')) {
1211 1211
 		$gd_page   = 'author';
1212
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1213
-	} elseif ( geodir_is_page( 'login' ) ) {
1212
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1213
+	} elseif (geodir_is_page('login')) {
1214 1214
 		$gd_page   = 'login';
1215
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1216
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1215
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1216
+	} elseif (geodir_is_page('listing-success')) {
1217 1217
 		$gd_page   = 'listing-success';
1218
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1218
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222
-	if ( $meta_desc ) {
1223
-		$meta_desc = stripslashes_deep( $meta_desc );
1222
+	if ($meta_desc) {
1223
+		$meta_desc = stripslashes_deep($meta_desc);
1224 1224
 		/**
1225 1225
 		 * Filter page description to replace variables.
1226 1226
 		 *
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 		 * @param string $title   The page description including variables.
1230 1230
 		 * @param string $gd_page The GeoDirectory page type if any.
1231 1231
 		 */
1232
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1232
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1233 1233
 
1234 1234
 		/**
1235 1235
 		 * Filter SEO meta description.
@@ -1238,49 +1238,49 @@  discard block
 block discarded – undo
1238 1238
 		 *
1239 1239
 		 * @param string $meta_desc Meta description content.
1240 1240
 		 */
1241
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1241
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1242 1242
 	}
1243 1243
 
1244 1244
 	// meta keywords
1245
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1246
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1247
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1245
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1246
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1247
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1248 1248
 
1249
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1249
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1250 1250
 	} else {
1251 1251
 		$posttags = get_the_tags();
1252
-		if ( $posttags ) {
1253
-			foreach ( $posttags as $tag ) {
1254
-				$meta_key .= $tag->name . ' ';
1252
+		if ($posttags) {
1253
+			foreach ($posttags as $tag) {
1254
+				$meta_key .= $tag->name.' ';
1255 1255
 			}
1256 1256
 		} else {
1257
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1257
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1258 1258
 			$xt   = 1;
1259 1259
 
1260
-			foreach ( $tags as $tag ) {
1261
-				if ( $xt <= 20 ) {
1262
-					$meta_key .= $tag->name . ", ";
1260
+			foreach ($tags as $tag) {
1261
+				if ($xt <= 20) {
1262
+					$meta_key .= $tag->name.", ";
1263 1263
 				}
1264 1264
 
1265
-				$xt ++;
1265
+				$xt++;
1266 1266
 			}
1267 1267
 		}
1268 1268
 	}
1269 1269
 
1270
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1271
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1272
-	if ( $geodir_meta_keys != '' ) {
1273
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1274
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1275
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1276
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1277
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1270
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1271
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1272
+	if ($geodir_meta_keys != '') {
1273
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1274
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1275
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1276
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1277
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1278 1278
 
1279
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1279
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1280 1280
 	}
1281 1281
 
1282
-	if ( $meta_key ) {
1283
-		$meta_key = stripslashes_deep( $meta_key );
1282
+	if ($meta_key) {
1283
+		$meta_key = stripslashes_deep($meta_key);
1284 1284
 		/**
1285 1285
 		 * Filter SEO meta keywords.
1286 1286
 		 *
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		 *
1289 1289
 		 * @param string $meta_desc Meta keywords.
1290 1290
 		 */
1291
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1291
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1292 1292
 	}
1293 1293
 
1294 1294
 }
@@ -1308,8 +1308,8 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1310 1310
 
1311
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1312
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1311
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1312
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1313 1313
 	}
1314 1314
 
1315 1315
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1331,57 +1331,57 @@  discard block
 block discarded – undo
1331 1331
 	 * @since 1.0.0
1332 1332
 	 */
1333 1333
 	$arr_tabs['post_profile'] = array(
1334
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1334
+		'heading_text'  => __('Profile', 'geodirectory'),
1335 1335
 		'is_active_tab' => true,
1336
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1336
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1337 1337
 		'tab_content'   => ''
1338 1338
 	);
1339
-	$arr_tabs['post_info']    = array(
1340
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1339
+	$arr_tabs['post_info'] = array(
1340
+		'heading_text'  => __('More Info', 'geodirectory'),
1341 1341
 		'is_active_tab' => false,
1342
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1342
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1343 1343
 		'tab_content'   => ''
1344 1344
 	);
1345 1345
 
1346 1346
 	$arr_tabs['post_images'] = array(
1347
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1347
+		'heading_text'  => __('Photos', 'geodirectory'),
1348 1348
 		'is_active_tab' => false,
1349
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1349
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1350 1350
 		'tab_content'   => ''
1351 1351
 	);
1352 1352
 
1353 1353
 	$arr_tabs['post_video'] = array(
1354
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1354
+		'heading_text'  => __('Video', 'geodirectory'),
1355 1355
 		'is_active_tab' => false,
1356
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1356
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1357 1357
 		'tab_content'   => ''
1358 1358
 	);
1359 1359
 
1360 1360
 	$arr_tabs['special_offers'] = array(
1361
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1361
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1362 1362
 		'is_active_tab' => false,
1363
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1363
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1364 1364
 		'tab_content'   => ''
1365 1365
 	);
1366 1366
 
1367 1367
 	$arr_tabs['post_map'] = array(
1368
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1368
+		'heading_text'  => __('Map', 'geodirectory'),
1369 1369
 		'is_active_tab' => false,
1370
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1370
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1371 1371
 		'tab_content'   => ''
1372 1372
 	);
1373 1373
 
1374 1374
 	$arr_tabs['reviews'] = array(
1375
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1375
+		'heading_text'  => __('Reviews', 'geodirectory'),
1376 1376
 		'is_active_tab' => false,
1377
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1377
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1378 1378
 		'tab_content'   => 'review display'
1379 1379
 	);
1380 1380
 
1381 1381
 	$arr_tabs['related_listing'] = array(
1382
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1382
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1383 1383
 		'is_active_tab' => false,
1384
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1384
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1385 1385
 		'tab_content'   => ''
1386 1386
 	);
1387 1387
 
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 	 *
1391 1391
 	 * @since 1.0.0
1392 1392
 	 */
1393
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1393
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1394 1394
 
1395 1395
 
1396 1396
 }
@@ -1404,13 +1404,13 @@  discard block
 block discarded – undo
1404 1404
  * @return mixed|array Tabs array.
1405 1405
  */
1406 1406
 function geodir_detail_page_tabs_list() {
1407
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1407
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1408 1408
 	$tabs_array    = geodir_detail_page_tabs_array();
1409 1409
 
1410
-	if ( ! empty( $tabs_excluded ) ) {
1411
-		foreach ( $tabs_excluded as $tab ) {
1412
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1413
-				unset( $tabs_array[ $tab ] );
1410
+	if (!empty($tabs_excluded)) {
1411
+		foreach ($tabs_excluded as $tab) {
1412
+			if (array_key_exists($tab, $tabs_array)) {
1413
+				unset($tabs_array[$tab]);
1414 1414
 			}
1415 1415
 		}
1416 1416
 	}
@@ -1434,66 +1434,66 @@  discard block
 block discarded – undo
1434 1434
 function geodir_show_detail_page_tabs() {
1435 1435
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1436 1436
 
1437
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1438
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1439
-	$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
1437
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1438
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1439
+	$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
1440 1440
 
1441
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1442
-		$post = geodir_get_post_info( $request_post_id );
1443
-		setup_postdata( $post );
1441
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1442
+		$post = geodir_get_post_info($request_post_id);
1443
+		setup_postdata($post);
1444 1444
 	}
1445 1445
 
1446
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1446
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1447 1447
 
1448 1448
 	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1449 1449
 	$image_limit = '';
1450 1450
 	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1451
-		$image_limit = (int)$package_info->image_limit;
1451
+		$image_limit = (int) $package_info->image_limit;
1452 1452
 	}
1453 1453
 
1454
-	if ( geodir_is_page( 'detail' ) ) {
1455
-		$video                 = geodir_get_video( $post->ID );
1456
-		$special_offers        = geodir_get_special_offers( $post->ID );
1454
+	if (geodir_is_page('detail')) {
1455
+		$video                 = geodir_get_video($post->ID);
1456
+		$special_offers        = geodir_get_special_offers($post->ID);
1457 1457
 		$related_listing_array = array();
1458
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1459
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1458
+		if (get_option('geodir_add_related_listing_posttypes')) {
1459
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1460 1460
 		}
1461 1461
 
1462
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1463
-		if ( ! $excluded_tabs ) {
1462
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1463
+		if (!$excluded_tabs) {
1464 1464
 			$excluded_tabs = array();
1465 1465
 		}
1466 1466
 
1467 1467
 		$related_listing = '';
1468
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1468
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1469 1469
 			$request = array(
1470
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1471
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1472
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1473
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1474
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1475
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1470
+				'post_number'         => get_option('geodir_related_post_count'),
1471
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1472
+				'layout'              => get_option('geodir_related_post_listing_view'),
1473
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1474
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1475
+				'character_count'     => get_option('geodir_related_post_excerpt')
1476 1476
 			);
1477 1477
 
1478
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1479
-				$related_listing = geodir_get_detail_page_related_events( $request );
1478
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1479
+				$related_listing = geodir_get_detail_page_related_events($request);
1480 1480
 			} else {
1481
-				$related_listing = geodir_related_posts_display( $request );
1481
+				$related_listing = geodir_related_posts_display($request);
1482 1482
 			}
1483 1483
 
1484 1484
 		}
1485 1485
 
1486
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1486
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1487 1487
 		$thumb_image = '';
1488
-		if ( ! empty( $post_images ) ) {
1488
+		if (!empty($post_images)) {
1489 1489
 			$count = 1;
1490
-			foreach ( $post_images as $image ) {
1490
+			foreach ($post_images as $image) {
1491 1491
 				if ($image_limit !== '' && $count > $image_limit) {
1492 1492
 					break;
1493 1493
 				}
1494
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1495
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1496
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1494
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1495
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1496
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1497 1497
 				$thumb_image .= '</a>';
1498 1498
 				$count++;
1499 1499
 			}
@@ -1503,11 +1503,11 @@  discard block
 block discarded – undo
1503 1503
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1504 1504
 		$map_args['width']           = '600';
1505 1505
 		$map_args['height']          = '300';
1506
-		if ( $post->post_mapzoom ) {
1507
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1506
+		if ($post->post_mapzoom) {
1507
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1508 1508
 		}
1509 1509
 		$map_args['autozoom']                 = false;
1510
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1510
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1511 1511
 		$map_args['child_collapse']           = '0';
1512 1512
 		$map_args['enable_cat_filters']       = false;
1513 1513
 		$map_args['enable_text_search']       = false;
@@ -1516,29 +1516,29 @@  discard block
 block discarded – undo
1516 1516
 		$map_args['enable_jason_on_load']     = true;
1517 1517
 		$map_args['enable_map_direction']     = true;
1518 1518
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1519
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1520
-	} else if ( geodir_is_page( 'preview' ) ) {
1521
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1522
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1519
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1520
+	} else if (geodir_is_page('preview')) {
1521
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1522
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1523 1523
 
1524
-		if ( isset( $post->post_images ) ) {
1525
-			$post->post_images = trim( $post->post_images, "," );
1524
+		if (isset($post->post_images)) {
1525
+			$post->post_images = trim($post->post_images, ",");
1526 1526
 		}
1527 1527
 
1528
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1529
-			$post_images = explode( ",", $post->post_images );
1528
+		if (isset($post->post_images) && !empty($post->post_images)) {
1529
+			$post_images = explode(",", $post->post_images);
1530 1530
 		}
1531 1531
 
1532 1532
 		$thumb_image = '';
1533
-		if ( ! empty( $post_images ) ) {
1533
+		if (!empty($post_images)) {
1534 1534
 			$count = 1;
1535
-			foreach ( $post_images as $image ) {
1536
-				if ( $image != '' ) {
1535
+			foreach ($post_images as $image) {
1536
+				if ($image != '') {
1537 1537
 					if ($image_limit !== '' && $count > $image_limit) {
1538 1538
 						break;
1539 1539
 					}
1540
-					$thumb_image .= '<a href="' . $image . '">';
1541
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1540
+					$thumb_image .= '<a href="'.$image.'">';
1541
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1542 1542
 					$thumb_image .= '</a>';
1543 1543
 					$count++;
1544 1544
 				}
@@ -1546,18 +1546,18 @@  discard block
 block discarded – undo
1546 1546
 		}
1547 1547
 
1548 1548
 		global $map_jason;
1549
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1550
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1551
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1549
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1550
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1551
+		$icon_size        = geodir_get_marker_size($marker_icon);
1552 1552
 		$marker_json['w'] = $icon_size['w'];
1553 1553
 		$marker_json['h'] = $icon_size['h'];
1554
-		$map_jason[]      = json_encode( $marker_json );
1554
+		$map_jason[]      = json_encode($marker_json);
1555 1555
 
1556
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1557
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1558
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1559
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1560
-		if ( ! $mapzoom ) {
1556
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1557
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1558
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1559
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1560
+		if (!$mapzoom) {
1561 1561
 			$mapzoom = 12;
1562 1562
 		}
1563 1563
 
@@ -1580,37 +1580,37 @@  discard block
 block discarded – undo
1580 1580
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1581 1581
 	}
1582 1582
 
1583
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1583
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1584 1584
 
1585 1585
 	$active_tab       = '';
1586 1586
 	$active_tab_name  = '';
1587 1587
 	$default_tab      = '';
1588 1588
 	$default_tab_name = '';
1589
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1590
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1589
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1590
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1591 1591
 			$active_tab      = $tab_index;
1592
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1592
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1593 1593
 		}
1594 1594
 
1595
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1595
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1596 1596
 			$default_tab      = $tab_index;
1597
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1597
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1598 1598
 		}
1599 1599
 	}
1600 1600
 
1601
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1602
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1603
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1601
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1602
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1603
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1604 1604
 		}
1605 1605
 
1606
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1606
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1607 1607
 		$active_tab                                            = $default_tab;
1608 1608
 		$active_tab_name                                       = $default_tab_name;
1609 1609
 	}
1610
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1610
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1611 1611
 	?>
1612 1612
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1613
-		<?php if ( ! $tab_list ){ ?>
1613
+		<?php if (!$tab_list) { ?>
1614 1614
 		<div id="geodir-tab-mobile-menu">
1615 1615
 			<i class="fa fa-bars"></i>
1616 1616
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1625,26 +1625,26 @@  discard block
 block discarded – undo
1625 1625
 			 * @since 1.0.0
1626 1626
 			 * @see   'geodir_after_tab_list'
1627 1627
 			 */
1628
-			do_action( 'geodir_before_tab_list' ); ?>
1628
+			do_action('geodir_before_tab_list'); ?>
1629 1629
 			<?php
1630 1630
 
1631
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1632
-				if ( $detail_page_tab['is_display'] ) {
1631
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1632
+				if ($detail_page_tab['is_display']) {
1633 1633
 
1634
-					if ( ! $tab_list ) {
1634
+					if (!$tab_list) {
1635 1635
 						?>
1636 1636
 						<dt></dt> <!-- added to comply with validation -->
1637
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1637
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1638 1638
 								data-tab="#<?php echo $tab_index; ?>"
1639
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1639
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1640 1640
 						</dd>
1641 1641
 						<?php
1642 1642
 					}
1643 1643
 					ob_start() // start tab content buffering
1644 1644
 					?>
1645 1645
 					<li id="<?php echo $tab_index; ?>Tab">
1646
-						<?php if ( $tab_list ) {
1647
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1646
+						<?php if ($tab_list) {
1647
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1648 1648
 							/**
1649 1649
 							 * Filter the tab list title html.
1650 1650
 							 *
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 							 * @param string $tab_index      The tab index type.
1655 1655
 							 * @param array $detail_page_tab The array of values including title text.
1656 1656
 							 */
1657
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1657
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1658 1658
 						} ?>
1659 1659
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1660 1660
 						<?php
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
 						 *
1666 1666
 						 * @param string $tab_index The tab name ID.
1667 1667
 						 */
1668
-						do_action( 'geodir_before_tab_content', $tab_index );
1668
+						do_action('geodir_before_tab_content', $tab_index);
1669 1669
 
1670 1670
 						/**
1671 1671
 						 * Called before the details tab content is output per tab.
@@ -1675,21 +1675,21 @@  discard block
 block discarded – undo
1675 1675
 						 * @since 1.0.0
1676 1676
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1677 1677
 						 */
1678
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1678
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1679 1679
 						/// write a code to generate content of each tab
1680
-						switch ( $tab_index ) {
1680
+						switch ($tab_index) {
1681 1681
 							case 'post_profile':
1682 1682
 								/**
1683 1683
 								 * Called before the listing description content on the details page tab.
1684 1684
 								 *
1685 1685
 								 * @since 1.0.0
1686 1686
 								 */
1687
-								do_action( 'geodir_before_description_on_listing_detail' );
1688
-								if ( geodir_is_page( 'detail' ) ) {
1687
+								do_action('geodir_before_description_on_listing_detail');
1688
+								if (geodir_is_page('detail')) {
1689 1689
 									the_content();
1690 1690
 								} else {
1691 1691
 									/** This action is documented in geodirectory_template_actions.php */
1692
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1692
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1693 1693
 								}
1694 1694
 
1695 1695
 								/**
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 								 *
1698 1698
 								 * @since 1.0.0
1699 1699
 								 */
1700
-								do_action( 'geodir_after_description_on_listing_detail' );
1700
+								do_action('geodir_after_description_on_listing_detail');
1701 1701
 								break;
1702 1702
 							case 'post_info':
1703 1703
 								echo $geodir_post_detail_fields;
@@ -1707,32 +1707,32 @@  discard block
 block discarded – undo
1707 1707
 								break;
1708 1708
 							case 'post_video':
1709 1709
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1710
-								if ( $preview ) {
1711
-									if ( $video ) {
1712
-										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>";
1710
+								if ($preview) {
1711
+									if ($video) {
1712
+										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>";
1713 1713
 									}
1714 1714
 								} else {
1715 1715
 
1716 1716
 									// stop payment manager filtering content length
1717
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1718
-									if ( false !== $filter_priority ) {
1719
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1717
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1718
+									if (false !== $filter_priority) {
1719
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1720 1720
 									}
1721 1721
 
1722 1722
 									/** This action is documented in geodirectory_template_actions.php */
1723
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1723
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1724 1724
 
1725
-									if ( false !== $filter_priority ) {
1726
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1725
+									if (false !== $filter_priority) {
1726
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1727 1727
 									}
1728 1728
 								}
1729 1729
 								break;
1730 1730
 							case 'special_offers':
1731
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1731
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1732 1732
 
1733 1733
 								break;
1734 1734
 							case 'post_map':
1735
-								geodir_draw_map( $map_args );
1735
+								geodir_draw_map($map_args);
1736 1736
 								break;
1737 1737
 							case 'reviews':
1738 1738
 								comments_template();
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 								echo $related_listing;
1742 1742
 								break;
1743 1743
 							default: {
1744
-								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'] ) ) {
1744
+								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'])) {
1745 1745
 									echo $detail_page_tab['tab_content'];
1746 1746
 								}
1747 1747
 							}
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 						 *
1754 1754
 						 * @since 1.0.0
1755 1755
 						 */
1756
-						do_action( 'geodir_after_tab_content', $tab_index );
1756
+						do_action('geodir_after_tab_content', $tab_index);
1757 1757
 
1758 1758
 						/**
1759 1759
 						 * Called after the details tab content is output per tab.
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
 						 * @since 1.0.0
1764 1764
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1765 1765
 						 */
1766
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1766
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1767 1767
 						?> </li>
1768 1768
 					<?php
1769 1769
 					/**
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 					 *
1772 1772
 					 * @since 1.0.0
1773 1773
 					 */
1774
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1774
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1775 1775
 				} // end of if for is_display
1776 1776
 			}// end of foreach
1777 1777
 
@@ -1781,14 +1781,14 @@  discard block
 block discarded – undo
1781 1781
 			 * @since 1.0.0
1782 1782
 			 * @see   'geodir_before_tab_list'
1783 1783
 			 */
1784
-			do_action( 'geodir_after_tab_list' );
1784
+			do_action('geodir_after_tab_list');
1785 1785
 			?>
1786
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1787
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1786
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1787
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1788 1788
 		    style="position:relative;">
1789 1789
 			<?php
1790
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1791
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1790
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1791
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1792 1792
 					echo $detail_page_tab['tab_content'];
1793 1793
 				}// end of if
1794 1794
 			}// end of foreach
@@ -1798,11 +1798,11 @@  discard block
 block discarded – undo
1798 1798
 			 *
1799 1799
 			 * @since 1.0.0
1800 1800
 			 */
1801
-			do_action( 'geodir_add_tab_content' ); ?>
1801
+			do_action('geodir_add_tab_content'); ?>
1802 1802
 		</ul>
1803 1803
 		<!--gd-tabs-content ul end-->
1804 1804
 	</div>
1805
-	<?php if ( ! $tab_list ) { ?>
1805
+	<?php if (!$tab_list) { ?>
1806 1806
 		<script>
1807 1807
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1808 1808
 				hashVal = window.location.hash;
@@ -1834,31 +1834,31 @@  discard block
 block discarded – undo
1834 1834
  *
1835 1835
  * @return mixed Image file.
1836 1836
  */
1837
-function geodir_exif( $file ) {
1838
-	if ( empty( $file ) || ! is_array( $file ) ) {
1837
+function geodir_exif($file) {
1838
+	if (empty($file) || !is_array($file)) {
1839 1839
 		return $file;
1840 1840
 	}
1841 1841
 
1842
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1843
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1842
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1843
+	if (!($file_path && file_exists($file_path))) {
1844 1844
 		return $file;
1845 1845
 	}
1846 1846
 	$file['file'] = $file_path;
1847 1847
 
1848
-	if ( ! file_is_valid_image( $file_path ) ) {
1848
+	if (!file_is_valid_image($file_path)) {
1849 1849
 		return $file; // Bail if file is not an image.
1850 1850
 	}
1851 1851
 
1852
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1852
+	if (!function_exists('wp_get_image_editor')) {
1853 1853
 		return $file;
1854 1854
 	}
1855 1855
 
1856 1856
 	$mime_type = $file['type'];
1857 1857
 	$exif      = array();
1858
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1858
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1859 1859
 		try {
1860
-			$exif = exif_read_data( $file_path );
1861
-		} catch ( Exception $e ) {
1860
+			$exif = exif_read_data($file_path);
1861
+		} catch (Exception $e) {
1862 1862
 			$exif = array();
1863 1863
 		}
1864 1864
 	}
@@ -1867,13 +1867,13 @@  discard block
 block discarded – undo
1867 1867
 	$flip        = false;
1868 1868
 	$modify      = false;
1869 1869
 	$orientation = 0;
1870
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1871
-		switch ( (int) $exif['Orientation'] ) {
1870
+	if (!empty($exif) && isset($exif['Orientation'])) {
1871
+		switch ((int) $exif['Orientation']) {
1872 1872
 			case 1:
1873 1873
 				// do nothing
1874 1874
 				break;
1875 1875
 			case 2:
1876
-				$flip   = array( false, true );
1876
+				$flip   = array(false, true);
1877 1877
 				$modify = true;
1878 1878
 				break;
1879 1879
 			case 3:
@@ -1882,13 +1882,13 @@  discard block
 block discarded – undo
1882 1882
 				$modify      = true;
1883 1883
 				break;
1884 1884
 			case 4:
1885
-				$flip   = array( true, false );
1885
+				$flip   = array(true, false);
1886 1886
 				$modify = true;
1887 1887
 				break;
1888 1888
 			case 5:
1889 1889
 				$orientation = - 90;
1890 1890
 				$rotate      = true;
1891
-				$flip        = array( false, true );
1891
+				$flip        = array(false, true);
1892 1892
 				$modify      = true;
1893 1893
 				break;
1894 1894
 			case 6:
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 			case 7:
1900 1900
 				$orientation = - 270;
1901 1901
 				$rotate      = true;
1902
-				$flip        = array( false, true );
1902
+				$flip        = array(false, true);
1903 1903
 				$modify      = true;
1904 1904
 				break;
1905 1905
 			case 8:
@@ -1925,31 +1925,31 @@  discard block
 block discarded – undo
1925 1925
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1926 1926
 	 * @param string $quality   Image mime type.
1927 1927
 	 */
1928
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1929
-	if ( $quality !== null ) {
1928
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1929
+	if ($quality !== null) {
1930 1930
 		$modify = true;
1931 1931
 	}
1932 1932
 
1933
-	if ( ! $modify ) {
1933
+	if (!$modify) {
1934 1934
 		return $file; // no change
1935 1935
 	}
1936 1936
 
1937
-	$image = wp_get_image_editor( $file_path );
1938
-	if ( ! is_wp_error( $image ) ) {
1939
-		if ( $rotate ) {
1940
-			$image->rotate( $orientation );
1937
+	$image = wp_get_image_editor($file_path);
1938
+	if (!is_wp_error($image)) {
1939
+		if ($rotate) {
1940
+			$image->rotate($orientation);
1941 1941
 		}
1942 1942
 
1943
-		if ( ! empty( $flip ) ) {
1944
-			$image->flip( $flip[0], $flip[1] );
1943
+		if (!empty($flip)) {
1944
+			$image->flip($flip[0], $flip[1]);
1945 1945
 		}
1946 1946
 
1947
-		if ( $quality !== null ) {
1948
-			$image->set_quality( (int) $quality );
1947
+		if ($quality !== null) {
1948
+			$image->set_quality((int) $quality);
1949 1949
 		}
1950 1950
 
1951
-		$result = $image->save( $file_path );
1952
-		if ( ! is_wp_error( $result ) ) {
1951
+		$result = $image->save($file_path);
1952
+		if (!is_wp_error($result)) {
1953 1953
 			$file['file']     = $result['path'];
1954 1954
 			$file['tmp_name'] = $result['path'];
1955 1955
 		}
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
  *
1978 1978
  * @return string Returns the recent reviews html.
1979 1979
  */
1980
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false ) {
1980
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false) {
1981 1981
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1982 1982
 	$tablecomments = $wpdb->comments;
1983 1983
 	$tableposts    = $wpdb->posts;
@@ -1987,17 +1987,17 @@  discard block
 block discarded – undo
1987 1987
 	$region_filter  = '';
1988 1988
 	$country_filter = '';
1989 1989
 
1990
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1991
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1992
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1990
+	if ($gd_session->get('gd_multi_location')) {
1991
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1992
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1993 1993
 		}
1994 1994
 
1995
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1996
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1995
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1996
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1997 1997
 		}
1998 1998
 
1999
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
2000
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1999
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
2000
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
2001 2001
 		}
2002 2002
 	}
2003 2003
 
@@ -2008,84 +2008,84 @@  discard block
 block discarded – undo
2008 2008
 		$lang_code = ICL_LANGUAGE_CODE;
2009 2009
 
2010 2010
 		if ($lang_code) {
2011
-			$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'";
2012
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2011
+			$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'";
2012
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2013 2013
 		}
2014 2014
 	}
2015 2015
 
2016
-	$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 ". $no_comments;
2016
+	$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 ".$no_comments;
2017 2017
 
2018
-	$comments = $wpdb->get_results( $request );
2018
+	$comments = $wpdb->get_results($request);
2019 2019
 
2020
-	foreach ( $comments as $comment ) {
2020
+	foreach ($comments as $comment) {
2021 2021
 		// Set the extra comment info needed.
2022
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2022
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2023 2023
 		$comment->comment_content      = $comment_extra->comment_content;
2024 2024
 		$comment->comment_author       = $comment_extra->comment_author;
2025 2025
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2026 2026
 
2027 2027
 		$comment_id      = '';
2028 2028
 		$comment_id      = $comment->comment_ID;
2029
-		$comment_content = strip_tags( $comment->comment_content );
2029
+		$comment_content = strip_tags($comment->comment_content);
2030 2030
 
2031
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2031
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2032 2032
 
2033
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2033
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2034 2034
 		$comment_author_email = $comment->comment_author_email;
2035 2035
 		$comment_post_ID      = $comment->post_id;
2036 2036
 
2037
-		$post_title        = get_the_title( $comment_post_ID );
2038
-		$permalink         = get_permalink( $comment_post_ID );
2039
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2040
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2037
+		$post_title        = get_the_title($comment_post_ID);
2038
+		$permalink         = get_permalink($comment_post_ID);
2039
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2040
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2041 2041
 
2042
-		$comment_content_length = strlen( $comment_content );
2043
-		if ( $comment_content_length > $comment_lenth ) {
2044
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2042
+		$comment_content_length = strlen($comment_content);
2043
+		if ($comment_content_length > $comment_lenth) {
2044
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2045 2045
 		} else {
2046 2046
 			$comment_excerpt = $comment_content;
2047 2047
 		}
2048 2048
 
2049
-		if ( $comment->user_id ) {
2050
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2049
+		if ($comment->user_id) {
2050
+			$user_profile_url = get_author_posts_url($comment->user_id);
2051 2051
 		} else {
2052 2052
 			$user_profile_url = '';
2053 2053
 		}
2054 2054
 
2055
-		if ( $comment_id ) {
2055
+		if ($comment_id) {
2056 2056
 			$comments_echo .= '<li class="clearfix">';
2057
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2058
-			if ( function_exists( 'get_avatar' ) ) {
2059
-				if ( ! isset( $comment->comment_type ) ) {
2060
-					if ( $user_profile_url ) {
2061
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2057
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2058
+			if (function_exists('get_avatar')) {
2059
+				if (!isset($comment->comment_type)) {
2060
+					if ($user_profile_url) {
2061
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2062 2062
 					}
2063
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2064
-					if ( $user_profile_url ) {
2063
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2064
+					if ($user_profile_url) {
2065 2065
 						$comments_echo .= '</a>';
2066 2066
 					}
2067
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2068
-					if ( $user_profile_url ) {
2069
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2067
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2068
+					if ($user_profile_url) {
2069
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2070 2070
 					}
2071
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2071
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2072 2072
 				}
2073
-			} elseif ( function_exists( 'gravatar' ) ) {
2074
-				if ( $user_profile_url ) {
2075
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2073
+			} elseif (function_exists('gravatar')) {
2074
+				if ($user_profile_url) {
2075
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2076 2076
 				}
2077 2077
 				$comments_echo .= "<img src=\"";
2078
-				if ( '' == $comment->comment_type ) {
2079
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2080
-					if ( $user_profile_url ) {
2078
+				if ('' == $comment->comment_type) {
2079
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2080
+					if ($user_profile_url) {
2081 2081
 						$comments_echo .= '</a>';
2082 2082
 					}
2083
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2084
-					if ( $user_profile_url ) {
2085
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2083
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2084
+					if ($user_profile_url) {
2085
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2086 2086
 					}
2087
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2088
-					if ( $user_profile_url ) {
2087
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2088
+					if ($user_profile_url) {
2089 2089
 						$comments_echo .= '</a>';
2090 2090
 					}
2091 2091
 				}
@@ -2096,17 +2096,17 @@  discard block
 block discarded – undo
2096 2096
 
2097 2097
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2098 2098
 			$author_link = apply_filters('geodir_reviewer_content_author_link', true);
2099
-			if ( $comment->user_id && $author_link ) {
2100
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2099
+			if ($comment->user_id && $author_link) {
2100
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2101 2101
 			}
2102
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2103
-			if ( $comment->user_id && $author_link ) {
2102
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2103
+			if ($comment->user_id && $author_link) {
2104 2104
 				$comments_echo .= '</a>';
2105 2105
 			}
2106
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2107
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2108
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2109
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2106
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2107
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2108
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2109
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2110 2110
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2111 2111
 			$comments_echo .= '</p>';
2112 2112
 
@@ -2126,25 +2126,25 @@  discard block
 block discarded – undo
2126 2126
  * @return array Returns post categories as an array.
2127 2127
  */
2128 2128
 function geodir_home_map_cats_key_value_array() {
2129
-	$post_types = geodir_get_posttypes( 'object' );
2129
+	$post_types = geodir_get_posttypes('object');
2130 2130
 
2131 2131
 	$return = array();
2132
-	if ( ! empty( $post_types ) ) {
2133
-		foreach ( $post_types as $key => $post_type ) {
2134
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2135
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2136
-			$taxonomies     = geodir_get_taxonomies( $key );
2137
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2138
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2139
-
2140
-			if ( ! empty( $cat_terms ) ) {
2141
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2142
-
2143
-				foreach ( $cat_terms as $cat_term ) {
2144
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2132
+	if (!empty($post_types)) {
2133
+		foreach ($post_types as $key => $post_type) {
2134
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2135
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2136
+			$taxonomies     = geodir_get_taxonomies($key);
2137
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2138
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2139
+
2140
+			if (!empty($cat_terms)) {
2141
+				$return['optgroup_start-'.$key] = $post_type_name;
2142
+
2143
+				foreach ($cat_terms as $cat_term) {
2144
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2145 2145
 				}
2146 2146
 
2147
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2147
+				$return['optgroup_end-'.$key] = $post_type_name;
2148 2148
 			}
2149 2149
 		}
2150 2150
 	}
@@ -2160,14 +2160,14 @@  discard block
 block discarded – undo
2160 2160
  * @package GeoDirectory
2161 2161
  */
2162 2162
 function geodir_twitter_tweet_button() {
2163
-	if ( isset( $_GET['gde'] ) ) {
2164
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2163
+	if (isset($_GET['gde'])) {
2164
+		$link = '?url='.urlencode(geodir_curPageURL());
2165 2165
 	} else {
2166 2166
 		$link = '';
2167 2167
 	}
2168 2168
 	?>
2169 2169
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2170
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2170
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2171 2171
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2172 2172
 	<?php
2173 2173
 }
@@ -2184,10 +2184,10 @@  discard block
 block discarded – undo
2184 2184
 function geodir_fb_like_button() {
2185 2185
 	global $post;
2186 2186
 	?>
2187
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2187
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2188 2188
 		echo 'allowtransparency="true"';
2189 2189
 	} ?> class="facebook"
2190
-	     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"
2190
+	     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"
2191 2191
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2192 2192
 	<?php
2193 2193
 }
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 
2219 2219
 
2220 2220
 function geodir_listing_bounce_map_pin_on_hover() {
2221
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2221
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2222 2222
 		?>
2223 2223
 		<script>
2224 2224
 			jQuery(function ($) {
@@ -2241,44 +2241,44 @@  discard block
 block discarded – undo
2241 2241
 	}
2242 2242
 }
2243 2243
 
2244
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2244
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2245 2245
 
2246
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2247
-function geodir_output_favourite_html_listings( $post_id ) {
2248
-	geodir_favourite_html( '', $post_id );
2246
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2247
+function geodir_output_favourite_html_listings($post_id) {
2248
+	geodir_favourite_html('', $post_id);
2249 2249
 }
2250 2250
 
2251
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2252
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2251
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2252
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2253 2253
 	global $wp_query;
2254 2254
 
2255 2255
 	$show_pin_point = $wp_query->is_main_query();
2256 2256
 
2257
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2258
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2259
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2257
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2258
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2259
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2260 2260
 		?>
2261 2261
 		<span class="geodir-pinpoint"
2262
-		      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>
2262
+		      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>
2263 2263
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2264 2264
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2265 2265
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2266
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2266
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2267 2267
 		<?php
2268 2268
 	}
2269 2269
 }
2270 2270
 
2271 2271
 function geodir_search_form_submit_button() {
2272 2272
 
2273
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2273
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2274 2274
 
2275
-	if ( $new_style ) {
2275
+	if ($new_style) {
2276 2276
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2277
-	}else{
2277
+	} else {
2278 2278
 		$default_search_button_label = 'Search';
2279 2279
 	}
2280
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2281
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2280
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2281
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2282 2282
 	}
2283 2283
 
2284 2284
 	/**
@@ -2290,78 +2290,78 @@  discard block
 block discarded – undo
2290 2290
 	 *
2291 2291
 	 * @param string $default_search_button_label The current search button text.
2292 2292
 	 */
2293
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2293
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2294 2294
 
2295 2295
 	$fa_class = '';
2296
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2296
+	if (strpos($default_search_button_label, '&#') !== false) {
2297 2297
 		$fa_class = 'fa';
2298 2298
 	}
2299 2299
 
2300 2300
 
2301
-	if ( $new_style ) {
2301
+	if ($new_style) {
2302 2302
 		?>
2303
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2304
-	<?php }else{?>
2305
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2303
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2304
+	<?php } else {?>
2305
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2306 2306
 		       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2307 2307
 	<?php }
2308 2308
 }
2309 2309
 
2310
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2310
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2311 2311
 
2312 2312
 function geodir_search_form_post_type_input() {
2313 2313
 	global $geodir_search_post_type;
2314
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2314
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2315 2315
 	$curr_post_type = $geodir_search_post_type;
2316 2316
 
2317
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2317
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2318 2318
 
2319
-		foreach ( $post_types as $post_type => $info ){
2319
+		foreach ($post_types as $post_type => $info) {
2320 2320
 			global $wpdb;
2321
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2322
-			if ( ! $has_posts ) {
2321
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2322
+			if (!$has_posts) {
2323 2323
 				unset($post_types->{$post_type});
2324 2324
 			}
2325 2325
 		}
2326 2326
 
2327
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2327
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2328 2328
 
2329
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2330
-			if ( $new_style ) {
2329
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2330
+			if ($new_style) {
2331 2331
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2332 2332
 			}
2333 2333
 			?>
2334 2334
 			<select name="stype" class="search_by_post">
2335
-				<?php foreach ( $post_types as $post_type => $info ):
2335
+				<?php foreach ($post_types as $post_type => $info):
2336 2336
 					global $wpdb;
2337 2337
 					?>
2338 2338
 
2339
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2340
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2341
-						if ( $post_type == $_REQUEST['stype'] ) {
2339
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2340
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2341
+						if ($post_type == $_REQUEST['stype']) {
2342 2342
 							echo 'selected="selected"';
2343 2343
 						}
2344
-					} elseif ( $curr_post_type == $post_type ) {
2344
+					} elseif ($curr_post_type == $post_type) {
2345 2345
 						echo 'selected="selected"';
2346
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2346
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2347 2347
 
2348 2348
 				<?php endforeach; ?>
2349 2349
 			</select>
2350 2350
 			<?php
2351
-			if ( $new_style ) {
2351
+			if ($new_style) {
2352 2352
 				echo "</div>";
2353 2353
 			}
2354
-		}else{
2355
-			if(! empty( $post_types )){
2356
-				$pt_arr = (array)$post_types;
2357
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2358
-			}else{
2354
+		} else {
2355
+			if (!empty($post_types)) {
2356
+				$pt_arr = (array) $post_types;
2357
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2358
+			} else {
2359 2359
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2360 2360
 			}
2361 2361
 
2362 2362
 		}
2363 2363
 
2364
-	}elseif ( ! empty( $post_types ) ) {
2364
+	}elseif (!empty($post_types)) {
2365 2365
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2366 2366
 	}
2367 2367
 }
@@ -2369,26 +2369,26 @@  discard block
 block discarded – undo
2369 2369
 function geodir_search_form_search_input() {
2370 2370
 
2371 2371
 	$default_search_for_text = SEARCH_FOR_TEXT;
2372
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2373
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2372
+	if (get_option('geodir_search_field_default_text')) {
2373
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2374 2374
 	}
2375 2375
 
2376 2376
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2377
-	if($new_style){
2377
+	if ($new_style) {
2378 2378
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2379 2379
 	}
2380 2380
 	?>
2381 2381
 	<input class="search_text" name="s"
2382
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2383
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2382
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2383
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2384 2384
 	       } else {
2385 2385
 		       echo $default_search_for_text;
2386 2386
 	       } ?>" type="text"
2387
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2388
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2387
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2388
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2389 2389
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2390 2390
 	<?php
2391
-	if($new_style){
2391
+	if ($new_style) {
2392 2392
 		echo "</div>";
2393 2393
 	}
2394 2394
 }
@@ -2396,12 +2396,12 @@  discard block
 block discarded – undo
2396 2396
 function geodir_search_form_near_input() {
2397 2397
 
2398 2398
 	$default_near_text = NEAR_TEXT;
2399
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2400
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2399
+	if (get_option('geodir_near_field_default_text')) {
2400
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2401 2401
 	}
2402 2402
 
2403
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2404
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2403
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2404
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2405 2405
 	} else {
2406 2406
 		$near = $default_near_text;
2407 2407
 	}
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 	 * @since 1.6.9
2416 2416
 	 * @param string $curr_post_type The current post type.
2417 2417
 	 */
2418
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2418
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2419 2419
 
2420 2420
 
2421 2421
 	/**
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
 	 * @param string $near              The current near value.
2429 2429
 	 * @param string $default_near_text The default near value.
2430 2430
 	 */
2431
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2431
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2432 2432
 	/**
2433 2433
 	 * Filter the default "Near" text value for the search form.
2434 2434
 	 *
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
 	 * @param string $near              The current near value.
2440 2440
 	 * @param string $default_near_text The default near value.
2441 2441
 	 */
2442
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2442
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2443 2443
 	/**
2444 2444
 	 * Filter the class for the near search input.
2445 2445
 	 *
@@ -2447,10 +2447,10 @@  discard block
 block discarded – undo
2447 2447
 	 *
2448 2448
 	 * @param string $class The class for the HTML near input, default is blank.
2449 2449
 	 */
2450
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2450
+	$near_class = apply_filters('geodir_search_near_class', '');
2451 2451
 
2452 2452
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2453
-	if($new_style){
2453
+	if ($new_style) {
2454 2454
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2455 2455
 
2456 2456
 		do_action('geodir_before_near_input');
@@ -2458,30 +2458,30 @@  discard block
 block discarded – undo
2458 2458
 
2459 2459
 	?>
2460 2460
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2461
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2462
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2463
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2461
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2462
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2463
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2464 2464
 	<?php
2465
-	if($new_style){
2465
+	if ($new_style) {
2466 2466
 		do_action('geodir_after_near_input');
2467 2467
 
2468 2468
 		echo "</div>";
2469 2469
 	}
2470 2470
 }
2471 2471
 
2472
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2473
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2474
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2472
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2473
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2474
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2475 2475
 
2476
-function geodir_get_search_post_type($pt=''){
2476
+function geodir_get_search_post_type($pt = '') {
2477 2477
 	global $geodir_search_post_type;
2478 2478
 
2479
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2480
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2479
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2480
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2481 2481
 
2482 2482
 	$geodir_search_post_type = geodir_get_current_posttype();
2483 2483
 
2484
-	if(!$geodir_search_post_type) {
2484
+	if (!$geodir_search_post_type) {
2485 2485
 		$geodir_search_post_type = geodir_get_default_posttype();
2486 2486
 	}
2487 2487
 
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 	return $geodir_search_post_type;
2490 2490
 }
2491 2491
 
2492
-function geodir_search_form(){
2492
+function geodir_search_form() {
2493 2493
 
2494 2494
 	geodir_get_search_post_type();
2495 2495
 
@@ -2499,8 +2499,8 @@  discard block
 block discarded – undo
2499 2499
 	die();
2500 2500
 }
2501 2501
 
2502
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2503
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2502
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2503
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2504 2504
 
2505 2505
 /**
2506 2506
  * Check wpml active or not.
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
 		}
2575 2575
 	}
2576 2576
 }
2577
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2577
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2578 2578
 
2579 2579
 /**
2580 2580
  * Duplicate post listing manually after listing saved.
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 		foreach ($post_duplicates as $lang => $dup_post_id) {
2599 2599
 			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2600 2600
 		}
2601
-		do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info );
2601
+		do_action('geodir_wpml_listing_duplicated', $post_id, $request_info);
2602 2602
 	}
2603 2603
 }
2604 2604
 
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2618 2618
 	global $wpdb;
2619 2619
 
2620
-	$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);
2620
+	$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);
2621 2621
 
2622 2622
 	if (!empty($reviews)) {
2623 2623
 		foreach ($reviews as $review) {
@@ -2646,15 +2646,15 @@  discard block
 block discarded – undo
2646 2646
 	global $wpdb, $plugin_prefix;
2647 2647
 
2648 2648
 	$post_type = get_post_type($master_post_id);
2649
-	$post_table = $plugin_prefix . $post_type . '_detail';
2649
+	$post_table = $plugin_prefix.$post_type.'_detail';
2650 2650
 
2651
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2652
-	$data = (array)$wpdb->get_row($query);
2651
+	$query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2652
+	$data = (array) $wpdb->get_row($query);
2653 2653
 
2654
-	if ( !empty( $data ) ) {
2655
-		$data = apply_filters( 'geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang );
2654
+	if (!empty($data)) {
2655
+		$data = apply_filters('geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang);
2656 2656
 		$data['post_id'] = $tr_post_id;
2657
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2657
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2658 2658
 		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2659 2659
 		return true;
2660 2660
 	}
@@ -2679,7 +2679,7 @@  discard block
 block discarded – undo
2679 2679
 	global $sitepress, $wpdb;
2680 2680
 	$post_type = get_post_type($master_post_id);
2681 2681
 
2682
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2682
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2683 2683
 
2684 2684
 	$taxonomies = get_object_taxonomies($post_type);
2685 2685
 	foreach ($taxonomies as $taxonomy) {
@@ -2688,9 +2688,9 @@  discard block
 block discarded – undo
2688 2688
 
2689 2689
 		if ($terms) {
2690 2690
 			foreach ($terms as $term) {
2691
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2691
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2692 2692
 
2693
-				if (!is_null($tr_id)){
2693
+				if (!is_null($tr_id)) {
2694 2694
 					// not using get_term - unfiltered get_term
2695 2695
 					$translated_term = $wpdb->get_row($wpdb->prepare("
2696 2696
                         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));
@@ -2699,14 +2699,14 @@  discard block
 block discarded – undo
2699 2699
 				}
2700 2700
 			}
2701 2701
 
2702
-			if (!is_taxonomy_hierarchical($taxonomy)){
2703
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2702
+			if (!is_taxonomy_hierarchical($taxonomy)) {
2703
+				$terms_array = array_unique(array_map('intval', $terms_array));
2704 2704
 			}
2705 2705
 
2706 2706
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2707 2707
 
2708
-			if ($taxonomy == $post_type . 'category') {
2709
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2708
+			if ($taxonomy == $post_type.'category') {
2709
+				geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2710 2710
 			}
2711 2711
 		}
2712 2712
 	}
@@ -2727,15 +2727,15 @@  discard block
 block discarded – undo
2727 2727
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2728 2728
 	global $wpdb;
2729 2729
 
2730
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2730
+	$query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2731 2731
 	$wpdb->query($query);
2732 2732
 
2733
-	$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));
2733
+	$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));
2734 2734
 	$post_images = $wpdb->get_results($query);
2735 2735
 
2736
-	if ( !empty( $post_images ) ) {
2737
-		foreach ( $post_images as $post_image) {
2738
-			$image_data = (array)$post_image;
2736
+	if (!empty($post_images)) {
2737
+		foreach ($post_images as $post_image) {
2738
+			$image_data = (array) $post_image;
2739 2739
 			unset($image_data['ID']);
2740 2740
 			$image_data['post_id'] = $tr_post_id;
2741 2741
 
@@ -2768,13 +2768,13 @@  discard block
 block discarded – undo
2768 2768
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2769 2769
 	global $wpdb, $plugin_prefix, $sitepress;
2770 2770
 
2771
-	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2771
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2772 2772
 
2773 2773
 	if (empty($review)) {
2774 2774
 		return false;
2775 2775
 	}
2776 2776
 	if ($review['post_id'] != $master_post_id) {
2777
-		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2777
+		$wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2778 2778
 		geodir_update_postrating($master_post_id, $post_type);
2779 2779
 	}
2780 2780
 
@@ -2785,9 +2785,9 @@  discard block
 block discarded – undo
2785 2785
 	}
2786 2786
 
2787 2787
 	$post_type = get_post_type($master_post_id);
2788
-	$post_table = $plugin_prefix . $post_type . '_detail';
2788
+	$post_table = $plugin_prefix.$post_type.'_detail';
2789 2789
 
2790
-	$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);
2790
+	$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);
2791 2791
 	if (empty($translated_post)) {
2792 2792
 		return false;
2793 2793
 	}
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
 		unset($review['id']);
2806 2806
 	}
2807 2807
 
2808
-	$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));
2808
+	$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));
2809 2809
 
2810 2810
 	if ($tr_review_id) { // update review
2811 2811
 		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
 		geodir_update_postrating($tr_post_id, $post_type);
2819 2819
 
2820 2820
 		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2821
-			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2822
-			$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);
2821
+			$wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2822
+			$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);
2823 2823
 
2824 2824
 			if (!empty($likes)) {
2825 2825
 				foreach ($likes as $like) {
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
  * @return bool True if review star disabled, otherwise false.
2922 2922
  */
2923 2923
 function geodir_rating_disabled_post_types() {
2924
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2924
+	$post_types = get_option('geodir_disable_rating_cpt');
2925 2925
 
2926 2926
 	/**
2927 2927
 	 * Filter the post types array which have rating disabled.
@@ -2930,7 +2930,7 @@  discard block
 block discarded – undo
2930 2930
 	 *
2931 2931
 	 * @param array $post_types Array of post types which have rating starts disabled.
2932 2932
 	 */
2933
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2933
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2934 2934
 }
2935 2935
 
2936 2936
 /**
@@ -2942,30 +2942,30 @@  discard block
 block discarded – undo
2942 2942
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2943 2943
  * @return bool True if review star disabled, otherwise false.
2944 2944
  */
2945
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2945
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2946 2946
 	$post_types = geodir_rating_disabled_post_types();
2947 2947
 
2948
-	if ( empty( $post_types ) ) {
2948
+	if (empty($post_types)) {
2949 2949
 		return false;
2950 2950
 	}
2951 2951
 
2952
-	if ( is_int( $post_type ) ) {
2953
-		$post_type = get_post_type( $post_type );
2952
+	if (is_int($post_type)) {
2953
+		$post_type = get_post_type($post_type);
2954 2954
 	}
2955 2955
 
2956
-	if ( $taxonomy && !empty( $post_types ) ) {
2956
+	if ($taxonomy && !empty($post_types)) {
2957 2957
 		$posttypes = array();
2958 2958
 
2959
-		foreach ( $post_types as $posttype ) {
2960
-			$posttypes[] = $posttype . 'category';
2961
-			$posttypes[] = $posttype . '_tags';
2959
+		foreach ($post_types as $posttype) {
2960
+			$posttypes[] = $posttype.'category';
2961
+			$posttypes[] = $posttype.'_tags';
2962 2962
 		}
2963 2963
 
2964 2964
 		$post_types = $posttypes;
2965 2965
 	}
2966 2966
 
2967 2967
 	$return = false;
2968
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2968
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2969 2969
 		$return = true;
2970 2970
 	}
2971 2971
 
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
  * @return bool True if Yoast SEO disabled on GD pages.
2981 2981
  */
2982 2982
 function geodir_disable_yoast_seo_metas() {
2983
-	return (bool)get_option( 'geodir_disable_yoast_meta' );
2983
+	return (bool) get_option('geodir_disable_yoast_meta');
2984 2984
 }
2985 2985
 
2986 2986
 /**
@@ -2991,30 +2991,30 @@  discard block
 block discarded – undo
2991 2991
  * @param int $post_id The post ID.
2992 2992
  * @return bool True if allowed.
2993 2993
  */
2994
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
2994
+function geodir_wpml_allowed_to_duplicate($post_id) {
2995 2995
 	$allowed = false;
2996 2996
 
2997
-	if ( !geodir_is_wpml() || empty( $post_id ) ) {
2997
+	if (!geodir_is_wpml() || empty($post_id)) {
2998 2998
 		return $allowed;
2999 2999
 	}
3000 3000
 
3001
-	$user_id = (int)get_current_user_id();
3001
+	$user_id = (int) get_current_user_id();
3002 3002
 
3003
-	if ( empty( $user_id ) ) {
3003
+	if (empty($user_id)) {
3004 3004
 		return $allowed;
3005 3005
 	}
3006 3006
 
3007
-	$post_type = get_post_type( $post_id );
3008
-	if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3007
+	$post_type = get_post_type($post_id);
3008
+	if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
3009 3009
 		return $allowed;
3010 3010
 	}
3011 3011
 
3012
-	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3012
+	if (geodir_listing_belong_to_current_user($post_id)) {
3013 3013
 		$allowed = true;
3014 3014
 	}
3015 3015
 
3016
-	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3017
-	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3016
+	$disable_cpts = get_option('geodir_wpml_disable_duplicate');
3017
+	if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
3018 3018
 		$allowed = false;
3019 3019
 	}
3020 3020
 
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 	 * @param bool $allowed True if allowed.
3025 3025
 	 * @param int $post_id The post ID.
3026 3026
 	 */
3027
-	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3027
+	return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3028 3028
 }
3029 3029
 
3030 3030
 /**
@@ -3039,61 +3039,61 @@  discard block
 block discarded – undo
3039 3039
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3040 3040
  * @return string Filtered html of the geodir_edit_post_link() function.
3041 3041
  */
3042
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3042
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3043 3043
 	global $post, $preview, $sitepress;
3044 3044
 
3045
-	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3045
+	if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3046 3046
 		$post_id = $post->ID;
3047
-		$element_type = 'post_' . get_post_type( $post_id );
3048
-		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3047
+		$element_type = 'post_'.get_post_type($post_id);
3048
+		$original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3049 3049
 
3050
-		if ( $original_post_id == $post_id ) {
3050
+		if ($original_post_id == $post_id) {
3051 3051
 			$wpml_languages = $sitepress->get_active_languages();
3052
-			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3052
+			$post_language = $sitepress->get_language_for_element($post_id, $element_type);
3053 3053
 
3054
-			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3055
-				unset( $wpml_languages[ $post_language ] );
3054
+			if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3055
+				unset($wpml_languages[$post_language]);
3056 3056
 			}
3057 3057
 
3058
-			if ( !empty( $wpml_languages ) ) {
3059
-				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3060
-				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3061
-				$duplicates = $sitepress->get_duplicates( $post_id );
3058
+			if (!empty($wpml_languages)) {
3059
+				$trid = $sitepress->get_element_trid($post_id, $element_type);
3060
+				$element_translations = $sitepress->get_element_translations($trid, $element_type);
3061
+				$duplicates = $sitepress->get_duplicates($post_id);
3062 3062
 
3063
-				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3063
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3064 3064
 				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3065
-				$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>';
3065
+				$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>';
3066 3066
 
3067 3067
 				$needs_translation = false;
3068 3068
 
3069
-				foreach ( $wpml_languages as $lang_code => $lang ) {
3069
+				foreach ($wpml_languages as $lang_code => $lang) {
3070 3070
 					$duplicates_text = '';
3071 3071
 					$translated = false;
3072 3072
 
3073
-					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3073
+					if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3074 3074
 						$translated = true;
3075 3075
 
3076
-						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3077
-							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3076
+						if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3077
+							$duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3078 3078
 						}
3079 3079
 					} else {
3080 3080
 						$needs_translation = true;
3081 3081
 					}
3082 3082
 
3083
-					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3083
+					$wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3084 3084
 
3085
-					if ( $translated ) {
3085
+					if ($translated) {
3086 3086
 						$wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3087 3087
 					} else {
3088
-						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3088
+						$wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3089 3089
 					}
3090 3090
 
3091 3091
 					$wpml_content .= '</td></tr>';
3092 3092
 				}
3093 3093
 
3094
-				if ( $needs_translation ) {
3095
-					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3096
-					$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>';
3094
+				if ($needs_translation) {
3095
+					$nonce = wp_create_nonce('geodir_duplicate_nonce');
3096
+					$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>';
3097 3097
 				}
3098 3098
 
3099 3099
 				$wpml_content .= '</tbody></table>';
@@ -3115,12 +3115,12 @@  discard block
 block discarded – undo
3115 3115
  * @param array $settings GD design settings array.
3116 3116
  * @return array Filtered GD design settings array..
3117 3117
  */
3118
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3118
+function geodir_wpml_duplicate_settings($settings = array()) {
3119 3119
 	$new_settings = array();
3120 3120
 
3121
-	foreach ( $settings as $key => $setting ) {
3121
+	foreach ($settings as $key => $setting) {
3122 3122
 
3123
-		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3123
+		if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3124 3124
 			$new_settings[] = array(
3125 3125
 				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3126 3126
 				'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'),
@@ -3148,12 +3148,12 @@  discard block
 block discarded – undo
3148 3148
  * @param string $taxonomy name/slug of a taxonomy.
3149 3149
  * @return bool true if the taxonomy is currently set to being translatable in WPML.
3150 3150
  */
3151
-function geodir_wpml_is_taxonomy_translated( $taxonomy ) {
3152
-	if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3151
+function geodir_wpml_is_taxonomy_translated($taxonomy) {
3152
+	if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) {
3153 3153
 		return false;
3154 3154
 	}
3155 3155
 
3156
-	if ( is_taxonomy_translated( $taxonomy ) ) {
3156
+	if (is_taxonomy_translated($taxonomy)) {
3157 3157
 		return true;
3158 3158
 	}
3159 3159
 
@@ -3168,12 +3168,12 @@  discard block
 block discarded – undo
3168 3168
  * @param string $post_type name/slug of a post_type.
3169 3169
  * @return bool true if the post_type is currently set to being translatable in WPML.
3170 3170
  */
3171
-function geodir_wpml_is_post_type_translated( $post_type ) {
3172
-	if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3171
+function geodir_wpml_is_post_type_translated($post_type) {
3172
+	if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) {
3173 3173
 		return false;
3174 3174
 	}
3175 3175
 
3176
-	if ( is_post_type_translated( $post_type ) ) {
3176
+	if (is_post_type_translated($post_type)) {
3177 3177
 		return true;
3178 3178
 	}
3179 3179
 
@@ -3195,12 +3195,12 @@  discard block
 block discarded – undo
3195 3195
  *
3196 3196
  * @return int|NULL
3197 3197
  */
3198
-function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
3199
-	if ( geodir_is_wpml() ) {
3200
-		if ( function_exists( 'wpml_object_id_filter' ) ) {
3201
-			return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3198
+function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) {
3199
+	if (geodir_is_wpml()) {
3200
+		if (function_exists('wpml_object_id_filter')) {
3201
+			return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3202 3202
 		} else {
3203
-			return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3203
+			return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3204 3204
 		}
3205 3205
 	}
3206 3206
 
Please login to merge, or discard this patch.