Test Failed
Pull Request — master (#421)
by Kiran
17:15
created
geodirectory-functions/general_functions.php 1 patch
Spacing   +1297 added lines, -1297 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @return string example url eg: http://wpgeo.directory/wp-content/plugins/geodirectory
28 28
  */
29 29
 function geodir_plugin_url() {
30
-	return plugins_url( '', dirname( __FILE__ ) );
30
+	return plugins_url('', dirname(__FILE__));
31 31
 	/*
32 32
 	if ( is_ssl() ) :
33 33
 		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
48 48
  */
49 49
 function geodir_plugin_path() {
50
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
-		return dirname( dirname( __FILE__ ) );
50
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
51
+		return dirname(dirname(__FILE__));
52 52
 	} else {
53
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
53
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
54 54
 	}
55 55
 }
56 56
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
  * @return bool true or false.
66 66
  * @todo    check if this is faster than normal WP check and remove if not.
67 67
  */
68
-function geodir_is_plugin_active( $plugin ) {
69
-	$active_plugins = get_option( 'active_plugins' );
70
-	foreach ( $active_plugins as $key => $active_plugin ) {
71
-		if ( strstr( $active_plugin, $plugin ) ) {
68
+function geodir_is_plugin_active($plugin) {
69
+	$active_plugins = get_option('active_plugins');
70
+	foreach ($active_plugins as $key => $active_plugin) {
71
+		if (strstr($active_plugin, $plugin)) {
72 72
 			return true;
73 73
 		}
74 74
 	}
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return bool|int|string the formatted date.
92 92
  */
93
-function geodir_get_formated_date( $date ) {
94
-	return mysql2date( get_option( 'date_format' ), $date );
93
+function geodir_get_formated_date($date) {
94
+	return mysql2date(get_option('date_format'), $date);
95 95
 }
96 96
 
97 97
 /**
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return bool|int|string the formatted time.
109 109
  */
110
-function geodir_get_formated_time( $time ) {
111
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
110
+function geodir_get_formated_time($time) {
111
+	return mysql2date(get_option('time_format'), $time, $translate = true);
112 112
 }
113 113
 
114 114
 
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return string Formatted link.
128 128
  */
129
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
130
-	if ( $use_existing_arguments ) {
129
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
130
+	if ($use_existing_arguments) {
131 131
 		$params = $params + $_GET;
132 132
 	}
133
-	if ( ! $params ) {
133
+	if (!$params) {
134 134
 		return $url;
135 135
 	}
136 136
 	$link = $url;
137
-	if ( strpos( $link, '?' ) === false ) {
137
+	if (strpos($link, '?') === false) {
138 138
 		$link .= '?';
139 139
 	} //If there is no '?' add one at the end
140
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
140
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
141 141
 		$link .= '&';
142 142
 	} //If there is no '&' at the END, add one.
143
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
143
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
144 144
 		$link .= '&';
145 145
 	} //If there is no '&' at the END, add one.
146 146
 
147 147
 	$params_arr = array();
148
-	foreach ( $params as $key => $value ) {
149
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
150
-			foreach ( $value as $val ) {
151
-				$params_arr[] = $key . '[]=' . urlencode( $val );
148
+	foreach ($params as $key => $value) {
149
+		if (gettype($value) == 'array') { //Handle array data properly
150
+			foreach ($value as $val) {
151
+				$params_arr[] = $key.'[]='.urlencode($val);
152 152
 			}
153 153
 		} else {
154
-			$params_arr[] = $key . '=' . urlencode( $value );
154
+			$params_arr[] = $key.'='.urlencode($value);
155 155
 		}
156 156
 	}
157
-	$link .= implode( '&', $params_arr );
157
+	$link .= implode('&', $params_arr);
158 158
 
159 159
 	return $link;
160 160
 }
@@ -171,18 +171,18 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @return string Listing page url if valid. Otherwise home url will be returned.
173 173
  */
174
-function geodir_get_addlisting_link( $post_type = '' ) {
174
+function geodir_get_addlisting_link($post_type = '') {
175 175
 	global $wpdb;
176 176
 
177 177
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
178 178
 	$check_pkg = 1;
179
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
179
+	if (post_type_exists($post_type) && $check_pkg) {
180 180
 
181
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
181
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
182 182
 
183
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
183
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
184 184
 	} else {
185
-		return get_bloginfo( 'url' );
185
+		return get_bloginfo('url');
186 186
 	}
187 187
 }
188 188
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
211 211
 		// To build the entire URI we need to prepend the protocol, and the http host
212 212
 		// to the URI string.
213
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
213
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
214 214
 	} else {
215 215
 		/*
216 216
 		 * Since we do not have REQUEST_URI to work with, we will assume we are
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 		 *
220 220
 		 * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
221 221
 		 */
222
-		$pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
222
+		$pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
223 223
 		
224 224
 		// If the query string exists append it to the URI string
225 225
 		if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
226
-			$pageURL .= '?' . $_SERVER['QUERY_STRING'];
226
+			$pageURL .= '?'.$_SERVER['QUERY_STRING'];
227 227
 		}
228 228
 	}
229 229
 	
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @param string $pageURL The URL of the current page.
236 236
 	 */
237
-	return apply_filters( 'geodir_curPageURL', $pageURL );
237
+	return apply_filters('geodir_curPageURL', $pageURL);
238 238
 }
239 239
 
240 240
 /**
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @return string Cleaned variable.
251 251
  */
252
-function geodir_clean( $string ) {
252
+function geodir_clean($string) {
253 253
 
254
-	$string = trim( strip_tags( stripslashes( $string ) ) );
255
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
256
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
257
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
254
+	$string = trim(strip_tags(stripslashes($string)));
255
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
256
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
257
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
258 258
 
259 259
 	return $string;
260 260
 }
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
  */
269 269
 function geodir_get_weekday() {
270 270
 	return array(
271
-		__( 'Sunday', 'geodirectory' ),
272
-		__( 'Monday', 'geodirectory' ),
273
-		__( 'Tuesday', 'geodirectory' ),
274
-		__( 'Wednesday', 'geodirectory' ),
275
-		__( 'Thursday', 'geodirectory' ),
276
-		__( 'Friday', 'geodirectory' ),
277
-		__( 'Saturday', 'geodirectory' )
271
+		__('Sunday', 'geodirectory'),
272
+		__('Monday', 'geodirectory'),
273
+		__('Tuesday', 'geodirectory'),
274
+		__('Wednesday', 'geodirectory'),
275
+		__('Thursday', 'geodirectory'),
276
+		__('Friday', 'geodirectory'),
277
+		__('Saturday', 'geodirectory')
278 278
 	);
279 279
 }
280 280
 
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function geodir_get_weeks() {
289 289
 	return array(
290
-		__( 'First', 'geodirectory' ),
291
-		__( 'Second', 'geodirectory' ),
292
-		__( 'Third', 'geodirectory' ),
293
-		__( 'Fourth', 'geodirectory' ),
294
-		__( 'Last', 'geodirectory' )
290
+		__('First', 'geodirectory'),
291
+		__('Second', 'geodirectory'),
292
+		__('Third', 'geodirectory'),
293
+		__('Fourth', 'geodirectory'),
294
+		__('Last', 'geodirectory')
295 295
 	);
296 296
 }
297 297
 
@@ -310,112 +310,112 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return bool If valid returns true. Otherwise false.
312 312
  */
313
-function geodir_is_page( $gdpage = '' ) {
313
+function geodir_is_page($gdpage = '') {
314 314
 
315 315
 	global $wp_query, $post, $wp;
316 316
 	//if(!is_admin()):
317 317
 
318
-	switch ( $gdpage ):
318
+	switch ($gdpage):
319 319
 		case 'add-listing':
320 320
 
321
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
321
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
322 322
 				return true;
323
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
323
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
324 324
 				return true;
325 325
 			}
326 326
 
327 327
 			break;
328 328
 		case 'preview':
329
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
330
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
329
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
330
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
331 331
 			) {
332 332
 				return true;
333 333
 			}
334 334
 			break;
335 335
 		case 'listing-success':
336
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
336
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
337 337
 				return true;
338 338
 			}
339 339
 			break;
340 340
 		case 'detail':
341
-			$post_type = get_query_var( 'post_type' );
342
-			if ( is_array( $post_type ) ) {
343
-				$post_type = reset( $post_type );
341
+			$post_type = get_query_var('post_type');
342
+			if (is_array($post_type)) {
343
+				$post_type = reset($post_type);
344 344
 			}
345
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
345
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
346 346
 				return true;
347 347
 			}
348 348
 			break;
349 349
 		case 'pt':
350
-			$post_type = get_query_var( 'post_type' );
351
-			if ( is_array( $post_type ) ) {
352
-				$post_type = reset( $post_type );
350
+			$post_type = get_query_var('post_type');
351
+			if (is_array($post_type)) {
352
+				$post_type = reset($post_type);
353 353
 			}
354
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
354
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
355 355
 				return true;
356 356
 			}
357 357
 
358 358
 			break;
359 359
 		case 'listing':
360
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
360
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
361 361
 				global $current_term, $taxonomy, $term;
362 362
 
363 363
 				return true;
364 364
 			}
365
-			$post_type = get_query_var( 'post_type' );
366
-			if ( is_array( $post_type ) ) {
367
-				$post_type = reset( $post_type );
365
+			$post_type = get_query_var('post_type');
366
+			if (is_array($post_type)) {
367
+				$post_type = reset($post_type);
368 368
 			}
369
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
369
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
370 370
 				return true;
371 371
 			}
372 372
 
373 373
 			break;
374 374
 		case 'home':
375 375
 
376
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
376
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
377 377
 				return true;
378 378
 			}
379 379
 
380 380
 			break;
381 381
 		case 'location':
382
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
382
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
383 383
 				return true;
384 384
 			}
385 385
 			break;
386 386
 		case 'author':
387
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
387
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
388 388
 				return true;
389 389
 			}
390 390
 
391
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
392
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
391
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
392
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
393 393
 					return true;
394 394
 				}
395 395
 			}
396 396
 			break;
397 397
 		case 'search':
398
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
398
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
399 399
 				return true;
400 400
 			}
401 401
 			break;
402 402
 		case 'info':
403
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
403
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
404 404
 				return true;
405 405
 			}
406 406
 			break;
407 407
 		case 'login':
408
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
408
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
409 409
 				return true;
410 410
 			}
411 411
 			break;
412 412
 		case 'checkout':
413
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
413
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
414 414
 				return true;
415 415
 			}
416 416
 			break;
417 417
 		case 'invoices':
418
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
418
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
419 419
 				return true;
420 420
 			}
421 421
 			break;
@@ -440,25 +440,25 @@  discard block
 block discarded – undo
440 440
  *
441 441
  * @param object $wp WordPress object.
442 442
  */
443
-function geodir_set_is_geodir_page( $wp ) {
444
-	if ( ! is_admin() ) {
443
+function geodir_set_is_geodir_page($wp) {
444
+	if (!is_admin()) {
445 445
 		//$wp->query_vars['gd_is_geodir_page'] = false;
446 446
 		//print_r()
447
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
447
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
448 448
 				'preview',
449 449
 				'page',
450 450
 				'paged',
451 451
 				'cpage'
452
-			) )
452
+			))
453 453
 		) {
454
-			if ( geodir_is_page( 'home' ) ) {
454
+			if (geodir_is_page('home')) {
455 455
 				$wp->query_vars['gd_is_geodir_page'] = true;
456 456
 			}
457 457
 
458 458
 
459 459
 		}
460 460
 
461
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
461
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
462 462
 			if (
463 463
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
464 464
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -467,26 +467,26 @@  discard block
 block discarded – undo
467 467
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
468 468
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
469 469
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
470
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
471
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
470
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
471
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
472 472
 			) {
473 473
 				$wp->query_vars['gd_is_geodir_page'] = true;
474 474
 			}
475 475
 		}
476 476
 
477
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
478
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
477
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
478
+			$page = get_page_by_path($wp->query_vars['pagename']);
479 479
 
480
-			if ( ! empty( $page ) && (
480
+			if (!empty($page) && (
481 481
 					$page->ID == geodir_add_listing_page_id()
482 482
 					|| $page->ID == geodir_preview_page_id()
483 483
 					|| $page->ID == geodir_success_page_id()
484 484
 					|| $page->ID == geodir_location_page_id()
485
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
486
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
487
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
488
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
489
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
485
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
486
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
487
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
488
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
489
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
490 490
 				)
491 491
 			) {
492 492
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 		}
495 495
 
496 496
 
497
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
497
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
498 498
 			$requested_post_type = $wp->query_vars['post_type'];
499 499
 			// check if this post type is geodirectory post types
500 500
 			$post_type_array = geodir_get_posttypes();
501
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
501
+			if (in_array($requested_post_type, $post_type_array)) {
502 502
 				$wp->query_vars['gd_is_geodir_page'] = true;
503 503
 			}
504 504
 		}
505 505
 
506
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
507
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
508
-			if ( ! empty( $geodir_taxonomis ) ) {
509
-				foreach ( $geodir_taxonomis as $taxonomy ) {
510
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
506
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
507
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
508
+			if (!empty($geodir_taxonomis)) {
509
+				foreach ($geodir_taxonomis as $taxonomy) {
510
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
511 511
 						$wp->query_vars['gd_is_geodir_page'] = true;
512 512
 						break;
513 513
 					}
@@ -516,20 +516,20 @@  discard block
 block discarded – undo
516 516
 
517 517
 		}
518 518
 
519
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
519
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
520 520
 			$wp->query_vars['gd_is_geodir_page'] = true;
521 521
 		}
522 522
 
523 523
 
524
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
524
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
525 525
 			$wp->query_vars['gd_is_geodir_page'] = true;
526 526
 		}
527 527
 
528 528
 
529 529
 //check if homepage
530
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
531
-		     && ! isset( $wp->query_vars['page_id'] )
532
-		     && ! isset( $wp->query_vars['pagename'] )
530
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
531
+		     && !isset($wp->query_vars['page_id'])
532
+		     && !isset($wp->query_vars['pagename'])
533 533
 		     && is_page_geodir_home()
534 534
 		) {
535 535
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -553,14 +553,14 @@  discard block
 block discarded – undo
553 553
  */
554 554
 function geodir_is_geodir_page() {
555 555
 	global $wp;
556
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
556
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
557 557
 		return true;
558 558
 	} else {
559 559
 		return false;
560 560
 	}
561 561
 }
562 562
 
563
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
563
+if (!function_exists('geodir_get_imagesize')) {
564 564
 	/**
565 565
 	 * Get image size using the size key .
566 566
 	 *
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
 	 *
572 572
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
573 573
 	 */
574
-	function geodir_get_imagesize( $size = '' ) {
574
+	function geodir_get_imagesize($size = '') {
575 575
 
576 576
 		$imagesizes = array(
577
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
578
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
579
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
580
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
577
+			'list-thumb'   => array('w' => 283, 'h' => 188),
578
+			'thumbnail'    => array('w' => 125, 'h' => 125),
579
+			'widget-thumb' => array('w' => 50, 'h' => 50),
580
+			'slider-thumb' => array('w' => 100, 'h' => 100)
581 581
 		);
582 582
 
583 583
 		/**
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
 		 *
588 588
 		 * @param array $imagesizes Image size array.
589 589
 		 */
590
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
590
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
591 591
 
592
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
592
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
593 593
 			/**
594 594
 			 * Filters image size of the passed key.
595 595
 			 *
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 			 *
598 598
 			 * @param array $imagesizes [$size] Image size array of the passed key.
599 599
 			 */
600
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
600
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
601 601
 
602
-		} elseif ( ! empty( $size ) ) {
602
+		} elseif (!empty($size)) {
603 603
 
604
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
604
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
605 605
 
606 606
 		}
607 607
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 */
626 626
 
627 627
 
628
-if ( ! function_exists( 'createRandomString' ) ) {
628
+if (!function_exists('createRandomString')) {
629 629
 	/**
630 630
 	 * Creates random string.
631 631
 	 *
@@ -635,21 +635,21 @@  discard block
 block discarded – undo
635 635
 	 */
636 636
 	function createRandomString() {
637 637
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
638
-		srand( (double) microtime() * 1000000 );
638
+		srand((double) microtime() * 1000000);
639 639
 		$i       = 0;
640 640
 		$rstring = '';
641
-		while ( $i <= 25 ) {
641
+		while ($i <= 25) {
642 642
 			$num     = rand() % 33;
643
-			$tmp     = substr( $chars, $num, 1 );
644
-			$rstring = $rstring . $tmp;
645
-			$i ++;
643
+			$tmp     = substr($chars, $num, 1);
644
+			$rstring = $rstring.$tmp;
645
+			$i++;
646 646
 		}
647 647
 
648 648
 		return $rstring;
649 649
 	}
650 650
 }
651 651
 
652
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
652
+if (!function_exists('geodir_getDistanceRadius')) {
653 653
 	/**
654 654
 	 * Calculates the distance radius.
655 655
 	 *
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 	 *
661 661
 	 * @return float The mean radius.
662 662
 	 */
663
-	function geodir_getDistanceRadius( $uom = 'km' ) {
663
+	function geodir_getDistanceRadius($uom = 'km') {
664 664
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
665
-		switch ( geodir_strtolower( $uom ) ):
665
+		switch (geodir_strtolower($uom)):
666 666
 			case 'km'    :
667 667
 				$earthMeanRadius = 6371.009; // km
668 668
 				break;
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 }
695 695
 
696 696
 
697
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
697
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
698 698
 	/**
699 699
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
700 700
 	 *
@@ -707,17 +707,17 @@  discard block
 block discarded – undo
707 707
 	 *
708 708
 	 * @return float The distance.
709 709
 	 */
710
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
710
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
711 711
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
712 712
 
713
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
713
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
714 714
 
715
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
716
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
717
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
718
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
719
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
720
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
715
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
716
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
717
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
718
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
719
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
720
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
721 721
 		$distance       = $earthMeanRadius * $c;
722 722
 
723 723
 		return $distance;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 }
727 727
 
728 728
 
729
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
729
+if (!function_exists('geodir_sendEmail')) {
730 730
 	/**
731 731
 	 * The main function that send transactional emails using the args provided.
732 732
 	 *
@@ -745,95 +745,95 @@  discard block
 block discarded – undo
745 745
 	 * @param string $post_id       The post ID.
746 746
 	 * @param string $user_id       The user ID.
747 747
 	 */
748
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
748
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
749 749
 		$login_details = '';
750 750
 
751 751
 		// strip slashes from subject & message text
752
-		$to_subject = stripslashes_deep( $to_subject );
753
-		$to_message = stripslashes_deep( $to_message );
752
+		$to_subject = stripslashes_deep($to_subject);
753
+		$to_message = stripslashes_deep($to_message);
754 754
 
755
-		if ( $message_type == 'send_friend' ) {
756
-			$subject = get_option( 'geodir_email_friend_subject' );
757
-			$message = get_option( 'geodir_email_friend_content' );
758
-		} elseif ( $message_type == 'send_enquiry' ) {
759
-			$subject = get_option( 'geodir_email_enquiry_subject' );
760
-			$message = get_option( 'geodir_email_enquiry_content' );
755
+		if ($message_type == 'send_friend') {
756
+			$subject = get_option('geodir_email_friend_subject');
757
+			$message = get_option('geodir_email_friend_content');
758
+		} elseif ($message_type == 'send_enquiry') {
759
+			$subject = get_option('geodir_email_enquiry_subject');
760
+			$message = get_option('geodir_email_enquiry_content');
761 761
 
762 762
 			// change to name in some cases
763
-			$post_author = get_post_field( 'post_author', $post_id );
764
-			if(is_super_admin( $post_author  )){// if admin probably not the post author so change name
765
-				$toEmailName = __('Business Owner','geodirectory');
766
-			}elseif(defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id,'claimed')!='1'){// if claim manager installed but listing not claimed
767
-				$toEmailName = __('Business Owner','geodirectory');
763
+			$post_author = get_post_field('post_author', $post_id);
764
+			if (is_super_admin($post_author)) {// if admin probably not the post author so change name
765
+				$toEmailName = __('Business Owner', 'geodirectory');
766
+			}elseif (defined('GEODIRCLAIM_VERSION') && geodir_get_post_meta($post_id, 'claimed') != '1') {// if claim manager installed but listing not claimed
767
+				$toEmailName = __('Business Owner', 'geodirectory');
768 768
 			}
769 769
 
770 770
 
771
-		} elseif ( $message_type == 'forgot_password' ) {
772
-			$subject       = get_option( 'geodir_forgot_password_subject' );
773
-			$message       = get_option( 'geodir_forgot_password_content' );
771
+		} elseif ($message_type == 'forgot_password') {
772
+			$subject       = get_option('geodir_forgot_password_subject');
773
+			$message       = get_option('geodir_forgot_password_content');
774 774
 			$login_details = $to_message;
775
-		} elseif ( $message_type == 'registration' ) {
776
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
777
-			$message       = get_option( 'geodir_registration_success_email_content' );
775
+		} elseif ($message_type == 'registration') {
776
+			$subject       = get_option('geodir_registration_success_email_subject');
777
+			$message       = get_option('geodir_registration_success_email_content');
778 778
 			$login_details = $to_message;
779
-		} elseif ( $message_type == 'post_submit' ) {
780
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
781
-			$message = get_option( 'geodir_post_submited_success_email_content' );
782
-		} elseif ( $message_type == 'listing_published' ) {
783
-			$subject = get_option( 'geodir_post_published_email_subject' );
784
-			$message = get_option( 'geodir_post_published_email_content' );
785
-		} elseif ( $message_type == 'listing_edited' ) {
786
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
787
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
779
+		} elseif ($message_type == 'post_submit') {
780
+			$subject = get_option('geodir_post_submited_success_email_subject');
781
+			$message = get_option('geodir_post_submited_success_email_content');
782
+		} elseif ($message_type == 'listing_published') {
783
+			$subject = get_option('geodir_post_published_email_subject');
784
+			$message = get_option('geodir_post_published_email_content');
785
+		} elseif ($message_type == 'listing_edited') {
786
+			$subject = get_option('geodir_post_edited_email_subject_admin');
787
+			$message = get_option('geodir_post_edited_email_content_admin');
788 788
 		}
789 789
 
790
-		if ( ! empty( $subject ) ) {
791
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
790
+		if (!empty($subject)) {
791
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
792 792
 		}
793 793
 
794
-		if ( ! empty( $message ) ) {
795
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
794
+		if (!empty($message)) {
795
+			$message = __(stripslashes_deep($message), 'geodirectory');
796 796
 		}
797 797
 
798
-		$to_message        = nl2br( $to_message );
799
-		$sitefromEmail     = get_option( 'site_email' );
798
+		$to_message        = nl2br($to_message);
799
+		$sitefromEmail     = get_option('site_email');
800 800
 		$sitefromEmailName = get_site_emailName();
801
-		$productlink       = get_permalink( $post_id );
801
+		$productlink       = get_permalink($post_id);
802 802
 
803 803
 		$user_login = '';
804
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
804
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
805 805
 			$user_login = $user_info->user_login;
806 806
 		}
807 807
 
808 808
 		$posted_date = '';
809 809
 		$listingLink = '';
810 810
 
811
-		$post_info = get_post( $post_id );
811
+		$post_info = get_post($post_id);
812 812
 
813
-		if ( $post_info ) {
813
+		if ($post_info) {
814 814
 			$posted_date = $post_info->post_date;
815
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
815
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
816 816
 		}
817 817
 		$siteurl       = home_url();
818
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
818
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
819 819
 		$loginurl      = geodir_login_url();
820
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
820
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
821 821
         
822
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
823
-		$post_author_data = $post_author_id ? get_userdata( $post_author_id ) : NULL;
824
-		$post_author_name = geodir_get_client_name( $post_author_id );
825
-		$post_author_email = !empty( $post_author_data->user_email ) ? $post_author_data->user_email : '';
826
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
827
-
828
-		if ( $fromEmail == '' ) {
829
-			$fromEmail = get_option( 'site_email' );
822
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
823
+		$post_author_data = $post_author_id ? get_userdata($post_author_id) : NULL;
824
+		$post_author_name = geodir_get_client_name($post_author_id);
825
+		$post_author_email = !empty($post_author_data->user_email) ? $post_author_data->user_email : '';
826
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
827
+
828
+		if ($fromEmail == '') {
829
+			$fromEmail = get_option('site_email');
830 830
 		}
831 831
 
832
-		if ( $fromEmailName == '' ) {
833
-			$fromEmailName = get_option( 'site_email_name' );
832
+		if ($fromEmailName == '') {
833
+			$fromEmailName = get_option('site_email_name');
834 834
 		}
835 835
 
836
-		$search_array  = array(
836
+		$search_array = array(
837 837
 			'[#listing_link#]',
838 838
 			'[#site_name_url#]',
839 839
 			'[#post_id#]',
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 			$post_author_email,
876 876
 			$current_date,
877 877
 		);
878
-		$message       = str_replace( $search_array, $replace_array, $message );
878
+		$message       = str_replace($search_array, $replace_array, $message);
879 879
 
880 880
 		$search_array  = array(
881 881
 			'[#listing_link#]',
@@ -913,12 +913,12 @@  discard block
 block discarded – undo
913 913
 			$post_author_email,
914 914
 			$current_date
915 915
 		);
916
-		$subject       = str_replace( $search_array, $replace_array, $subject );
916
+		$subject = str_replace($search_array, $replace_array, $subject);
917 917
 
918
-		$headers =  array();
918
+		$headers = array();
919 919
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
920
-		$headers[] = "Reply-To: " . $fromEmail;
921
-		$headers[] = 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>';
920
+		$headers[] = "Reply-To: ".$fromEmail;
921
+		$headers[] = 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>';
922 922
 
923 923
 		$to = $toEmail;
924 924
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		 * @param string $post_id       The post ID.
941 941
 		 * @param string $user_id       The user ID.
942 942
 		 */
943
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
943
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
944 944
 		/**
945 945
 		 * Filter the client email subject.
946 946
 		 *
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 		 * @param string $post_id       The post ID.
960 960
 		 * @param string $user_id       The user ID.
961 961
 		 */
962
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
962
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
963 963
 		/**
964 964
 		 * Filter the client email message.
965 965
 		 *
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 		 * @param string $post_id       The post ID.
979 979
 		 * @param string $user_id       The user ID.
980 980
 		 */
981
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
981
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
982 982
 		/**
983 983
 		 * Filter the client email headers.
984 984
 		 *
@@ -997,39 +997,39 @@  discard block
 block discarded – undo
997 997
 		 * @param string $post_id       The post ID.
998 998
 		 * @param string $user_id       The user ID.
999 999
 		 */
1000
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1000
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1001 1001
 
1002
-		$sent = wp_mail( $to, $subject, $message, $headers );
1002
+		$sent = wp_mail($to, $subject, $message, $headers);
1003 1003
 
1004
-		if ( ! $sent ) {
1005
-			if ( is_array( $to ) ) {
1006
-				$to = implode( ',', $to );
1004
+		if (!$sent) {
1005
+			if (is_array($to)) {
1006
+				$to = implode(',', $to);
1007 1007
 			}
1008 1008
 			$log_message = sprintf(
1009
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1009
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1010 1010
 				$message_type,
1011
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1011
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1012 1012
 				$to,
1013 1013
 				$subject
1014 1014
 			);
1015
-			geodir_error_log( $log_message );
1015
+			geodir_error_log($log_message);
1016 1016
 		}
1017 1017
 
1018 1018
 		///////// ADMIN BCC EMIALS
1019
-		$adminEmail = get_bloginfo( 'admin_email' );
1019
+		$adminEmail = get_bloginfo('admin_email');
1020 1020
 		$to         = $adminEmail;
1021 1021
 
1022 1022
 		$admin_bcc = false;
1023
-		if ( $message_type == 'registration' ) {
1024
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1025
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1026
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1023
+		if ($message_type == 'registration') {
1024
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1025
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1026
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1027 1027
 		}
1028
-		if ( $message_type == 'post_submit' && ( get_option( 'geodir_notify_post_submit' ) || get_option( 'geodir_notify_post_submit', '-1' ) == '-1' ) ) {
1029
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
1030
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
1028
+		if ($message_type == 'post_submit' && (get_option('geodir_notify_post_submit') || get_option('geodir_notify_post_submit', '-1') == '-1')) {
1029
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
1030
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
1031 1031
 
1032
-			$search_array  = array(
1032
+			$search_array = array(
1033 1033
 				'[#listing_link#]',
1034 1034
 				'[#site_name_url#]',
1035 1035
 				'[#post_id#]',
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 				$user_login,
1066 1066
 				$post_author_email,
1067 1067
 			);
1068
-			$message       = str_replace( $search_array, $replace_array, $message );
1068
+			$message       = str_replace($search_array, $replace_array, $message);
1069 1069
 
1070 1070
 			$search_array  = array(
1071 1071
 				'[#listing_link#]',
@@ -1097,26 +1097,26 @@  discard block
 block discarded – undo
1097 1097
 				$user_login,
1098 1098
 				$post_author_email,
1099 1099
 			);
1100
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1100
+			$subject = str_replace($search_array, $replace_array, $subject);
1101 1101
 
1102 1102
 			$subject .= ' - ADMIN BCC COPY';
1103 1103
 			$admin_bcc = true;
1104 1104
 
1105
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1105
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1106 1106
 			$subject .= ' - ADMIN BCC COPY';
1107 1107
 			$admin_bcc = true;
1108
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1108
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1109 1109
 			$subject .= ' - ADMIN BCC COPY';
1110 1110
 			$admin_bcc = true;
1111
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1111
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1112 1112
 			$subject .= ' - ADMIN BCC COPY';
1113 1113
 			$admin_bcc = true;
1114
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1114
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1115 1115
 			$subject .= ' - ADMIN BCC COPY';
1116 1116
 			$admin_bcc = true;
1117 1117
 		}
1118 1118
 
1119
-		if ( $admin_bcc === true ) {
1119
+		if ($admin_bcc === true) {
1120 1120
 
1121 1121
 			/**
1122 1122
 			 * Filter the client email subject.
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 			 * @param string $post_id       The post ID.
1137 1137
 			 * @param string $user_id       The user ID.
1138 1138
 			 */
1139
-			$subject = apply_filters( 'geodir_sendEmail_subject_admin_bcc', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1139
+			$subject = apply_filters('geodir_sendEmail_subject_admin_bcc', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1140 1140
 			/**
1141 1141
 			 * Filter the client email message.
1142 1142
 			 *
@@ -1155,23 +1155,23 @@  discard block
 block discarded – undo
1155 1155
 			 * @param string $post_id       The post ID.
1156 1156
 			 * @param string $user_id       The user ID.
1157 1157
 			 */
1158
-			$message = apply_filters( 'geodir_sendEmail_message_admin_bcc', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
1158
+			$message = apply_filters('geodir_sendEmail_message_admin_bcc', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
1159 1159
 
1160 1160
 
1161
-			$sent = wp_mail( $to, $subject, $message, $headers );
1161
+			$sent = wp_mail($to, $subject, $message, $headers);
1162 1162
 
1163
-			if ( ! $sent ) {
1164
-				if ( is_array( $to ) ) {
1165
-					$to = implode( ',', $to );
1163
+			if (!$sent) {
1164
+				if (is_array($to)) {
1165
+					$to = implode(',', $to);
1166 1166
 				}
1167 1167
 				$log_message = sprintf(
1168
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1168
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1169 1169
 					$message_type,
1170
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1170
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1171 1171
 					$to,
1172 1172
 					$subject
1173 1173
 				);
1174
-				geodir_error_log( $log_message );
1174
+				geodir_error_log($log_message);
1175 1175
 			}
1176 1176
 		}
1177 1177
 
@@ -1187,51 +1187,51 @@  discard block
 block discarded – undo
1187 1187
  */
1188 1188
 function geodir_taxonomy_breadcrumb() {
1189 1189
 
1190
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1190
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1191 1191
 	$parent = $term->parent;
1192 1192
 
1193
-	while ( $parent ):
1193
+	while ($parent):
1194 1194
 		$parents[]  = $parent;
1195
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1195
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1196 1196
 		$parent     = $new_parent->parent;
1197 1197
 	endwhile;
1198 1198
 
1199
-	if ( ! empty( $parents ) ):
1200
-		$parents = array_reverse( $parents );
1199
+	if (!empty($parents)):
1200
+		$parents = array_reverse($parents);
1201 1201
 
1202
-		foreach ( $parents as $parent ):
1203
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1204
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1205
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1202
+		foreach ($parents as $parent):
1203
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1204
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1205
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1206 1206
 		endforeach;
1207 1207
 
1208 1208
 	endif;
1209 1209
 
1210
-	echo '<li> > ' . $term->name . '</li>';
1210
+	echo '<li> > '.$term->name.'</li>';
1211 1211
 }
1212 1212
 
1213
-function geodir_wpml_post_type_archive_link($link, $post_type){
1213
+function geodir_wpml_post_type_archive_link($link, $post_type) {
1214 1214
 	if (geodir_is_wpml()) {
1215
-		$post_types   = get_option( 'geodir_post_types' );
1215
+		$post_types = get_option('geodir_post_types');
1216 1216
 		
1217
-		if ( isset( $post_types[ $post_type ] ) ) {
1218
-			$slug = $post_types[ $post_type ]['rewrite']['slug'];
1217
+		if (isset($post_types[$post_type])) {
1218
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1219 1219
 
1220 1220
 			// Alter the CPT slug if WPML is set to do so
1221
-			if ( geodir_wpml_is_post_type_translated( $post_type ) ) {
1222
-				if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
1221
+			if (geodir_wpml_is_post_type_translated($post_type)) {
1222
+				if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
1223 1223
 
1224 1224
 					$org_slug = $slug;
1225
-					$slug     = apply_filters( 'wpml_translate_single_string',
1225
+					$slug     = apply_filters('wpml_translate_single_string',
1226 1226
 						$slug,
1227 1227
 						'WordPress',
1228
-						'URL slug: ' . $slug,
1229
-						$language_code );
1228
+						'URL slug: '.$slug,
1229
+						$language_code);
1230 1230
                     
1231
-					if ( ! $slug ) {
1231
+					if (!$slug) {
1232 1232
 						$slug = $org_slug;
1233 1233
 					} else {
1234
-						$link = str_replace( $org_slug, $slug, $link );
1234
+						$link = str_replace($org_slug, $slug, $link);
1235 1235
 					}
1236 1236
 				}
1237 1237
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 	return $link;
1242 1242
 }
1243
-add_filter( 'post_type_archive_link','geodir_wpml_post_type_archive_link', 1000, 2);
1243
+add_filter('post_type_archive_link', 'geodir_wpml_post_type_archive_link', 1000, 2);
1244 1244
 
1245 1245
 /**
1246 1246
  * Main function that generates breadcrumb for all pages.
@@ -1261,9 +1261,9 @@  discard block
 block discarded – undo
1261 1261
 	 *
1262 1262
 	 * @since 1.0.0
1263 1263
 	 */
1264
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1264
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1265 1265
 
1266
-	if ( ! geodir_is_page( 'home' ) ) {
1266
+	if (!geodir_is_page('home')) {
1267 1267
 		$breadcrumb    = '';
1268 1268
 		$url_categoris = '';
1269 1269
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1272,167 +1272,167 @@  discard block
 block discarded – undo
1272 1272
 		 *
1273 1273
 		 * @since 1.0.0
1274 1274
 		 */
1275
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1275
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1276 1276
 
1277 1277
 		$gd_post_type   = geodir_get_current_posttype();
1278
-		$post_type_info = get_post_type_object( $gd_post_type );
1278
+		$post_type_info = get_post_type_object($gd_post_type);
1279 1279
 
1280
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1280
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1281 1281
 
1282
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1282
+		$listing_link = get_post_type_archive_link($gd_post_type);
1283 1283
 
1284
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1285
-		$listing_link = rtrim( $listing_link, '/' );
1284
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1285
+		$listing_link = rtrim($listing_link, '/');
1286 1286
 		$listing_link .= '/';
1287 1287
 
1288 1288
 		$post_type_for_location_link = $listing_link;
1289
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1289
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1290 1290
 
1291 1291
 		global $wp, $gd_session;
1292 1292
 		$location_link = $post_type_for_location_link;
1293 1293
 
1294
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1294
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1295 1295
 			global $post;
1296
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1297
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1296
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1297
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1298 1298
 
1299
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1299
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1300 1300
 				$location_terms = array(
1301 1301
 					'gd_country' => $post->country_slug,
1302 1302
 					'gd_region'  => $post->region_slug,
1303 1303
 					'gd_city'    => $post->city_slug
1304 1304
 				);
1305 1305
 
1306
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1306
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1307 1307
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1308 1308
 				}
1309 1309
 			}
1310 1310
 
1311
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1311
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1312 1312
 
1313 1313
 			$hide_url_part = array();
1314
-			if ( $location_manager ) {
1315
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1316
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1317
-
1318
-				if ( $hide_region_part && $hide_country_part ) {
1319
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1320
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1321
-					$hide_url_part = array( 'gd_region' );
1322
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1323
-					$hide_url_part = array( 'gd_country' );
1314
+			if ($location_manager) {
1315
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1316
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1317
+
1318
+				if ($hide_region_part && $hide_country_part) {
1319
+					$hide_url_part = array('gd_country', 'gd_region');
1320
+				} else if ($hide_region_part && !$hide_country_part) {
1321
+					$hide_url_part = array('gd_region');
1322
+				} else if (!$hide_region_part && $hide_country_part) {
1323
+					$hide_url_part = array('gd_country');
1324 1324
 				}
1325 1325
 			}
1326 1326
 
1327 1327
 			$hide_text_part = array();
1328
-			if ( $geodir_show_location_url == 'country_city' ) {
1329
-				$hide_text_part = array( 'gd_region' );
1328
+			if ($geodir_show_location_url == 'country_city') {
1329
+				$hide_text_part = array('gd_region');
1330 1330
 
1331
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1332
-					unset( $location_terms['gd_region'] );
1331
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1332
+					unset($location_terms['gd_region']);
1333 1333
 				}
1334
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1335
-				$hide_text_part = array( 'gd_country' );
1334
+			} else if ($geodir_show_location_url == 'region_city') {
1335
+				$hide_text_part = array('gd_country');
1336 1336
 
1337
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1338
-					unset( $location_terms['gd_country'] );
1337
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1338
+					unset($location_terms['gd_country']);
1339 1339
 				}
1340
-			} else if ( $geodir_show_location_url == 'city' ) {
1341
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1340
+			} else if ($geodir_show_location_url == 'city') {
1341
+				$hide_text_part = array('gd_country', 'gd_region');
1342 1342
 
1343
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1344
-					unset( $location_terms['gd_country'] );
1343
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1344
+					unset($location_terms['gd_country']);
1345 1345
 				}
1346
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1347
-					unset( $location_terms['gd_region'] );
1346
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1347
+					unset($location_terms['gd_region']);
1348 1348
 				}
1349 1349
 			}
1350 1350
 
1351 1351
 			$is_location_last = '';
1352 1352
 			$is_taxonomy_last = '';
1353 1353
 			$breadcrumb .= '<li>';
1354
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1355
-				$gd_taxonomy = $gd_post_type . 'category';
1356
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1357
-				$gd_taxonomy = $gd_post_type . '_tags';
1354
+			if (get_query_var($gd_post_type.'category')) {
1355
+				$gd_taxonomy = $gd_post_type.'category';
1356
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1357
+				$gd_taxonomy = $gd_post_type.'_tags';
1358 1358
 			}
1359 1359
 
1360
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( geodir_utf8_ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1361
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1360
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(geodir_utf8_ucfirst($post_type_info->label), 'geodirectory').'</a>';
1361
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1362 1362
 				$is_location_last = false;
1363 1363
 			} else {
1364 1364
 				$is_location_last = true;
1365 1365
 			}
1366 1366
 
1367
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1367
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1368 1368
 				$is_taxonomy_last = true;
1369 1369
 			} else {
1370 1370
 				$is_taxonomy_last = false;
1371 1371
 			}
1372 1372
 
1373
-			if ( ! empty( $location_terms ) ) {
1374
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1373
+			if (!empty($location_terms)) {
1374
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1375 1375
 
1376
-				foreach ( $location_terms as $key => $location_term ) {
1377
-					if ( $location_term != '' ) {
1378
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1376
+				foreach ($location_terms as $key => $location_term) {
1377
+					if ($location_term != '') {
1378
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1379 1379
 							continue;
1380 1380
 						}
1381 1381
 
1382
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1383
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1384
-						$gd_location_link_text = geodir_utf8_ucfirst( $gd_location_link_text );
1382
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1383
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1384
+						$gd_location_link_text = geodir_utf8_ucfirst($gd_location_link_text);
1385 1385
 
1386 1386
 						$location_term_actual_country = '';
1387 1387
 						$location_term_actual_region  = '';
1388 1388
 						$location_term_actual_city    = '';
1389 1389
 						$location_term_actual_neighbourhood = '';
1390
-						if ( $geodir_get_locations ) {
1391
-							if ( $key == 'gd_country' ) {
1392
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1393
-							} else if ( $key == 'gd_region' ) {
1394
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1395
-							} else if ( $key == 'gd_city' ) {
1396
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1397
-							} else if ( $key == 'gd_neighbourhood' ) {
1398
-								$location_term_actual_neighbourhood = get_actual_location_name( 'neighbourhood', $location_term, true );
1390
+						if ($geodir_get_locations) {
1391
+							if ($key == 'gd_country') {
1392
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1393
+							} else if ($key == 'gd_region') {
1394
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1395
+							} else if ($key == 'gd_city') {
1396
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1397
+							} else if ($key == 'gd_neighbourhood') {
1398
+								$location_term_actual_neighbourhood = get_actual_location_name('neighbourhood', $location_term, true);
1399 1399
 							}
1400 1400
 						} else {
1401 1401
 							$location_info = geodir_get_location();
1402 1402
 
1403
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1404
-								if ( $key == 'gd_country' ) {
1405
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1406
-								} else if ( $key == 'gd_region' ) {
1407
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1408
-								} else if ( $key == 'gd_city' ) {
1409
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1403
+							if (!empty($location_info) && isset($location_info->location_id)) {
1404
+								if ($key == 'gd_country') {
1405
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1406
+								} else if ($key == 'gd_region') {
1407
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1408
+								} else if ($key == 'gd_city') {
1409
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1410 1410
 								}
1411 1411
 							}
1412 1412
 						}
1413 1413
 
1414
-						if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1415
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1416
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1417
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1418
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1419
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1420
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1421
-							$breadcrumb .= $location_term_actual_neighbourhood != '' ? $separator . $location_term_actual_neighbourhood : $separator . $gd_location_link_text;
1414
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1415
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1416
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1417
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1418
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1419
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1420
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1421
+							$breadcrumb .= $location_term_actual_neighbourhood != '' ? $separator.$location_term_actual_neighbourhood : $separator.$gd_location_link_text;
1422 1422
 						} else {
1423
-							if ( get_option( 'permalink_structure' ) != '' ) {
1424
-								$location_link .= $location_term . '/';
1423
+							if (get_option('permalink_structure') != '') {
1424
+								$location_link .= $location_term.'/';
1425 1425
 							} else {
1426
-								$location_link .= "&$key=" . $location_term;
1426
+								$location_link .= "&$key=".$location_term;
1427 1427
 							}
1428 1428
 
1429
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1429
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1430 1430
 								$gd_location_link_text = $location_term_actual_country;
1431
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1431
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1432 1432
 								$gd_location_link_text = $location_term_actual_region;
1433
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1433
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1434 1434
 								$gd_location_link_text = $location_term_actual_city;
1435
-							} else if ( $key == 'gd_neighbourhood' && $location_term_actual_neighbourhood != '' ) {
1435
+							} else if ($key == 'gd_neighbourhood' && $location_term_actual_neighbourhood != '') {
1436 1436
 								$gd_location_link_text = $location_term_actual_neighbourhood;
1437 1437
 							}
1438 1438
 
@@ -1442,77 +1442,77 @@  discard block
 block discarded – undo
1442 1442
                             }
1443 1443
                             */
1444 1444
 
1445
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1445
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1446 1446
 						}
1447 1447
 					}
1448 1448
 				}
1449 1449
 			}
1450 1450
 
1451
-			if ( ! empty( $gd_taxonomy ) ) {
1451
+			if (!empty($gd_taxonomy)) {
1452 1452
 				$term_index = 1;
1453 1453
 
1454 1454
 				//if(get_option('geodir_add_categories_url'))
1455 1455
 				{
1456
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1457
-						$cat_link = $listing_link . 'tags/';
1456
+					if (get_query_var($gd_post_type.'_tags')) {
1457
+						$cat_link = $listing_link.'tags/';
1458 1458
 					} else {
1459 1459
 						$cat_link = $listing_link;
1460 1460
 					}
1461 1461
 
1462
-					foreach ( $location_terms as $key => $location_term ) {
1463
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1462
+					foreach ($location_terms as $key => $location_term) {
1463
+						if ($location_manager && in_array($key, $hide_url_part)) {
1464 1464
 							continue;
1465 1465
 						}
1466 1466
 
1467
-						if ( $location_term != '' ) {
1468
-							if ( get_option( 'permalink_structure' ) != '' ) {
1469
-								$cat_link .= $location_term . '/';
1467
+						if ($location_term != '') {
1468
+							if (get_option('permalink_structure') != '') {
1469
+								$cat_link .= $location_term.'/';
1470 1470
 							}
1471 1471
 						}
1472 1472
 					}
1473 1473
 
1474
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1475
-					foreach ( $term_array as $term ) {
1476
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1477
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1474
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1475
+					foreach ($term_array as $term) {
1476
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1477
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1478 1478
 
1479 1479
 						// get term actual name
1480
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1481
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1482
-							$term_link_text = urldecode( $term_info['name'] );
1480
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1481
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1482
+							$term_link_text = urldecode($term_info['name']);
1483 1483
 						} else {
1484 1484
 							continue;
1485 1485
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1486 1486
 						}
1487 1487
 
1488
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1489
-							$breadcrumb .= $separator . $term_link_text;
1488
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1489
+							$breadcrumb .= $separator.$term_link_text;
1490 1490
 						} else {
1491
-							$cat_link .= $term . '/';
1492
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1491
+							$cat_link .= $term.'/';
1492
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1493 1493
 						}
1494
-						$term_index ++;
1494
+						$term_index++;
1495 1495
 					}
1496 1496
 				}
1497 1497
 
1498 1498
 
1499 1499
 			}
1500 1500
 
1501
-			if ( geodir_is_page( 'detail' ) ) {
1502
-				$breadcrumb .= $separator . get_the_title();
1501
+			if (geodir_is_page('detail')) {
1502
+				$breadcrumb .= $separator.get_the_title();
1503 1503
 			}
1504 1504
 
1505 1505
 			$breadcrumb .= '</li>';
1506 1506
 
1507 1507
 
1508
-		} elseif ( geodir_is_page( 'author' ) ) {
1508
+		} elseif (geodir_is_page('author')) {
1509 1509
 			$dashboard_post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : $gd_post_type;
1510 1510
 			$user_id             = get_current_user_id();
1511
-			$author_link         = get_author_posts_url( $user_id );
1512
-			$default_author_link = geodir_getlink( $author_link, array(
1511
+			$author_link         = get_author_posts_url($user_id);
1512
+			$default_author_link = geodir_getlink($author_link, array(
1513 1513
 				'geodir_dashbord' => 'true',
1514 1514
 				'stype'           => $dashboard_post_type
1515
-			), false );
1515
+			), false);
1516 1516
 
1517 1517
 			/**
1518 1518
 			 * Filter author page link.
@@ -1522,16 +1522,16 @@  discard block
 block discarded – undo
1522 1522
 			 * @param string $default_author_link Default author link.
1523 1523
 			 * @param int $user_id                Author ID.
1524 1524
 			 */
1525
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1525
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1526 1526
 
1527 1527
 			$breadcrumb .= '<li>';
1528
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1528
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1529 1529
 
1530
-			if ( isset( $_REQUEST['list'] ) ) {
1531
-				$author_link = geodir_getlink( $author_link, array(
1530
+			if (isset($_REQUEST['list'])) {
1531
+				$author_link = geodir_getlink($author_link, array(
1532 1532
 					'geodir_dashbord' => 'true',
1533 1533
 					'stype'           => $_REQUEST['stype']
1534
-				), false );
1534
+				), false);
1535 1535
 
1536 1536
 				/**
1537 1537
 				 * Filter author page link.
@@ -1542,61 +1542,61 @@  discard block
 block discarded – undo
1542 1542
 				 * @param int $user_id        Author ID.
1543 1543
 				 * @param string $_REQUEST    ['stype'] Post type.
1544 1544
 				 */
1545
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1545
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1546 1546
 
1547
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( geodir_utf8_ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1548
-				$breadcrumb .= $separator . geodir_utf8_ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1547
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(geodir_utf8_ucfirst($post_type_info->label), 'geodirectory').'</a>';
1548
+				$breadcrumb .= $separator.geodir_utf8_ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1549 1549
 			} else {
1550
-				$breadcrumb .= $separator . __( geodir_utf8_ucfirst( $post_type_info->label ), 'geodirectory' );
1550
+				$breadcrumb .= $separator.__(geodir_utf8_ucfirst($post_type_info->label), 'geodirectory');
1551 1551
 			}
1552 1552
 
1553 1553
 			$breadcrumb .= '</li>';
1554
-		} elseif ( is_category() || is_single() ) {
1554
+		} elseif (is_category() || is_single()) {
1555 1555
 			$category = get_the_category();
1556
-			if ( is_category() ) {
1557
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1556
+			if (is_category()) {
1557
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1558 1558
 			}
1559
-			if ( is_single() ) {
1560
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1561
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1559
+			if (is_single()) {
1560
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1561
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1562 1562
 			}
1563 1563
 			/* End of my version ##################################################### */
1564
-		} else if ( is_page() ) {
1564
+		} else if (is_page()) {
1565 1565
 			$page_title = get_the_title();
1566 1566
 
1567
-			if ( geodir_is_page( 'location' ) ) {
1567
+			if (geodir_is_page('location')) {
1568 1568
 				$location_page_id = geodir_location_page_id();
1569
-				$loc_post         = get_post( $location_page_id );
1569
+				$loc_post         = get_post($location_page_id);
1570 1570
 				$post_name        = $loc_post->post_name;
1571
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1572
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1571
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1572
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1573 1573
 			}
1574 1574
 
1575
-			$breadcrumb .= '<li>' . $separator;
1576
-			$breadcrumb .= stripslashes_deep( $page_title );
1575
+			$breadcrumb .= '<li>'.$separator;
1576
+			$breadcrumb .= stripslashes_deep($page_title);
1577 1577
 			$breadcrumb .= '</li>';
1578
-		} else if ( is_tag() ) {
1579
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1580
-		} else if ( is_day() ) {
1581
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1582
-			the_time( 'F jS, Y' );
1578
+		} else if (is_tag()) {
1579
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1580
+		} else if (is_day()) {
1581
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1582
+			the_time('F jS, Y');
1583 1583
 			$breadcrumb .= '</li>';
1584
-		} else if ( is_month() ) {
1585
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1586
-			the_time( 'F, Y' );
1584
+		} else if (is_month()) {
1585
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1586
+			the_time('F, Y');
1587 1587
 			$breadcrumb .= '</li>';
1588
-		} else if ( is_year() ) {
1589
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1590
-			the_time( 'Y' );
1588
+		} else if (is_year()) {
1589
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1590
+			the_time('Y');
1591 1591
 			$breadcrumb .= '</li>';
1592
-		} else if ( is_author() ) {
1593
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1592
+		} else if (is_author()) {
1593
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1594 1594
 			$breadcrumb .= '</li>';
1595
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1596
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1595
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1596
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1597 1597
 			$breadcrumb .= '</li>';
1598
-		} else if ( is_search() ) {
1599
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1598
+		} else if (is_search()) {
1599
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1600 1600
 			$breadcrumb .= '</li>';
1601 1601
 		}
1602 1602
 		$breadcrumb .= '</ul></div>';
@@ -1609,13 +1609,13 @@  discard block
 block discarded – undo
1609 1609
 		 * @param string $breadcrumb Breadcrumb HTML.
1610 1610
 		 * @param string $separator  Breadcrumb separator.
1611 1611
 		 */
1612
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1612
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1613 1613
 	}
1614 1614
 }
1615 1615
 
1616 1616
 
1617
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1618
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1617
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1618
+if (!function_exists('geodir_allow_wpadmin')) {
1619 1619
 	/**
1620 1620
 	 * Allow only admins to access wp-admin.
1621 1621
 	 *
@@ -1627,12 +1627,12 @@  discard block
 block discarded – undo
1627 1627
 	 */
1628 1628
 	function geodir_allow_wpadmin() {
1629 1629
 		global $wpdb;
1630
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1630
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1631 1631
 		{
1632
-			if ( current_user_can( 'administrator' ) ) {
1632
+			if (current_user_can('administrator')) {
1633 1633
 			} else {
1634 1634
 
1635
-				wp_redirect( home_url() );
1635
+				wp_redirect(home_url());
1636 1636
 				exit;
1637 1637
 			}
1638 1638
 
@@ -1651,23 +1651,23 @@  discard block
 block discarded – undo
1651 1651
  *
1652 1652
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1653 1653
  */
1654
-function fetch_remote_file( $url ) {
1654
+function fetch_remote_file($url) {
1655 1655
 	// extract the file name and extension from the url
1656
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1657
-	$file_name = basename( $url );
1658
-	if ( strpos( $file_name, '?' ) !== false ) {
1659
-		list( $file_name ) = explode( '?', $file_name );
1656
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1657
+	$file_name = basename($url);
1658
+	if (strpos($file_name, '?') !== false) {
1659
+		list($file_name) = explode('?', $file_name);
1660 1660
 	}
1661 1661
 	$dummy        = false;
1662 1662
 	$add_to_cache = false;
1663 1663
 	$key          = null;
1664
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1664
+	if (strpos($url, '/dummy/') !== false) {
1665 1665
 		$dummy = true;
1666
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1667
-		$value = get_transient( 'cached_dummy_images' );
1668
-		if ( $value ) {
1669
-			if ( isset( $value[ $key ] ) ) {
1670
-				return $value[ $key ];
1666
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1667
+		$value = get_transient('cached_dummy_images');
1668
+		if ($value) {
1669
+			if (isset($value[$key])) {
1670
+				return $value[$key];
1671 1671
 			} else {
1672 1672
 				$add_to_cache = true;
1673 1673
 			}
@@ -1678,58 +1678,58 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
 	// get placeholder file in the upload dir with a unique, sanitized filename
1680 1680
 
1681
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1681
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1682 1682
 
1683
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1684
-	if ( $upload['error'] ) {
1685
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1683
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1684
+	if ($upload['error']) {
1685
+		return new WP_Error('upload_dir_error', $upload['error']);
1686 1686
 	}
1687 1687
 
1688 1688
 
1689
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1689
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1690 1690
 
1691 1691
 	// fetch the remote url and write it to the placeholder file
1692
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1692
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1693 1693
 
1694 1694
 	$log_message = '';
1695
-	if ( is_wp_error( $headers ) ) {
1696
-		echo 'file: ' . $url;
1695
+	if (is_wp_error($headers)) {
1696
+		echo 'file: '.$url;
1697 1697
 
1698
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1698
+		return new WP_Error('import_file_error', $headers->get_error_message());
1699 1699
 	}
1700 1700
 
1701
-	$filesize = filesize( $upload['file'] );
1701
+	$filesize = filesize($upload['file']);
1702 1702
 	// request failed
1703
-	if ( ! $headers ) {
1704
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1703
+	if (!$headers) {
1704
+		$log_message = __('Remote server did not respond', 'geodirectory');
1705 1705
 	} // make sure the fetch was successful
1706
-	elseif ( $headers['response']['code'] != '200' ) {
1707
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1708
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1709
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1710
-	} elseif ( 0 == $filesize ) {
1711
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1712
-	}
1713
-
1714
-	if ( $log_message ) {
1715
-		$del = unlink( $upload['file'] );
1716
-		if ( ! $del ) {
1717
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1706
+	elseif ($headers['response']['code'] != '200') {
1707
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1708
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1709
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1710
+	} elseif (0 == $filesize) {
1711
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1712
+	}
1713
+
1714
+	if ($log_message) {
1715
+		$del = unlink($upload['file']);
1716
+		if (!$del) {
1717
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1718 1718
 		}
1719 1719
 
1720
-		return new WP_Error( 'import_file_error', $log_message );
1720
+		return new WP_Error('import_file_error', $log_message);
1721 1721
 	}
1722 1722
 
1723
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1724
-		$images = get_transient( 'cached_dummy_images' );
1725
-		if ( is_array( $images ) ) {
1726
-			$images[ $key ] = $upload;
1723
+	if ($dummy && $add_to_cache && is_array($upload)) {
1724
+		$images = get_transient('cached_dummy_images');
1725
+		if (is_array($images)) {
1726
+			$images[$key] = $upload;
1727 1727
 		} else {
1728
-			$images = array( $key => $upload );
1728
+			$images = array($key => $upload);
1729 1729
 		}
1730 1730
 
1731 1731
 		//setting the cache using the WP Transient API
1732
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1732
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1733 1733
 	}
1734 1734
 
1735 1735
 	return $upload;
@@ -1743,12 +1743,12 @@  discard block
 block discarded – undo
1743 1743
  * @return string|void Max upload size.
1744 1744
  */
1745 1745
 function geodir_max_upload_size() {
1746
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1746
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1747 1747
 
1748
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1749
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1748
+	if ($max_filesize > 0 && $max_filesize < 1) {
1749
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1750 1750
 	} else {
1751
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1751
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1752 1752
 	}
1753 1753
 
1754 1754
 	/**
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 	 *
1759 1759
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1760 1760
 	 */
1761
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1761
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1762 1762
 }
1763 1763
 
1764 1764
 /**
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
  * @return bool If dummy folder exists returns true, else false.
1772 1772
  */
1773 1773
 function geodir_dummy_folder_exists() {
1774
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1775
-	if ( ! is_dir( $path ) ) {
1774
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1775
+	if (!is_dir($path)) {
1776 1776
 		return false;
1777 1777
 	} else {
1778 1778
 		return true;
@@ -1791,17 +1791,17 @@  discard block
 block discarded – undo
1791 1791
  *
1792 1792
  * @return object Author info.
1793 1793
  */
1794
-function geodir_get_author_info( $aid ) {
1794
+function geodir_get_author_info($aid) {
1795 1795
 	global $wpdb;
1796 1796
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1797
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1798
-	$info    = $wpdb->get_results( $infosql );
1799
-	if ( $info ) {
1797
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1798
+	$info    = $wpdb->get_results($infosql);
1799
+	if ($info) {
1800 1800
 		return $info[0];
1801 1801
 	}
1802 1802
 }
1803 1803
 
1804
-if ( ! function_exists( 'adminEmail' ) ) {
1804
+if (!function_exists('adminEmail')) {
1805 1805
 	/**
1806 1806
 	 * Send emails to client on post submission, renew etc.
1807 1807
 	 *
@@ -1814,67 +1814,67 @@  discard block
 block discarded – undo
1814 1814
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1815 1815
 	 * @param string $custom_1     Custom data to be sent.
1816 1816
 	 */
1817
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1817
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1818 1818
 		global $wpdb;
1819
-		if ( $message_type == 'expiration' ) {
1820
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1821
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1822
-		} elseif ( $message_type == 'post_submited' ) {
1823
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1824
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1825
-		} elseif ( $message_type == 'renew' ) {
1826
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1827
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1828
-		} elseif ( $message_type == 'upgrade' ) {
1829
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1830
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1831
-		} elseif ( $message_type == 'claim_approved' ) {
1832
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1833
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1834
-		} elseif ( $message_type == 'claim_rejected' ) {
1835
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1836
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1837
-		} elseif ( $message_type == 'claim_requested' ) {
1838
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1839
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1840
-		} elseif ( $message_type == 'auto_claim' ) {
1841
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1842
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1843
-		} elseif ( $message_type == 'payment_success' ) {
1844
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1845
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1846
-		} elseif ( $message_type == 'payment_fail' ) {
1847
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1848
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1819
+		if ($message_type == 'expiration') {
1820
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1821
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1822
+		} elseif ($message_type == 'post_submited') {
1823
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1824
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1825
+		} elseif ($message_type == 'renew') {
1826
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1827
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1828
+		} elseif ($message_type == 'upgrade') {
1829
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1830
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1831
+		} elseif ($message_type == 'claim_approved') {
1832
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1833
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1834
+		} elseif ($message_type == 'claim_rejected') {
1835
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1836
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1837
+		} elseif ($message_type == 'claim_requested') {
1838
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1839
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1840
+		} elseif ($message_type == 'auto_claim') {
1841
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1842
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1843
+		} elseif ($message_type == 'payment_success') {
1844
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1845
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1846
+		} elseif ($message_type == 'payment_fail') {
1847
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1848
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1849 1849
 		}
1850 1850
 		$transaction_details = $custom_1;
1851
-		$fromEmail           = get_option( 'site_email' );
1851
+		$fromEmail           = get_option('site_email');
1852 1852
 		$fromEmailName       = get_site_emailName();
1853 1853
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1854
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1854
+		$pkg_limit            = get_property_price_info_listing($page_id);
1855 1855
 		$alivedays            = $pkg_limit['days'];
1856
-		$productlink          = get_permalink( $page_id );
1857
-		$post_info            = get_post( $page_id );
1858
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1859
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1856
+		$productlink          = get_permalink($page_id);
1857
+		$post_info            = get_post($page_id);
1858
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1859
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1860 1860
 		$loginurl             = geodir_login_url();
1861
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1861
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1862 1862
 		$siteurl              = home_url();
1863
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1864
-		$user_info            = get_userdata( $user_id );
1863
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1864
+		$user_info            = get_userdata($user_id);
1865 1865
 		$user_email           = $user_info->user_email;
1866
-		$display_name         = geodir_get_client_name( $user_id );
1866
+		$display_name         = geodir_get_client_name($user_id);
1867 1867
 		$user_login           = $user_info->user_login;
1868
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1869
-		if ( $number_of_grace_days == '' ) {
1868
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1869
+		if ($number_of_grace_days == '') {
1870 1870
 			$number_of_grace_days = 1;
1871 1871
 		}
1872
-		if ( $post_info->post_type == 'event' ) {
1872
+		if ($post_info->post_type == 'event') {
1873 1873
 			$post_type = 'event';
1874 1874
 		} else {
1875 1875
 			$post_type = 'listing';
1876 1876
 		}
1877
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1877
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1878 1878
 		$search_array   = array(
1879 1879
 			'[#client_name#]',
1880 1880
 			'[#listing_link#]',
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
 			'[#site_name#]',
1891 1891
 			'[#transaction_details#]'
1892 1892
 		);
1893
-		$replace_array  = array(
1893
+		$replace_array = array(
1894 1894
 			$display_name,
1895 1895
 			$listingLink,
1896 1896
 			$post_date,
@@ -1905,13 +1905,13 @@  discard block
 block discarded – undo
1905 1905
 			$fromEmailName,
1906 1906
 			$transaction_details
1907 1907
 		);
1908
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1909
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1908
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1909
+		$subject        = str_replace($search_array, $replace_array, $subject);
1910 1910
 		
1911 1911
 		
1912
-		$headers  = array();
1912
+		$headers = array();
1913 1913
 		$headers[] = 'Content-type: text/html; charset=UTF-8';
1914
-		$headers[] = 'From: ' . $fromEmailName . ' <' . $fromEmail . '>';
1914
+		$headers[] = 'From: '.$fromEmailName.' <'.$fromEmail.'>';
1915 1915
 
1916 1916
 		$to      = $fromEmail;
1917 1917
 		$message = $client_message;
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1930 1930
 		 * @param string $custom_1     Custom data to be sent.
1931 1931
 		 */
1932
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1932
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1933 1933
 		/**
1934 1934
 		 * Filter the admin email subject.
1935 1935
 		 *
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1943 1943
 		 * @param string $custom_1     Custom data to be sent.
1944 1944
 		 */
1945
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1945
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1946 1946
 		/**
1947 1947
 		 * Filter the admin email message.
1948 1948
 		 *
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1956 1956
 		 * @param string $custom_1     Custom data to be sent.
1957 1957
 		 */
1958
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1958
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1959 1959
 		/**
1960 1960
 		 * Filter the admin email headers.
1961 1961
 		 *
@@ -1968,22 +1968,22 @@  discard block
 block discarded – undo
1968 1968
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1969 1969
 		 * @param string $custom_1     Custom data to be sent.
1970 1970
 		 */
1971
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1971
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1972 1972
 
1973 1973
 
1974
-		$sent = wp_mail( $to, $subject, $message, $headers );
1975
-		if ( ! $sent ) {
1976
-			if ( is_array( $to ) ) {
1977
-				$to = implode( ',', $to );
1974
+		$sent = wp_mail($to, $subject, $message, $headers);
1975
+		if (!$sent) {
1976
+			if (is_array($to)) {
1977
+				$to = implode(',', $to);
1978 1978
 			}
1979 1979
 			$log_message = sprintf(
1980
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1980
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1981 1981
 				$message_type,
1982
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1982
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1983 1983
 				$to,
1984 1984
 				$subject
1985 1985
 			);
1986
-			geodir_error_log( $log_message );
1986
+			geodir_error_log($log_message);
1987 1987
 		}
1988 1988
 	}
1989 1989
 }
@@ -2003,12 +2003,12 @@  discard block
 block discarded – undo
2003 2003
  *
2004 2004
  * @return array Category IDs.
2005 2005
  */
2006
-function gd_lang_object_ids( $ids_array, $type ) {
2007
-	if ( geodir_is_wpml() ) {
2006
+function gd_lang_object_ids($ids_array, $type) {
2007
+	if (geodir_is_wpml()) {
2008 2008
 		$res = array();
2009
-		foreach ( $ids_array as $id ) {
2010
-			$xlat = geodir_wpml_object_id( $id, $type, false );
2011
-			if ( ! is_null( $xlat ) ) {
2009
+		foreach ($ids_array as $id) {
2010
+			$xlat = geodir_wpml_object_id($id, $type, false);
2011
+			if (!is_null($xlat)) {
2012 2012
 				$res[] = $xlat;
2013 2013
 			}
2014 2014
 		}
@@ -2032,20 +2032,20 @@  discard block
 block discarded – undo
2032 2032
  *
2033 2033
  * @return array Modified Body CSS classes.
2034 2034
  */
2035
-function geodir_custom_posts_body_class( $classes ) {
2035
+function geodir_custom_posts_body_class($classes) {
2036 2036
 	global $wpdb, $wp;
2037
-	$post_types = geodir_get_posttypes( 'object' );
2038
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2037
+	$post_types = geodir_get_posttypes('object');
2038
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2039 2039
 		$classes[] = 'geodir_custom_posts';
2040 2040
 	}
2041 2041
 
2042 2042
 	// fix body class for signup page
2043
-	if ( geodir_is_page( 'login' ) ) {
2043
+	if (geodir_is_page('login')) {
2044 2044
 		$new_classes   = array();
2045 2045
 		$new_classes[] = 'signup page-geodir-signup';
2046
-		if ( ! empty( $classes ) ) {
2047
-			foreach ( $classes as $class ) {
2048
-				if ( $class && $class != 'home' && $class != 'blog' ) {
2046
+		if (!empty($classes)) {
2047
+			foreach ($classes as $class) {
2048
+				if ($class && $class != 'home' && $class != 'blog') {
2049 2049
 					$new_classes[] = $class;
2050 2050
 				}
2051 2051
 			}
@@ -2053,14 +2053,14 @@  discard block
 block discarded – undo
2053 2053
 		$classes = $new_classes;
2054 2054
 	}
2055 2055
 
2056
-	if ( geodir_is_geodir_page() ) {
2056
+	if (geodir_is_geodir_page()) {
2057 2057
 		$classes[] = 'geodir-page';
2058 2058
 	}
2059 2059
 
2060 2060
 	return $classes;
2061 2061
 }
2062 2062
 
2063
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2063
+add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
2064 2064
 
2065 2065
 
2066 2066
 /**
@@ -2076,7 +2076,7 @@  discard block
 block discarded – undo
2076 2076
 	 *
2077 2077
 	 * @since 1.0.0
2078 2078
 	 */
2079
-	return apply_filters( 'geodir_map_zoom_level', array(
2079
+	return apply_filters('geodir_map_zoom_level', array(
2080 2080
 		1,
2081 2081
 		2,
2082 2082
 		3,
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 		17,
2097 2097
 		18,
2098 2098
 		19
2099
-	) );
2099
+	));
2100 2100
 
2101 2101
 }
2102 2102
 
@@ -2109,12 +2109,12 @@  discard block
 block discarded – undo
2109 2109
  *
2110 2110
  * @param string $geodir_option_name Option key.
2111 2111
  */
2112
-function geodir_option_version_backup( $geodir_option_name ) {
2112
+function geodir_option_version_backup($geodir_option_name) {
2113 2113
 	$version_date  = time();
2114
-	$geodir_option = get_option( $geodir_option_name );
2114
+	$geodir_option = get_option($geodir_option_name);
2115 2115
 
2116
-	if ( ! empty( $geodir_option ) ) {
2117
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2116
+	if (!empty($geodir_option)) {
2117
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2118 2118
 	}
2119 2119
 }
2120 2120
 
@@ -2128,10 +2128,10 @@  discard block
 block discarded – undo
2128 2128
  *
2129 2129
  * @return int Page ID.
2130 2130
  */
2131
-function get_page_id_geodir_add_listing_page( $page_id ) {
2132
-	if ( geodir_wpml_multilingual_status() ) {
2131
+function get_page_id_geodir_add_listing_page($page_id) {
2132
+	if (geodir_wpml_multilingual_status()) {
2133 2133
 		$post_type = 'post_page';
2134
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2134
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2135 2135
 	}
2136 2136
 
2137 2137
 	return $page_id;
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2146 2146
  */
2147 2147
 function geodir_wpml_multilingual_status() {
2148
-	if ( geodir_is_wpml() ) {
2148
+	if (geodir_is_wpml()) {
2149 2149
 		return true;
2150 2150
 	}
2151 2151
 
@@ -2163,19 +2163,19 @@  discard block
 block discarded – undo
2163 2163
  *
2164 2164
  * @return int Element ID when exists. Else the page id.
2165 2165
  */
2166
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2166
+function geodir_get_wpml_element_id($page_id, $post_type) {
2167 2167
 	global $sitepress;
2168
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2169
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2168
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2169
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2170 2170
 
2171
-		if ( $trid > 0 ) {
2172
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2171
+		if ($trid > 0) {
2172
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2173 2173
 
2174 2174
 			$lang = $sitepress->get_current_language();
2175 2175
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2176 2176
 
2177
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2178
-				$page_id = $translations[ $lang ]->element_id;
2177
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2178
+				$page_id = $translations[$lang]->element_id;
2179 2179
 			}
2180 2180
 		}
2181 2181
 	}
@@ -2192,15 +2192,15 @@  discard block
 block discarded – undo
2192 2192
  */
2193 2193
 function geodir_wpml_check_element_id() {
2194 2194
 	global $sitepress;
2195
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2195
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2196 2196
 		$el_type      = 'post_page';
2197
-		$el_id        = get_option( 'geodir_add_listing_page' );
2197
+		$el_id        = get_option('geodir_add_listing_page');
2198 2198
 		$default_lang = $sitepress->get_default_language();
2199
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2199
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2200 2200
 
2201
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2202
-			if ( ! $el_details->source_language_code ) {
2203
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2201
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2202
+			if (!$el_details->source_language_code) {
2203
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2204 2204
 				$sitepress->icl_translations_cache->clear();
2205 2205
 			}
2206 2206
 		}
@@ -2220,44 +2220,44 @@  discard block
 block discarded – undo
2220 2220
  *
2221 2221
  * @return string Orderby SQL.
2222 2222
  */
2223
-function geodir_widget_listings_get_order( $query_args ) {
2223
+function geodir_widget_listings_get_order($query_args) {
2224 2224
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2225 2225
 
2226 2226
 	$query_args = $gd_query_args_widgets;
2227
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2228
-		return $wpdb->posts . ".post_date DESC, ";
2227
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2228
+		return $wpdb->posts.".post_date DESC, ";
2229 2229
 	}
2230 2230
 
2231
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2232
-	$table     = $plugin_prefix . $post_type . '_detail';
2231
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2232
+	$table     = $plugin_prefix.$post_type.'_detail';
2233 2233
 
2234
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2234
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2235 2235
 
2236
-	switch ( $sort_by ) {
2236
+	switch ($sort_by) {
2237 2237
 		case 'latest':
2238 2238
 		case 'newest':
2239
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2239
+			$orderby = $wpdb->posts.".post_date DESC, ";
2240 2240
 			break;
2241 2241
 		case 'featured':
2242
-			$orderby = $table . ".is_featured ASC, ". $wpdb->posts . ".post_date DESC, ";
2242
+			$orderby = $table.".is_featured ASC, ".$wpdb->posts.".post_date DESC, ";
2243 2243
 			break;
2244 2244
 		case 'az':
2245
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2245
+			$orderby = $wpdb->posts.".post_title ASC, ";
2246 2246
 			break;
2247 2247
 		case 'high_review':
2248
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2248
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2249 2249
 			break;
2250 2250
 		case 'high_rating':
2251
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2251
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2252 2252
 			break;
2253 2253
 		case 'random':
2254 2254
 			$orderby = "RAND(), ";
2255 2255
 			break;
2256 2256
 		default:
2257
-			if ( $custom_orderby = geodir_prepare_custom_sorting( $sort_by, $table ) ) {
2258
-				$orderby = $custom_orderby . ", ";
2257
+			if ($custom_orderby = geodir_prepare_custom_sorting($sort_by, $table)) {
2258
+				$orderby = $custom_orderby.", ";
2259 2259
 			} else {
2260
-				$orderby = $wpdb->posts . ".post_title ASC, ";
2260
+				$orderby = $wpdb->posts.".post_title ASC, ";
2261 2261
 			}
2262 2262
 			break;
2263 2263
 	}
@@ -2282,16 +2282,16 @@  discard block
 block discarded – undo
2282 2282
  *
2283 2283
  * @return mixed Result object.
2284 2284
  */
2285
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2285
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2286 2286
 	global $wpdb, $plugin_prefix, $table_prefix;
2287 2287
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2288 2288
 	$gd_query_args_widgets            = $query_args;
2289 2289
 
2290
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2291
-	$table     = $plugin_prefix . $post_type . '_detail';
2292
-	$supports_wpml = geodir_wpml_is_post_type_translated( $post_type );
2290
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2291
+	$table     = $plugin_prefix.$post_type.'_detail';
2292
+	$supports_wpml = geodir_wpml_is_post_type_translated($post_type);
2293 2293
 
2294
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2294
+	$fields = $wpdb->posts.".*, ".$table.".*";
2295 2295
 	/**
2296 2296
 	 * Filter widget listing fields string part that is being used for query.
2297 2297
 	 *
@@ -2301,17 +2301,17 @@  discard block
 block discarded – undo
2301 2301
 	 * @param string $table     Table name.
2302 2302
 	 * @param string $post_type Post type.
2303 2303
 	 */
2304
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2304
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2305 2305
 
2306
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2306
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2307 2307
 
2308 2308
 	########### WPML ###########
2309 2309
 
2310
-	if ( $supports_wpml ) {
2310
+	if ($supports_wpml) {
2311 2311
 		global $sitepress;
2312 2312
 		$lang_code = ICL_LANGUAGE_CODE;
2313
-		if ( $lang_code ) {
2314
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2313
+		if ($lang_code) {
2314
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2315 2315
 		}
2316 2316
 	}
2317 2317
 
@@ -2325,15 +2325,15 @@  discard block
 block discarded – undo
2325 2325
 	 * @param string $join      Join clause string.
2326 2326
 	 * @param string $post_type Post type.
2327 2327
 	 */
2328
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2328
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2329 2329
 
2330
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2330
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2331 2331
 
2332
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2332
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2333 2333
 
2334 2334
 	########### WPML ###########
2335
-	if ( $supports_wpml ) {
2336
-		if ( $lang_code ) {
2335
+	if ($supports_wpml) {
2336
+		if ($lang_code) {
2337 2337
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2338 2338
 		}
2339 2339
 	}
@@ -2346,8 +2346,8 @@  discard block
 block discarded – undo
2346 2346
 	 * @param string $where     Where clause string.
2347 2347
 	 * @param string $post_type Post type.
2348 2348
 	 */
2349
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2350
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2349
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2350
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2351 2351
 
2352 2352
 	$groupby = " GROUP BY $wpdb->posts.ID "; //@todo is this needed? faster without
2353 2353
 	/**
@@ -2358,15 +2358,15 @@  discard block
 block discarded – undo
2358 2358
 	 * @param string $groupby   Group by clause string.
2359 2359
 	 * @param string $post_type Post type.
2360 2360
 	 */
2361
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2361
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2362 2362
 
2363
-	if ( $count_only ) {
2364
-		$sql  = "SELECT COUNT(DISTINCT " . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2365
-			" . $join . "
2363
+	if ($count_only) {
2364
+		$sql  = "SELECT COUNT(DISTINCT ".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2365
+			" . $join."
2366 2366
 			" . $where;
2367
-		$rows = (int) $wpdb->get_var( $sql );
2367
+		$rows = (int) $wpdb->get_var($sql);
2368 2368
 	} else {
2369
-		$orderby = geodir_widget_listings_get_order( $query_args );
2369
+		$orderby = geodir_widget_listings_get_order($query_args);
2370 2370
 		/**
2371 2371
 		 * Filter widget listing orderby clause string part that is being used for query.
2372 2372
 		 *
@@ -2376,33 +2376,33 @@  discard block
 block discarded – undo
2376 2376
 		 * @param string $table     Table name.
2377 2377
 		 * @param string $post_type Post type.
2378 2378
 		 */
2379
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2379
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2380 2380
 		
2381 2381
 		$second_orderby = array();
2382
-		if ( strpos( $orderby, strtolower( $table . ".is_featured" )  ) === false ) {
2383
-			$second_orderby[] = $table . ".is_featured ASC";
2382
+		if (strpos($orderby, strtolower($table.".is_featured")) === false) {
2383
+			$second_orderby[] = $table.".is_featured ASC";
2384 2384
 		}
2385 2385
 		
2386
-		if ( strpos( $orderby, strtolower( $wpdb->posts . ".post_date" )  ) === false ) {
2387
-			$second_orderby[] = $wpdb->posts . ".post_date DESC";
2386
+		if (strpos($orderby, strtolower($wpdb->posts.".post_date")) === false) {
2387
+			$second_orderby[] = $wpdb->posts.".post_date DESC";
2388 2388
 		}
2389 2389
 		
2390
-		if ( strpos( $orderby, strtolower( $wpdb->posts . ".post_title" )  ) === false ) {
2391
-			$second_orderby[] = $wpdb->posts . ".post_title ASC";
2390
+		if (strpos($orderby, strtolower($wpdb->posts.".post_title")) === false) {
2391
+			$second_orderby[] = $wpdb->posts.".post_title ASC";
2392 2392
 		}
2393 2393
 		
2394
-		if ( !empty( $second_orderby ) ) {
2395
-			$orderby .= implode( ', ', $second_orderby );
2394
+		if (!empty($second_orderby)) {
2395
+			$orderby .= implode(', ', $second_orderby);
2396 2396
 		}
2397 2397
 		
2398
-		if ( !empty( $orderby ) ) {
2399
-			$orderby = trim( $orderby );
2400
-			$orderby = rtrim( $orderby, "," );
2398
+		if (!empty($orderby)) {
2399
+			$orderby = trim($orderby);
2400
+			$orderby = rtrim($orderby, ",");
2401 2401
 		}
2402 2402
 		
2403
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2403
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2404 2404
 
2405
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2405
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2406 2406
 		/**
2407 2407
 		 * Filter widget listing limit that is being used for query.
2408 2408
 		 *
@@ -2411,27 +2411,27 @@  discard block
 block discarded – undo
2411 2411
 		 * @param int $limit        Query results limit.
2412 2412
 		 * @param string $post_type Post type.
2413 2413
 		 */
2414
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2414
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2415 2415
 
2416
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2417
-		if ( ! $page ) {
2416
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2417
+		if (!$page) {
2418 2418
 			$page = 1;
2419 2419
 		}
2420 2420
 
2421
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2421
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2422 2422
 
2423 2423
 		//@todo removed SQL_CALC_FOUND_ROWS from below as don't think it is needed and query is faster without
2424
-		$sql  = "SELECT " . $fields . " FROM " . $wpdb->posts . "
2425
-			" . $join . "
2426
-			" . $where . "
2427
-			" . $groupby . "
2428
-			" . $orderby . "
2424
+		$sql = "SELECT ".$fields." FROM ".$wpdb->posts."
2425
+			" . $join."
2426
+			" . $where."
2427
+			" . $groupby."
2428
+			" . $orderby."
2429 2429
 			" . $limit;
2430
-		$rows = $wpdb->get_results( $sql );
2430
+		$rows = $wpdb->get_results($sql);
2431 2431
 	}
2432 2432
 
2433
-	unset( $GLOBALS['gd_query_args_widgets'] );
2434
-	unset( $gd_query_args_widgets );
2433
+	unset($GLOBALS['gd_query_args_widgets']);
2434
+	unset($gd_query_args_widgets);
2435 2435
 
2436 2436
 	return $rows;
2437 2437
 }
@@ -2448,11 +2448,11 @@  discard block
 block discarded – undo
2448 2448
  *
2449 2449
  * @return string Modified fields SQL.
2450 2450
  */
2451
-function geodir_function_widget_listings_fields( $fields ) {
2451
+function geodir_function_widget_listings_fields($fields) {
2452 2452
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2453 2453
 
2454 2454
 	$query_args = $gd_query_args_widgets;
2455
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2455
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2456 2456
 		return $fields;
2457 2457
 	}
2458 2458
 
@@ -2471,24 +2471,24 @@  discard block
 block discarded – undo
2471 2471
  *
2472 2472
  * @return string Modified join clause SQL.
2473 2473
  */
2474
-function geodir_function_widget_listings_join( $join ) {
2474
+function geodir_function_widget_listings_join($join) {
2475 2475
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2476 2476
 
2477 2477
 	$query_args = $gd_query_args_widgets;
2478
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2478
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2479 2479
 		return $join;
2480 2480
 	}
2481 2481
 
2482
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2483
-	$table     = $plugin_prefix . $post_type . '_detail';
2482
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2483
+	$table     = $plugin_prefix.$post_type.'_detail';
2484 2484
 
2485
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2486
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2485
+	if (!empty($query_args['with_pics_only'])) {
2486
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2487 2487
 	}
2488 2488
 
2489
-	if ( ! empty( $query_args['tax_query'] ) ) {
2490
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2491
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2489
+	if (!empty($query_args['tax_query'])) {
2490
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2491
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2492 2492
 			$join .= $tax_queries['join'];
2493 2493
 		}
2494 2494
 	}
@@ -2509,60 +2509,60 @@  discard block
 block discarded – undo
2509 2509
  *
2510 2510
  * @return string Modified where clause SQL.
2511 2511
  */
2512
-function geodir_function_widget_listings_where( $where ) {
2512
+function geodir_function_widget_listings_where($where) {
2513 2513
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2514 2514
 
2515 2515
 	$query_args = $gd_query_args_widgets;
2516
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2516
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2517 2517
 		return $where;
2518 2518
 	}
2519
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2520
-	$table     = $plugin_prefix . $post_type . '_detail';
2519
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2520
+	$table     = $plugin_prefix.$post_type.'_detail';
2521 2521
 
2522
-	if ( ! empty( $query_args ) ) {
2523
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2524
-			$where = geodir_default_location_where( $where, $table );
2522
+	if (!empty($query_args)) {
2523
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2524
+			$where = geodir_default_location_where($where, $table);
2525 2525
 		}
2526 2526
 
2527
-		if ( ! empty( $query_args['post_author'] ) ) {
2528
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2527
+		if (!empty($query_args['post_author'])) {
2528
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2529 2529
 		}
2530 2530
 
2531
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2532
-			$where .= " AND " . $table . ".is_featured = '1'";
2531
+		if (!empty($query_args['show_featured_only'])) {
2532
+			$where .= " AND ".$table.".is_featured = '1'";
2533 2533
 		}
2534 2534
 
2535
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2536
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2535
+		if (!empty($query_args['show_special_only'])) {
2536
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2537 2537
 		}
2538 2538
 
2539
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2540
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2539
+		if (!empty($query_args['with_pics_only'])) {
2540
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2541 2541
 		}
2542 2542
 
2543
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2544
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2543
+		if (!empty($query_args['featured_image_only'])) {
2544
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2545 2545
 		}
2546 2546
 
2547
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2548
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2547
+		if (!empty($query_args['with_videos_only'])) {
2548
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2549 2549
 		}
2550 2550
         
2551
-		if ( ! empty( $query_args['show_favorites_only'] ) ) {
2551
+		if (!empty($query_args['show_favorites_only'])) {
2552 2552
 			$user_favorites = '-1';
2553 2553
 			
2554
-			if ( !empty( $query_args['favorites_by_user'] ) ) {
2555
-				$user_favorites = get_user_meta( (int)$query_args['favorites_by_user'], 'gd_user_favourite_post', true );
2554
+			if (!empty($query_args['favorites_by_user'])) {
2555
+				$user_favorites = get_user_meta((int) $query_args['favorites_by_user'], 'gd_user_favourite_post', true);
2556 2556
 				$user_favorites = !empty($user_favorites) && is_array($user_favorites) ? implode("','", $user_favorites) : '-1';
2557 2557
 			}
2558 2558
 			
2559
-			$where .= " AND `" . $wpdb->posts . "`.`ID` IN('" . $user_favorites . "')";
2559
+			$where .= " AND `".$wpdb->posts."`.`ID` IN('".$user_favorites."')";
2560 2560
 		}
2561 2561
 
2562
-		if ( ! empty( $query_args['tax_query'] ) ) {
2563
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2562
+		if (!empty($query_args['tax_query'])) {
2563
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2564 2564
 
2565
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2565
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2566 2566
 				$where .= $tax_queries['where'];
2567 2567
 			}
2568 2568
 		}
@@ -2583,11 +2583,11 @@  discard block
 block discarded – undo
2583 2583
  *
2584 2584
  * @return string Modified orderby clause SQL.
2585 2585
  */
2586
-function geodir_function_widget_listings_orderby( $orderby ) {
2586
+function geodir_function_widget_listings_orderby($orderby) {
2587 2587
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2588 2588
 
2589 2589
 	$query_args = $gd_query_args_widgets;
2590
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2590
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2591 2591
 		return $orderby;
2592 2592
 	}
2593 2593
 
@@ -2606,15 +2606,15 @@  discard block
 block discarded – undo
2606 2606
  *
2607 2607
  * @return int Query limit.
2608 2608
  */
2609
-function geodir_function_widget_listings_limit( $limit ) {
2609
+function geodir_function_widget_listings_limit($limit) {
2610 2610
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2611 2611
 
2612 2612
 	$query_args = $gd_query_args_widgets;
2613
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2613
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2614 2614
 		return $limit;
2615 2615
 	}
2616 2616
 
2617
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2617
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2618 2618
 		$limit = (int) $query_args['posts_per_page'];
2619 2619
 	}
2620 2620
 
@@ -2632,12 +2632,12 @@  discard block
 block discarded – undo
2632 2632
  *
2633 2633
  * @return int Large size width.
2634 2634
  */
2635
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2636
-	$large_size_w = get_option( 'large_size_w' );
2635
+function geodir_media_image_large_width($default = 800, $params = '') {
2636
+	$large_size_w = get_option('large_size_w');
2637 2637
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2638
-	$large_size_w = absint( $large_size_w );
2638
+	$large_size_w = absint($large_size_w);
2639 2639
 
2640
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2640
+	if (!get_option('geodir_use_wp_media_large_size')) {
2641 2641
 		$large_size_w = 800;
2642 2642
 	}
2643 2643
 
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 	 * @param int $default         Default width.
2651 2651
 	 * @param string|array $params Image parameters.
2652 2652
 	 */
2653
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2653
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2654 2654
 
2655 2655
 	return $large_size_w;
2656 2656
 }
@@ -2666,12 +2666,12 @@  discard block
 block discarded – undo
2666 2666
  *
2667 2667
  * @return int Large size height.
2668 2668
  */
2669
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2670
-	$large_size_h = get_option( 'large_size_h' );
2669
+function geodir_media_image_large_height($default = 800, $params = '') {
2670
+	$large_size_h = get_option('large_size_h');
2671 2671
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2672
-	$large_size_h = absint( $large_size_h );
2672
+	$large_size_h = absint($large_size_h);
2673 2673
 
2674
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2674
+	if (!get_option('geodir_use_wp_media_large_size')) {
2675 2675
 		$large_size_h = 800;
2676 2676
 	}
2677 2677
 
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
 	 * @param int $default         Default height.
2685 2685
 	 * @param string|array $params Image parameters.
2686 2686
 	 */
2687
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2687
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2688 2688
 
2689 2689
 	return $large_size_h;
2690 2690
 }
@@ -2701,8 +2701,8 @@  discard block
 block discarded – undo
2701 2701
  *
2702 2702
  * @return string Sanitized name.
2703 2703
  */
2704
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2705
-	if ( $name == '' ) {
2704
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2705
+	if ($name == '') {
2706 2706
 		return null;
2707 2707
 	}
2708 2708
 
@@ -2711,13 +2711,13 @@  discard block
 block discarded – undo
2711 2711
 	$type = $type == 'gd_city' ? 'city' : $type;
2712 2712
 
2713 2713
 	$return = $name;
2714
-	if ( function_exists( 'get_actual_location_name' ) ) {
2715
-		$return = get_actual_location_name( $type, $name, $translate );
2714
+	if (function_exists('get_actual_location_name')) {
2715
+		$return = get_actual_location_name($type, $name, $translate);
2716 2716
 	} else {
2717
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2718
-		$return = preg_replace( '/[_-]/', ' ', $return );
2719
-		$return = geodir_ucwords( $return );
2720
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2717
+		$return = preg_replace('/-(\d+)$/', '', $return);
2718
+		$return = preg_replace('/[_-]/', ' ', $return);
2719
+		$return = geodir_ucwords($return);
2720
+		$return = $translate ? __($return, 'geodirectory') : $return;
2721 2721
 	}
2722 2722
 
2723 2723
 	return $return;
@@ -2735,26 +2735,26 @@  discard block
 block discarded – undo
2735 2735
  *
2736 2736
  * @param int $number Comments number.
2737 2737
  */
2738
-function geodir_comments_number( $number ) {
2738
+function geodir_comments_number($number) {
2739 2739
 	global $post;
2740 2740
 	
2741
-	if ( !empty( $post->post_type ) && geodir_cpt_has_rating_disabled( $post->post_type ) ) {
2741
+	if (!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type)) {
2742 2742
 		$number = get_comments_number();
2743 2743
 		
2744
-		if ( $number > 1 ) {
2745
-			$output = str_replace( '%', number_format_i18n( $number ), __( '% Comments', 'geodirectory' ) );
2746
-		} elseif ( $number == 0 || $number == '' ) {
2747
-			$output = __( 'No Comments', 'geodirectory' );
2744
+		if ($number > 1) {
2745
+			$output = str_replace('%', number_format_i18n($number), __('% Comments', 'geodirectory'));
2746
+		} elseif ($number == 0 || $number == '') {
2747
+			$output = __('No Comments', 'geodirectory');
2748 2748
 		} else { // must be one
2749
-			$output = __( '1 Comment', 'geodirectory' );
2749
+			$output = __('1 Comment', 'geodirectory');
2750 2750
 		}
2751 2751
 	} else {    
2752
-		if ( $number > 1 ) {
2753
-			$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2754
-		} elseif ( $number == 0 || $number == '' ) {
2755
-			$output = __( 'No Reviews', 'geodirectory' );
2752
+		if ($number > 1) {
2753
+			$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2754
+		} elseif ($number == 0 || $number == '') {
2755
+			$output = __('No Reviews', 'geodirectory');
2756 2756
 		} else { // must be one
2757
-			$output = __( '1 Review', 'geodirectory' );
2757
+			$output = __('1 Review', 'geodirectory');
2758 2758
 		}
2759 2759
 	}
2760 2760
 	
@@ -2771,18 +2771,18 @@  discard block
 block discarded – undo
2771 2771
  */
2772 2772
 function is_page_geodir_home() {
2773 2773
 	global $wpdb;
2774
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2775
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2776
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2774
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2775
+	if (function_exists('geodir_location_geo_home_link')) {
2776
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2777 2777
 	}
2778
-	$home_url = home_url( '', 'http' );
2779
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2780
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2778
+	$home_url = home_url('', 'http');
2779
+	if (function_exists('geodir_location_geo_home_link')) {
2780
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2781 2781
 	}
2782
-	$home_url = str_replace( "www.", "", $home_url );
2783
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2782
+	$home_url = str_replace("www.", "", $home_url);
2783
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2784 2784
 		return true;
2785
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2785
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2786 2786
 		return true;
2787 2787
 	} else {
2788 2788
 		return false;
@@ -2802,18 +2802,18 @@  discard block
 block discarded – undo
2802 2802
  *
2803 2803
  * @return string The canonical URL.
2804 2804
  */
2805
-function geodir_wpseo_homepage_canonical( $url ) {
2805
+function geodir_wpseo_homepage_canonical($url) {
2806 2806
 	global $post;
2807 2807
 
2808
-	if ( is_page_geodir_home() ) {
2808
+	if (is_page_geodir_home()) {
2809 2809
 		return home_url();
2810 2810
 	}
2811 2811
 
2812 2812
 	return $url;
2813 2813
 }
2814 2814
 
2815
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2816
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2815
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2816
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2817 2817
 
2818 2818
 /**
2819 2819
  * Add extra fields to google maps script call.
@@ -2826,20 +2826,20 @@  discard block
 block discarded – undo
2826 2826
  *
2827 2827
  * @return string Modified extra string.
2828 2828
  */
2829
-function geodir_googlemap_script_extra_details_page( $extra ) {
2829
+function geodir_googlemap_script_extra_details_page($extra) {
2830 2830
 	global $post;
2831 2831
 	$add_google_places_api = false;
2832
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2832
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2833 2833
 		$add_google_places_api = true;
2834 2834
 	}
2835
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2835
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2836 2836
 		$extra .= "&amp;libraries=places";
2837 2837
 	}
2838 2838
 
2839 2839
 	return $extra;
2840 2840
 }
2841 2841
 
2842
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2842
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2843 2843
 
2844 2844
 
2845 2845
 /**
@@ -2858,119 +2858,119 @@  discard block
 block discarded – undo
2858 2858
  *                                          after_widget.
2859 2859
  * @param array|string $instance            The settings for the particular instance of the widget.
2860 2860
  */
2861
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2861
+function geodir_popular_post_category_output($args = '', $instance = '') {
2862 2862
 	// prints the widget
2863 2863
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2864
-	extract( $args, EXTR_SKIP );
2864
+	extract($args, EXTR_SKIP);
2865 2865
 
2866 2866
 	echo $before_widget;
2867 2867
 
2868 2868
 	/** This filter is documented in geodirectory_widgets.php */
2869
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2869
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2870 2870
 
2871 2871
 	$gd_post_type = geodir_get_current_posttype();
2872 2872
 
2873
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2873
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2874 2874
 	if (!isset($category_restrict)) {
2875 2875
 		$category_restrict = false;
2876 2876
 	}
2877
-	if ( ! empty( $gd_post_type ) ) {
2877
+	if (!empty($gd_post_type)) {
2878 2878
 		$default_post_type = $gd_post_type;
2879
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2879
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2880 2880
 		$default_post_type = $instance['default_post_type'];
2881 2881
 	} else {
2882 2882
 		$all_gd_post_type  = geodir_get_posttypes();
2883
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2883
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2884 2884
 	}
2885
-	$parent_only = !empty( $instance['parent_only'] ) ? true : false;
2885
+	$parent_only = !empty($instance['parent_only']) ? true : false;
2886 2886
 
2887 2887
 	$taxonomy = array();
2888
-	if ( ! empty( $gd_post_type ) ) {
2889
-		$taxonomy[] = $gd_post_type . "category";
2888
+	if (!empty($gd_post_type)) {
2889
+		$taxonomy[] = $gd_post_type."category";
2890 2890
 	} else {
2891
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2891
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2892 2892
 	}
2893 2893
 
2894 2894
 	$taxonomy = apply_filters('geodir_pp_category_taxonomy', $taxonomy);
2895 2895
 
2896
-	$term_args = array( 'taxonomy' => $taxonomy );
2897
-	if ( $parent_only ) {
2896
+	$term_args = array('taxonomy' => $taxonomy);
2897
+	if ($parent_only) {
2898 2898
 		$term_args['parent'] = 0;
2899 2899
 	}
2900 2900
 
2901
-	$terms   = get_terms( $term_args );
2901
+	$terms   = get_terms($term_args);
2902 2902
 	$a_terms = array();
2903 2903
 	$b_terms = array();
2904 2904
 
2905
-	foreach ( $terms as $term ) {
2906
-		if ( $term->count > 0 ) {
2907
-			$a_terms[ $term->taxonomy ][] = $term;
2905
+	foreach ($terms as $term) {
2906
+		if ($term->count > 0) {
2907
+			$a_terms[$term->taxonomy][] = $term;
2908 2908
 		}
2909 2909
 	}
2910 2910
 
2911
-	if ( ! empty( $a_terms ) ) {
2911
+	if (!empty($a_terms)) {
2912 2912
 		// Sort CPT taxonomies in categories widget.
2913
-		if ( !empty( $taxonomy ) && is_array( $taxonomy ) && count( $taxonomy ) > 1 ) {
2913
+		if (!empty($taxonomy) && is_array($taxonomy) && count($taxonomy) > 1) {
2914 2914
 			$gd_post_types = geodir_get_posttypes();
2915 2915
 			$sort_taxonomies = array();
2916 2916
 			
2917
-			foreach ( $gd_post_types as $gd_post_type ) {
2918
-				$taxonomy_name = $gd_post_type . 'category';
2917
+			foreach ($gd_post_types as $gd_post_type) {
2918
+				$taxonomy_name = $gd_post_type.'category';
2919 2919
 				
2920
-				if ( !empty( $a_terms[$taxonomy_name] ) ) {
2920
+				if (!empty($a_terms[$taxonomy_name])) {
2921 2921
 					$sort_taxonomies[$taxonomy_name] = $a_terms[$taxonomy_name];
2922 2922
 				}
2923 2923
 			}
2924
-			$a_terms = !empty( $sort_taxonomies ) ? $sort_taxonomies : $a_terms;
2924
+			$a_terms = !empty($sort_taxonomies) ? $sort_taxonomies : $a_terms;
2925 2925
 		}
2926 2926
 		
2927
-		foreach ( $a_terms as $b_key => $b_val ) {
2928
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2927
+		foreach ($a_terms as $b_key => $b_val) {
2928
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2929 2929
 		}
2930 2930
 
2931
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2931
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2932 2932
 
2933 2933
 		$tax_change_output = '';
2934
-		if ( count( $b_terms ) > 1 ) {
2935
-			$tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2936
-			foreach ( $b_terms as $key => $val ) {
2937
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2938
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2939
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2934
+		if (count($b_terms) > 1) {
2935
+			$tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2936
+			foreach ($b_terms as $key => $val) {
2937
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2938
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2939
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2940 2940
 			}
2941 2941
 			$tax_change_output .= "</select>";
2942 2942
 		}
2943 2943
 
2944
-		if ( ! empty( $b_terms ) ) {
2945
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2946
-			global $cat_count;//make global so we can change via function
2944
+		if (!empty($b_terms)) {
2945
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2946
+			global $cat_count; //make global so we can change via function
2947 2947
 			$cat_count = 0;
2948 2948
 			?>
2949 2949
 			<div class="geodir-category-list-in clearfix">
2950 2950
 				<div class="geodir-cat-list clearfix">
2951 2951
 					<?php
2952
-					echo $before_title . __( $title ) . $after_title;
2952
+					echo $before_title.__($title).$after_title;
2953 2953
 
2954 2954
 					echo $tax_change_output;
2955 2955
 
2956 2956
 					echo '<ul class="geodir-popular-cat-list">';
2957 2957
 
2958
-					geodir_helper_cat_list_output( $terms, $category_limit, $category_restrict);
2958
+					geodir_helper_cat_list_output($terms, $category_limit, $category_restrict);
2959 2959
 
2960 2960
 					echo '</ul>';
2961 2961
 					?>
2962 2962
 				</div>
2963 2963
 				<?php
2964 2964
 				$hide = '';
2965
-				if ( $cat_count < $category_limit ) {
2965
+				if ($cat_count < $category_limit) {
2966 2966
 					$hide = 'style="display:none;"';
2967 2967
 				}
2968 2968
 				echo "<div class='geodir-cat-list-more' $hide >";
2969
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2970
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2969
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2970
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2971 2971
 				echo "</div>";
2972 2972
 				/* add scripts */
2973
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2973
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2974 2974
 				?>
2975 2975
 			</div>
2976 2976
 			<?php
@@ -2990,28 +2990,28 @@  discard block
 block discarded – undo
2990 2990
  * @param int $category_limit               Number of categories to display by default.
2991 2991
  * @param bool $category_restrict           If the cat limit should be hidden or not shown.
2992 2992
  */
2993
-function geodir_helper_cat_list_output( $terms, $category_limit , $category_restrict=false) {
2993
+function geodir_helper_cat_list_output($terms, $category_limit, $category_restrict = false) {
2994 2994
 	global $geodir_post_category_str, $cat_count;
2995 2995
 	$term_icons = geodir_get_term_icon();
2996 2996
 
2997 2997
 	$geodir_post_category_str = array();
2998 2998
 
2999 2999
 
3000
-	foreach ( $terms as $cat ) {
3001
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
3002
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
3000
+	foreach ($terms as $cat) {
3001
+		$post_type     = str_replace("category", "", $cat->taxonomy);
3002
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
3003 3003
 
3004
-		$cat_count ++;
3004
+		$cat_count++;
3005 3005
 
3006
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
3006
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
3007 3007
 
3008
-		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
3009
-		if($category_restrict && $cat_count > $category_limit ){
3008
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
3009
+		if ($category_restrict && $cat_count > $category_limit) {
3010 3010
 			continue;
3011 3011
 		}
3012 3012
 		$total_post = $cat->count;
3013 3013
 
3014
-		$term_link = get_term_link( $cat, $cat->taxonomy );
3014
+		$term_link = get_term_link($cat, $cat->taxonomy);
3015 3015
 		/**
3016 3016
 		 * Filer the category term link.
3017 3017
 		 *
@@ -3021,11 +3021,11 @@  discard block
 block discarded – undo
3021 3021
 		 * @param int $cat          ->term_id The term id.
3022 3022
 		 * @param string $post_type Wordpress post type.
3023 3023
 		 */
3024
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
3024
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
3025 3025
 
3026
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
3027
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
3028
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
3026
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
3027
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
3028
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
3029 3029
 		echo '</a></li>';
3030 3030
 	}
3031 3031
 }
@@ -3040,14 +3040,14 @@  discard block
 block discarded – undo
3040 3040
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3041 3041
  * @param array|string $instance The settings for the particular instance of the widget.
3042 3042
  */
3043
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
3043
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
3044 3044
 	// prints the widget
3045
-	extract( $args, EXTR_SKIP );
3045
+	extract($args, EXTR_SKIP);
3046 3046
 
3047 3047
 	echo $before_widget;
3048 3048
 
3049 3049
 	/** This filter is documented in geodirectory_widgets.php */
3050
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3050
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3051 3051
 	/**
3052 3052
 	 * Filter the widget post type.
3053 3053
 	 *
@@ -3055,7 +3055,7 @@  discard block
 block discarded – undo
3055 3055
 	 *
3056 3056
 	 * @param string $instance ['post_type'] Post type of listing.
3057 3057
 	 */
3058
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3058
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3059 3059
 	/**
3060 3060
 	 * Filter the widget's term.
3061 3061
 	 *
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 	 *
3064 3064
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3065 3065
 	 */
3066
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3066
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3067 3067
 	/**
3068 3068
 	 * Filter widget's "add_location_filter" value.
3069 3069
 	 *
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
 	 *
3072 3072
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3073 3073
 	 */
3074
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3074
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3075 3075
 	/**
3076 3076
 	 * Filter the widget listings limit.
3077 3077
 	 *
@@ -3079,7 +3079,7 @@  discard block
 block discarded – undo
3079 3079
 	 *
3080 3080
 	 * @param string $instance ['post_number'] Number of listings to display.
3081 3081
 	 */
3082
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3082
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3083 3083
 	/**
3084 3084
 	 * Filter the widget listings limit shown at one time.
3085 3085
 	 *
@@ -3087,7 +3087,7 @@  discard block
 block discarded – undo
3087 3087
 	 *
3088 3088
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
3089 3089
 	 */
3090
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
3090
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
3091 3091
 	/**
3092 3092
 	 * Filter the widget slide width.
3093 3093
 	 *
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 	 *
3096 3096
 	 * @param string $instance ['slide_width'] Width of the slides shown.
3097 3097
 	 */
3098
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
3098
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
3099 3099
 	/**
3100 3100
 	 * Filter widget's "show title" value.
3101 3101
 	 *
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
 	 *
3104 3104
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
3105 3105
 	 */
3106
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
3106
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
3107 3107
 	/**
3108 3108
 	 * Filter widget's "slideshow" value.
3109 3109
 	 *
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
 	 *
3112 3112
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
3113 3113
 	 */
3114
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
3114
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
3115 3115
 	/**
3116 3116
 	 * Filter widget's "animationLoop" value.
3117 3117
 	 *
@@ -3119,7 +3119,7 @@  discard block
 block discarded – undo
3119 3119
 	 *
3120 3120
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
3121 3121
 	 */
3122
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
3122
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
3123 3123
 	/**
3124 3124
 	 * Filter widget's "directionNav" value.
3125 3125
 	 *
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
 	 *
3128 3128
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
3129 3129
 	 */
3130
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
3130
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
3131 3131
 	/**
3132 3132
 	 * Filter widget's "slideshowSpeed" value.
3133 3133
 	 *
@@ -3135,7 +3135,7 @@  discard block
 block discarded – undo
3135 3135
 	 *
3136 3136
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
3137 3137
 	 */
3138
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
3138
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
3139 3139
 	/**
3140 3140
 	 * Filter widget's "animationSpeed" value.
3141 3141
 	 *
@@ -3143,7 +3143,7 @@  discard block
 block discarded – undo
3143 3143
 	 *
3144 3144
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3145 3145
 	 */
3146
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3146
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3147 3147
 	/**
3148 3148
 	 * Filter widget's "animation" value.
3149 3149
 	 *
@@ -3151,7 +3151,7 @@  discard block
 block discarded – undo
3151 3151
 	 *
3152 3152
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3153 3153
 	 */
3154
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3154
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3155 3155
 	/**
3156 3156
 	 * Filter widget's "list_sort" type.
3157 3157
 	 *
@@ -3159,10 +3159,10 @@  discard block
 block discarded – undo
3159 3159
 	 *
3160 3160
 	 * @param string $instance ['list_sort'] Listing sort by type.
3161 3161
 	 */
3162
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3163
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3162
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3163
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3164 3164
 
3165
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3165
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3166 3166
 	?>
3167 3167
 		<script type="text/javascript">
3168 3168
 		jQuery(window).load(function () {
@@ -3181,7 +3181,7 @@  discard block
 block discarded – undo
3181 3181
 				itemWidth: 75,
3182 3182
 				itemMargin: 5,
3183 3183
 				asNavFor: '#geodir_widget_slider',
3184
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>,
3184
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>,
3185 3185
 				start: function (slider) {
3186 3186
 					// chrome 53 introduced a bug, so we need to repaint the slider when shown.
3187 3187
 					jQuery('.geodir-slides', jQuery(slider)).removeClass('flexslider-fix-rtl');
@@ -3189,19 +3189,19 @@  discard block
 block discarded – undo
3189 3189
 			});
3190 3190
 			
3191 3191
 			jQuery('#geodir_widget_slider').flexslider({
3192
-				animation: "<?php echo $animation;?>",
3192
+				animation: "<?php echo $animation; ?>",
3193 3193
 				selector: ".geodir-slides > li",
3194 3194
 				namespace: "geodir-",
3195 3195
 				controlNav: true,
3196
-				animationLoop: <?php echo $animationLoop;?>,
3197
-				slideshow: <?php echo $slideshow;?>,
3198
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3199
-				animationSpeed: <?php echo $animationSpeed;?>,
3200
-				directionNav: <?php echo $directionNav;?>,
3201
-				maxItems: <?php echo $max_show;?>,
3196
+				animationLoop: <?php echo $animationLoop; ?>,
3197
+				slideshow: <?php echo $slideshow; ?>,
3198
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3199
+				animationSpeed: <?php echo $animationSpeed; ?>,
3200
+				directionNav: <?php echo $directionNav; ?>,
3201
+				maxItems: <?php echo $max_show; ?>,
3202 3202
 				move: 1,
3203
-				<?php if ( $slide_width ) {
3204
-				echo "itemWidth: " . $slide_width . ",";
3203
+				<?php if ($slide_width) {
3204
+				echo "itemWidth: ".$slide_width.",";
3205 3205
 			}?>
3206 3206
 				sync: "#geodir_widget_carousel",
3207 3207
 				start: function (slider) {
@@ -3212,7 +3212,7 @@  discard block
 block discarded – undo
3212 3212
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3213 3213
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3214 3214
 				},
3215
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3215
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3216 3216
 			});
3217 3217
 		});
3218 3218
 	</script>
@@ -3225,62 +3225,62 @@  discard block
 block discarded – undo
3225 3225
 		'order_by'       => $list_sort
3226 3226
 	);
3227 3227
 
3228
-	if ( $show_featured_only ) {
3228
+	if ($show_featured_only) {
3229 3229
 		$query_args['show_featured_only'] = 1;
3230 3230
 	}
3231 3231
 
3232
-	if ( $category != 0 || $category != '' ) {
3233
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3232
+	if ($category != 0 || $category != '') {
3233
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3234 3234
 		$tax_query         = array(
3235 3235
 			'taxonomy' => $category_taxonomy[0],
3236 3236
 			'field'    => 'id',
3237 3237
 			'terms'    => $category
3238 3238
 		);
3239 3239
 
3240
-		$query_args['tax_query'] = array( $tax_query );
3240
+		$query_args['tax_query'] = array($tax_query);
3241 3241
 	}
3242 3242
 
3243 3243
 	// we want listings with featured image only
3244 3244
 	$query_args['featured_image_only'] = 1;
3245 3245
 
3246
-	if ( $post_type == 'gd_event' ) {
3246
+	if ($post_type == 'gd_event') {
3247 3247
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3248 3248
 	}// show only upcoming events
3249 3249
 
3250
-	$widget_listings = geodir_get_widget_listings( $query_args );
3251
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3252
-		if ( $title ) {
3253
-			echo $before_title . $title . $after_title;
3250
+	$widget_listings = geodir_get_widget_listings($query_args);
3251
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3252
+		if ($title) {
3253
+			echo $before_title.$title.$after_title;
3254 3254
 		}
3255 3255
 
3256 3256
 		global $post;
3257 3257
 
3258
-		$current_post = $post;// keep current post info
3258
+		$current_post = $post; // keep current post info
3259 3259
 
3260 3260
 		$widget_main_slides = '';
3261 3261
 		$nav_slides         = '';
3262 3262
 		$widget_slides      = 0;
3263 3263
 
3264
-		foreach ( $widget_listings as $widget_listing ) {
3264
+		foreach ($widget_listings as $widget_listing) {
3265 3265
 			global $gd_widget_listing_type;
3266 3266
 			$post         = $widget_listing;
3267
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3267
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3268 3268
 
3269
-			if ( ! empty( $widget_image ) ) {
3270
-				if ( $widget_image->height >= 200 ) {
3269
+			if (!empty($widget_image)) {
3270
+				if ($widget_image->height >= 200) {
3271 3271
 					$widget_spacer_height = 0;
3272 3272
 				} else {
3273
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3273
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3274 3274
 				}
3275 3275
 
3276
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3276
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3277 3277
 
3278 3278
 				$title = '';
3279
-				if ( $show_title ) {
3280
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3279
+				if ($show_title) {
3280
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3281 3281
 					$post_id        = $post->ID;
3282
-					$post_permalink = get_permalink( $post->ID );
3283
-					$post_title     = get_the_title( $post->ID );
3282
+					$post_permalink = get_permalink($post->ID);
3283
+					$post_title     = get_the_title($post->ID);
3284 3284
 					/**
3285 3285
 					 * Filter the listing slider widget title.
3286 3286
 					 *
@@ -3291,12 +3291,12 @@  discard block
 block discarded – undo
3291 3291
 					 * @param string $post_permalink The post permalink url.
3292 3292
 					 * @param string $post_title     The post title text.
3293 3293
 					 */
3294
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3294
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3295 3295
 				}
3296 3296
 
3297
-				$widget_main_slides .= $title . '<a href="' . get_permalink( $post->ID ) . '"><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></a></li>';
3298
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3299
-				$widget_slides ++;
3297
+				$widget_main_slides .= $title.'<a href="'.get_permalink($post->ID).'"><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></a></li>';
3298
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3299
+				$widget_slides++;
3300 3300
 			}
3301 3301
 		}
3302 3302
 		?>
@@ -3305,7 +3305,7 @@  discard block
 block discarded – undo
3305 3305
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3306 3306
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3307 3307
 			</div>
3308
-			<?php if ( $widget_slides > 1 ) { ?>
3308
+			<?php if ($widget_slides > 1) { ?>
3309 3309
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3310 3310
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3311 3311
 				</div>
@@ -3313,7 +3313,7 @@  discard block
 block discarded – undo
3313 3313
 		</div>
3314 3314
 		<?php
3315 3315
 		$GLOBALS['post'] = $current_post;
3316
-		setup_postdata( $current_post );
3316
+		setup_postdata($current_post);
3317 3317
 	}
3318 3318
 	echo $after_widget;
3319 3319
 }
@@ -3329,50 +3329,50 @@  discard block
 block discarded – undo
3329 3329
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3330 3330
  * @param array|string $instance The settings for the particular instance of the widget.
3331 3331
  */
3332
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3332
+function geodir_loginwidget_output($args = '', $instance = '') {
3333 3333
 	//print_r($args);
3334 3334
 	//print_r($instance);
3335 3335
 	// prints the widget
3336
-	extract( $args, EXTR_SKIP );
3336
+	extract($args, EXTR_SKIP);
3337 3337
 
3338 3338
 	/** This filter is documented in geodirectory_widgets.php */
3339
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) );
3339
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
3340 3340
 
3341 3341
 	echo $before_widget;
3342
-	echo $before_title . $title . $after_title;
3342
+	echo $before_title.$title.$after_title;
3343 3343
 
3344 3344
 //	global $gd_session;
3345 3345
 //	print_r($gd_session);
3346 3346
 //	print_r($_SESSION);
3347 3347
 
3348
-	if ( is_user_logged_in() ) {
3348
+	if (is_user_logged_in()) {
3349 3349
 		global $current_user;
3350 3350
 
3351
-		$author_link = get_author_posts_url( $current_user->data->ID );
3352
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3351
+		$author_link = get_author_posts_url($current_user->data->ID);
3352
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3353 3353
 
3354 3354
 		echo '<ul class="geodir-loginbox-list">';
3355 3355
 		ob_start();
3356 3356
 		?>
3357 3357
 		<li><a class="signin"
3358
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3358
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3359 3359
 		<?php
3360
-		$post_types                           = geodir_get_posttypes( 'object' );
3361
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3362
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3360
+		$post_types                           = geodir_get_posttypes('object');
3361
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3362
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3363 3363
 
3364
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3364
+		if (!empty($show_add_listing_post_types_main_nav)) {
3365 3365
 			$addlisting_links = '';
3366
-			foreach ( $post_types as $key => $postobj ) {
3366
+			foreach ($post_types as $key => $postobj) {
3367 3367
 
3368
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3368
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3369 3369
 
3370
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3370
+					if ($add_link = geodir_get_addlisting_link($key)) {
3371 3371
 
3372 3372
 						$name = $postobj->labels->name;
3373 3373
 
3374 3374
 						$selected = '';
3375
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3375
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3376 3376
 							$selected = 'selected="selected"';
3377 3377
 						}
3378 3378
 
@@ -3385,23 +3385,23 @@  discard block
 block discarded – undo
3385 3385
 						 * @param string $key       Add listing array key.
3386 3386
 						 * @param int $current_user ->ID Current user ID.
3387 3387
 						 */
3388
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3389
-						$name = apply_filters( 'geodir_dashboard_label_add_listing', $name, $key, $current_user->ID );
3388
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3389
+						$name = apply_filters('geodir_dashboard_label_add_listing', $name, $key, $current_user->ID);
3390 3390
 
3391
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( geodir_utf8_ucfirst( $name ), 'geodirectory' ) . '</option>';
3391
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>';
3392 3392
 
3393 3393
 					}
3394 3394
 				}
3395 3395
 
3396 3396
 			}
3397 3397
 
3398
-			if ( $addlisting_links != '' ) { ?>
3398
+			if ($addlisting_links != '') { ?>
3399 3399
 
3400 3400
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3401 3401
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3402
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3402
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3403 3403
 						<option value="" disabled="disabled" selected="selected"
3404
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3404
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3405 3405
 						<?php echo $addlisting_links; ?>
3406 3406
 					</select></li> <?php
3407 3407
 
@@ -3409,24 +3409,24 @@  discard block
 block discarded – undo
3409 3409
 
3410 3410
 		}
3411 3411
 		// My Favourites in Dashboard
3412
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3412
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3413 3413
 		$user_favourite                    = geodir_user_favourite_listing_count();
3414 3414
 
3415
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3415
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3416 3416
 			$favourite_links = '';
3417 3417
 
3418
-			foreach ( $post_types as $key => $postobj ) {
3419
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3418
+			foreach ($post_types as $key => $postobj) {
3419
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3420 3420
 					$name           = $postobj->labels->name;
3421 3421
 					$fav_author_link = apply_filters('gd_dash_fav_author_link', $author_link, $current_user->data->ID);
3422
-					$post_type_link = geodir_getlink( $fav_author_link, array(
3422
+					$post_type_link = geodir_getlink($fav_author_link, array(
3423 3423
 						'stype' => $key,
3424 3424
 						'list'  => 'favourite'
3425
-					), false );
3425
+					), false);
3426 3426
 
3427 3427
 					$selected = '';
3428 3428
 
3429
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3429
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3430 3430
 						$selected = 'selected="selected"';
3431 3431
 					}
3432 3432
 					/**
@@ -3438,20 +3438,20 @@  discard block
 block discarded – undo
3438 3438
 					 * @param string $key            Favorite listing array key.
3439 3439
 					 * @param int $current_user      ->ID Current user ID.
3440 3440
 					 */
3441
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3441
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3442 3442
 
3443
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( geodir_utf8_ucfirst( $name ), 'geodirectory' ) . '</option>';
3443
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>';
3444 3444
 				}
3445 3445
 			}
3446 3446
 
3447
-			if ( $favourite_links != '' ) {
3447
+			if ($favourite_links != '') {
3448 3448
 				?>
3449 3449
 				<li>
3450 3450
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3451 3451
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3452
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3452
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3453 3453
 						<option value="" disabled="disabled" selected="selected"
3454
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3454
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3455 3455
 						<?php echo $favourite_links; ?>
3456 3456
 					</select>
3457 3457
 				</li>
@@ -3460,20 +3460,20 @@  discard block
 block discarded – undo
3460 3460
 		}
3461 3461
 
3462 3462
 
3463
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3463
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3464 3464
 		$user_listing                     = geodir_user_post_listing_count();
3465 3465
 
3466
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3466
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3467 3467
 			$listing_links = '';
3468 3468
 
3469
-			foreach ( $post_types as $key => $postobj ) {
3470
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3469
+			foreach ($post_types as $key => $postobj) {
3470
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3471 3471
 					$name         = $postobj->labels->name;
3472 3472
 					$listing_author_link = apply_filters('gd_dash_listing_author_link', $author_link, $current_user->data->ID);
3473
-					$listing_link = geodir_getlink( $listing_author_link, array( 'stype' => $key ), false );
3473
+					$listing_link = geodir_getlink($listing_author_link, array('stype' => $key), false);
3474 3474
 
3475 3475
 					$selected = '';
3476
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3476
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3477 3477
 						$selected = 'selected="selected"';
3478 3478
 					}
3479 3479
 
@@ -3486,20 +3486,20 @@  discard block
 block discarded – undo
3486 3486
 					 * @param string $key          My listing array key.
3487 3487
 					 * @param int $current_user    ->ID Current user ID.
3488 3488
 					 */
3489
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3489
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3490 3490
 
3491
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( geodir_utf8_ucfirst( $name ), 'geodirectory' ) . '</option>';
3491
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>';
3492 3492
 				}
3493 3493
 			}
3494 3494
 
3495
-			if ( $listing_links != '' ) {
3495
+			if ($listing_links != '') {
3496 3496
 				?>
3497 3497
 				<li>
3498 3498
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3499 3499
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3500
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3500
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3501 3501
 						<option value="" disabled="disabled" selected="selected"
3502
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3502
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3503 3503
 						<?php echo $listing_links; ?>
3504 3504
 					</select>
3505 3505
 				</li>
@@ -3515,7 +3515,7 @@  discard block
 block discarded – undo
3515 3515
 		 *
3516 3516
 		 * @param string $dashboard_link Dashboard links HTML.
3517 3517
 		 */
3518
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3518
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3519 3519
 		echo '</ul>';
3520 3520
 
3521 3521
 		/**
@@ -3523,7 +3523,7 @@  discard block
 block discarded – undo
3523 3523
 		 *
3524 3524
 		 * @since 1.6.6
3525 3525
 		 */
3526
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3526
+		do_action('geodir_after_loginwidget_form_logged_in');
3527 3527
 
3528 3528
 
3529 3529
 	} else {
@@ -3538,18 +3538,18 @@  discard block
 block discarded – undo
3538 3538
 		<form name="loginform" class="loginform1"
3539 3539
 		      action="<?php echo geodir_login_url(); ?>"
3540 3540
 		      method="post">
3541
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3541
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3542 3542
 			                                    type="text" class="textfield user_login1"/> <span
3543 3543
 					class="user_loginInfo"></span></div>
3544
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3544
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3545 3545
 			                                    name="pwd" type="password"
3546 3546
 			                                    class="textfield user_pass1 input-text"/><span
3547 3547
 					class="user_passInfo"></span></div>
3548 3548
 
3549
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3549
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3550 3550
 			<input type="hidden" name="testcookie" value="1"/>
3551 3551
 
3552
-				<?php do_action( 'login_form' ); ?>
3552
+				<?php do_action('login_form'); ?>
3553 3553
 
3554 3554
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3555 3555
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3561,11 +3561,11 @@  discard block
 block discarded – undo
3561 3561
 					 *
3562 3562
 					 * @since 1.0.0
3563 3563
 					 */
3564
-					$is_enable_signup = get_option( 'users_can_register' );
3564
+					$is_enable_signup = get_option('users_can_register');
3565 3565
 					
3566
-					if ( $is_enable_signup ) {
3566
+					if ($is_enable_signup) {
3567 3567
 					?>
3568
-						<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3568
+						<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3569 3569
 						   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3570 3570
 
3571 3571
 					<?php
@@ -3576,7 +3576,7 @@  discard block
 block discarded – undo
3576 3576
 					 * @since 1.0.0
3577 3577
 					 */
3578 3578
 					?>
3579
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3579
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3580 3580
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3581 3581
 		</form>
3582 3582
 		<?php
@@ -3585,7 +3585,7 @@  discard block
 block discarded – undo
3585 3585
 		 *
3586 3586
 		 * @since 1.6.6
3587 3587
 		 */
3588
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3588
+		do_action('geodir_after_loginwidget_form_logged_out');
3589 3589
 	}
3590 3590
 
3591 3591
 	echo $after_widget;
@@ -3607,14 +3607,14 @@  discard block
 block discarded – undo
3607 3607
  *                                         after_widget.
3608 3608
  * @param array|string $instance           The settings for the particular instance of the widget.
3609 3609
  */
3610
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3610
+function geodir_popular_postview_output($args = '', $instance = '') {
3611 3611
 	global $gd_session;
3612 3612
 
3613 3613
 	// prints the widget
3614
-	extract( $args, EXTR_SKIP );
3614
+	extract($args, EXTR_SKIP);
3615 3615
 
3616 3616
 	/** This filter is documented in geodirectory_widgets.php */
3617
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3617
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3618 3618
 	/**
3619 3619
 	 * Filter the widget post type.
3620 3620
 	 *
@@ -3622,7 +3622,7 @@  discard block
 block discarded – undo
3622 3622
 	 *
3623 3623
 	 * @param string $instance ['post_type'] Post type of listing.
3624 3624
 	 */
3625
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3625
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3626 3626
 	/**
3627 3627
 	 * Filter the widget's term.
3628 3628
 	 *
@@ -3630,7 +3630,7 @@  discard block
 block discarded – undo
3630 3630
 	 *
3631 3631
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3632 3632
 	 */
3633
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3633
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3634 3634
 	/**
3635 3635
 	 * Filter the widget listings limit.
3636 3636
 	 *
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
 	 *
3639 3639
 	 * @param string $instance ['post_number'] Number of listings to display.
3640 3640
 	 */
3641
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3641
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3642 3642
 	/**
3643 3643
 	 * Filter widget's "layout" type.
3644 3644
 	 *
@@ -3646,7 +3646,7 @@  discard block
 block discarded – undo
3646 3646
 	 *
3647 3647
 	 * @param string $instance ['layout'] Widget layout type.
3648 3648
 	 */
3649
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3649
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3650 3650
 	/**
3651 3651
 	 * Filter widget's "add_location_filter" value.
3652 3652
 	 *
@@ -3654,7 +3654,7 @@  discard block
 block discarded – undo
3654 3654
 	 *
3655 3655
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3656 3656
 	 */
3657
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3657
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3658 3658
 	/**
3659 3659
 	 * Filter widget's listing width.
3660 3660
 	 *
@@ -3662,7 +3662,7 @@  discard block
 block discarded – undo
3662 3662
 	 *
3663 3663
 	 * @param string $instance ['listing_width'] Listing width.
3664 3664
 	 */
3665
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3665
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3666 3666
 	/**
3667 3667
 	 * Filter widget's "list_sort" type.
3668 3668
 	 *
@@ -3670,36 +3670,36 @@  discard block
 block discarded – undo
3670 3670
 	 *
3671 3671
 	 * @param string $instance ['list_sort'] Listing sort by type.
3672 3672
 	 */
3673
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3674
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3673
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3674
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3675 3675
 
3676 3676
 	// set post type to current viewing post type
3677
-	if ( $use_viewing_post_type ) {
3677
+	if ($use_viewing_post_type) {
3678 3678
 		$current_post_type = geodir_get_current_posttype();
3679
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3679
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3680 3680
 			$post_type = $current_post_type;
3681 3681
 			$category  = array(); // old post type category will not work for current changed post type
3682 3682
 		}
3683 3683
 	}
3684 3684
 	// replace widget title dynamically
3685
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3686
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3685
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3686
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3687 3687
 
3688
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3689
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3688
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3689
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3690 3690
     
3691 3691
 	$categories = $category;
3692
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3693
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3692
+	if (!empty($category) && $category[0] != '0') {
3693
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3694 3694
 		
3695 3695
 		######### WPML #########
3696
-		if ( geodir_wpml_is_taxonomy_translated( $category_taxonomy[0] ) ) {
3697
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3696
+		if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) {
3697
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3698 3698
 		}
3699 3699
 		######### WPML #########
3700 3700
 	}
3701 3701
 
3702
-	if ( isset( $instance['character_count'] ) ) {
3702
+	if (isset($instance['character_count'])) {
3703 3703
 		/**
3704 3704
 		 * Filter the widget's excerpt character count.
3705 3705
 		 *
@@ -3707,37 +3707,37 @@  discard block
 block discarded – undo
3707 3707
 		 *
3708 3708
 		 * @param int $instance ['character_count'] Excerpt character count.
3709 3709
 		 */
3710
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3710
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3711 3711
 	} else {
3712 3712
 		$character_count = '';
3713 3713
 	}
3714 3714
 
3715
-	if ( empty( $title ) || $title == 'All' ) {
3716
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3715
+	if (empty($title) || $title == 'All') {
3716
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3717 3717
 	}
3718 3718
 
3719 3719
 	$location_url = array();
3720
-	$city         = get_query_var( 'gd_city' );
3721
-	if ( ! empty( $city ) ) {
3722
-		$country = get_query_var( 'gd_country' );
3723
-		$region  = get_query_var( 'gd_region' );
3720
+	$city         = get_query_var('gd_city');
3721
+	if (!empty($city)) {
3722
+		$country = get_query_var('gd_country');
3723
+		$region  = get_query_var('gd_region');
3724 3724
 
3725
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3725
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3726 3726
 
3727
-		if ( $geodir_show_location_url == 'all' ) {
3728
-			if ( $country != '' ) {
3727
+		if ($geodir_show_location_url == 'all') {
3728
+			if ($country != '') {
3729 3729
 				$location_url[] = $country;
3730 3730
 			}
3731 3731
 
3732
-			if ( $region != '' ) {
3732
+			if ($region != '') {
3733 3733
 				$location_url[] = $region;
3734 3734
 			}
3735
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3736
-			if ( $country != '' ) {
3735
+		} else if ($geodir_show_location_url == 'country_city') {
3736
+			if ($country != '') {
3737 3737
 				$location_url[] = $country;
3738 3738
 			}
3739
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3740
-			if ( $region != '' ) {
3739
+		} else if ($geodir_show_location_url == 'region_city') {
3740
+			if ($region != '') {
3741 3741
 				$location_url[] = $region;
3742 3742
 			}
3743 3743
 		}
@@ -3745,37 +3745,37 @@  discard block
 block discarded – undo
3745 3745
 		$location_url[] = $city;
3746 3746
 	}
3747 3747
 
3748
-	$location_url  = implode( '/', $location_url );
3748
+	$location_url  = implode('/', $location_url);
3749 3749
 	$skip_location = false;
3750
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3750
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3751 3751
 		$skip_location = true;
3752
-		$gd_session->un_set( 'gd_multi_location' );
3752
+		$gd_session->un_set('gd_multi_location');
3753 3753
 	}
3754 3754
 
3755
-	if ( get_option( 'permalink_structure' ) ) {
3756
-		$viewall_url = get_post_type_archive_link( $post_type );
3755
+	if (get_option('permalink_structure')) {
3756
+		$viewall_url = get_post_type_archive_link($post_type);
3757 3757
 	} else {
3758
-		$viewall_url = get_post_type_archive_link( $post_type );
3758
+		$viewall_url = get_post_type_archive_link($post_type);
3759 3759
 	}
3760 3760
 
3761
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3761
+	if (!empty($category) && $category[0] != '0') {
3762 3762
 		global $geodir_add_location_url;
3763 3763
 
3764 3764
 		$geodir_add_location_url = '0';
3765 3765
 
3766
-		if ( $add_location_filter != '0' ) {
3766
+		if ($add_location_filter != '0') {
3767 3767
 			$geodir_add_location_url = '1';
3768 3768
 		}
3769 3769
 
3770
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3770
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3771 3771
 
3772 3772
 		$geodir_add_location_url = null;
3773 3773
 	}
3774
-	if ( $skip_location ) {
3775
-		$gd_session->set( 'gd_multi_location', 1 );
3774
+	if ($skip_location) {
3775
+		$gd_session->set('gd_multi_location', 1);
3776 3776
 	}
3777 3777
 
3778
-	if ( is_wp_error( $viewall_url ) ) {
3778
+	if (is_wp_error($viewall_url)) {
3779 3779
 		$viewall_url = '';
3780 3780
 	}
3781 3781
 
@@ -3787,43 +3787,43 @@  discard block
 block discarded – undo
3787 3787
 		'order_by'       => $list_sort
3788 3788
 	);
3789 3789
 
3790
-	if ( $character_count ) {
3790
+	if ($character_count) {
3791 3791
 		$query_args['excerpt_length'] = $character_count;
3792 3792
 	}
3793 3793
 
3794
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3794
+	if (!empty($instance['show_featured_only'])) {
3795 3795
 		$query_args['show_featured_only'] = 1;
3796 3796
 	}
3797 3797
 
3798
-	if ( ! empty( $instance['show_special_only'] ) ) {
3798
+	if (!empty($instance['show_special_only'])) {
3799 3799
 		$query_args['show_special_only'] = 1;
3800 3800
 	}
3801 3801
 
3802
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3802
+	if (!empty($instance['with_pics_only'])) {
3803 3803
 		$query_args['with_pics_only']      = 0;
3804 3804
 		$query_args['featured_image_only'] = 1;
3805 3805
 	}
3806 3806
 
3807
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3807
+	if (!empty($instance['with_videos_only'])) {
3808 3808
 		$query_args['with_videos_only'] = 1;
3809 3809
 	}
3810
-	$hide_if_empty = ! empty( $instance['hide_if_empty'] ) ? true : false;
3810
+	$hide_if_empty = !empty($instance['hide_if_empty']) ? true : false;
3811 3811
 
3812
-	if ( ! empty( $categories ) && $categories[0] != '0' && !empty( $category_taxonomy ) ) {
3812
+	if (!empty($categories) && $categories[0] != '0' && !empty($category_taxonomy)) {
3813 3813
 		$tax_query = array(
3814 3814
 			'taxonomy' => $category_taxonomy[0],
3815 3815
 			'field'    => 'id',
3816 3816
 			'terms'    => $category
3817 3817
 		);
3818 3818
 
3819
-		$query_args['tax_query'] = array( $tax_query );
3819
+		$query_args['tax_query'] = array($tax_query);
3820 3820
 	}
3821 3821
 
3822 3822
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3823 3823
 
3824
-	$widget_listings = geodir_get_widget_listings( $query_args );
3824
+	$widget_listings = geodir_get_widget_listings($query_args);
3825 3825
     
3826
-	if ( $hide_if_empty && empty( $widget_listings ) ) {
3826
+	if ($hide_if_empty && empty($widget_listings)) {
3827 3827
 		return;
3828 3828
 	}
3829 3829
     
@@ -3838,11 +3838,11 @@  discard block
 block discarded – undo
3838 3838
 		 *
3839 3839
 		 * @since 1.0.0
3840 3840
 		 */
3841
-		do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3841
+		do_action('geodir_before_view_all_link_in_widget'); ?>
3842 3842
 		<div class="geodir_list_heading clearfix">
3843
-			<?php echo $before_title . $title . $after_title; ?>
3843
+			<?php echo $before_title.$title.$after_title; ?>
3844 3844
 			<a href="<?php echo $viewall_url; ?>"
3845
-			   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3845
+			   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3846 3846
 		</div>
3847 3847
 		<?php
3848 3848
 		/**
@@ -3850,10 +3850,10 @@  discard block
 block discarded – undo
3850 3850
 		 *
3851 3851
 		 * @since 1.0.0
3852 3852
 		 */
3853
-		do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3853
+		do_action('geodir_after_view_all_link_in_widget'); ?>
3854 3854
 		<?php
3855
-		if ( strstr( $layout, 'gridview' ) ) {
3856
-			$listing_view_exp        = explode( '_', $layout );
3855
+		if (strstr($layout, 'gridview')) {
3856
+			$listing_view_exp        = explode('_', $layout);
3857 3857
 			$gridview_columns_widget = $layout;
3858 3858
 			$layout                  = $listing_view_exp[0];
3859 3859
 		} else {
@@ -3864,8 +3864,8 @@  discard block
 block discarded – undo
3864 3864
 		 *
3865 3865
 		 * @since 1.0.0
3866 3866
 		 */
3867
-		$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3868
-		if ( ! isset( $character_count ) ) {
3867
+		$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3868
+		if (!isset($character_count)) {
3869 3869
 			/**
3870 3870
 			 * Filter the widget's excerpt character count.
3871 3871
 			 *
@@ -3873,7 +3873,7 @@  discard block
 block discarded – undo
3873 3873
 			 *
3874 3874
 			 * @param int $instance ['character_count'] Excerpt character count.
3875 3875
 			 */
3876
-			$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3876
+			$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3877 3877
 		}
3878 3878
 
3879 3879
 		global $post, $map_jason, $map_canvas_arr;
@@ -3888,13 +3888,13 @@  discard block
 block discarded – undo
3888 3888
 		 *
3889 3889
 		 * @since 1.0.0
3890 3890
 		 */
3891
-		include( $template );
3891
+		include($template);
3892 3892
 
3893 3893
 		$geodir_is_widget_listing = false;
3894 3894
 
3895 3895
 		$GLOBALS['post'] = $current_post;
3896
-		if ( ! empty( $current_post ) ) {
3897
-			setup_postdata( $current_post );
3896
+		if (!empty($current_post)) {
3897
+			setup_postdata($current_post);
3898 3898
 		}
3899 3899
 		$map_jason      = $current_map_jason;
3900 3900
 		$map_canvas_arr = $current_map_canvas_arr;
@@ -3923,12 +3923,12 @@  discard block
 block discarded – undo
3923 3923
  *
3924 3924
  * @return int Reviews count.
3925 3925
  */
3926
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3926
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3927 3927
 	global $wpdb, $plugin_prefix;
3928 3928
 
3929
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3929
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3930 3930
 
3931
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3931
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3932 3932
 
3933 3933
 	/**
3934 3934
 	 * Filter count review sql query.
@@ -3940,9 +3940,9 @@  discard block
 block discarded – undo
3940 3940
 	 * @param int $taxonomy     The taxonomy Id.
3941 3941
 	 * @param string $post_type The post type.
3942 3942
 	 */
3943
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3943
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3944 3944
 
3945
-	$count = $wpdb->get_var( $sql );
3945
+	$count = $wpdb->get_var($sql);
3946 3946
 
3947 3947
 	return $count;
3948 3948
 }
@@ -3960,7 +3960,7 @@  discard block
 block discarded – undo
3960 3960
  *
3961 3961
  * @return array Term array data.
3962 3962
  */
3963
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3963
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3964 3964
 	/**
3965 3965
 	 * Filter review count option data.
3966 3966
 	 *
@@ -3970,78 +3970,78 @@  discard block
 block discarded – undo
3970 3970
 	 * @param bool $force_update Force update option value?. Default.false.
3971 3971
 	 * @param int $post_ID       The post id to update if any.
3972 3972
 	 */
3973
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3974
-	if ( ! empty( $option_data ) ) {
3973
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3974
+	if (!empty($option_data)) {
3975 3975
 		return $option_data;
3976 3976
 	}
3977 3977
 
3978
-	$option_data = get_option( 'geodir_global_review_count' );
3978
+	$option_data = get_option('geodir_global_review_count');
3979 3979
 
3980
-	if ( ! $option_data || $force_update ) {
3981
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3980
+	if (!$option_data || $force_update) {
3981
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3982 3982
 			global $gd_session;
3983 3983
 			$term_array = (array) $option_data;
3984
-			$post_type  = get_post_type( $post_ID );
3985
-			$taxonomy   = $post_type . 'category';
3986
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3987
-
3988
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3989
-				foreach ( $terms as $term_id ) {
3990
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3991
-					$children               = get_term_children( $term_id, $taxonomy );
3992
-					$term_array[ $term_id ] = $count;
3984
+			$post_type  = get_post_type($post_ID);
3985
+			$taxonomy   = $post_type.'category';
3986
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3987
+
3988
+			if (!empty($terms) && !is_wp_error($terms)) {
3989
+				foreach ($terms as $term_id) {
3990
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3991
+					$children               = get_term_children($term_id, $taxonomy);
3992
+					$term_array[$term_id] = $count;
3993 3993
 				}
3994 3994
 			}
3995 3995
 
3996
-			$session_listing = $gd_session->get( 'listing' );
3996
+			$session_listing = $gd_session->get('listing');
3997 3997
 
3998 3998
 			$terms = array();
3999
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
4000
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
4001
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
4002
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3999
+			if (isset($_POST['post_category'][$taxonomy])) {
4000
+				$terms = (array) $_POST['post_category'][$taxonomy];
4001
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
4002
+				$terms = (array) $session_listing['post_category'][$taxonomy];
4003 4003
 			}
4004 4004
 
4005
-			if ( ! empty( $terms ) ) {
4006
-				foreach ( $terms as $term_id ) {
4007
-					if ( $term_id > 0 ) {
4008
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
4009
-						$children               = get_term_children( $term_id, $taxonomy );
4010
-						$term_array[ $term_id ] = $count;
4005
+			if (!empty($terms)) {
4006
+				foreach ($terms as $term_id) {
4007
+					if ($term_id > 0) {
4008
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
4009
+						$children               = get_term_children($term_id, $taxonomy);
4010
+						$term_array[$term_id] = $count;
4011 4011
 					}
4012 4012
 				}
4013 4013
 			}
4014 4014
 		} else { // Update reviews count for all post categories.
4015 4015
 			$term_array = array();
4016 4016
 			$post_types = geodir_get_posttypes();
4017
-			foreach ( $post_types as $post_type ) {
4017
+			foreach ($post_types as $post_type) {
4018 4018
 
4019
-				$taxonomy = geodir_get_taxonomies( $post_type );
4019
+				$taxonomy = geodir_get_taxonomies($post_type);
4020 4020
 				$taxonomy = $taxonomy[0];
4021 4021
 
4022 4022
 				$args = array(
4023 4023
 					'hide_empty' => false
4024 4024
 				);
4025 4025
 
4026
-				$terms = get_terms( $taxonomy, $args );
4026
+				$terms = get_terms($taxonomy, $args);
4027 4027
 
4028
-				foreach ( $terms as $term ) {
4029
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
4030
-					$children = get_term_children( $term->term_id, $taxonomy );
4028
+				foreach ($terms as $term) {
4029
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
4030
+					$children = get_term_children($term->term_id, $taxonomy);
4031 4031
 					/*if ( is_array( $children ) ) {
4032 4032
                         foreach ( $children as $child_id ) {
4033 4033
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
4034 4034
                             $count = $count + $child_count;
4035 4035
                         }
4036 4036
                     }*/
4037
-					$term_array[ $term->term_id ] = $count;
4037
+					$term_array[$term->term_id] = $count;
4038 4038
 				}
4039 4039
 			}
4040 4040
 		}
4041 4041
 
4042
-		update_option( 'geodir_global_review_count', $term_array );
4042
+		update_option('geodir_global_review_count', $term_array);
4043 4043
 		//clear cache
4044
-		wp_cache_delete( 'geodir_global_review_count' );
4044
+		wp_cache_delete('geodir_global_review_count');
4045 4045
 
4046 4046
 		return $term_array;
4047 4047
 	} else {
@@ -4057,39 +4057,39 @@  discard block
 block discarded – undo
4057 4057
  * @package GeoDirectory
4058 4058
  * @return bool
4059 4059
  */
4060
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
4061
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
4060
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
4061
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
4062 4062
 		return; // do not run if importing listings
4063 4063
 	}
4064 4064
 
4065
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
4065
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
4066 4066
 		return;
4067 4067
 	}
4068 4068
 
4069 4069
 	$post_ID = 0;
4070
-	if ( ! empty( $post ) ) {
4071
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
4070
+	if (!empty($post)) {
4071
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
4072 4072
 			return;
4073 4073
 		}
4074 4074
 
4075
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
4075
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
4076 4076
 			return;
4077 4077
 		}
4078 4078
 
4079
-		if ( ! empty( $post->ID ) ) {
4079
+		if (!empty($post->ID)) {
4080 4080
 			$post_ID = $post->ID;
4081 4081
 		}
4082 4082
 	}
4083 4083
 
4084
-	if ( $new_status != $old_status ) {
4085
-		geodir_count_reviews_by_terms( true, $post_ID );
4084
+	if ($new_status != $old_status) {
4085
+		geodir_count_reviews_by_terms(true, $post_ID);
4086 4086
 	}
4087 4087
 
4088 4088
 	return true;
4089 4089
 }
4090 4090
 
4091
-function geodir_term_review_count_force_update_single_post( $post_id ) {
4092
-	geodir_count_reviews_by_terms( true, $post_id );
4091
+function geodir_term_review_count_force_update_single_post($post_id) {
4092
+	geodir_count_reviews_by_terms(true, $post_id);
4093 4093
 }
4094 4094
 
4095 4095
 /*-----------------------------------------------------------------------------------*/
@@ -4106,11 +4106,11 @@  discard block
 block discarded – undo
4106 4106
  *
4107 4107
  * @return int Post count.
4108 4108
  */
4109
-function geodir_count_posts_by_term( $data, $term ) {
4109
+function geodir_count_posts_by_term($data, $term) {
4110 4110
 
4111
-	if ( $data ) {
4112
-		if ( isset( $data[ $term->term_id ] ) ) {
4113
-			return $data[ $term->term_id ];
4111
+	if ($data) {
4112
+		if (isset($data[$term->term_id])) {
4113
+			return $data[$term->term_id];
4114 4114
 		} else {
4115 4115
 			return 0;
4116 4116
 		}
@@ -4127,8 +4127,8 @@  discard block
 block discarded – undo
4127 4127
  * param array $terms An array of term objects.
4128 4128
  * @return array Sorted terms array.
4129 4129
  */
4130
-function geodir_sort_terms_by_count( $terms ) {
4131
-	usort( $terms, "geodir_sort_by_count_obj" );
4130
+function geodir_sort_terms_by_count($terms) {
4131
+	usort($terms, "geodir_sort_by_count_obj");
4132 4132
 
4133 4133
 	return $terms;
4134 4134
 }
@@ -4143,8 +4143,8 @@  discard block
 block discarded – undo
4143 4143
  *
4144 4144
  * @return array Sorted terms array.
4145 4145
  */
4146
-function geodir_sort_terms_by_review_count( $terms ) {
4147
-	usort( $terms, "geodir_sort_by_review_count_obj" );
4146
+function geodir_sort_terms_by_review_count($terms) {
4147
+	usort($terms, "geodir_sort_by_review_count_obj");
4148 4148
 
4149 4149
 	return $terms;
4150 4150
 }
@@ -4160,12 +4160,12 @@  discard block
 block discarded – undo
4160 4160
  *
4161 4161
  * @return array Sorted terms array.
4162 4162
  */
4163
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4164
-	if ( $sort == 'count' ) {
4165
-		return geodir_sort_terms_by_count( $terms );
4163
+function geodir_sort_terms($terms, $sort = 'count') {
4164
+	if ($sort == 'count') {
4165
+		return geodir_sort_terms_by_count($terms);
4166 4166
 	}
4167
-	if ( $sort == 'review_count' ) {
4168
-		return geodir_sort_terms_by_review_count( $terms );
4167
+	if ($sort == 'review_count') {
4168
+		return geodir_sort_terms_by_review_count($terms);
4169 4169
 	}
4170 4170
 }
4171 4171
 
@@ -4183,7 +4183,7 @@  discard block
 block discarded – undo
4183 4183
  *
4184 4184
  * @return bool
4185 4185
  */
4186
-function geodir_sort_by_count( $a, $b ) {
4186
+function geodir_sort_by_count($a, $b) {
4187 4187
 	return $a['count'] < $b['count'];
4188 4188
 }
4189 4189
 
@@ -4198,7 +4198,7 @@  discard block
 block discarded – undo
4198 4198
  *
4199 4199
  * @return bool
4200 4200
  */
4201
-function geodir_sort_by_count_obj( $a, $b ) {
4201
+function geodir_sort_by_count_obj($a, $b) {
4202 4202
 	return $a->count < $b->count;
4203 4203
 }
4204 4204
 
@@ -4213,7 +4213,7 @@  discard block
 block discarded – undo
4213 4213
  *
4214 4214
  * @return bool
4215 4215
  */
4216
-function geodir_sort_by_review_count_obj( $a, $b ) {
4216
+function geodir_sort_by_review_count_obj($a, $b) {
4217 4217
 	return $a->review_count < $b->review_count;
4218 4218
 }
4219 4219
 
@@ -4230,35 +4230,35 @@  discard block
 block discarded – undo
4230 4230
 	 * @since   1.4.2
4231 4231
 	 * @package GeoDirectory
4232 4232
 	 */
4233
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4233
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4234 4234
 
4235
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4236
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4235
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4236
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4237 4237
 
4238 4238
 	/**
4239 4239
 	 * Define language constants.
4240 4240
 	 *
4241 4241
 	 * @since 1.0.0
4242 4242
 	 */
4243
-	require_once( geodir_plugin_path() . '/language.php' );
4243
+	require_once(geodir_plugin_path().'/language.php');
4244 4244
 
4245
-	$language_file = geodir_plugin_path() . '/db-language.php';
4245
+	$language_file = geodir_plugin_path().'/db-language.php';
4246 4246
 
4247 4247
 	// Load language string file if not created yet
4248
-	if ( ! file_exists( $language_file ) ) {
4248
+	if (!file_exists($language_file)) {
4249 4249
 		geodirectory_load_db_language();
4250 4250
 	}
4251 4251
 
4252
-	if ( file_exists( $language_file ) ) {
4252
+	if (file_exists($language_file)) {
4253 4253
 		/**
4254 4254
 		 * Language strings from database.
4255 4255
 		 *
4256 4256
 		 * @since 1.4.2
4257 4257
 		 */
4258 4258
 		try {
4259
-			require_once( $language_file );
4260
-		} catch ( Exception $e ) {
4261
-			error_log( 'Language Error: ' . $e->getMessage() );
4259
+			require_once($language_file);
4260
+		} catch (Exception $e) {
4261
+			error_log('Language Error: '.$e->getMessage());
4262 4262
 		}
4263 4263
 	}
4264 4264
 }
@@ -4275,19 +4275,19 @@  discard block
 block discarded – undo
4275 4275
  */
4276 4276
 function geodirectory_load_db_language() {
4277 4277
 	global $wp_filesystem;
4278
-	if ( empty( $wp_filesystem ) ) {
4279
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4278
+	if (empty($wp_filesystem)) {
4279
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4280 4280
 		WP_Filesystem();
4281 4281
 		global $wp_filesystem;
4282 4282
 	}
4283 4283
 
4284
-	$language_file = geodir_plugin_path() . '/db-language.php';
4284
+	$language_file = geodir_plugin_path().'/db-language.php';
4285 4285
 
4286
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4286
+	if (is_file($language_file) && !is_writable($language_file)) {
4287 4287
 		return false;
4288 4288
 	} // Not possible to create.
4289 4289
 
4290
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4290
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4291 4291
 		return false;
4292 4292
 	} // Not possible to create.
4293 4293
 
@@ -4301,9 +4301,9 @@  discard block
 block discarded – undo
4301 4301
 	 *
4302 4302
 	 * @param array $contents_strings Array of strings.
4303 4303
 	 */
4304
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4304
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4305 4305
 
4306
-	$contents_strings = array_unique( $contents_strings );
4306
+	$contents_strings = array_unique($contents_strings);
4307 4307
 
4308 4308
 	$contents_head   = array();
4309 4309
 	$contents_head[] = "<?php";
@@ -4320,21 +4320,21 @@  discard block
 block discarded – undo
4320 4320
 	$contents_foot[] = "";
4321 4321
 	$contents_foot[] = "";
4322 4322
 
4323
-	$contents = implode( PHP_EOL, $contents_head );
4323
+	$contents = implode(PHP_EOL, $contents_head);
4324 4324
 
4325
-	if ( ! empty( $contents_strings ) ) {
4326
-		foreach ( $contents_strings as $string ) {
4327
-			if ( is_scalar( $string ) && $string != '' ) {
4328
-				$string = str_replace( "'", "\'", $string );
4329
-				geodir_wpml_register_string( $string );
4330
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4325
+	if (!empty($contents_strings)) {
4326
+		foreach ($contents_strings as $string) {
4327
+			if (is_scalar($string) && $string != '') {
4328
+				$string = str_replace("'", "\'", $string);
4329
+				geodir_wpml_register_string($string);
4330
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4331 4331
 			}
4332 4332
 		}
4333 4333
 	}
4334 4334
 
4335
-	$contents .= implode( PHP_EOL, $contents_foot );
4335
+	$contents .= implode(PHP_EOL, $contents_foot);
4336 4336
 
4337
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4337
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4338 4338
 		return false;
4339 4339
 	} // Failure; could not write file.
4340 4340
 
@@ -4355,49 +4355,49 @@  discard block
 block discarded – undo
4355 4355
  *
4356 4356
  * @return array Translation texts.
4357 4357
  */
4358
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4358
+function geodir_load_custom_field_translation($translation_texts = array()) {
4359 4359
 	global $wpdb;
4360 4360
 
4361 4361
 	// Custom fields table
4362
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4363
-	$rows = $wpdb->get_results( $sql );
4362
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4363
+	$rows = $wpdb->get_results($sql);
4364 4364
 
4365
-	if ( ! empty( $rows ) ) {
4366
-		foreach ( $rows as $row ) {
4367
-			if ( ! empty( $row->admin_title ) ) {
4368
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4365
+	if (!empty($rows)) {
4366
+		foreach ($rows as $row) {
4367
+			if (!empty($row->admin_title)) {
4368
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4369 4369
 			}
4370 4370
 
4371
-			if ( ! empty( $row->admin_desc ) ) {
4372
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4371
+			if (!empty($row->admin_desc)) {
4372
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4373 4373
 			}
4374 4374
 
4375
-			if ( ! empty( $row->site_title ) ) {
4376
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4375
+			if (!empty($row->site_title)) {
4376
+				$translation_texts[] = stripslashes_deep($row->site_title);
4377 4377
 			}
4378 4378
 
4379
-			if ( ! empty( $row->clabels ) ) {
4380
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4379
+			if (!empty($row->clabels)) {
4380
+				$translation_texts[] = stripslashes_deep($row->clabels);
4381 4381
 			}
4382 4382
 
4383
-			if ( ! empty( $row->required_msg ) ) {
4384
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4383
+			if (!empty($row->required_msg)) {
4384
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4385 4385
 			}
4386 4386
             
4387
-			if ( ! empty( $row->validation_msg ) ) {
4388
-				$translation_texts[] = stripslashes_deep( $row->validation_msg );
4387
+			if (!empty($row->validation_msg)) {
4388
+				$translation_texts[] = stripslashes_deep($row->validation_msg);
4389 4389
 			}
4390 4390
 
4391
-			if ( ! empty( $row->default_value ) ) {
4392
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4391
+			if (!empty($row->default_value)) {
4392
+				$translation_texts[] = stripslashes_deep($row->default_value);
4393 4393
 			}
4394 4394
 
4395
-			if ( ! empty( $row->option_values ) ) {
4396
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4395
+			if (!empty($row->option_values)) {
4396
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4397 4397
 
4398
-				if ( ! empty( $option_values ) ) {
4399
-					foreach ( $option_values as $option_value ) {
4400
-						if ( ! empty( $option_value['label'] ) ) {
4398
+				if (!empty($option_values)) {
4399
+					foreach ($option_values as $option_value) {
4400
+						if (!empty($option_value['label'])) {
4401 4401
 							$translation_texts[] = $option_value['label'];
4402 4402
 						}
4403 4403
 					}
@@ -4407,56 +4407,56 @@  discard block
 block discarded – undo
4407 4407
 	}
4408 4408
 
4409 4409
 	// Custom sorting fields table
4410
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4411
-	$rows = $wpdb->get_results( $sql );
4410
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4411
+	$rows = $wpdb->get_results($sql);
4412 4412
 
4413
-	if ( ! empty( $rows ) ) {
4414
-		foreach ( $rows as $row ) {
4415
-			if ( ! empty( $row->site_title ) ) {
4416
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4413
+	if (!empty($rows)) {
4414
+		foreach ($rows as $row) {
4415
+			if (!empty($row->site_title)) {
4416
+				$translation_texts[] = stripslashes_deep($row->site_title);
4417 4417
 			}
4418 4418
 
4419
-			if ( ! empty( $row->asc_title ) ) {
4420
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4419
+			if (!empty($row->asc_title)) {
4420
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4421 4421
 			}
4422 4422
 
4423
-			if ( ! empty( $row->desc_title ) ) {
4424
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4423
+			if (!empty($row->desc_title)) {
4424
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4425 4425
 			}
4426 4426
 		}
4427 4427
 	}
4428 4428
 
4429 4429
 	// Advance search filter fields table
4430
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4431
-		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4432
-		$rows = $wpdb->get_results( $sql );
4433
-
4434
-		if ( ! empty( $rows ) ) {
4435
-			foreach ( $rows as $row ) {
4436
-				if ( ! empty( $row->field_site_name ) ) {
4437
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4430
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4431
+		$sql  = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4432
+		$rows = $wpdb->get_results($sql);
4433
+
4434
+		if (!empty($rows)) {
4435
+			foreach ($rows as $row) {
4436
+				if (!empty($row->field_site_name)) {
4437
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4438 4438
 				}
4439 4439
 
4440
-				if ( ! empty( $row->front_search_title ) ) {
4441
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4440
+				if (!empty($row->front_search_title)) {
4441
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4442 4442
 				}
4443 4443
 
4444
-				if ( ! empty( $row->first_search_text ) ) {
4445
-					$translation_texts[] = stripslashes_deep( $row->first_search_text );
4444
+				if (!empty($row->first_search_text)) {
4445
+					$translation_texts[] = stripslashes_deep($row->first_search_text);
4446 4446
 				}
4447 4447
 
4448
-				if ( ! empty( $row->last_search_text ) ) {
4449
-					$translation_texts[] = stripslashes_deep( $row->last_search_text );
4448
+				if (!empty($row->last_search_text)) {
4449
+					$translation_texts[] = stripslashes_deep($row->last_search_text);
4450 4450
 				}
4451 4451
 
4452
-				if ( ! empty( $row->field_desc ) ) {
4453
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4452
+				if (!empty($row->field_desc)) {
4453
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4454 4454
 				}
4455 4455
 			}
4456 4456
 		}
4457 4457
 	}
4458 4458
 
4459
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4459
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4460 4460
 
4461 4461
 	return $translation_texts;
4462 4462
 }
@@ -4478,7 +4478,7 @@  discard block
 block discarded – undo
4478 4478
 	 *
4479 4479
 	 * @param array $geodir_allowed_mime_types and file extensions.
4480 4480
 	 */
4481
-	return apply_filters( 'geodir_allowed_mime_types', array(
4481
+	return apply_filters('geodir_allowed_mime_types', array(
4482 4482
 			'Image'       => array( // Image formats.
4483 4483
 				'jpg'  => 'image/jpeg',
4484 4484
 				'jpe'  => 'image/jpeg',
@@ -4547,18 +4547,18 @@  discard block
 block discarded – undo
4547 4547
  *
4548 4548
  * @return string User display name.
4549 4549
  */
4550
-function geodir_get_client_name( $user_id ) {
4550
+function geodir_get_client_name($user_id) {
4551 4551
 	$client_name = '';
4552 4552
 
4553
-	$user_data = get_userdata( $user_id );
4553
+	$user_data = get_userdata($user_id);
4554 4554
 
4555
-	if ( ! empty( $user_data ) ) {
4556
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4557
-			$client_name = trim( $user_data->display_name );
4558
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4559
-			$client_name = trim( $user_data->user_nicename );
4555
+	if (!empty($user_data)) {
4556
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4557
+			$client_name = trim($user_data->display_name);
4558
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4559
+			$client_name = trim($user_data->user_nicename);
4560 4560
 		} else {
4561
-			$client_name = trim( $user_data->user_login );
4561
+			$client_name = trim($user_data->user_login);
4562 4562
 		}
4563 4563
 	}
4564 4564
 
@@ -4566,17 +4566,17 @@  discard block
 block discarded – undo
4566 4566
 }
4567 4567
 
4568 4568
 
4569
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4569
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4570 4570
 /*
4571 4571
  * Add location variables to wpseo replacements.
4572 4572
  *
4573 4573
  * @since 1.5.4
4574 4574
  */
4575
-function geodir_wpseo_replacements( $vars ) {
4575
+function geodir_wpseo_replacements($vars) {
4576 4576
 
4577 4577
 	// location variables
4578 4578
 	$gd_post_type   = geodir_get_current_posttype();
4579
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4579
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4580 4580
 	/**
4581 4581
 	 * Filter the title variables location variables array
4582 4582
 	 *
@@ -4586,7 +4586,7 @@  discard block
 block discarded – undo
4586 4586
 	 * @param array $location_array The array of location variables.
4587 4587
 	 * @param array $vars           The page title variables.
4588 4588
 	 */
4589
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4589
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4590 4590
 
4591 4591
 
4592 4592
 	$location_replace_vars = geodir_location_replace_vars($location_array, NULL, '');
@@ -4601,13 +4601,13 @@  discard block
 block discarded – undo
4601 4601
 	 * @param string $vars          The title with variables.
4602 4602
 	 * @param array $location_array The array of location variables.
4603 4603
 	 */
4604
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4604
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4605 4605
 }
4606 4606
 
4607 4607
 
4608
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4609
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4610
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4608
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4609
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4610
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4611 4611
 
4612 4612
 /**
4613 4613
  * Filter the title variables.
@@ -4649,14 +4649,14 @@  discard block
 block discarded – undo
4649 4649
  *
4650 4650
  * @return string Title after filtered variables.
4651 4651
  */
4652
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4652
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4653 4653
 	global $wp, $post;
4654 4654
 
4655
-	if ( ! $gd_page || ! $title ) {
4655
+	if (!$gd_page || !$title) {
4656 4656
 		return $title; // if no a GD page then bail.
4657 4657
 	}
4658 4658
 
4659
-	if ( $sep == '' ) {
4659
+	if ($sep == '') {
4660 4660
 		/**
4661 4661
 		 * Filter the page title separator.
4662 4662
 		 *
@@ -4665,100 +4665,100 @@  discard block
 block discarded – undo
4665 4665
 		 *
4666 4666
 		 * @param string $sep The separator, default: `|`.
4667 4667
 		 */
4668
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4668
+		$sep = apply_filters('geodir_page_title_separator', '|');
4669 4669
 	}
4670 4670
 
4671
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4672
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4671
+	if (strpos($title, '%%title%%') !== false) {
4672
+		$title = str_replace("%%title%%", $post->post_title, $title);
4673 4673
 	}
4674 4674
 
4675
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4676
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4675
+	if (strpos($title, '%%sitename%%') !== false) {
4676
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4677 4677
 	}
4678 4678
 
4679
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4680
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4679
+	if (strpos($title, '%%sitedesc%%') !== false) {
4680
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4681 4681
 	}
4682 4682
 
4683
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4684
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4683
+	if (strpos($title, '%%excerpt%%') !== false) {
4684
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4685 4685
 	}
4686 4686
 
4687
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4688
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4689
-	} else if ( $gd_page == 'add-listing' ) {
4690
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4691
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4692
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4687
+	if ($gd_page == 'search' || $gd_page == 'author') {
4688
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4689
+	} else if ($gd_page == 'add-listing') {
4690
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4691
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4692
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4693 4693
 		$post_type = $post->post_type;
4694 4694
 	} else {
4695
-		$post_type = get_query_var( 'post_type' );
4695
+		$post_type = get_query_var('post_type');
4696 4696
 	}
4697 4697
 
4698
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4698
+	if (strpos($title, '%%pt_single%%') !== false) {
4699 4699
 		$singular_name = '';
4700
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4701
-			$singular_name = __( $singular_name, 'geodirectory' );
4700
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4701
+			$singular_name = __($singular_name, 'geodirectory');
4702 4702
 		}
4703 4703
 
4704
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4704
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4705 4705
 	}
4706 4706
 
4707
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4707
+	if (strpos($title, '%%pt_plural%%') !== false) {
4708 4708
 		$plural_name = '';
4709
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4710
-			$plural_name = __( $plural_name, 'geodirectory' );
4709
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4710
+			$plural_name = __($plural_name, 'geodirectory');
4711 4711
 		}
4712 4712
 
4713
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4713
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4714 4714
 	}
4715 4715
 
4716
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4716
+	if (strpos($title, '%%category%%') !== false) {
4717 4717
 		$cat_name = '';
4718 4718
 
4719
-		if ( $gd_page == 'detail' ) {
4720
-			if ( $post->default_category ) {
4721
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4722
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4719
+		if ($gd_page == 'detail') {
4720
+			if ($post->default_category) {
4721
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4722
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4723 4723
 			}
4724
-		} else if ( $gd_page == 'listing' ) {
4724
+		} else if ($gd_page == 'listing') {
4725 4725
 			$queried_object = get_queried_object();
4726
-			if ( isset( $queried_object->name ) ) {
4726
+			if (isset($queried_object->name)) {
4727 4727
 				$cat_name = $queried_object->name;
4728 4728
 			}
4729 4729
 		}
4730
-		$title = str_replace( "%%category%%", $cat_name, $title );
4730
+		$title = str_replace("%%category%%", $cat_name, $title);
4731 4731
 	}
4732 4732
 
4733
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4733
+	if (strpos($title, '%%tag%%') !== false) {
4734 4734
 		$cat_name = '';
4735 4735
 
4736
-		if ( $gd_page == 'detail' ) {
4737
-			if ( $post->default_category ) {
4738
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4739
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4736
+		if ($gd_page == 'detail') {
4737
+			if ($post->default_category) {
4738
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4739
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4740 4740
 			}
4741
-		} else if ( $gd_page == 'listing' ) {
4741
+		} else if ($gd_page == 'listing') {
4742 4742
 			$queried_object = get_queried_object();
4743
-			if ( isset( $queried_object->name ) ) {
4743
+			if (isset($queried_object->name)) {
4744 4744
 				$cat_name = $queried_object->name;
4745 4745
 			}
4746 4746
 		}
4747
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4747
+		$title = str_replace("%%tag%%", $cat_name, $title);
4748 4748
 	}
4749 4749
 
4750
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4751
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4752
-		$title = str_replace( "%%id%%", $ID, $title );
4750
+	if (strpos($title, '%%id%%') !== false) {
4751
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4752
+		$title = str_replace("%%id%%", $ID, $title);
4753 4753
 	}
4754 4754
 
4755
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4756
-		$title = str_replace( "%%sep%%", $sep, $title );
4755
+	if (strpos($title, '%%sep%%') !== false) {
4756
+		$title = str_replace("%%sep%%", $sep, $title);
4757 4757
 	}
4758 4758
 
4759 4759
 	// location variables
4760 4760
 	$gd_post_type   = geodir_get_current_posttype();
4761
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4761
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4762 4762
 	
4763 4763
 	/**
4764 4764
 	 * Filter the title variables location variables array
@@ -4771,20 +4771,20 @@  discard block
 block discarded – undo
4771 4771
 	 * @param string $gd_page       The page being filtered.
4772 4772
 	 * @param string $sep           The separator, default: `|`.
4773 4773
 	 */
4774
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4774
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4775 4775
 	
4776
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4777
-		if ( get_query_var( 'gd_country_full' ) ) {
4778
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4776
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4777
+		if (get_query_var('gd_country_full')) {
4778
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4779 4779
 		}
4780
-		if ( get_query_var( 'gd_region_full' ) ) {
4781
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4780
+		if (get_query_var('gd_region_full')) {
4781
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4782 4782
 		}
4783
-		if ( get_query_var( 'gd_city_full' ) ) {
4784
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4783
+		if (get_query_var('gd_city_full')) {
4784
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4785 4785
 		}
4786
-		if ( get_query_var( 'gd_neighbourhood_full' ) ) {
4787
-			$location_array['gd_neighbourhood'] = get_query_var( 'gd_neighbourhood_full' );
4786
+		if (get_query_var('gd_neighbourhood_full')) {
4787
+			$location_array['gd_neighbourhood'] = get_query_var('gd_neighbourhood_full');
4788 4788
 		}
4789 4789
 	}
4790 4790
 	
@@ -4799,57 +4799,57 @@  discard block
 block discarded – undo
4799 4799
 	 * @param string $gd_page       The page being filtered.
4800 4800
 	 * @param string $sep           The separator, default: `|`.
4801 4801
 	 */
4802
-	$title = apply_filters( 'geodir_replace_location_variables', $title, $location_array, $gd_page, $sep );
4802
+	$title = apply_filters('geodir_replace_location_variables', $title, $location_array, $gd_page, $sep);
4803 4803
 	
4804
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4804
+	if (strpos($title, '%%search_term%%') !== false) {
4805 4805
 		$search_term = '';
4806
-		if ( isset( $_REQUEST['s'] ) ) {
4807
-			$search_term = esc_attr( $_REQUEST['s'] );
4806
+		if (isset($_REQUEST['s'])) {
4807
+			$search_term = esc_attr($_REQUEST['s']);
4808 4808
 		}
4809
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4809
+		$title = str_replace("%%search_term%%", $search_term, $title);
4810 4810
 	}
4811 4811
 
4812
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4812
+	if (strpos($title, '%%search_near%%') !== false) {
4813 4813
 		$search_term = '';
4814
-		if ( isset( $_REQUEST['snear'] ) ) {
4815
-			$search_term = esc_attr( $_REQUEST['snear'] );
4814
+		if (isset($_REQUEST['snear'])) {
4815
+			$search_term = esc_attr($_REQUEST['snear']);
4816 4816
 		}
4817
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4817
+		$title = str_replace("%%search_near%%", $search_term, $title);
4818 4818
 	}
4819 4819
 
4820
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4821
-		if ( is_author() ) {
4822
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4820
+	if (strpos($title, '%%name%%') !== false) {
4821
+		if (is_author()) {
4822
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4823 4823
 			$author_name = $curauth->display_name;
4824 4824
 		} else {
4825 4825
 			$author_name = get_the_author();
4826 4826
 		}
4827
-		if ( ! $author_name || $author_name === '' ) {
4827
+		if (!$author_name || $author_name === '') {
4828 4828
 			$queried_object = get_queried_object();
4829 4829
 
4830
-			if ( isset( $queried_object->data->user_nicename ) ) {
4830
+			if (isset($queried_object->data->user_nicename)) {
4831 4831
 				$author_name = $queried_object->data->display_name;
4832 4832
 			}
4833 4833
 		}
4834
-		$title = str_replace( "%%name%%", $author_name, $title );
4834
+		$title = str_replace("%%name%%", $author_name, $title);
4835 4835
 	}
4836 4836
 
4837
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4838
-		$page  = geodir_title_meta_page( $sep );
4839
-		$title = str_replace( "%%page%%", $page, $title );
4837
+	if (strpos($title, '%%page%%') !== false) {
4838
+		$page  = geodir_title_meta_page($sep);
4839
+		$title = str_replace("%%page%%", $page, $title);
4840 4840
 	}
4841
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4841
+	if (strpos($title, '%%pagenumber%%') !== false) {
4842 4842
 		$pagenumber = geodir_title_meta_pagenumber();
4843
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4843
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4844 4844
 	}
4845
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4845
+	if (strpos($title, '%%pagetotal%%') !== false) {
4846 4846
 		$pagetotal = geodir_title_meta_pagetotal();
4847
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4847
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4848 4848
 	}
4849 4849
 
4850
-	$title = wptexturize( $title );
4851
-	$title = convert_chars( $title );
4852
-	$title = esc_html( $title );
4850
+	$title = wptexturize($title);
4851
+	$title = convert_chars($title);
4852
+	$title = esc_html($title);
4853 4853
 
4854 4854
 	/**
4855 4855
 	 * Filter the title variables after standard ones have been filtered.
@@ -4863,7 +4863,7 @@  discard block
 block discarded – undo
4863 4863
 	 * @param string $sep           The separator, default: `|`.
4864 4864
 	 */
4865 4865
 
4866
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4866
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4867 4867
 }
4868 4868
 
4869 4869
 /**
@@ -4876,82 +4876,82 @@  discard block
 block discarded – undo
4876 4876
  *
4877 4877
  * @return array Translation texts.
4878 4878
  */
4879
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4880
-	$gd_post_types = geodir_get_posttypes( 'array' );
4879
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4880
+	$gd_post_types = geodir_get_posttypes('array');
4881 4881
 
4882
-	if ( ! empty( $gd_post_types ) ) {
4883
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4884
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4885
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4886
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4882
+	if (!empty($gd_post_types)) {
4883
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4884
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4885
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4886
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4887 4887
 
4888
-			if ( ! empty( $labels ) ) {
4889
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4888
+			if (!empty($labels)) {
4889
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4890 4890
 					$translation_texts[] = $labels['name'];
4891 4891
 				}
4892
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4892
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4893 4893
 					$translation_texts[] = $labels['singular_name'];
4894 4894
 				}
4895
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4895
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4896 4896
 					$translation_texts[] = $labels['add_new'];
4897 4897
 				}
4898
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4898
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4899 4899
 					$translation_texts[] = $labels['add_new_item'];
4900 4900
 				}
4901
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4901
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4902 4902
 					$translation_texts[] = $labels['edit_item'];
4903 4903
 				}
4904
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4904
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4905 4905
 					$translation_texts[] = $labels['new_item'];
4906 4906
 				}
4907
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4907
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4908 4908
 					$translation_texts[] = $labels['view_item'];
4909 4909
 				}
4910
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4910
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4911 4911
 					$translation_texts[] = $labels['search_items'];
4912 4912
 				}
4913
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4913
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4914 4914
 					$translation_texts[] = $labels['not_found'];
4915 4915
 				}
4916
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4916
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4917 4917
 					$translation_texts[] = $labels['not_found_in_trash'];
4918 4918
 				}
4919
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4919
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4920 4920
 					$translation_texts[] = $labels['label_post_profile'];
4921 4921
 				}
4922
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4922
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4923 4923
 					$translation_texts[] = $labels['label_post_info'];
4924 4924
 				}
4925
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4925
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4926 4926
 					$translation_texts[] = $labels['label_post_images'];
4927 4927
 				}
4928
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4928
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4929 4929
 					$translation_texts[] = $labels['label_post_map'];
4930 4930
 				}
4931
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4931
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4932 4932
 					$translation_texts[] = $labels['label_reviews'];
4933 4933
 				}
4934
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4934
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4935 4935
 					$translation_texts[] = $labels['label_related_listing'];
4936 4936
 				}
4937 4937
 			}
4938 4938
 
4939
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
4940
-				$translation_texts[] = normalize_whitespace( $description );
4939
+			if ($description != '' && !in_array($description, $translation_texts)) {
4940
+				$translation_texts[] = normalize_whitespace($description);
4941 4941
 			}
4942 4942
 
4943
-			if ( ! empty( $seo ) ) {
4944
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
4945
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
4943
+			if (!empty($seo)) {
4944
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4945
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4946 4946
 				}
4947 4947
 
4948
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
4949
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
4948
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4949
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4950 4950
 				}
4951 4951
 			}
4952 4952
 		}
4953 4953
 	}
4954
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4954
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4955 4955
 
4956 4956
 	return $translation_texts;
4957 4957
 }
@@ -4966,27 +4966,27 @@  discard block
 block discarded – undo
4966 4966
  *
4967 4967
  * @return array Location terms.
4968 4968
  */
4969
-function geodir_remove_location_terms( $location_terms = array() ) {
4970
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
4969
+function geodir_remove_location_terms($location_terms = array()) {
4970
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4971 4971
 
4972
-	if ( ! empty( $location_terms ) && $location_manager ) {
4973
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
4974
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
4972
+	if (!empty($location_terms) && $location_manager) {
4973
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4974
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
4975 4975
 
4976
-		if ( $hide_region_part && $hide_country_part ) {
4977
-			if ( isset( $location_terms['gd_country'] ) ) {
4978
-				unset( $location_terms['gd_country'] );
4976
+		if ($hide_region_part && $hide_country_part) {
4977
+			if (isset($location_terms['gd_country'])) {
4978
+				unset($location_terms['gd_country']);
4979 4979
 			}
4980
-			if ( isset( $location_terms['gd_region'] ) ) {
4981
-				unset( $location_terms['gd_region'] );
4980
+			if (isset($location_terms['gd_region'])) {
4981
+				unset($location_terms['gd_region']);
4982 4982
 			}
4983
-		} else if ( $hide_region_part && ! $hide_country_part ) {
4984
-			if ( isset( $location_terms['gd_region'] ) ) {
4985
-				unset( $location_terms['gd_region'] );
4983
+		} else if ($hide_region_part && !$hide_country_part) {
4984
+			if (isset($location_terms['gd_region'])) {
4985
+				unset($location_terms['gd_region']);
4986 4986
 			}
4987
-		} else if ( ! $hide_region_part && $hide_country_part ) {
4988
-			if ( isset( $location_terms['gd_country'] ) ) {
4989
-				unset( $location_terms['gd_country'] );
4987
+		} else if (!$hide_region_part && $hide_country_part) {
4988
+			if (isset($location_terms['gd_country'])) {
4989
+				unset($location_terms['gd_country']);
4990 4990
 			}
4991 4991
 		}
4992 4992
 	}
@@ -4997,7 +4997,7 @@  discard block
 block discarded – undo
4997 4997
 	 * @since 1.6.22
4998 4998
 	 * @param array $location_terms The array of location terms.
4999 4999
 	 */
5000
-	return apply_filters('geodir_remove_location_terms',$location_terms);
5000
+	return apply_filters('geodir_remove_location_terms', $location_terms);
5001 5001
 }
5002 5002
 
5003 5003
 /**
@@ -5013,40 +5013,40 @@  discard block
 block discarded – undo
5013 5013
  * @param WP_Post $post Post object.
5014 5014
  * @param bool $update  Whether this is an existing listing being updated or not.
5015 5015
  */
5016
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5016
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5017 5017
 	global $gd_notified_edited;
5018 5018
 	
5019
-	if ( ! $update ) {
5019
+	if (!$update) {
5020 5020
 		return;
5021 5021
 	}
5022 5022
 
5023
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5024
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5023
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5024
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5025 5025
 	$inline_save = $action == 'inline-save' ? true : false;
5026 5026
 
5027
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5027
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5028 5028
 		return;
5029 5029
 	}
5030 5030
 
5031
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5031
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5032 5032
 		return;
5033 5033
 	}
5034 5034
 
5035 5035
 	$user_id = (int) get_current_user_id();
5036 5036
 
5037
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5038
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5037
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5038
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5039 5039
 
5040
-		if ( $user_id == $author_id && ! is_super_admin() && empty( $gd_notified_edited[$post_ID] ) ) {
5041
-			if ( !empty( $gd_notified_edited ) ) {
5040
+		if ($user_id == $author_id && !is_super_admin() && empty($gd_notified_edited[$post_ID])) {
5041
+			if (!empty($gd_notified_edited)) {
5042 5042
 				$gd_notified_edited = array();
5043 5043
 			}
5044 5044
 			$gd_notified_edited[$post_ID] = true;
5045 5045
 			
5046
-			$from_email   = get_option( 'site_email' );
5046
+			$from_email   = get_option('site_email');
5047 5047
 			$from_name    = get_site_emailName();
5048
-			$to_email     = get_option( 'admin_email' );
5049
-			$to_name      = get_option( 'name' );
5048
+			$to_email     = get_option('admin_email');
5049
+			$to_name      = get_option('name');
5050 5050
 			$message_type = 'listing_edited';
5051 5051
 
5052 5052
 			$notify_edited = true;
@@ -5058,9 +5058,9 @@  discard block
 block discarded – undo
5058 5058
 			 * @param bool $notify_edited Notify on listing edited by author?
5059 5059
 			 * @param object $post        The current post object.
5060 5060
 			 */
5061
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5061
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5062 5062
 
5063
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5063
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5064 5064
 		}
5065 5065
 	}
5066 5066
 }
@@ -5075,14 +5075,14 @@  discard block
 block discarded – undo
5075 5075
  *
5076 5076
  * @return string|null The current page start & end numbering.
5077 5077
  */
5078
-function geodir_title_meta_page( $sep ) {
5078
+function geodir_title_meta_page($sep) {
5079 5079
 	$replacement = null;
5080 5080
 
5081
-	$max = geodir_title_meta_pagenumbering( 'max' );
5082
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5081
+	$max = geodir_title_meta_pagenumbering('max');
5082
+	$nr  = geodir_title_meta_pagenumbering('nr');
5083 5083
 
5084
-	if ( $max > 1 && $nr > 1 ) {
5085
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5084
+	if ($max > 1 && $nr > 1) {
5085
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5086 5086
 	}
5087 5087
 
5088 5088
 	return $replacement;
@@ -5099,8 +5099,8 @@  discard block
 block discarded – undo
5099 5099
 function geodir_title_meta_pagenumber() {
5100 5100
 	$replacement = null;
5101 5101
 
5102
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5103
-	if ( isset( $nr ) && $nr > 0 ) {
5102
+	$nr = geodir_title_meta_pagenumbering('nr');
5103
+	if (isset($nr) && $nr > 0) {
5104 5104
 		$replacement = (string) $nr;
5105 5105
 	}
5106 5106
 
@@ -5118,8 +5118,8 @@  discard block
 block discarded – undo
5118 5118
 function geodir_title_meta_pagetotal() {
5119 5119
 	$replacement = null;
5120 5120
 
5121
-	$max = geodir_title_meta_pagenumbering( 'max' );
5122
-	if ( isset( $max ) && $max > 0 ) {
5121
+	$max = geodir_title_meta_pagenumbering('max');
5122
+	if (isset($max) && $max > 0) {
5123 5123
 		$replacement = (string) $max;
5124 5124
 	}
5125 5125
 
@@ -5139,36 +5139,36 @@  discard block
 block discarded – undo
5139 5139
  *
5140 5140
  * @return int|null The current page numbering.
5141 5141
  */
5142
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5142
+function geodir_title_meta_pagenumbering($request = 'nr') {
5143 5143
 	global $wp_query, $post;
5144 5144
 	$max_num_pages = null;
5145 5145
 	$page_number   = null;
5146 5146
 
5147 5147
 	$max_num_pages = 1;
5148 5148
 
5149
-	if ( ! is_singular() ) {
5150
-		$page_number = get_query_var( 'paged' );
5151
-		if ( $page_number === 0 || $page_number === '' ) {
5149
+	if (!is_singular()) {
5150
+		$page_number = get_query_var('paged');
5151
+		if ($page_number === 0 || $page_number === '') {
5152 5152
 			$page_number = 1;
5153 5153
 		}
5154 5154
 
5155
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5155
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5156 5156
 			$max_num_pages = $wp_query->max_num_pages;
5157 5157
 		}
5158 5158
 	} else {
5159
-		$page_number = get_query_var( 'page' );
5160
-		if ( $page_number === 0 || $page_number === '' ) {
5159
+		$page_number = get_query_var('page');
5160
+		if ($page_number === 0 || $page_number === '') {
5161 5161
 			$page_number = 1;
5162 5162
 		}
5163 5163
 
5164
-		if ( isset( $post->post_content ) ) {
5165
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5164
+		if (isset($post->post_content)) {
5165
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5166 5166
 		}
5167 5167
 	}
5168 5168
 
5169 5169
 	$return = null;
5170 5170
 
5171
-	switch ( $request ) {
5171
+	switch ($request) {
5172 5172
 		case 'nr':
5173 5173
 			$return = $page_number;
5174 5174
 			break;
@@ -5189,14 +5189,14 @@  discard block
 block discarded – undo
5189 5189
  *
5190 5190
  * @return array Terms.
5191 5191
  */
5192
-function geodir_filter_empty_terms( $terms ) {
5193
-	if ( empty( $terms ) ) {
5192
+function geodir_filter_empty_terms($terms) {
5193
+	if (empty($terms)) {
5194 5194
 		return $terms;
5195 5195
 	}
5196 5196
 
5197 5197
 	$return = array();
5198
-	foreach ( $terms as $term ) {
5199
-		if ( isset( $term->count ) && $term->count > 0 ) {
5198
+	foreach ($terms as $term) {
5199
+		if (isset($term->count) && $term->count > 0) {
5200 5200
 			$return[] = $term;
5201 5201
 		} else {
5202 5202
 			/**
@@ -5207,7 +5207,7 @@  discard block
 block discarded – undo
5207 5207
 			 * @param array $return The array of terms to return.
5208 5208
 			 * @param object $term  The term object.
5209 5209
 			 */
5210
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5210
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5211 5211
 		}
5212 5212
 	}
5213 5213
 
@@ -5224,15 +5224,15 @@  discard block
 block discarded – undo
5224 5224
  *
5225 5225
  * @return array
5226 5226
  */
5227
-function geodir_remove_hentry( $class ) {
5228
-	if ( geodir_is_page( 'detail' ) ) {
5229
-		$class = array_diff( $class, array( 'hentry' ) );
5227
+function geodir_remove_hentry($class) {
5228
+	if (geodir_is_page('detail')) {
5229
+		$class = array_diff($class, array('hentry'));
5230 5230
 	}
5231 5231
 
5232 5232
 	return $class;
5233 5233
 }
5234 5234
 
5235
-add_filter( 'post_class', 'geodir_remove_hentry' );
5235
+add_filter('post_class', 'geodir_remove_hentry');
5236 5236
 
5237 5237
 /**
5238 5238
  * Registers a individual text string for WPML translation.
@@ -5244,8 +5244,8 @@  discard block
 block discarded – undo
5244 5244
  * @param string $domain The plugin domain. Default geodirectory.
5245 5245
  * @param string $name The name of the string which helps to know what's being translated.
5246 5246
  */
5247
-function geodir_wpml_register_string( $string, $domain = 'geodirectory', $name = '' ) {
5248
-    do_action( 'wpml_register_single_string', $domain, $name, $string );
5247
+function geodir_wpml_register_string($string, $domain = 'geodirectory', $name = '') {
5248
+    do_action('wpml_register_single_string', $domain, $name, $string);
5249 5249
 }
5250 5250
 
5251 5251
 /**
@@ -5260,6 +5260,6 @@  discard block
 block discarded – undo
5260 5260
  * @param string $language_code Return the translation in this language. Default is NULL which returns the current language.
5261 5261
  * @return string The translated string.
5262 5262
  */
5263
-function geodir_wpml_translate_string( $string, $domain = 'geodirectory', $name = '', $language_code = NULL ) {
5264
-    return apply_filters( 'wpml_translate_single_string', $string, $domain, $name, $language_code );
5263
+function geodir_wpml_translate_string($string, $domain = 'geodirectory', $name = '', $language_code = NULL) {
5264
+    return apply_filters('wpml_translate_single_string', $string, $domain, $name, $language_code);
5265 5265
 }
5266 5266
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/notifications_settings_array.php 1 patch
Indentation   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -17,314 +17,314 @@
 block discarded – undo
17 17
 $geodir_settings['notifications_settings'] = apply_filters('geodir_notifications_settings', array(
18 18
 
19 19
 
20
-    array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
-
22
-
23
-    array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
-
25
-    array(
26
-        'name' => __('List of usable shortcodes', 'geodirectory'),
27
-        'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
-        'id' => 'geodir_list_of_usable_shordcodes',
29
-        'type' => 'html_content',
30
-        'css' => 'min-width:300px;',
31
-        'std' => 'All Places' // Default value for the page title - changed in settings
32
-    ),
33
-
34
-    array(
35
-        'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
-        'desc' => __('Yes', 'geodirectory'),
37
-        'id' => 'geodir_tiny_editor',
38
-        'std' => 'yes',
39
-        'type' => 'radio',
40
-        'value' => '1',
41
-        'radiogroup' => 'start'
42
-    ),
43
-    array(
44
-        'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
-        'desc' => __('No', 'geodirectory'),
46
-        'id' => 'geodir_tiny_editor',
47
-        'std' => 'yes',
48
-        'type' => 'radio',
49
-        'value' => '0',
50
-        'radiogroup' => 'end'
51
-    ),
52
-
53
-
54
-    array('type' => 'sectionend', 'id' => 'notification_options'),
55
-
56
-
57
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
-
59
-    array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
-
61
-    array(
62
-        'name' => __('New user registration', 'geodirectory'),
63
-        'desc' => __('Yes', 'geodirectory'),
64
-        'id' => 'geodir_bcc_new_user',
65
-        'std' => 'yes',
66
-        'type' => 'radio',
67
-        'value' => '1',
68
-        'radiogroup' => 'start'
69
-    ),
70
-    array(
71
-        'name' => __('New user registration', 'geodirectory'),
72
-        'desc' => __('No', 'geodirectory'),
73
-        'id' => 'geodir_bcc_new_user',
74
-        'std' => 'yes',
75
-        'type' => 'radio',
76
-        'value' => '0',
77
-        'radiogroup' => 'end'
78
-    ),
79
-
80
-    array(
81
-        'name' => __('Send to friend', 'geodirectory'),
82
-        'desc' => __('Yes', 'geodirectory'),
83
-        'id' => 'geodir_bcc_friend',
84
-        'std' => 'yes',
85
-        'type' => 'radio',
86
-        'value' => '1',
87
-        'radiogroup' => 'start'
88
-    ),
89
-    array(
90
-        'name' => __('Send to friend', 'geodirectory'),
91
-        'desc' => __('No', 'geodirectory'),
92
-        'id' => 'geodir_bcc_friend',
93
-        'std' => 'yes',
94
-        'type' => 'radio',
95
-        'value' => '0',
96
-        'radiogroup' => 'end'
97
-    ),
98
-
99
-    array(
100
-        'name' => __('Send enquiry', 'geodirectory'),
101
-        'desc' => __('Yes', 'geodirectory'),
102
-        'id' => 'geodir_bcc_enquiry',
103
-        'std' => 'yes',
104
-        'type' => 'radio',
105
-        'value' => '1',
106
-        'radiogroup' => 'start'
107
-    ),
108
-    array(
109
-        'name' => __('Send enquiry', 'geodirectory'),
110
-        'desc' => __('No', 'geodirectory'),
111
-        'id' => 'geodir_bcc_enquiry',
112
-        'std' => 'yes',
113
-        'type' => 'radio',
114
-        'value' => '0',
115
-        'radiogroup' => 'end'
116
-    ),
117
-
118
-
119
-    array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
-
121
-
122
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
-
124
-    array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
-
126
-    array(
127
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
128
-        'desc' => __('Yes', 'geodirectory'),
129
-        'id' => 'geodir_notify_post_submit',
130
-        'std' => '1',
131
-        'type' => 'radio',
132
-        'value' => '1',
133
-        'radiogroup' => 'start'
134
-    ),
135
-    array(
136
-        'name' => __('Notify to admin on post submit', 'geodirectory'),
137
-        'desc' => __('No', 'geodirectory'),
138
-        'id' => 'geodir_notify_post_submit',
139
-        'std' => '1',
140
-        'type' => 'radio',
141
-        'value' => '0',
142
-        'radiogroup' => 'end'
143
-    ),
144
-    array(
145
-        'name' => __('Post submit success to admin email', 'geodirectory'),
146
-        'desc' => '',
147
-        'id' => 'geodir_post_submited_success_email_subject_admin',
148
-        'type' => 'text',
149
-        'css' => 'min-width:300px;',
150
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
151
-    ),
152
-     array(
153
-        'name' => '',
154
-        'desc' => '',
155
-        'id' => 'geodir_post_submited_success_email_content_admin',
156
-        'css' => 'width:500px; height: 150px;',
157
-        'type' => 'textarea',
158
-        'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
159
-    ),
160
-    array(
161
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
162
-        'desc' => __('Yes', 'geodirectory'),
163
-        'id' => 'geodir_notify_post_edited',
164
-        'std' => '0',
165
-        'type' => 'radio',
166
-        'value' => '1',
167
-        'radiogroup' => 'start'
168
-    ),
169
-    array(
170
-        'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
171
-        'desc' => __('No', 'geodirectory'),
172
-        'id' => 'geodir_notify_post_edited',
173
-        'std' => '0',
174
-        'type' => 'radio',
175
-        'value' => '0',
176
-        'radiogroup' => 'end'
177
-    ),
178
-    array(
179
-        'name' => __('Listing edited by Author', 'geodirectory'),
180
-        'desc' => '',
181
-        'id' => 'geodir_post_edited_email_subject_admin',
182
-        'type' => 'text',
183
-        'css' => 'min-width:300px;',
184
-        'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
185
-    ),
186
-    array(
187
-        'name' => '',
188
-        'desc' => '',
189
-        'id' => 'geodir_post_edited_email_content_admin',
190
-        'css' => 'width:500px; height: 150px;',
191
-        'type' => 'textarea',
192
-        'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
193
-    ),
194
-
195
-
196
-    array('type' => 'sectionend', 'id' => 'admin_emails'),
197
-
198
-
199
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
200
-
201
-    array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
202
-
203
-    array(
204
-        'name' => __('Post submit success to client email', 'geodirectory'),
205
-        'desc' => '',
206
-        'id' => 'geodir_post_submited_success_email_subject',
207
-        'type' => 'text',
208
-        'css' => 'min-width:300px;',
209
-        'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
210
-    ),
211
-    array(
212
-        'name' => '',
213
-        'desc' => '',
214
-        'id' => 'geodir_post_submited_success_email_content',
215
-        'css' => 'width:500px; height: 150px;',
216
-        'type' => 'textarea',
217
-        'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
218
-    ),
219
-
220
-
221
-    array(
222
-        'name' => __('User forgot password email', 'geodirectory'),
223
-        'desc' => '',
224
-        'id' => 'geodir_forgot_password_subject',
225
-        'type' => 'text',
226
-        'css' => 'min-width:300px;',
227
-        'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
228
-    ),
229
-    array(
230
-        'name' => '',
231
-        'desc' => '',
232
-        'id' => 'geodir_forgot_password_content',
233
-        'css' => 'width:500px; height: 150px;',
234
-        'type' => 'textarea',
235
-        'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Registration success email', 'geodirectory'),
240
-        'desc' => '',
241
-        'id' => 'geodir_registration_success_email_subject',
242
-        'type' => 'text',
243
-        'css' => 'min-width:300px;',
244
-        'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
245
-    ),
246
-    array(
247
-        'name' => '',
248
-        'desc' => '',
249
-        'id' => 'geodir_registration_success_email_content',
250
-        'css' => 'width:500px; height: 150px;',
251
-        'type' => 'textarea',
252
-        'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
253
-    ),
254
-    array(
255
-        'name' => __('Listing published email', 'geodirectory'),
256
-        'desc' => '',
257
-        'id' => 'geodir_post_published_email_subject',
258
-        'type' => 'text',
259
-        'css' => 'min-width:300px;',
260
-        'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
261
-    ),
262
-    array(
263
-        'name' => '',
264
-        'desc' => '',
265
-        'id' => 'geodir_post_published_email_content',
266
-        'css' => 'width:500px; height: 150px;',
267
-        'type' => 'textarea',
268
-        'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
269
-    ),
270
-
271
-    array('type' => 'sectionend', 'id' => 'client_emails'),
272
-
273
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
274
-
275
-    array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
276
-
277
-    array(
278
-        'name' => __('Send to friend', 'geodirectory'),
279
-        'desc' => '',
280
-        'id' => 'geodir_email_friend_subject',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
284
-    ),
285
-    array(
286
-        'name' => '',
287
-        'desc' => '',
288
-        'id' => 'geodir_email_friend_content',
289
-        'css' => 'width:500px; height: 150px;',
290
-        'type' => 'textarea',
291
-        'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
292
-    ),
293
-
294
-    array(
295
-        'name' => __('Email enquiry', 'geodirectory'),
296
-        'desc' => '',
297
-        'id' => 'geodir_email_enquiry_subject',
298
-        'type' => 'text',
299
-        'css' => 'min-width:300px;',
300
-        'std' => __('Website Enquiry', 'geodirectory')
301
-    ),
302
-    array(
303
-        'name' => '',
304
-        'desc' => '',
305
-        'id' => 'geodir_email_enquiry_content',
306
-        'css' => 'width:500px; height: 150px;',
307
-        'type' => 'textarea',
308
-        'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
309
-    ),
310
-
311
-    array('type' => 'sectionend', 'id' => 'other_emails'),
312
-
313
-
314
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
315
-
316
-    array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
317
-
318
-    array(
319
-        'name' => __('Post submitted success', 'geodirectory'),
320
-        'desc' => '',
321
-        'id' => 'geodir_post_added_success_msg_content',
322
-        'css' => 'width:500px; height: 150px;',
323
-        'type' => 'textarea',
324
-        'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
325
-    ),
326
-
327
-
328
-    array('type' => 'sectionend', 'id' => 'messages'),
20
+	array('name' => __('Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'notification_options'),
21
+
22
+
23
+	array('name' => __('Notification Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'notification_options'),
24
+
25
+	array(
26
+		'name' => __('List of usable shortcodes', 'geodirectory'),
27
+		'desc' => __('[#client_name#],[#listing_link#],[#posted_date#],[#number_of_days#],[#number_of_grace_days#],[#login_url#],[#username#],[#user_email#],[#site_name_url#],[#renew_link#],[#post_id#],[#site_name#],[#from_email#](in most cases this will be the admin email, except for popup forms)', 'geodirectory'),
28
+		'id' => 'geodir_list_of_usable_shordcodes',
29
+		'type' => 'html_content',
30
+		'css' => 'min-width:300px;',
31
+		'std' => 'All Places' // Default value for the page title - changed in settings
32
+	),
33
+
34
+	array(
35
+		'name' => __('Use advanced editor? (slow loading)', 'geodirectory'),
36
+		'desc' => __('Yes', 'geodirectory'),
37
+		'id' => 'geodir_tiny_editor',
38
+		'std' => 'yes',
39
+		'type' => 'radio',
40
+		'value' => '1',
41
+		'radiogroup' => 'start'
42
+	),
43
+	array(
44
+		'name' => __('Use advanced editor?(slow loading)', 'geodirectory'),
45
+		'desc' => __('No', 'geodirectory'),
46
+		'id' => 'geodir_tiny_editor',
47
+		'std' => 'yes',
48
+		'type' => 'radio',
49
+		'value' => '0',
50
+		'radiogroup' => 'end'
51
+	),
52
+
53
+
54
+	array('type' => 'sectionend', 'id' => 'notification_options'),
55
+
56
+
57
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'site_bcc_options'),
58
+
59
+	array('name' => __('Site Bcc Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'site_bcc_options'),
60
+
61
+	array(
62
+		'name' => __('New user registration', 'geodirectory'),
63
+		'desc' => __('Yes', 'geodirectory'),
64
+		'id' => 'geodir_bcc_new_user',
65
+		'std' => 'yes',
66
+		'type' => 'radio',
67
+		'value' => '1',
68
+		'radiogroup' => 'start'
69
+	),
70
+	array(
71
+		'name' => __('New user registration', 'geodirectory'),
72
+		'desc' => __('No', 'geodirectory'),
73
+		'id' => 'geodir_bcc_new_user',
74
+		'std' => 'yes',
75
+		'type' => 'radio',
76
+		'value' => '0',
77
+		'radiogroup' => 'end'
78
+	),
79
+
80
+	array(
81
+		'name' => __('Send to friend', 'geodirectory'),
82
+		'desc' => __('Yes', 'geodirectory'),
83
+		'id' => 'geodir_bcc_friend',
84
+		'std' => 'yes',
85
+		'type' => 'radio',
86
+		'value' => '1',
87
+		'radiogroup' => 'start'
88
+	),
89
+	array(
90
+		'name' => __('Send to friend', 'geodirectory'),
91
+		'desc' => __('No', 'geodirectory'),
92
+		'id' => 'geodir_bcc_friend',
93
+		'std' => 'yes',
94
+		'type' => 'radio',
95
+		'value' => '0',
96
+		'radiogroup' => 'end'
97
+	),
98
+
99
+	array(
100
+		'name' => __('Send enquiry', 'geodirectory'),
101
+		'desc' => __('Yes', 'geodirectory'),
102
+		'id' => 'geodir_bcc_enquiry',
103
+		'std' => 'yes',
104
+		'type' => 'radio',
105
+		'value' => '1',
106
+		'radiogroup' => 'start'
107
+	),
108
+	array(
109
+		'name' => __('Send enquiry', 'geodirectory'),
110
+		'desc' => __('No', 'geodirectory'),
111
+		'id' => 'geodir_bcc_enquiry',
112
+		'std' => 'yes',
113
+		'type' => 'radio',
114
+		'value' => '0',
115
+		'radiogroup' => 'end'
116
+	),
117
+
118
+
119
+	array('type' => 'sectionend', 'id' => 'site_bcc_options'),
120
+
121
+
122
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'admin_emails'),
123
+
124
+	array('name' => __('Admin Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'admin_emails'),
125
+
126
+	array(
127
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
128
+		'desc' => __('Yes', 'geodirectory'),
129
+		'id' => 'geodir_notify_post_submit',
130
+		'std' => '1',
131
+		'type' => 'radio',
132
+		'value' => '1',
133
+		'radiogroup' => 'start'
134
+	),
135
+	array(
136
+		'name' => __('Notify to admin on post submit', 'geodirectory'),
137
+		'desc' => __('No', 'geodirectory'),
138
+		'id' => 'geodir_notify_post_submit',
139
+		'std' => '1',
140
+		'type' => 'radio',
141
+		'value' => '0',
142
+		'radiogroup' => 'end'
143
+	),
144
+	array(
145
+		'name' => __('Post submit success to admin email', 'geodirectory'),
146
+		'desc' => '',
147
+		'id' => 'geodir_post_submited_success_email_subject_admin',
148
+		'type' => 'text',
149
+		'css' => 'min-width:300px;',
150
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
151
+	),
152
+	 array(
153
+		'name' => '',
154
+		'desc' => '',
155
+		'id' => 'geodir_post_submited_success_email_content_admin',
156
+		'css' => 'width:500px; height: 150px;',
157
+		'type' => 'textarea',
158
+		'std' => __('<p>Dear Admin,</p><p>A new  listing has been published [#listing_link#]. This email is just for your information.</p><br><p>[#site_name#]</p>','geodirectory')
159
+	),
160
+	array(
161
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
162
+		'desc' => __('Yes', 'geodirectory'),
163
+		'id' => 'geodir_notify_post_edited',
164
+		'std' => '0',
165
+		'type' => 'radio',
166
+		'value' => '1',
167
+		'radiogroup' => 'start'
168
+	),
169
+	array(
170
+		'name' => __('Notify Admin when listing edited by Author', 'geodirectory'),
171
+		'desc' => __('No', 'geodirectory'),
172
+		'id' => 'geodir_notify_post_edited',
173
+		'std' => '0',
174
+		'type' => 'radio',
175
+		'value' => '0',
176
+		'radiogroup' => 'end'
177
+	),
178
+	array(
179
+		'name' => __('Listing edited by Author', 'geodirectory'),
180
+		'desc' => '',
181
+		'id' => 'geodir_post_edited_email_subject_admin',
182
+		'type' => 'text',
183
+		'css' => 'min-width:300px;',
184
+		'std' => __('[[#site_name#]] Listing edited by Author', 'geodirectory')
185
+	),
186
+	array(
187
+		'name' => '',
188
+		'desc' => '',
189
+		'id' => 'geodir_post_edited_email_content_admin',
190
+		'css' => 'width:500px; height: 150px;',
191
+		'type' => 'textarea',
192
+		'std' => __('<p>Dear Admin,</p><p>A listing [#listing_link#] has been edited by it\'s author [#post_author_name#].</p><br><p><b>Listing Details:</b></p><p>Listing ID: [#post_id#]</p><p>Listing URL: [#listing_link#]</p><p>Date: [#current_date#]</p><br><p>This email is just for your information.</p><p>[#site_name#]</p>', 'geodirectory')
193
+	),
194
+
195
+
196
+	array('type' => 'sectionend', 'id' => 'admin_emails'),
197
+
198
+
199
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'client_emails'),
200
+
201
+	array('name' => __('Client Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'client_emails'),
202
+
203
+	array(
204
+		'name' => __('Post submit success to client email', 'geodirectory'),
205
+		'desc' => '',
206
+		'id' => 'geodir_post_submited_success_email_subject',
207
+		'type' => 'text',
208
+		'css' => 'min-width:300px;',
209
+		'std' => __('Post Submitted Successfully','geodirectory') // Default value for the page title - changed in settings
210
+	),
211
+	array(
212
+		'name' => '',
213
+		'desc' => '',
214
+		'id' => 'geodir_post_submited_success_email_content',
215
+		'css' => 'width:500px; height: 150px;',
216
+		'type' => 'textarea',
217
+		'std' => __('<p>Dear [#client_name#],</p><p>You submitted the below listing information. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>','geodirectory')
218
+	),
219
+
220
+
221
+	array(
222
+		'name' => __('User forgot password email', 'geodirectory'),
223
+		'desc' => '',
224
+		'id' => 'geodir_forgot_password_subject',
225
+		'type' => 'text',
226
+		'css' => 'min-width:300px;',
227
+		'std' => __('[#site_name#] - Your new password', 'geodirectory') // Default value for the page title - changed in settings
228
+	),
229
+	array(
230
+		'name' => '',
231
+		'desc' => '',
232
+		'id' => 'geodir_forgot_password_content',
233
+		'css' => 'width:500px; height: 150px;',
234
+		'type' => 'textarea',
235
+		'std' => __("<p>Dear [#client_name#],<p><p>You requested a new password for [#site_name_url#]</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
236
+	),
237
+
238
+	array(
239
+		'name' => __('Registration success email', 'geodirectory'),
240
+		'desc' => '',
241
+		'id' => 'geodir_registration_success_email_subject',
242
+		'type' => 'text',
243
+		'css' => 'min-width:300px;',
244
+		'std' => __('Your Log In Details', 'geodirectory') // Default value for the page title - changed in settings
245
+	),
246
+	array(
247
+		'name' => '',
248
+		'desc' => '',
249
+		'id' => 'geodir_registration_success_email_content',
250
+		'css' => 'width:500px; height: 150px;',
251
+		'type' => 'textarea',
252
+		'std' => __("<p>Dear [#client_name#],</p><p>You can log in  with the following information:</p><p>[#login_details#]</p><p>You can login here: [#login_url#]</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
253
+	),
254
+	array(
255
+		'name' => __('Listing published email', 'geodirectory'),
256
+		'desc' => '',
257
+		'id' => 'geodir_post_published_email_subject',
258
+		'type' => 'text',
259
+		'css' => 'min-width:300px;',
260
+		'std' => __('Listing Published Successfully', 'geodirectory') // Default value for the page title - changed in settings
261
+	),
262
+	array(
263
+		'name' => '',
264
+		'desc' => '',
265
+		'id' => 'geodir_post_published_email_content',
266
+		'css' => 'width:500px; height: 150px;',
267
+		'type' => 'textarea',
268
+		'std' => __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory')
269
+	),
270
+
271
+	array('type' => 'sectionend', 'id' => 'client_emails'),
272
+
273
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'other_emails'),
274
+
275
+	array('name' => __('Other Emails', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'other_emails'),
276
+
277
+	array(
278
+		'name' => __('Send to friend', 'geodirectory'),
279
+		'desc' => '',
280
+		'id' => 'geodir_email_friend_subject',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => __('[#from_name#] thought you might be interested in..', 'geodirectory')
284
+	),
285
+	array(
286
+		'name' => '',
287
+		'desc' => '',
288
+		'id' => 'geodir_email_friend_content',
289
+		'css' => 'width:500px; height: 150px;',
290
+		'type' => 'textarea',
291
+		'std' => __("<p>Dear [#to_name#],<p><p>Your friend has sent you a message from <b>[#site_name#]</b> </p><p>===============================</p><p><b>Subject : [#subject#]</b></p><p>[#comments#] [#listing_link#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name#].</p>",'geodirectory')
292
+	),
293
+
294
+	array(
295
+		'name' => __('Email enquiry', 'geodirectory'),
296
+		'desc' => '',
297
+		'id' => 'geodir_email_enquiry_subject',
298
+		'type' => 'text',
299
+		'css' => 'min-width:300px;',
300
+		'std' => __('Website Enquiry', 'geodirectory')
301
+	),
302
+	array(
303
+		'name' => '',
304
+		'desc' => '',
305
+		'id' => 'geodir_email_enquiry_content',
306
+		'css' => 'width:500px; height: 150px;',
307
+		'type' => 'textarea',
308
+		'std' => __("<p>Dear [#to_name#],<p><p>An enquiry has been sent from <b>[#listing_link#]</b></p><p>===============================</p><p>[#comments#]</p><p>===============================</p><p>Thank you,<br /><br />[#site_name_url#].</p>",'geodirectory')
309
+	),
310
+
311
+	array('type' => 'sectionend', 'id' => 'other_emails'),
312
+
313
+
314
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'messages'),
315
+
316
+	array('name' => __('Messages', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'messages'),
317
+
318
+	array(
319
+		'name' => __('Post submitted success', 'geodirectory'),
320
+		'desc' => '',
321
+		'id' => 'geodir_post_added_success_msg_content',
322
+		'css' => 'width:500px; height: 150px;',
323
+		'type' => 'textarea',
324
+		'std' => __('<p>Thank you, your information has been successfully received.</p><p><a href="[#submited_information_link#]" >View your submitted information &raquo;</a></p><p>Thank you for visiting us at [#site_name#].</p>','geodirectory')
325
+	),
326
+
327
+
328
+	array('type' => 'sectionend', 'id' => 'messages'),
329 329
 
330 330
 )); // End Manage NOtifications settings
Please login to merge, or discard this patch.
upgrade.php 2 patches
Indentation   +661 added lines, -661 removed lines patch added patch discarded remove patch
@@ -10,53 +10,53 @@  discard block
 block discarded – undo
10 10
 global $wpdb;
11 11
 
12 12
 if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
13
-    /**
14
-     * Include custom database table related functions.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     */
19
-    include_once('geodirectory-admin/admin_db_install.php');
20
-    add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
-    if (GEODIRECTORY_VERSION <= '1.3.6') {
22
-        add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
-    }
24
-
25
-    if (GEODIRECTORY_VERSION <= '1.4.6') {
26
-        add_action('init', 'geodir_upgrade_146', 11);
27
-    }
28
-
29
-    if (GEODIRECTORY_VERSION <= '1.4.8') {
30
-        add_action('init', 'geodir_upgrade_148', 11);
31
-    }
32
-
33
-    if (GEODIRECTORY_VERSION <= '1.5.0') {
34
-        add_action('init', 'geodir_upgrade_150', 11);
35
-    }
36
-
37
-    if (GEODIRECTORY_VERSION <= '1.5.2') {
38
-        add_action('init', 'geodir_upgrade_152', 11);
39
-    }
40
-
41
-    if (GEODIRECTORY_VERSION <= '1.5.3') {
42
-        add_action('init', 'geodir_upgrade_153', 11);
43
-    }
44
-
45
-    if (GEODIRECTORY_VERSION <= '1.5.4') {
46
-        add_action('init', 'geodir_upgrade_154', 11);
47
-    }
13
+	/**
14
+	 * Include custom database table related functions.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 */
19
+	include_once('geodirectory-admin/admin_db_install.php');
20
+	add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
+	if (GEODIRECTORY_VERSION <= '1.3.6') {
22
+		add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
+	}
24
+
25
+	if (GEODIRECTORY_VERSION <= '1.4.6') {
26
+		add_action('init', 'geodir_upgrade_146', 11);
27
+	}
28
+
29
+	if (GEODIRECTORY_VERSION <= '1.4.8') {
30
+		add_action('init', 'geodir_upgrade_148', 11);
31
+	}
32
+
33
+	if (GEODIRECTORY_VERSION <= '1.5.0') {
34
+		add_action('init', 'geodir_upgrade_150', 11);
35
+	}
36
+
37
+	if (GEODIRECTORY_VERSION <= '1.5.2') {
38
+		add_action('init', 'geodir_upgrade_152', 11);
39
+	}
40
+
41
+	if (GEODIRECTORY_VERSION <= '1.5.3') {
42
+		add_action('init', 'geodir_upgrade_153', 11);
43
+	}
44
+
45
+	if (GEODIRECTORY_VERSION <= '1.5.4') {
46
+		add_action('init', 'geodir_upgrade_154', 11);
47
+	}
48 48
     
49
-    if (GEODIRECTORY_VERSION <= '1.6.18') {
50
-        add_action('init', 'geodir_upgrade_1618', 11);
51
-    }
49
+	if (GEODIRECTORY_VERSION <= '1.6.18') {
50
+		add_action('init', 'geodir_upgrade_1618', 11);
51
+	}
52 52
     
53
-    if (GEODIRECTORY_VERSION <= '1.6.22') {
54
-        add_action('init', 'geodir_upgrade_1622', 11);
55
-    }
53
+	if (GEODIRECTORY_VERSION <= '1.6.22') {
54
+		add_action('init', 'geodir_upgrade_1622', 11);
55
+	}
56 56
 
57
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
57
+	add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
58 58
 
59
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
59
+	update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
60 60
 
61 61
 }
62 62
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
  */
70 70
 function geodirectory_upgrade_all()
71 71
 {
72
-    geodir_create_tables();
73
-    geodir_update_review_db();
74
-    gd_install_theme_compat();
75
-    gd_convert_custom_field_display();
72
+	geodir_create_tables();
73
+	geodir_update_review_db();
74
+	gd_install_theme_compat();
75
+	gd_convert_custom_field_display();
76 76
 }
77 77
 
78 78
 /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function geodir_upgrade_136()
85 85
 {
86
-    geodir_fix_review_overall_rating();
86
+	geodir_fix_review_overall_rating();
87 87
 }
88 88
 
89 89
 /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
  * @package GeoDirectory
94 94
  */
95 95
 function geodir_upgrade_146(){
96
-    gd_convert_virtual_pages();
96
+	gd_convert_virtual_pages();
97 97
 }
98 98
 
99 99
 /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  * @package GeoDirectory
104 104
  */
105 105
 function geodir_upgrade_150(){
106
-    gd_fix_cpt_rewrite_slug();
106
+	gd_fix_cpt_rewrite_slug();
107 107
 }
108 108
 
109 109
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @package GeoDirectory
116 116
  */
117 117
 function geodir_upgrade_148(){
118
-    /*
118
+	/*
119 119
      * Blank the users google password if present as we now use oAuth 2.0
120 120
      */
121
-    update_option('geodir_ga_pass','');
122
-    update_option('geodir_ga_user','');
121
+	update_option('geodir_ga_pass','');
122
+	update_option('geodir_ga_user','');
123 123
 
124 124
 }
125 125
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  * @package GeoDirectory
132 132
  */
133 133
 function geodir_upgrade_153(){
134
-    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
135
-    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
134
+	geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
135
+	geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
136 136
 }
137 137
 
138 138
 /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
  * @package GeoDirectory
143 143
  */
144 144
 function geodir_upgrade_154(){
145
-    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
145
+	geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
146 146
 }
147 147
 
148 148
 /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  * @package GeoDirectory
153 153
  */
154 154
 function geodir_upgrade_152(){
155
-    gd_fix_address_detail_table_limit();
155
+	gd_fix_address_detail_table_limit();
156 156
 }
157 157
 
158 158
 
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
  */
169 169
 function geodir_update_review_db()
170 170
 {
171
-    global $wpdb, $plugin_prefix;
171
+	global $wpdb, $plugin_prefix;
172 172
 
173
-    geodir_fix_review_date();
174
-    geodir_fix_review_post_status();
175
-    geodir_fix_review_content();
176
-    geodir_fix_review_location();
173
+	geodir_fix_review_date();
174
+	geodir_fix_review_post_status();
175
+	geodir_fix_review_content();
176
+	geodir_fix_review_location();
177 177
 
178 178
 }
179 179
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  */
187 187
 function geodir_fix_review_date()
188 188
 {
189
-    global $wpdb;
190
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
189
+	global $wpdb;
190
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
191 191
 }
192 192
 
193 193
 /**
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
  */
200 200
 function geodir_fix_review_post_status()
201 201
 {
202
-    global $wpdb;
203
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
202
+	global $wpdb;
203
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
204 204
 }
205 205
 
206 206
 /**
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
  */
214 214
 function geodir_fix_review_content()
215 215
 {
216
-    global $wpdb;
217
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
218
-        return true;
219
-    } else {
220
-        return false;
221
-    }
216
+	global $wpdb;
217
+	if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
218
+		return true;
219
+	} else {
220
+		return false;
221
+	}
222 222
 }
223 223
 
224 224
 /**
@@ -231,20 +231,20 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function geodir_fix_review_location()
233 233
 {
234
-    global $wpdb;
234
+	global $wpdb;
235 235
 
236
-    $all_postypes = geodir_get_posttypes();
236
+	$all_postypes = geodir_get_posttypes();
237 237
 
238
-    if (!empty($all_postypes)) {
239
-        foreach ($all_postypes as $key) {
240
-            // update each GD CTP
238
+	if (!empty($all_postypes)) {
239
+		foreach ($all_postypes as $key) {
240
+			// update each GD CTP
241 241
 
242
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
242
+			$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
243 243
 
244
-        }
245
-        return true;
246
-    }
247
-    return false;
244
+		}
245
+		return true;
246
+	}
247
+	return false;
248 248
 }
249 249
 
250 250
 /**
@@ -256,82 +256,82 @@  discard block
 block discarded – undo
256 256
  */
257 257
 function geodir_fix_review_overall_rating()
258 258
 {
259
-    global $wpdb;
259
+	global $wpdb;
260 260
 
261
-    $all_postypes = geodir_get_posttypes();
261
+	$all_postypes = geodir_get_posttypes();
262 262
 
263
-    if (!empty($all_postypes)) {
264
-        foreach ($all_postypes as $key) {
265
-            // update each GD CTP
266
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
263
+	if (!empty($all_postypes)) {
264
+		foreach ($all_postypes as $key) {
265
+			// update each GD CTP
266
+			$reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
267 267
 
268
-            if (!empty($reviews)) {
269
-                foreach ($reviews as $post_id) {
270
-                    geodir_update_postrating($post_id->post_id, $key);
271
-                }
268
+			if (!empty($reviews)) {
269
+				foreach ($reviews as $post_id) {
270
+					geodir_update_postrating($post_id->post_id, $key);
271
+				}
272 272
 
273
-            }
273
+			}
274 274
 
275
-        }
275
+		}
276 276
 
277
-    }
277
+	}
278 278
 }
279 279
 
280 280
 
281 281
 function gd_convert_custom_field_display(){
282
-    global $wpdb;
282
+	global $wpdb;
283 283
 
284
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
284
+	$field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
285 285
 
286
-    $has_run = get_option('gd_convert_custom_field_display');
287
-    if($has_run){return;}
286
+	$has_run = get_option('gd_convert_custom_field_display');
287
+	if($has_run){return;}
288 288
 
289
-    // set the field_type_key for standard fields
290
-    $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
289
+	// set the field_type_key for standard fields
290
+	$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
291 291
 
292 292
 
293
-    if(is_array( $field_info)){
293
+	if(is_array( $field_info)){
294 294
 
295
-        foreach( $field_info as $cf){
295
+		foreach( $field_info as $cf){
296 296
 
297
-            $id = $cf->id;
297
+			$id = $cf->id;
298 298
 
299
-            if(!property_exists($cf,'show_in') || !$id){return;}
299
+			if(!property_exists($cf,'show_in') || !$id){return;}
300 300
 
301
-            $show_in_arr = array();
301
+			$show_in_arr = array();
302 302
 
303
-            if($cf->is_default){
304
-                $show_in_arr[] = "[detail]";
305
-            }
303
+			if($cf->is_default){
304
+				$show_in_arr[] = "[detail]";
305
+			}
306 306
 
307
-            if($cf->show_on_detail){
308
-                $show_in_arr[] = "[moreinfo]";
309
-            }
307
+			if($cf->show_on_detail){
308
+				$show_in_arr[] = "[moreinfo]";
309
+			}
310 310
 
311
-            if($cf->show_on_listing){
312
-                $show_in_arr[] = "[listing]";
313
-            }
311
+			if($cf->show_on_listing){
312
+				$show_in_arr[] = "[listing]";
313
+			}
314 314
 
315
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
316
-                $show_in_arr[] = "[owntab]";
317
-            }
315
+			if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
316
+				$show_in_arr[] = "[owntab]";
317
+			}
318 318
 
319
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
320
-                $show_in_arr[] = "[mapbubble]";
321
-            }
319
+			if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
320
+				$show_in_arr[] = "[mapbubble]";
321
+			}
322 322
 
323
-            if(!empty($show_in_arr )){
324
-                $show_in_arr = implode(',',$show_in_arr);
325
-            }else{
326
-                $show_in_arr = '';
327
-            }
323
+			if(!empty($show_in_arr )){
324
+				$show_in_arr = implode(',',$show_in_arr);
325
+			}else{
326
+				$show_in_arr = '';
327
+			}
328 328
 
329
-            $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
329
+			$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
330 330
 
331
-        }
331
+		}
332 332
 
333
-        update_option('gd_convert_custom_field_display',1);
334
-    }
333
+		update_option('gd_convert_custom_field_display',1);
334
+	}
335 335
 }
336 336
 
337 337
 ############################################
@@ -347,422 +347,422 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function gd_install_theme_compat()
349 349
 {
350
-    global $wpdb;
350
+	global $wpdb;
351 351
 
352
-    $theme_compat = array();
353
-    $theme_compat = get_option('gd_theme_compats');
352
+	$theme_compat = array();
353
+	$theme_compat = get_option('gd_theme_compats');
354 354
 //GDF
355
-    $theme_compat['GeoDirectory_Framework'] = array(
356
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
357
-        'geodir_wrapper_open_class' => '',
358
-        'geodir_wrapper_open_replace' => '',
359
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
360
-        'geodir_wrapper_content_open_id' => 'geodir_content',
361
-        'geodir_wrapper_content_open_class' => '',
362
-        'geodir_wrapper_content_open_replace' => '',
363
-        'geodir_wrapper_content_close_replace' => '',
364
-        'geodir_article_open_id' => '',
365
-        'geodir_article_open_class' => '',
366
-        'geodir_article_open_replace' => '',
367
-        'geodir_article_close_replace' => '',
368
-        'geodir_sidebar_right_open_id' => '',
369
-        'geodir_sidebar_right_open_class' => '',
370
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
371
-        'geodir_sidebar_right_close_replace' => '',
372
-        'geodir_sidebar_left_open_id' => '',
373
-        'geodir_sidebar_left_open_class' => '',
374
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
375
-        'geodir_sidebar_left_close_replace' => '',
376
-        'geodir_main_content_open_id' => '',
377
-        'geodir_main_content_open_class' => '',
378
-        'geodir_main_content_open_replace' => '<!-- removed -->',
379
-        'geodir_main_content_close_replace' => '<!-- removed -->',
380
-        'geodir_top_content_add' => '',
381
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
382
-        'geodir_before_widget_filter' => '',
383
-        'geodir_after_widget_filter' => '',
384
-        'geodir_theme_compat_css' => '',
385
-        'geodir_theme_compat_js' => '',
386
-        'geodir_theme_compat_default_options' => '',
387
-        'geodir_theme_compat_code' => ''
388
-    );
355
+	$theme_compat['GeoDirectory_Framework'] = array(
356
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
357
+		'geodir_wrapper_open_class' => '',
358
+		'geodir_wrapper_open_replace' => '',
359
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
360
+		'geodir_wrapper_content_open_id' => 'geodir_content',
361
+		'geodir_wrapper_content_open_class' => '',
362
+		'geodir_wrapper_content_open_replace' => '',
363
+		'geodir_wrapper_content_close_replace' => '',
364
+		'geodir_article_open_id' => '',
365
+		'geodir_article_open_class' => '',
366
+		'geodir_article_open_replace' => '',
367
+		'geodir_article_close_replace' => '',
368
+		'geodir_sidebar_right_open_id' => '',
369
+		'geodir_sidebar_right_open_class' => '',
370
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
371
+		'geodir_sidebar_right_close_replace' => '',
372
+		'geodir_sidebar_left_open_id' => '',
373
+		'geodir_sidebar_left_open_class' => '',
374
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
375
+		'geodir_sidebar_left_close_replace' => '',
376
+		'geodir_main_content_open_id' => '',
377
+		'geodir_main_content_open_class' => '',
378
+		'geodir_main_content_open_replace' => '<!-- removed -->',
379
+		'geodir_main_content_close_replace' => '<!-- removed -->',
380
+		'geodir_top_content_add' => '',
381
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
382
+		'geodir_before_widget_filter' => '',
383
+		'geodir_after_widget_filter' => '',
384
+		'geodir_theme_compat_css' => '',
385
+		'geodir_theme_compat_js' => '',
386
+		'geodir_theme_compat_default_options' => '',
387
+		'geodir_theme_compat_code' => ''
388
+	);
389 389
 
390 390
 //Directory Theme
391
-    $theme_compat['Directory_Starter'] = array(
392
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
393
-        'geodir_wrapper_open_class' => '',
394
-        'geodir_wrapper_open_replace' => '',
395
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
396
-        'geodir_wrapper_content_open_id' => 'geodir_content',
397
-        'geodir_wrapper_content_open_class' => '',
398
-        'geodir_wrapper_content_open_replace' => '',
399
-        'geodir_wrapper_content_close_replace' => '',
400
-        'geodir_article_open_id' => '',
401
-        'geodir_article_open_class' => '',
402
-        'geodir_article_open_replace' => '',
403
-        'geodir_article_close_replace' => '',
404
-        'geodir_sidebar_right_open_id' => '',
405
-        'geodir_sidebar_right_open_class' => '',
406
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
407
-        'geodir_sidebar_right_close_replace' => '',
408
-        'geodir_sidebar_left_open_id' => '',
409
-        'geodir_sidebar_left_open_class' => '',
410
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
411
-        'geodir_sidebar_left_close_replace' => '',
412
-        'geodir_main_content_open_id' => '',
413
-        'geodir_main_content_open_class' => '',
414
-        'geodir_main_content_open_replace' => '<!-- removed -->',
415
-        'geodir_main_content_close_replace' => '<!-- removed -->',
416
-        'geodir_top_content_add' => '',
417
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
418
-        'geodir_before_widget_filter' => '',
419
-        'geodir_after_widget_filter' => '',
420
-        'geodir_theme_compat_css' => '',
421
-        'geodir_theme_compat_js' => '',
422
-        'geodir_theme_compat_default_options' => '',
423
-        'geodir_theme_compat_code' => ''
424
-    );
391
+	$theme_compat['Directory_Starter'] = array(
392
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
393
+		'geodir_wrapper_open_class' => '',
394
+		'geodir_wrapper_open_replace' => '',
395
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
396
+		'geodir_wrapper_content_open_id' => 'geodir_content',
397
+		'geodir_wrapper_content_open_class' => '',
398
+		'geodir_wrapper_content_open_replace' => '',
399
+		'geodir_wrapper_content_close_replace' => '',
400
+		'geodir_article_open_id' => '',
401
+		'geodir_article_open_class' => '',
402
+		'geodir_article_open_replace' => '',
403
+		'geodir_article_close_replace' => '',
404
+		'geodir_sidebar_right_open_id' => '',
405
+		'geodir_sidebar_right_open_class' => '',
406
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
407
+		'geodir_sidebar_right_close_replace' => '',
408
+		'geodir_sidebar_left_open_id' => '',
409
+		'geodir_sidebar_left_open_class' => '',
410
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
411
+		'geodir_sidebar_left_close_replace' => '',
412
+		'geodir_main_content_open_id' => '',
413
+		'geodir_main_content_open_class' => '',
414
+		'geodir_main_content_open_replace' => '<!-- removed -->',
415
+		'geodir_main_content_close_replace' => '<!-- removed -->',
416
+		'geodir_top_content_add' => '',
417
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
418
+		'geodir_before_widget_filter' => '',
419
+		'geodir_after_widget_filter' => '',
420
+		'geodir_theme_compat_css' => '',
421
+		'geodir_theme_compat_js' => '',
422
+		'geodir_theme_compat_default_options' => '',
423
+		'geodir_theme_compat_code' => ''
424
+	);
425 425
 
426 426
 //Jobby
427
-    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
427
+	$theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
428 428
 
429 429
 //GeoProperty
430
-    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
430
+	$theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
431 431
 
432 432
 //Avada
433
-    $theme_compat['Avada'] = array(
434
-        'geodir_wrapper_open_id' => '',
435
-        'geodir_wrapper_open_class' => '',
436
-        'geodir_wrapper_open_replace' => '<!-- removed -->',
437
-        'geodir_wrapper_close_replace' => '<!-- removed -->',
438
-        'geodir_wrapper_content_open_id' => 'content',
439
-        'geodir_wrapper_content_open_class' => '',
440
-        'geodir_wrapper_content_open_replace' => '',
441
-        'geodir_wrapper_content_close_replace' => '',
442
-        'geodir_article_open_id' => '',
443
-        'geodir_article_open_class' => '',
444
-        'geodir_article_open_replace' => '',
445
-        'geodir_article_close_replace' => '',
446
-        'geodir_sidebar_right_open_id' => '',
447
-        'geodir_sidebar_right_open_class' => '',
448
-        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
449
-        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
450
-        'geodir_sidebar_left_open_id' => '',
451
-        'geodir_sidebar_left_open_class' => '',
452
-        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
453
-        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
454
-        'geodir_main_content_open_id' => '',
455
-        'geodir_main_content_open_class' => '',
456
-        'geodir_main_content_open_replace' => '<!-- removed -->',
457
-        'geodir_main_content_close_replace' => '<!-- removed -->',
458
-        'geodir_top_content_add' => '',
459
-        'geodir_before_main_content_add' => '',
460
-        'geodir_before_widget_filter' => '',
461
-        'geodir_after_widget_filter' => '',
462
-        'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
463
-        'geodir_theme_compat_js' => '',
464
-        'geodir_theme_compat_default_options' => '',
465
-        'geodir_theme_compat_code' => 'Avada'
466
-    );
433
+	$theme_compat['Avada'] = array(
434
+		'geodir_wrapper_open_id' => '',
435
+		'geodir_wrapper_open_class' => '',
436
+		'geodir_wrapper_open_replace' => '<!-- removed -->',
437
+		'geodir_wrapper_close_replace' => '<!-- removed -->',
438
+		'geodir_wrapper_content_open_id' => 'content',
439
+		'geodir_wrapper_content_open_class' => '',
440
+		'geodir_wrapper_content_open_replace' => '',
441
+		'geodir_wrapper_content_close_replace' => '',
442
+		'geodir_article_open_id' => '',
443
+		'geodir_article_open_class' => '',
444
+		'geodir_article_open_replace' => '',
445
+		'geodir_article_close_replace' => '',
446
+		'geodir_sidebar_right_open_id' => '',
447
+		'geodir_sidebar_right_open_class' => '',
448
+		'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
449
+		'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
450
+		'geodir_sidebar_left_open_id' => '',
451
+		'geodir_sidebar_left_open_class' => '',
452
+		'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
453
+		'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
454
+		'geodir_main_content_open_id' => '',
455
+		'geodir_main_content_open_class' => '',
456
+		'geodir_main_content_open_replace' => '<!-- removed -->',
457
+		'geodir_main_content_close_replace' => '<!-- removed -->',
458
+		'geodir_top_content_add' => '',
459
+		'geodir_before_main_content_add' => '',
460
+		'geodir_before_widget_filter' => '',
461
+		'geodir_after_widget_filter' => '',
462
+		'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
463
+		'geodir_theme_compat_js' => '',
464
+		'geodir_theme_compat_default_options' => '',
465
+		'geodir_theme_compat_code' => 'Avada'
466
+	);
467 467
 
468 468
 //Enfold
469
-    $theme_compat['Enfold'] = array(
470
-        'geodir_wrapper_open_id' => '',
471
-        'geodir_wrapper_open_class' => '',
472
-        'geodir_wrapper_open_replace' => '',
473
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
474
-        'geodir_wrapper_content_open_id' => '',
475
-        'geodir_wrapper_content_open_class' => '',
476
-        'geodir_wrapper_content_open_replace' => '',
477
-        'geodir_wrapper_content_close_replace' => '</div></main>',
478
-        'geodir_article_open_id' => '',
479
-        'geodir_article_open_class' => '',
480
-        'geodir_article_open_replace' => '',
481
-        'geodir_article_close_replace' => '',
482
-        'geodir_sidebar_right_open_id' => '',
483
-        'geodir_sidebar_right_open_class' => '',
484
-        'geodir_sidebar_right_open_replace' => '',
485
-        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
486
-        'geodir_sidebar_left_open_id' => '',
487
-        'geodir_sidebar_left_open_class' => '',
488
-        'geodir_sidebar_left_open_replace' => '',
489
-        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
490
-        'geodir_main_content_open_id' => '',
491
-        'geodir_main_content_open_class' => '',
492
-        'geodir_main_content_open_replace' => '',
493
-        'geodir_main_content_close_replace' => '',
494
-        'geodir_top_content_add' => '',
495
-        'geodir_before_main_content_add' => '',
496
-        'geodir_before_widget_filter' => '',
497
-        'geodir_after_widget_filter' => '',
498
-        'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
499
-        'geodir_theme_compat_js' => '',
500
-        'geodir_theme_compat_default_options' => '',
501
-        'geodir_theme_compat_code' => 'Enfold'
502
-    );
469
+	$theme_compat['Enfold'] = array(
470
+		'geodir_wrapper_open_id' => '',
471
+		'geodir_wrapper_open_class' => '',
472
+		'geodir_wrapper_open_replace' => '',
473
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
474
+		'geodir_wrapper_content_open_id' => '',
475
+		'geodir_wrapper_content_open_class' => '',
476
+		'geodir_wrapper_content_open_replace' => '',
477
+		'geodir_wrapper_content_close_replace' => '</div></main>',
478
+		'geodir_article_open_id' => '',
479
+		'geodir_article_open_class' => '',
480
+		'geodir_article_open_replace' => '',
481
+		'geodir_article_close_replace' => '',
482
+		'geodir_sidebar_right_open_id' => '',
483
+		'geodir_sidebar_right_open_class' => '',
484
+		'geodir_sidebar_right_open_replace' => '',
485
+		'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
486
+		'geodir_sidebar_left_open_id' => '',
487
+		'geodir_sidebar_left_open_class' => '',
488
+		'geodir_sidebar_left_open_replace' => '',
489
+		'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
490
+		'geodir_main_content_open_id' => '',
491
+		'geodir_main_content_open_class' => '',
492
+		'geodir_main_content_open_replace' => '',
493
+		'geodir_main_content_close_replace' => '',
494
+		'geodir_top_content_add' => '',
495
+		'geodir_before_main_content_add' => '',
496
+		'geodir_before_widget_filter' => '',
497
+		'geodir_after_widget_filter' => '',
498
+		'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
499
+		'geodir_theme_compat_js' => '',
500
+		'geodir_theme_compat_default_options' => '',
501
+		'geodir_theme_compat_code' => 'Enfold'
502
+	);
503 503
 
504 504
 // X
505
-    $theme_compat['X'] = array(
506
-        'geodir_wrapper_open_id' => '',
507
-        'geodir_wrapper_open_class' => '',
508
-        'geodir_wrapper_open_replace' => '',
509
-        'geodir_wrapper_close_replace' => '',
510
-        'geodir_wrapper_content_open_id' => '',
511
-        'geodir_wrapper_content_open_class' => '',
512
-        'geodir_wrapper_content_open_replace' => '',
513
-        'geodir_wrapper_content_close_replace' => '',
514
-        'geodir_article_open_id' => '',
515
-        'geodir_article_open_class' => '',
516
-        'geodir_article_open_replace' => '',
517
-        'geodir_article_close_replace' => '',
518
-        'geodir_sidebar_right_open_id' => '',
519
-        'geodir_sidebar_right_open_class' => '',
520
-        'geodir_sidebar_right_open_replace' => '',
521
-        'geodir_sidebar_right_close_replace' => '',
522
-        'geodir_sidebar_left_open_id' => '',
523
-        'geodir_sidebar_left_open_class' => '',
524
-        'geodir_sidebar_left_open_replace' => '',
525
-        'geodir_sidebar_left_close_replace' => '',
526
-        'geodir_main_content_open_id' => '',
527
-        'geodir_main_content_open_class' => '',
528
-        'geodir_main_content_open_replace' => '',
529
-        'geodir_main_content_close_replace' => '',
530
-        'geodir_top_content_add' => '',
531
-        'geodir_before_main_content_add' => '',
532
-        'geodir_before_widget_filter' => '',
533
-        'geodir_after_widget_filter' => '',
534
-        'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
535
-        'geodir_theme_compat_js' => '',
536
-        'geodir_theme_compat_default_options' => '',
537
-        'geodir_theme_compat_code' => 'X'
538
-    );
505
+	$theme_compat['X'] = array(
506
+		'geodir_wrapper_open_id' => '',
507
+		'geodir_wrapper_open_class' => '',
508
+		'geodir_wrapper_open_replace' => '',
509
+		'geodir_wrapper_close_replace' => '',
510
+		'geodir_wrapper_content_open_id' => '',
511
+		'geodir_wrapper_content_open_class' => '',
512
+		'geodir_wrapper_content_open_replace' => '',
513
+		'geodir_wrapper_content_close_replace' => '',
514
+		'geodir_article_open_id' => '',
515
+		'geodir_article_open_class' => '',
516
+		'geodir_article_open_replace' => '',
517
+		'geodir_article_close_replace' => '',
518
+		'geodir_sidebar_right_open_id' => '',
519
+		'geodir_sidebar_right_open_class' => '',
520
+		'geodir_sidebar_right_open_replace' => '',
521
+		'geodir_sidebar_right_close_replace' => '',
522
+		'geodir_sidebar_left_open_id' => '',
523
+		'geodir_sidebar_left_open_class' => '',
524
+		'geodir_sidebar_left_open_replace' => '',
525
+		'geodir_sidebar_left_close_replace' => '',
526
+		'geodir_main_content_open_id' => '',
527
+		'geodir_main_content_open_class' => '',
528
+		'geodir_main_content_open_replace' => '',
529
+		'geodir_main_content_close_replace' => '',
530
+		'geodir_top_content_add' => '',
531
+		'geodir_before_main_content_add' => '',
532
+		'geodir_before_widget_filter' => '',
533
+		'geodir_after_widget_filter' => '',
534
+		'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
535
+		'geodir_theme_compat_js' => '',
536
+		'geodir_theme_compat_default_options' => '',
537
+		'geodir_theme_compat_code' => 'X'
538
+	);
539 539
 
540 540
 // Divi
541
-    $theme_compat['Divi'] = array(
542
-        'geodir_wrapper_open_id' => 'main-content',
543
-        'geodir_wrapper_open_class' => '',
544
-        'geodir_wrapper_open_replace' => '',
545
-        'geodir_wrapper_close_replace' => '',
546
-        'geodir_wrapper_content_open_id' => 'left-area',
547
-        'geodir_wrapper_content_open_class' => '',
548
-        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
549
-        'geodir_wrapper_content_close_replace' => '',
550
-        'geodir_article_open_id' => '',
551
-        'geodir_article_open_class' => '',
552
-        'geodir_article_open_replace' => '',
553
-        'geodir_article_close_replace' => '',
554
-        'geodir_sidebar_right_open_id' => 'sidebar',
555
-        'geodir_sidebar_right_open_class' => '',
556
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
557
-        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
558
-        'geodir_sidebar_left_open_id' => 'sidebar',
559
-        'geodir_sidebar_left_open_class' => '',
560
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
561
-        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
562
-        'geodir_main_content_open_id' => '',
563
-        'geodir_main_content_open_class' => '',
564
-        'geodir_main_content_open_replace' => '',
565
-        'geodir_main_content_close_replace' => '',
566
-        'geodir_top_content_add' => '',
567
-        'geodir_before_main_content_add' => '',
568
-        'geodir_before_widget_filter' => '',
569
-        'geodir_after_widget_filter' => '',
570
-        'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{padding:0 15px;width:100%}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type=button],.geodir_full_page .geodir-search input[type=submit],.geodir_full_page .geodir-search input[type=text],.geodir_full_page .geodir-search select{display:inline-block;float:none}'),
571
-        'geodir_theme_compat_js' => '',
572
-        'geodir_theme_compat_default_options' => '',
573
-        'geodir_theme_compat_code' => 'Divi'
574
-    );
541
+	$theme_compat['Divi'] = array(
542
+		'geodir_wrapper_open_id' => 'main-content',
543
+		'geodir_wrapper_open_class' => '',
544
+		'geodir_wrapper_open_replace' => '',
545
+		'geodir_wrapper_close_replace' => '',
546
+		'geodir_wrapper_content_open_id' => 'left-area',
547
+		'geodir_wrapper_content_open_class' => '',
548
+		'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
549
+		'geodir_wrapper_content_close_replace' => '',
550
+		'geodir_article_open_id' => '',
551
+		'geodir_article_open_class' => '',
552
+		'geodir_article_open_replace' => '',
553
+		'geodir_article_close_replace' => '',
554
+		'geodir_sidebar_right_open_id' => 'sidebar',
555
+		'geodir_sidebar_right_open_class' => '',
556
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
557
+		'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
558
+		'geodir_sidebar_left_open_id' => 'sidebar',
559
+		'geodir_sidebar_left_open_class' => '',
560
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
561
+		'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
562
+		'geodir_main_content_open_id' => '',
563
+		'geodir_main_content_open_class' => '',
564
+		'geodir_main_content_open_replace' => '',
565
+		'geodir_main_content_close_replace' => '',
566
+		'geodir_top_content_add' => '',
567
+		'geodir_before_main_content_add' => '',
568
+		'geodir_before_widget_filter' => '',
569
+		'geodir_after_widget_filter' => '',
570
+		'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{padding:0 15px;width:100%}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type=button],.geodir_full_page .geodir-search input[type=submit],.geodir_full_page .geodir-search input[type=text],.geodir_full_page .geodir-search select{display:inline-block;float:none}'),
571
+		'geodir_theme_compat_js' => '',
572
+		'geodir_theme_compat_default_options' => '',
573
+		'geodir_theme_compat_code' => 'Divi'
574
+	);
575 575
 
576 576
 // Genesis
577
-    $theme_compat['Genesis'] = array(
578
-        'geodir_wrapper_open_id' => '',
579
-        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
580
-        'geodir_wrapper_open_replace' => '',
581
-        'geodir_wrapper_close_replace' => '',
582
-        'geodir_wrapper_content_open_id' => '',
583
-        'geodir_wrapper_content_open_class' => 'content',
584
-        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
585
-        'geodir_wrapper_content_close_replace' => '',
586
-        'geodir_article_open_id' => '',
587
-        'geodir_article_open_class' => '',
588
-        'geodir_article_open_replace' => '',
589
-        'geodir_article_close_replace' => '',
590
-        'geodir_sidebar_right_open_id' => '',
591
-        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
592
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
593
-        'geodir_sidebar_right_close_replace' => '',
594
-        'geodir_sidebar_left_open_id' => '',
595
-        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
596
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
597
-        'geodir_sidebar_left_close_replace' => '',
598
-        'geodir_main_content_open_id' => '',
599
-        'geodir_main_content_open_class' => '',
600
-        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
601
-        'geodir_main_content_close_replace' => '',
602
-        'geodir_top_content_add' => '',
603
-        'geodir_before_main_content_add' => '',
604
-        'geodir_before_widget_filter' => '',
605
-        'geodir_after_widget_filter' => '',
606
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
607
-        'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
608
-        'geodir_theme_compat_js' => '',
609
-        'geodir_theme_compat_default_options' => '',
610
-        'geodir_theme_compat_code' => 'Genesis'
611
-    );
577
+	$theme_compat['Genesis'] = array(
578
+		'geodir_wrapper_open_id' => '',
579
+		'geodir_wrapper_open_class' => 'content-sidebar-wrap',
580
+		'geodir_wrapper_open_replace' => '',
581
+		'geodir_wrapper_close_replace' => '',
582
+		'geodir_wrapper_content_open_id' => '',
583
+		'geodir_wrapper_content_open_class' => 'content',
584
+		'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
585
+		'geodir_wrapper_content_close_replace' => '',
586
+		'geodir_article_open_id' => '',
587
+		'geodir_article_open_class' => '',
588
+		'geodir_article_open_replace' => '',
589
+		'geodir_article_close_replace' => '',
590
+		'geodir_sidebar_right_open_id' => '',
591
+		'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
592
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
593
+		'geodir_sidebar_right_close_replace' => '',
594
+		'geodir_sidebar_left_open_id' => '',
595
+		'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
596
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
597
+		'geodir_sidebar_left_close_replace' => '',
598
+		'geodir_main_content_open_id' => '',
599
+		'geodir_main_content_open_class' => '',
600
+		'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
601
+		'geodir_main_content_close_replace' => '',
602
+		'geodir_top_content_add' => '',
603
+		'geodir_before_main_content_add' => '',
604
+		'geodir_before_widget_filter' => '',
605
+		'geodir_after_widget_filter' => '',
606
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
607
+		'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
608
+		'geodir_theme_compat_js' => '',
609
+		'geodir_theme_compat_default_options' => '',
610
+		'geodir_theme_compat_code' => 'Genesis'
611
+	);
612 612
 
613 613
 // Jupiter
614
-    $theme_compat['Jupiter'] = array(
615
-        'geodir_wrapper_open_id' => '',
616
-        'geodir_wrapper_open_class' => '',
617
-        'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
618
-        'geodir_wrapper_close_replace' => '</div></div></div>',
619
-        'geodir_wrapper_content_open_id' => '',
620
-        'geodir_wrapper_content_open_class' => '',
621
-        'geodir_wrapper_content_open_replace' => '',
622
-        'geodir_wrapper_content_close_replace' => '',
623
-        'geodir_article_open_id' => '',
624
-        'geodir_article_open_class' => '',
625
-        'geodir_article_open_replace' => '',
626
-        'geodir_article_close_replace' => '',
627
-        'geodir_sidebar_right_open_id' => 'mk-sidebar',
628
-        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
629
-        'geodir_sidebar_right_open_replace' => '',
630
-        'geodir_sidebar_right_close_replace' => '',
631
-        'geodir_sidebar_left_open_id' => 'mk-sidebar',
632
-        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
633
-        'geodir_sidebar_left_open_replace' => '',
634
-        'geodir_sidebar_left_close_replace' => '',
635
-        'geodir_main_content_open_id' => '',
636
-        'geodir_main_content_open_class' => '',
637
-        'geodir_main_content_open_replace' => '',
638
-        'geodir_main_content_close_replace' => '',
639
-        'geodir_top_content_add' => '',
640
-        'geodir_before_main_content_add' => '',
641
-        'geodir_before_widget_filter' => '',
642
-        'geodir_after_widget_filter' => '',
643
-        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
644
-        'geodir_after_title_filter' => '',
645
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
646
-        'geodir_sub_menu_ul_class_filter' => '',
647
-        'geodir_sub_menu_li_class_filter' => '',
648
-        'geodir_menu_a_class_filter' => 'menu-item-link',
649
-        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
650
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
651
-        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
652
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
653
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
654
-        'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
655
-        'geodir_theme_compat_js' => '',
656
-        'geodir_theme_compat_default_options' => '',
657
-        'geodir_theme_compat_code' => 'Jupiter'
658
-    );
614
+	$theme_compat['Jupiter'] = array(
615
+		'geodir_wrapper_open_id' => '',
616
+		'geodir_wrapper_open_class' => '',
617
+		'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
618
+		'geodir_wrapper_close_replace' => '</div></div></div>',
619
+		'geodir_wrapper_content_open_id' => '',
620
+		'geodir_wrapper_content_open_class' => '',
621
+		'geodir_wrapper_content_open_replace' => '',
622
+		'geodir_wrapper_content_close_replace' => '',
623
+		'geodir_article_open_id' => '',
624
+		'geodir_article_open_class' => '',
625
+		'geodir_article_open_replace' => '',
626
+		'geodir_article_close_replace' => '',
627
+		'geodir_sidebar_right_open_id' => 'mk-sidebar',
628
+		'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
629
+		'geodir_sidebar_right_open_replace' => '',
630
+		'geodir_sidebar_right_close_replace' => '',
631
+		'geodir_sidebar_left_open_id' => 'mk-sidebar',
632
+		'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
633
+		'geodir_sidebar_left_open_replace' => '',
634
+		'geodir_sidebar_left_close_replace' => '',
635
+		'geodir_main_content_open_id' => '',
636
+		'geodir_main_content_open_class' => '',
637
+		'geodir_main_content_open_replace' => '',
638
+		'geodir_main_content_close_replace' => '',
639
+		'geodir_top_content_add' => '',
640
+		'geodir_before_main_content_add' => '',
641
+		'geodir_before_widget_filter' => '',
642
+		'geodir_after_widget_filter' => '',
643
+		'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
644
+		'geodir_after_title_filter' => '',
645
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
646
+		'geodir_sub_menu_ul_class_filter' => '',
647
+		'geodir_sub_menu_li_class_filter' => '',
648
+		'geodir_menu_a_class_filter' => 'menu-item-link',
649
+		'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
650
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
651
+		'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
652
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
653
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
654
+		'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
655
+		'geodir_theme_compat_js' => '',
656
+		'geodir_theme_compat_default_options' => '',
657
+		'geodir_theme_compat_code' => 'Jupiter'
658
+	);
659 659
 
660 660
 // Multi News
661
-    $theme_compat['Multi_News'] = array(
662
-        'geodir_wrapper_open_id' => '',
663
-        'geodir_wrapper_open_class' => 'main-container clearfix',
664
-        'geodir_wrapper_open_replace' => '',
665
-        'geodir_wrapper_close_replace' => '',
666
-        'geodir_wrapper_content_open_id' => '',
667
-        'geodir_wrapper_content_open_class' => '',
668
-        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
669
-        'geodir_wrapper_content_close_replace' => '</div></div></div>',
670
-        'geodir_article_open_id' => '',
671
-        'geodir_article_open_class' => '',
672
-        'geodir_article_open_replace' => '',
673
-        'geodir_article_close_replace' => '',
674
-        'geodir_sidebar_right_open_id' => '',
675
-        'geodir_sidebar_right_open_class' => '',
676
-        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
677
-        'geodir_sidebar_right_close_replace' => '',
678
-        'geodir_sidebar_left_open_id' => '',
679
-        'geodir_sidebar_left_open_class' => '',
680
-        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
681
-        'geodir_sidebar_left_close_replace' => '',
682
-        'geodir_main_content_open_id' => '',
683
-        'geodir_main_content_open_class' => '',
684
-        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
685
-        'geodir_main_content_close_replace' => '</div>',
686
-        'geodir_top_content_add' => '',
687
-        'geodir_before_main_content_add' => '',
688
-        'geodir_full_page_class_filter' => 'section full-width-section',
689
-        'geodir_before_widget_filter' => '',
690
-        'geodir_after_widget_filter' => '',
691
-        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
692
-        'geodir_after_title_filter' => '</h2></div>',
693
-        'geodir_menu_li_class_filter' => '',
694
-        'geodir_sub_menu_ul_class_filter' => '',
695
-        'geodir_sub_menu_li_class_filter' => '',
696
-        'geodir_menu_a_class_filter' => '',
697
-        'geodir_sub_menu_a_class_filter' => '',
698
-        'geodir_location_switcher_menu_li_class_filter' => '',
699
-        'geodir_location_switcher_menu_a_class_filter' => '',
700
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
701
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
702
-        'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
703
-        'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
704
-        'geodir_theme_compat_default_options' => '',
705
-        'geodir_theme_compat_code' => 'Multi_News'
706
-    );
707
-
708
-    // Kelo
709
-    $theme_compat['Kleo'] = array(
710
-        'geodir_theme_compat_code' => 'Kleo'
711
-    );
712
-
713
-
714
-    // Twenty Seventeen
715
-    $theme_compat['Twenty_Seventeen'] = array(
716
-        'geodir_wrapper_open_replace' => '<div class="wrap">',
717
-        'geodir_wrapper_content_open_replace' => '<div id="primary" class="content-area" >',
718
-        'geodir_sidebar_right_open_replace' => '<aside id="secondary"  class="widget-area" itemscope itemtype="[itemtype]" >',
719
-        'geodir_sidebar_left_open_replace' => '<aside id="secondary"  class="widget-area" itemscope itemtype="[itemtype]" >',
720
-        'geodir_theme_compat_css' => stripslashes('body.geodir-page #primary header.entry-header {margin-left:0;float:none !important;} .gxeodir_flex-container{float:left;} .geodir-tabs-content.entry-content{width:100% !important;} dl.geodir-tab-head, .geodir_map_container {z-index:2;} .geodir-cat-list ul.geodir-popular-cat-list  li + li {    margin-top: 0;} .geodir-cat-list .geodir-popular-cat-list a img, .entry-content .gm-style a img, .widget .gm-style a img {    box-sizing: none; -webkit-box-shadow: none; -moz-box-shadow: none;}'),
721
-        'geodir_theme_compat_code' => 'Twenty_Seventeen'
722
-    );
723
-
724
-    // buddyBoss
725
-    $theme_compat['Boss.'] = array(
726
-        'geodir_wrapper_open_replace' => '<div class="page-right-sidebar">',
727
-        'geodir_wrapper_content_open_replace' => '<div id="primary" class="site-content">',
728
-        'geodir_article_open_replace' => '<div  id="[id]" class="[class]" itemscope itemtype="[itemtype]">',
729
-        'geodir_article_close_replace' => '</div>',
730
-        'geodir_sidebar_right_open_replace' => '<div id="secondary" class="widget-area" >',
731
-        'geodir_sidebar_right_close_replace' => '</div>',
732
-        'geodir_sidebar_left_open_replace' => '<div id="secondary" class="widget-area" >',
733
-        'geodir_sidebar_left_close_replace' => '</div>',
734
-        'geodir_theme_compat_css' => stripslashes('.geodir-breadcrumb{padding-top:20px;border-bottom:1px solid #ddd;padding-bottom:0} article.geodir-category-listing{padding: 0 !important;}'),
735
-        'geodir_theme_compat_code' => 'BuddyBoss'
736
-
737
-
738
-    );
739
-
740
-    // Flatsome
741
-    $theme_compat['Flatsome'] = array(
742
-        'geodir_wrapper_open_replace' => '<div class="page-wrapper page-right-sidebar"><div class="row">',
743
-        'geodir_wrapper_close_replace' => '</div></div>',
744
-        'geodir_wrapper_content_open_replace' => '<div id="content" class="large-9 left col col-divided" role="main"><div class="page-inner">',
745
-        'geodir_wrapper_content_close_replace' => '</div></div>',
746
-        'geodir_sidebar_right_open_replace' => '<div class="large-3 col"><div id="secondary" class="widget-area " role="complementary">',
747
-        'geodir_sidebar_right_close_replace' => '</div></div>',
748
-        'geodir_sidebar_left_open_replace' => '<div class="large-3 col"><div id="secondary" class="widget-area " role="complementary">',
749
-        'geodir_sidebar_left_close_replace' => '</div></div>',
750
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children  has-dropdown',
751
-        'geodir_sub_menu_ul_class_filter' => 'nav-dropdown nav-dropdown-default gd-nav-dropdown',
752
-        'geodir_sub_menu_li_class_filter' => 'menu-item menu-item-type-custom menu-item-object-custom',
753
-        'geodir_menu_a_class_filter' => 'nav-top-link gd-nav-top-link',
754
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher has-dropdown',
755
-        'geodir_location_switcher_menu_sub_ul_class_filter' => 'nav-dropdown nav-dropdown-default',
756
-        'geodir_theme_compat_css' => stripslashes('dl.geodir_location_tabs_head dt{margin:0;}.header{z-index:90;}'),
757
-        'geodir_theme_compat_js' => stripslashes('jQuery(function(){jQuery("#masthead .gd-nav-top-link").append(\'<i class="icon-angle-down"></i>\'),jQuery("#menu-item-gd-location-switcher >  a").append(\'<i class="icon-angle-down"></i>\'),jQuery(".mobile-sidebar .gd-nav-dropdown").addClass("children"),jQuery(".mobile-sidebar .gd-nav-dropdown").removeClass("nav-dropdown nav-dropdown-default"),jQuery(".mobile-sidebar #menu-item-gd-location-switcher ul").removeClass("nav-dropdown nav-dropdown-default"),setTimeout(function(){},5e3)});'),
758
-
759
-
760
-    );
761
-
762
-
763
-    update_option('gd_theme_compats', $theme_compat);
764
-
765
-    gd_set_theme_compat();// set the compat pack if avail
661
+	$theme_compat['Multi_News'] = array(
662
+		'geodir_wrapper_open_id' => '',
663
+		'geodir_wrapper_open_class' => 'main-container clearfix',
664
+		'geodir_wrapper_open_replace' => '',
665
+		'geodir_wrapper_close_replace' => '',
666
+		'geodir_wrapper_content_open_id' => '',
667
+		'geodir_wrapper_content_open_class' => '',
668
+		'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
669
+		'geodir_wrapper_content_close_replace' => '</div></div></div>',
670
+		'geodir_article_open_id' => '',
671
+		'geodir_article_open_class' => '',
672
+		'geodir_article_open_replace' => '',
673
+		'geodir_article_close_replace' => '',
674
+		'geodir_sidebar_right_open_id' => '',
675
+		'geodir_sidebar_right_open_class' => '',
676
+		'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
677
+		'geodir_sidebar_right_close_replace' => '',
678
+		'geodir_sidebar_left_open_id' => '',
679
+		'geodir_sidebar_left_open_class' => '',
680
+		'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
681
+		'geodir_sidebar_left_close_replace' => '',
682
+		'geodir_main_content_open_id' => '',
683
+		'geodir_main_content_open_class' => '',
684
+		'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
685
+		'geodir_main_content_close_replace' => '</div>',
686
+		'geodir_top_content_add' => '',
687
+		'geodir_before_main_content_add' => '',
688
+		'geodir_full_page_class_filter' => 'section full-width-section',
689
+		'geodir_before_widget_filter' => '',
690
+		'geodir_after_widget_filter' => '',
691
+		'geodir_before_title_filter' => '<div class="widget-title"><h2>',
692
+		'geodir_after_title_filter' => '</h2></div>',
693
+		'geodir_menu_li_class_filter' => '',
694
+		'geodir_sub_menu_ul_class_filter' => '',
695
+		'geodir_sub_menu_li_class_filter' => '',
696
+		'geodir_menu_a_class_filter' => '',
697
+		'geodir_sub_menu_a_class_filter' => '',
698
+		'geodir_location_switcher_menu_li_class_filter' => '',
699
+		'geodir_location_switcher_menu_a_class_filter' => '',
700
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
701
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
702
+		'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
703
+		'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
704
+		'geodir_theme_compat_default_options' => '',
705
+		'geodir_theme_compat_code' => 'Multi_News'
706
+	);
707
+
708
+	// Kelo
709
+	$theme_compat['Kleo'] = array(
710
+		'geodir_theme_compat_code' => 'Kleo'
711
+	);
712
+
713
+
714
+	// Twenty Seventeen
715
+	$theme_compat['Twenty_Seventeen'] = array(
716
+		'geodir_wrapper_open_replace' => '<div class="wrap">',
717
+		'geodir_wrapper_content_open_replace' => '<div id="primary" class="content-area" >',
718
+		'geodir_sidebar_right_open_replace' => '<aside id="secondary"  class="widget-area" itemscope itemtype="[itemtype]" >',
719
+		'geodir_sidebar_left_open_replace' => '<aside id="secondary"  class="widget-area" itemscope itemtype="[itemtype]" >',
720
+		'geodir_theme_compat_css' => stripslashes('body.geodir-page #primary header.entry-header {margin-left:0;float:none !important;} .gxeodir_flex-container{float:left;} .geodir-tabs-content.entry-content{width:100% !important;} dl.geodir-tab-head, .geodir_map_container {z-index:2;} .geodir-cat-list ul.geodir-popular-cat-list  li + li {    margin-top: 0;} .geodir-cat-list .geodir-popular-cat-list a img, .entry-content .gm-style a img, .widget .gm-style a img {    box-sizing: none; -webkit-box-shadow: none; -moz-box-shadow: none;}'),
721
+		'geodir_theme_compat_code' => 'Twenty_Seventeen'
722
+	);
723
+
724
+	// buddyBoss
725
+	$theme_compat['Boss.'] = array(
726
+		'geodir_wrapper_open_replace' => '<div class="page-right-sidebar">',
727
+		'geodir_wrapper_content_open_replace' => '<div id="primary" class="site-content">',
728
+		'geodir_article_open_replace' => '<div  id="[id]" class="[class]" itemscope itemtype="[itemtype]">',
729
+		'geodir_article_close_replace' => '</div>',
730
+		'geodir_sidebar_right_open_replace' => '<div id="secondary" class="widget-area" >',
731
+		'geodir_sidebar_right_close_replace' => '</div>',
732
+		'geodir_sidebar_left_open_replace' => '<div id="secondary" class="widget-area" >',
733
+		'geodir_sidebar_left_close_replace' => '</div>',
734
+		'geodir_theme_compat_css' => stripslashes('.geodir-breadcrumb{padding-top:20px;border-bottom:1px solid #ddd;padding-bottom:0} article.geodir-category-listing{padding: 0 !important;}'),
735
+		'geodir_theme_compat_code' => 'BuddyBoss'
736
+
737
+
738
+	);
739
+
740
+	// Flatsome
741
+	$theme_compat['Flatsome'] = array(
742
+		'geodir_wrapper_open_replace' => '<div class="page-wrapper page-right-sidebar"><div class="row">',
743
+		'geodir_wrapper_close_replace' => '</div></div>',
744
+		'geodir_wrapper_content_open_replace' => '<div id="content" class="large-9 left col col-divided" role="main"><div class="page-inner">',
745
+		'geodir_wrapper_content_close_replace' => '</div></div>',
746
+		'geodir_sidebar_right_open_replace' => '<div class="large-3 col"><div id="secondary" class="widget-area " role="complementary">',
747
+		'geodir_sidebar_right_close_replace' => '</div></div>',
748
+		'geodir_sidebar_left_open_replace' => '<div class="large-3 col"><div id="secondary" class="widget-area " role="complementary">',
749
+		'geodir_sidebar_left_close_replace' => '</div></div>',
750
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children  has-dropdown',
751
+		'geodir_sub_menu_ul_class_filter' => 'nav-dropdown nav-dropdown-default gd-nav-dropdown',
752
+		'geodir_sub_menu_li_class_filter' => 'menu-item menu-item-type-custom menu-item-object-custom',
753
+		'geodir_menu_a_class_filter' => 'nav-top-link gd-nav-top-link',
754
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher has-dropdown',
755
+		'geodir_location_switcher_menu_sub_ul_class_filter' => 'nav-dropdown nav-dropdown-default',
756
+		'geodir_theme_compat_css' => stripslashes('dl.geodir_location_tabs_head dt{margin:0;}.header{z-index:90;}'),
757
+		'geodir_theme_compat_js' => stripslashes('jQuery(function(){jQuery("#masthead .gd-nav-top-link").append(\'<i class="icon-angle-down"></i>\'),jQuery("#menu-item-gd-location-switcher >  a").append(\'<i class="icon-angle-down"></i>\'),jQuery(".mobile-sidebar .gd-nav-dropdown").addClass("children"),jQuery(".mobile-sidebar .gd-nav-dropdown").removeClass("nav-dropdown nav-dropdown-default"),jQuery(".mobile-sidebar #menu-item-gd-location-switcher ul").removeClass("nav-dropdown nav-dropdown-default"),setTimeout(function(){},5e3)});'),
758
+
759
+
760
+	);
761
+
762
+
763
+	update_option('gd_theme_compats', $theme_compat);
764
+
765
+	gd_set_theme_compat();// set the compat pack if avail
766 766
 }
767 767
 
768 768
 
@@ -774,61 +774,61 @@  discard block
 block discarded – undo
774 774
  * @global object $wpdb WordPress Database object.
775 775
  */
776 776
 function gd_convert_virtual_pages(){
777
-    global $wpdb;
778
-
779
-    // Update the add listing page settings
780
-    $add_listing_page = $wpdb->get_var(
781
-        $wpdb->prepare(
782
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
783
-            array('add-listing')
784
-        )
785
-    );
786
-
787
-    if($add_listing_page){
788
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
789
-        update_option( 'geodir_add_listing_page', $add_listing_page);
790
-    }
791
-
792
-    // Update the listing preview page settings
793
-    $listing_preview_page = $wpdb->get_var(
794
-        $wpdb->prepare(
795
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
796
-            array('listing-preview')
797
-        )
798
-    );
799
-
800
-    if($listing_preview_page){
801
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
802
-        update_option( 'geodir_preview_page', $listing_preview_page);
803
-    }
804
-
805
-    // Update the listing success page settings
806
-    $listing_success_page = $wpdb->get_var(
807
-        $wpdb->prepare(
808
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
809
-            array('listing-success')
810
-        )
811
-    );
812
-
813
-    if($listing_success_page){
814
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
815
-        update_option( 'geodir_success_page', $listing_success_page);
816
-    }
817
-
818
-    // Update the listing success page settings
819
-    $location_page = $wpdb->get_var(
820
-        $wpdb->prepare(
821
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
822
-            array('location')
823
-        )
824
-    );
825
-
826
-    if($location_page){
827
-        $location_slug = get_option('geodir_location_prefix');
828
-        if(!$location_slug ){$location_slug  = 'location';}
829
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
830
-        update_option( 'geodir_location_page', $location_page);
831
-    }
777
+	global $wpdb;
778
+
779
+	// Update the add listing page settings
780
+	$add_listing_page = $wpdb->get_var(
781
+		$wpdb->prepare(
782
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
783
+			array('add-listing')
784
+		)
785
+	);
786
+
787
+	if($add_listing_page){
788
+		wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
789
+		update_option( 'geodir_add_listing_page', $add_listing_page);
790
+	}
791
+
792
+	// Update the listing preview page settings
793
+	$listing_preview_page = $wpdb->get_var(
794
+		$wpdb->prepare(
795
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
796
+			array('listing-preview')
797
+		)
798
+	);
799
+
800
+	if($listing_preview_page){
801
+		wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
802
+		update_option( 'geodir_preview_page', $listing_preview_page);
803
+	}
804
+
805
+	// Update the listing success page settings
806
+	$listing_success_page = $wpdb->get_var(
807
+		$wpdb->prepare(
808
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
809
+			array('listing-success')
810
+		)
811
+	);
812
+
813
+	if($listing_success_page){
814
+		wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
815
+		update_option( 'geodir_success_page', $listing_success_page);
816
+	}
817
+
818
+	// Update the listing success page settings
819
+	$location_page = $wpdb->get_var(
820
+		$wpdb->prepare(
821
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
822
+			array('location')
823
+		)
824
+	);
825
+
826
+	if($location_page){
827
+		$location_slug = get_option('geodir_location_prefix');
828
+		if(!$location_slug ){$location_slug  = 'location';}
829
+		wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
830
+		update_option( 'geodir_location_page', $location_page);
831
+	}
832 832
 
833 833
 }
834 834
 
@@ -842,31 +842,31 @@  discard block
 block discarded – undo
842 842
 function gd_fix_cpt_rewrite_slug()
843 843
 {
844 844
 
845
-    $alt_post_types = array();
846
-    $post_types = get_option('geodir_post_types');
845
+	$alt_post_types = array();
846
+	$post_types = get_option('geodir_post_types');
847 847
 
848 848
 
849
-    if (is_array($post_types)){
849
+	if (is_array($post_types)){
850 850
 
851
-        foreach ($post_types as $post_type => $args) {
851
+		foreach ($post_types as $post_type => $args) {
852 852
 
853 853
 
854
-            if(isset($args['rewrite']['slug'])){
855
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
856
-            }
854
+			if(isset($args['rewrite']['slug'])){
855
+				$args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
856
+			}
857 857
 
858
-                $alt_post_types[$post_type] = $args;
858
+				$alt_post_types[$post_type] = $args;
859 859
 
860
-        }
861
-    }
860
+		}
861
+	}
862 862
 
863
-    if(!empty($alt_post_types)) {
864
-        update_option('geodir_post_types',$alt_post_types);
865
-        }
863
+	if(!empty($alt_post_types)) {
864
+		update_option('geodir_post_types',$alt_post_types);
865
+		}
866 866
 
867 867
 
868
-    // flush the rewrite rules
869
-    flush_rewrite_rules();
868
+	// flush the rewrite rules
869
+	flush_rewrite_rules();
870 870
 }
871 871
 
872 872
 
@@ -879,20 +879,20 @@  discard block
 block discarded – undo
879 879
  */
880 880
 function gd_fix_address_detail_table_limit()
881 881
 {
882
-    global $wpdb;
883
-
884
-    $all_postypes = geodir_get_posttypes();
885
-
886
-    if (!empty($all_postypes)) {
887
-        foreach ($all_postypes as $key) {
888
-            // update each GD CTP
889
-            try {
890
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
891
-            } catch(Exception $e) {
892
-                error_log( 'Error: ' . $e->getMessage() );
893
-            }
894
-        }
895
-    }
882
+	global $wpdb;
883
+
884
+	$all_postypes = geodir_get_posttypes();
885
+
886
+	if (!empty($all_postypes)) {
887
+		foreach ($all_postypes as $key) {
888
+			// update each GD CTP
889
+			try {
890
+				$wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
891
+			} catch(Exception $e) {
892
+				error_log( 'Error: ' . $e->getMessage() );
893
+			}
894
+		}
895
+	}
896 896
 }
897 897
 
898 898
 /**
@@ -904,63 +904,63 @@  discard block
 block discarded – undo
904 904
  * @return bool
905 905
  */
906 906
 function geodir_upgrade_1618() {
907
-    global $wpdb;
907
+	global $wpdb;
908 908
 
909
-    $gd_posttypes = geodir_get_posttypes();
910
-    $default_location = geodir_get_default_location();
909
+	$gd_posttypes = geodir_get_posttypes();
910
+	$default_location = geodir_get_default_location();
911 911
     
912
-    $old_country = 'Czech Republic';
913
-    $old_slug = 'czech-republic';
914
-    $new_country = 'Czechia';
915
-    $new_slug = 'czechia';
916
-    $flush_rewrite_rules = false;
917
-
918
-    if (!empty($gd_posttypes) && defined('POST_LOCATION_TABLE')) {        
919
-        // Update locations
920
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . POST_LOCATION_TABLE . "` SET `country` = %s, country_slug = %s WHERE `country` LIKE %s OR country_slug LIKE %s", array($new_country, $new_slug, $old_country, $old_slug)))) {
921
-            $flush_rewrite_rules = true;
922
-        }
912
+	$old_country = 'Czech Republic';
913
+	$old_slug = 'czech-republic';
914
+	$new_country = 'Czechia';
915
+	$new_slug = 'czechia';
916
+	$flush_rewrite_rules = false;
917
+
918
+	if (!empty($gd_posttypes) && defined('POST_LOCATION_TABLE')) {        
919
+		// Update locations
920
+		if ($wpdb->query($wpdb->prepare("UPDATE `" . POST_LOCATION_TABLE . "` SET `country` = %s, country_slug = %s WHERE `country` LIKE %s OR country_slug LIKE %s", array($new_country, $new_slug, $old_country, $old_slug)))) {
921
+			$flush_rewrite_rules = true;
922
+		}
923 923
         
924
-        // Update locations seo
925
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . LOCATION_SEO_TABLE . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
926
-            $flush_rewrite_rules = true;
927
-        }
928
-
929
-        // Update term meta
930
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
931
-            $flush_rewrite_rules = true;
932
-        }
933
-
934
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `location_name` = %s WHERE location_type LIKE 'gd_country' AND location_name LIKE %s", array($new_slug, $old_slug)))) {
935
-            $flush_rewrite_rules = true;
936
-        }
937
-
938
-        // Update detail table
939
-        foreach ($gd_posttypes as $pos_type) {
940
-            try {
941
-                if ($wpdb->query("UPDATE `" . $wpdb->prefix . "geodir_" . $pos_type . "_detail` SET post_country = '" . $new_country . "', post_locations = REPLACE ( post_locations, ',[" . $old_slug . "]', ',[" . $new_slug . "]' ) WHERE post_locations LIKE '%[" . $old_slug . "]' OR post_country LIKE '" . $old_country . "'")) {
942
-                    $flush_rewrite_rules = true;
943
-                }
944
-            } catch(Exception $e) {
945
-                error_log( 'Error: ' . $e->getMessage() );
946
-            }
947
-        }
948
-    }
924
+		// Update locations seo
925
+		if ($wpdb->query($wpdb->prepare("UPDATE `" . LOCATION_SEO_TABLE . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
926
+			$flush_rewrite_rules = true;
927
+		}
928
+
929
+		// Update term meta
930
+		if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
931
+			$flush_rewrite_rules = true;
932
+		}
933
+
934
+		if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `location_name` = %s WHERE location_type LIKE 'gd_country' AND location_name LIKE %s", array($new_slug, $old_slug)))) {
935
+			$flush_rewrite_rules = true;
936
+		}
937
+
938
+		// Update detail table
939
+		foreach ($gd_posttypes as $pos_type) {
940
+			try {
941
+				if ($wpdb->query("UPDATE `" . $wpdb->prefix . "geodir_" . $pos_type . "_detail` SET post_country = '" . $new_country . "', post_locations = REPLACE ( post_locations, ',[" . $old_slug . "]', ',[" . $new_slug . "]' ) WHERE post_locations LIKE '%[" . $old_slug . "]' OR post_country LIKE '" . $old_country . "'")) {
942
+					$flush_rewrite_rules = true;
943
+				}
944
+			} catch(Exception $e) {
945
+				error_log( 'Error: ' . $e->getMessage() );
946
+			}
947
+		}
948
+	}
949 949
     
950
-    if (!empty($default_location) && ((isset($default_location->country) && $default_location->country == $old_country) || (isset($default_location->country_slug) && $default_location->country_slug == $old_slug))) {
951
-        $default_location->country = $new_country;
952
-        $default_location->country_slug = $new_slug;
950
+	if (!empty($default_location) && ((isset($default_location->country) && $default_location->country == $old_country) || (isset($default_location->country_slug) && $default_location->country_slug == $old_slug))) {
951
+		$default_location->country = $new_country;
952
+		$default_location->country_slug = $new_slug;
953 953
         
954
-        update_option('geodir_default_location', $default_location);
954
+		update_option('geodir_default_location', $default_location);
955 955
         
956
-        $flush_rewrite_rules = true;
957
-    }
956
+		$flush_rewrite_rules = true;
957
+	}
958 958
     
959
-    if ($flush_rewrite_rules) {
960
-        flush_rewrite_rules();
961
-    }
959
+	if ($flush_rewrite_rules) {
960
+		flush_rewrite_rules();
961
+	}
962 962
     
963
-    return true;
963
+	return true;
964 964
 }
965 965
 
966 966
 /**
@@ -971,9 +971,9 @@  discard block
 block discarded – undo
971 971
  * @return bool
972 972
  */
973 973
 function geodir_upgrade_1622() {
974
-    if ( get_option( 'geodir_notify_post_submit', '-1' ) == '-1' ) {
975
-        update_option( 'geodir_notify_post_submit', '1' );
976
-    }
974
+	if ( get_option( 'geodir_notify_post_submit', '-1' ) == '-1' ) {
975
+		update_option( 'geodir_notify_post_submit', '1' );
976
+	}
977 977
     
978
-    return true;
978
+	return true;
979 979
 }
980 980
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $wpdb;
11 11
 
12
-if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
12
+if (get_option('geodirectory'.'_db_version') != GEODIRECTORY_VERSION) {
13 13
     /**
14 14
      * Include custom database table related functions.
15 15
      *
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
         add_action('init', 'geodir_upgrade_1622', 11);
55 55
     }
56 56
 
57
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
57
+    add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
58 58
 
59
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
59
+    update_option('geodirectory'.'_db_version', GEODIRECTORY_VERSION);
60 60
 
61 61
 }
62 62
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
  * @since 1.0.0
93 93
  * @package GeoDirectory
94 94
  */
95
-function geodir_upgrade_146(){
95
+function geodir_upgrade_146() {
96 96
     gd_convert_virtual_pages();
97 97
 }
98 98
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
  * @since 1.5.0
103 103
  * @package GeoDirectory
104 104
  */
105
-function geodir_upgrade_150(){
105
+function geodir_upgrade_150() {
106 106
     gd_fix_cpt_rewrite_slug();
107 107
 }
108 108
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
  * @since 1.4.8
115 115
  * @package GeoDirectory
116 116
  */
117
-function geodir_upgrade_148(){
117
+function geodir_upgrade_148() {
118 118
     /*
119 119
      * Blank the users google password if present as we now use oAuth 2.0
120 120
      */
121
-    update_option('geodir_ga_pass','');
122
-    update_option('geodir_ga_user','');
121
+    update_option('geodir_ga_pass', '');
122
+    update_option('geodir_ga_user', '');
123 123
 
124 124
 }
125 125
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
  * @since 1.5.3
131 131
  * @package GeoDirectory
132 132
  */
133
-function geodir_upgrade_153(){
133
+function geodir_upgrade_153() {
134 134
     geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
135 135
     geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
136 136
 }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
  * @since 1.5.3
142 142
  * @package GeoDirectory
143 143
  */
144
-function geodir_upgrade_154(){
144
+function geodir_upgrade_154() {
145 145
     geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
146 146
 }
147 147
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  * @since 1.5.2
152 152
  * @package GeoDirectory
153 153
  */
154
-function geodir_upgrade_152(){
154
+function geodir_upgrade_152() {
155 155
     gd_fix_address_detail_table_limit();
156 156
 }
157 157
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 function geodir_fix_review_date()
188 188
 {
189 189
     global $wpdb;
190
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
190
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
191 191
 }
192 192
 
193 193
 /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 function geodir_fix_review_post_status()
201 201
 {
202 202
     global $wpdb;
203
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
203
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
204 204
 }
205 205
 
206 206
 /**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 function geodir_fix_review_content()
215 215
 {
216 216
     global $wpdb;
217
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
217
+    if ($wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
218 218
         return true;
219 219
     } else {
220 220
         return false;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         foreach ($all_postypes as $key) {
240 240
             // update each GD CTP
241 241
 
242
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
242
+            $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN ".$wpdb->prefix."geodir_".$key."_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
243 243
 
244 244
         }
245 245
         return true;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     if (!empty($all_postypes)) {
264 264
         foreach ($all_postypes as $key) {
265 265
             // update each GD CTP
266
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
266
+            $reviews = $wpdb->get_results("SELECT post_id FROM ".$wpdb->prefix."geodir_".$key."_detail d");
267 267
 
268 268
             if (!empty($reviews)) {
269 269
                 foreach ($reviews as $post_id) {
@@ -278,51 +278,51 @@  discard block
 block discarded – undo
278 278
 }
279 279
 
280 280
 
281
-function gd_convert_custom_field_display(){
281
+function gd_convert_custom_field_display() {
282 282
     global $wpdb;
283 283
 
284
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
284
+    $field_info = $wpdb->get_results("select * from ".GEODIR_CUSTOM_FIELDS_TABLE);
285 285
 
286 286
     $has_run = get_option('gd_convert_custom_field_display');
287
-    if($has_run){return;}
287
+    if ($has_run) {return; }
288 288
 
289 289
     // set the field_type_key for standard fields
290 290
     $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
291 291
 
292 292
 
293
-    if(is_array( $field_info)){
293
+    if (is_array($field_info)) {
294 294
 
295
-        foreach( $field_info as $cf){
295
+        foreach ($field_info as $cf) {
296 296
 
297 297
             $id = $cf->id;
298 298
 
299
-            if(!property_exists($cf,'show_in') || !$id){return;}
299
+            if (!property_exists($cf, 'show_in') || !$id) {return; }
300 300
 
301 301
             $show_in_arr = array();
302 302
 
303
-            if($cf->is_default){
303
+            if ($cf->is_default) {
304 304
                 $show_in_arr[] = "[detail]";
305 305
             }
306 306
 
307
-            if($cf->show_on_detail){
307
+            if ($cf->show_on_detail) {
308 308
                 $show_in_arr[] = "[moreinfo]";
309 309
             }
310 310
 
311
-            if($cf->show_on_listing){
311
+            if ($cf->show_on_listing) {
312 312
                 $show_in_arr[] = "[listing]";
313 313
             }
314 314
 
315
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
315
+            if ($cf->show_as_tab || $cf->htmlvar_name == 'geodir_video' || $cf->htmlvar_name == 'geodir_special_offers') {
316 316
                 $show_in_arr[] = "[owntab]";
317 317
             }
318 318
 
319
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
319
+            if ($cf->htmlvar_name == 'post' || $cf->htmlvar_name == 'geodir_contact' || $cf->htmlvar_name == 'geodir_timing') {
320 320
                 $show_in_arr[] = "[mapbubble]";
321 321
             }
322 322
 
323
-            if(!empty($show_in_arr )){
324
-                $show_in_arr = implode(',',$show_in_arr);
325
-            }else{
323
+            if (!empty($show_in_arr)) {
324
+                $show_in_arr = implode(',', $show_in_arr);
325
+            } else {
326 326
                 $show_in_arr = '';
327 327
             }
328 328
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
         }
332 332
 
333
-        update_option('gd_convert_custom_field_display',1);
333
+        update_option('gd_convert_custom_field_display', 1);
334 334
     }
335 335
 }
336 336
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 
763 763
     update_option('gd_theme_compats', $theme_compat);
764 764
 
765
-    gd_set_theme_compat();// set the compat pack if avail
765
+    gd_set_theme_compat(); // set the compat pack if avail
766 766
 }
767 767
 
768 768
 
@@ -773,61 +773,61 @@  discard block
 block discarded – undo
773 773
  * @package GeoDirectory
774 774
  * @global object $wpdb WordPress Database object.
775 775
  */
776
-function gd_convert_virtual_pages(){
776
+function gd_convert_virtual_pages() {
777 777
     global $wpdb;
778 778
 
779 779
     // Update the add listing page settings
780 780
     $add_listing_page = $wpdb->get_var(
781 781
         $wpdb->prepare(
782
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
782
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
783 783
             array('add-listing')
784 784
         )
785 785
     );
786 786
 
787
-    if($add_listing_page){
788
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
789
-        update_option( 'geodir_add_listing_page', $add_listing_page);
787
+    if ($add_listing_page) {
788
+        wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
789
+        update_option('geodir_add_listing_page', $add_listing_page);
790 790
     }
791 791
 
792 792
     // Update the listing preview page settings
793 793
     $listing_preview_page = $wpdb->get_var(
794 794
         $wpdb->prepare(
795
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
795
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
796 796
             array('listing-preview')
797 797
         )
798 798
     );
799 799
 
800
-    if($listing_preview_page){
801
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
802
-        update_option( 'geodir_preview_page', $listing_preview_page);
800
+    if ($listing_preview_page) {
801
+        wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
802
+        update_option('geodir_preview_page', $listing_preview_page);
803 803
     }
804 804
 
805 805
     // Update the listing success page settings
806 806
     $listing_success_page = $wpdb->get_var(
807 807
         $wpdb->prepare(
808
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
808
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
809 809
             array('listing-success')
810 810
         )
811 811
     );
812 812
 
813
-    if($listing_success_page){
814
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
815
-        update_option( 'geodir_success_page', $listing_success_page);
813
+    if ($listing_success_page) {
814
+        wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
815
+        update_option('geodir_success_page', $listing_success_page);
816 816
     }
817 817
 
818 818
     // Update the listing success page settings
819 819
     $location_page = $wpdb->get_var(
820 820
         $wpdb->prepare(
821
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
821
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
822 822
             array('location')
823 823
         )
824 824
     );
825 825
 
826
-    if($location_page){
826
+    if ($location_page) {
827 827
         $location_slug = get_option('geodir_location_prefix');
828
-        if(!$location_slug ){$location_slug  = 'location';}
829
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
830
-        update_option( 'geodir_location_page', $location_page);
828
+        if (!$location_slug) {$location_slug = 'location'; }
829
+        wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
830
+        update_option('geodir_location_page', $location_page);
831 831
     }
832 832
 
833 833
 }
@@ -846,13 +846,13 @@  discard block
 block discarded – undo
846 846
     $post_types = get_option('geodir_post_types');
847 847
 
848 848
 
849
-    if (is_array($post_types)){
849
+    if (is_array($post_types)) {
850 850
 
851 851
         foreach ($post_types as $post_type => $args) {
852 852
 
853 853
 
854
-            if(isset($args['rewrite']['slug'])){
855
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
854
+            if (isset($args['rewrite']['slug'])) {
855
+                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
856 856
             }
857 857
 
858 858
                 $alt_post_types[$post_type] = $args;
@@ -860,8 +860,8 @@  discard block
 block discarded – undo
860 860
         }
861 861
     }
862 862
 
863
-    if(!empty($alt_post_types)) {
864
-        update_option('geodir_post_types',$alt_post_types);
863
+    if (!empty($alt_post_types)) {
864
+        update_option('geodir_post_types', $alt_post_types);
865 865
         }
866 866
 
867 867
 
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
         foreach ($all_postypes as $key) {
888 888
             // update each GD CTP
889 889
             try {
890
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
891
-            } catch(Exception $e) {
892
-                error_log( 'Error: ' . $e->getMessage() );
890
+                $wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_".$key."_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
891
+            } catch (Exception $e) {
892
+                error_log('Error: '.$e->getMessage());
893 893
             }
894 894
         }
895 895
     }
@@ -917,32 +917,32 @@  discard block
 block discarded – undo
917 917
 
918 918
     if (!empty($gd_posttypes) && defined('POST_LOCATION_TABLE')) {        
919 919
         // Update locations
920
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . POST_LOCATION_TABLE . "` SET `country` = %s, country_slug = %s WHERE `country` LIKE %s OR country_slug LIKE %s", array($new_country, $new_slug, $old_country, $old_slug)))) {
920
+        if ($wpdb->query($wpdb->prepare("UPDATE `".POST_LOCATION_TABLE."` SET `country` = %s, country_slug = %s WHERE `country` LIKE %s OR country_slug LIKE %s", array($new_country, $new_slug, $old_country, $old_slug)))) {
921 921
             $flush_rewrite_rules = true;
922 922
         }
923 923
         
924 924
         // Update locations seo
925
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . LOCATION_SEO_TABLE . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
925
+        if ($wpdb->query($wpdb->prepare("UPDATE `".LOCATION_SEO_TABLE."` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
926 926
             $flush_rewrite_rules = true;
927 927
         }
928 928
 
929 929
         // Update term meta
930
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
930
+        if ($wpdb->query($wpdb->prepare("UPDATE `".GEODIR_TERM_META."` SET `country_slug` = %s WHERE country_slug LIKE %s", array($new_slug, $old_slug)))) {
931 931
             $flush_rewrite_rules = true;
932 932
         }
933 933
 
934
-        if ($wpdb->query($wpdb->prepare("UPDATE `" . GEODIR_TERM_META . "` SET `location_name` = %s WHERE location_type LIKE 'gd_country' AND location_name LIKE %s", array($new_slug, $old_slug)))) {
934
+        if ($wpdb->query($wpdb->prepare("UPDATE `".GEODIR_TERM_META."` SET `location_name` = %s WHERE location_type LIKE 'gd_country' AND location_name LIKE %s", array($new_slug, $old_slug)))) {
935 935
             $flush_rewrite_rules = true;
936 936
         }
937 937
 
938 938
         // Update detail table
939 939
         foreach ($gd_posttypes as $pos_type) {
940 940
             try {
941
-                if ($wpdb->query("UPDATE `" . $wpdb->prefix . "geodir_" . $pos_type . "_detail` SET post_country = '" . $new_country . "', post_locations = REPLACE ( post_locations, ',[" . $old_slug . "]', ',[" . $new_slug . "]' ) WHERE post_locations LIKE '%[" . $old_slug . "]' OR post_country LIKE '" . $old_country . "'")) {
941
+                if ($wpdb->query("UPDATE `".$wpdb->prefix."geodir_".$pos_type."_detail` SET post_country = '".$new_country."', post_locations = REPLACE ( post_locations, ',[".$old_slug."]', ',[".$new_slug."]' ) WHERE post_locations LIKE '%[".$old_slug."]' OR post_country LIKE '".$old_country."'")) {
942 942
                     $flush_rewrite_rules = true;
943 943
                 }
944
-            } catch(Exception $e) {
945
-                error_log( 'Error: ' . $e->getMessage() );
944
+            } catch (Exception $e) {
945
+                error_log('Error: '.$e->getMessage());
946 946
             }
947 947
         }
948 948
     }
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
  * @return bool
972 972
  */
973 973
 function geodir_upgrade_1622() {
974
-    if ( get_option( 'geodir_notify_post_submit', '-1' ) == '-1' ) {
975
-        update_option( 'geodir_notify_post_submit', '1' );
974
+    if (get_option('geodir_notify_post_submit', '-1') == '-1') {
975
+        update_option('geodir_notify_post_submit', '1');
976 976
     }
977 977
     
978 978
     return true;
Please login to merge, or discard this patch.
geodirectory-functions/custom_taxonomy_hooks_actions.php 1 patch
Indentation   +484 added lines, -484 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function geodir_register_taxonomies()
15 15
 {
16
-    $taxonomies = array();
17
-    $taxonomies = get_option('geodir_taxonomies');
18
-    // If custom taxonomies are present, register them
19
-    if (is_array($taxonomies)) {
20
-        // Sort taxonomies
21
-        ksort($taxonomies);
22
-
23
-        // Register taxonomies
24
-        foreach ($taxonomies as $taxonomy => $args) {
25
-            // Allow taxonomy names to be translated
26
-            if (!empty($args['args']['labels'])) {
27
-                foreach ($args['args']['labels'] as $key => $tax_label) {
28
-                    $args['args']['labels'][$key] = __($tax_label, 'geodirectory');
29
-                }
30
-            }
31
-
32
-            $tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);
33
-
34
-            if (taxonomy_exists($taxonomy)) {
35
-                $tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);
36
-            }
37
-        }
38
-    }
16
+	$taxonomies = array();
17
+	$taxonomies = get_option('geodir_taxonomies');
18
+	// If custom taxonomies are present, register them
19
+	if (is_array($taxonomies)) {
20
+		// Sort taxonomies
21
+		ksort($taxonomies);
22
+
23
+		// Register taxonomies
24
+		foreach ($taxonomies as $taxonomy => $args) {
25
+			// Allow taxonomy names to be translated
26
+			if (!empty($args['args']['labels'])) {
27
+				foreach ($args['args']['labels'] as $key => $tax_label) {
28
+					$args['args']['labels'][$key] = __($tax_label, 'geodirectory');
29
+				}
30
+			}
31
+
32
+			$tax = register_taxonomy($taxonomy, $args['object_type'], $args['args']);
33
+
34
+			if (taxonomy_exists($taxonomy)) {
35
+				$tax = register_taxonomy_for_object_type($taxonomy, $args['object_type']);
36
+			}
37
+		}
38
+	}
39 39
 }
40 40
 
41 41
 /**
@@ -46,45 +46,45 @@  discard block
 block discarded – undo
46 46
  * @global array $wp_post_types List of post types.
47 47
  */
48 48
 function geodir_register_post_types() {
49
-    global $wp_post_types;
49
+	global $wp_post_types;
50 50
     
51
-    /**
52
-     * Get available custom posttypes and taxonomies and register them.
53
-     */
54
-    _x('places', 'URL slug', 'geodirectory');
55
-
56
-    $post_types = array();
57
-    $post_types = get_option('geodir_post_types');
58
-
59
-    // Register each post type if array of data is returned
60
-    if (is_array($post_types)):
61
-
62
-        foreach ($post_types as $post_type => $args):
63
-
64
-            if (!empty($args['rewrite']['slug'])) {
65
-                $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');
66
-            }
67
-            $args = stripslashes_deep($args);
68
-
69
-            if (!empty($args['labels'])) {
70
-                foreach ($args['labels'] as $key => $val) {
71
-                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
72
-                }
73
-            }
74
-
75
-            /**
76
-             * Filter post type args.
77
-             *
78
-             * @since 1.0.0
79
-             * @param string $args Post type args.
80
-             * @param string $post_type The post type.
81
-             */
82
-            $args = apply_filters('geodir_post_type_args', $args, $post_type);
83
-
84
-            $post_type = register_post_type($post_type, $args);
85
-
86
-        endforeach;
87
-    endif;
51
+	/**
52
+	 * Get available custom posttypes and taxonomies and register them.
53
+	 */
54
+	_x('places', 'URL slug', 'geodirectory');
55
+
56
+	$post_types = array();
57
+	$post_types = get_option('geodir_post_types');
58
+
59
+	// Register each post type if array of data is returned
60
+	if (is_array($post_types)):
61
+
62
+		foreach ($post_types as $post_type => $args):
63
+
64
+			if (!empty($args['rewrite']['slug'])) {
65
+				$args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');
66
+			}
67
+			$args = stripslashes_deep($args);
68
+
69
+			if (!empty($args['labels'])) {
70
+				foreach ($args['labels'] as $key => $val) {
71
+					$args['labels'][$key] = __($val, 'geodirectory');// allow translation
72
+				}
73
+			}
74
+
75
+			/**
76
+			 * Filter post type args.
77
+			 *
78
+			 * @since 1.0.0
79
+			 * @param string $args Post type args.
80
+			 * @param string $post_type The post type.
81
+			 */
82
+			$args = apply_filters('geodir_post_type_args', $args, $post_type);
83
+
84
+			$post_type = register_post_type($post_type, $args);
85
+
86
+		endforeach;
87
+	endif;
88 88
 }
89 89
 
90 90
 /**
@@ -98,72 +98,72 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function geodir_post_type_args_modify($args, $post_type)
100 100
 {
101
-    $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
101
+	$geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
102 102
 	if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
103 103
 
104
-        $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
104
+		$listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
105 105
 
106
-        if ($post_type == 'gd_place') {
107
-            if (array_key_exists('has_archive', $args))
108
-                $args['has_archive'] = $listing_slug;
106
+		if ($post_type == 'gd_place') {
107
+			if (array_key_exists('has_archive', $args))
108
+				$args['has_archive'] = $listing_slug;
109 109
 
110
-            if (array_key_exists('rewrite', $args)) {
111
-                if (array_key_exists('slug', $args['rewrite']))
112
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
113
-            }
110
+			if (array_key_exists('rewrite', $args)) {
111
+				if (array_key_exists('slug', $args['rewrite']))
112
+					$args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
113
+			}
114 114
 
115
-            $geodir_post_types = get_option('geodir_post_types');
115
+			$geodir_post_types = get_option('geodir_post_types');
116 116
 
117
-            if (array_key_exists($post_type, $geodir_post_types)) {
117
+			if (array_key_exists($post_type, $geodir_post_types)) {
118 118
 
119
-                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
120
-                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
119
+				if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
120
+					$geodir_post_types[$post_type]['has_archive'] = $listing_slug;
121 121
 
122
-                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123
-                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
122
+				if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
123
+					if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
124
+						$geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
125 125
 
126
-                update_option('geodir_post_types', $geodir_post_types);
126
+				update_option('geodir_post_types', $geodir_post_types);
127 127
 
128
-            }
128
+			}
129 129
 
130
-            $geodir_post_types = get_option('geodir_post_types');
130
+			$geodir_post_types = get_option('geodir_post_types');
131 131
 
132
-            /* --- update taxonomies (category) --- */
132
+			/* --- update taxonomies (category) --- */
133 133
 
134
-            $geodir_taxonomies = get_option('geodir_taxonomies');
134
+			$geodir_taxonomies = get_option('geodir_taxonomies');
135 135
 
136
-            if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
-                $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
136
+			if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
137
+				$geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
138 138
 
139
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
-                        if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
139
+				if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
140
+					if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
141
+						if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
142
+							$geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
143 143
 
144
-                update_option('geodir_taxonomies', $geodir_taxonomies);
144
+				update_option('geodir_taxonomies', $geodir_taxonomies);
145 145
 
146
-            }
146
+			}
147 147
 
148
-            /* --- update taxonomies (tags) --- */
149
-            $geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
-            if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
-                $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
148
+			/* --- update taxonomies (tags) --- */
149
+			$geodir_taxonomies_tag = get_option('geodir_taxonomies');
150
+			if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
151
+				$geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
152 152
 
153
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
-                        if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
153
+				if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
154
+					if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
155
+						if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
156
+							$geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
157 157
 
158
-                update_option('geodir_taxonomies', $geodir_taxonomies_tag);
158
+				update_option('geodir_taxonomies', $geodir_taxonomies_tag);
159 159
 
160
-            }
160
+			}
161 161
 
162
-        }
162
+		}
163 163
 
164
-    }
164
+	}
165 165
 
166
-    return $args;
166
+	return $args;
167 167
 }
168 168
 
169 169
 /**
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_flush_rewrite_rules()
178 178
 {
179
-    global $wp_rewrite;
180
-    $wp_rewrite->flush_rules(false);
179
+	global $wp_rewrite;
180
+	$wp_rewrite->flush_rules(false);
181 181
 }
182 182
 
183 183
 /**
@@ -192,35 +192,35 @@  discard block
 block discarded – undo
192 192
  * @return array Rewrite rules.
193 193
  */
194 194
 function geodir_listing_rewrite_rules($rules) {
195
-    $newrules = array();
196
-    $taxonomies = get_option('geodir_taxonomies');
197
-    $detail_url_seprator = get_option('geodir_detailurl_separator');
195
+	$newrules = array();
196
+	$taxonomies = get_option('geodir_taxonomies');
197
+	$detail_url_seprator = get_option('geodir_detailurl_separator');
198 198
     
199 199
 	// create rules for post listing
200
-    if (is_array($taxonomies)):
201
-        foreach ($taxonomies as $taxonomy => $args):
202
-            $post_type = $args['object_type'];
203
-            $listing_slug = $args['listing_slug'];
204
-
205
-            if (strpos($taxonomy, 'tags')) {
206
-                $newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
-                $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
208
-            } else {
209
-                // use this loop to add paging for details page comments paging
210
-                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
211
-            }
212
-        endforeach;
213
-    endif;
214
-
215
-    // create rules for location listing
216
-    $location_page = get_option('geodir_location_page');
200
+	if (is_array($taxonomies)):
201
+		foreach ($taxonomies as $taxonomy => $args):
202
+			$post_type = $args['object_type'];
203
+			$listing_slug = $args['listing_slug'];
204
+
205
+			if (strpos($taxonomy, 'tags')) {
206
+				$newrules[$listing_slug . '/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&paged=$matches[2]';
207
+				$newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
208
+			} else {
209
+				// use this loop to add paging for details page comments paging
210
+				$newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
211
+			}
212
+		endforeach;
213
+	endif;
214
+
215
+	// create rules for location listing
216
+	$location_page = get_option('geodir_location_page');
217 217
 	
218
-    if($location_page) {
219
-        global $wpdb;
220
-        $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221
-    }
222
-    if (!isset($location_prefix))
223
-        $location_prefix = 'location';
218
+	if($location_page) {
219
+		global $wpdb;
220
+		$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
221
+	}
222
+	if (!isset($location_prefix))
223
+		$location_prefix = 'location';
224 224
 
225 225
 	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
226 226
 	if ($location_manager) {
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
265 265
 	}
266 266
 
267
-    if ($location_page && geodir_is_wpml()) {
268
-        foreach(icl_get_languages('skip_missing=N') as $lang){
269
-            $alt_page_id = '';
270
-            $alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
-            if($alt_page_id){
272
-                $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
267
+	if ($location_page && geodir_is_wpml()) {
268
+		foreach(icl_get_languages('skip_missing=N') as $lang){
269
+			$alt_page_id = '';
270
+			$alt_page_id = geodir_wpml_object_id($location_page, 'page', false,$lang['language_code']);
271
+			if($alt_page_id){
272
+				$location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
273 273
 
274 274
 				if ($location_manager && ($hide_country_part || $hide_region_part)) {
275 275
 					$matches2 = '';
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 					$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
306 306
 					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
307 307
 				}
308
-            }
309
-        }
310
-    }
308
+			}
309
+		}
310
+	}
311 311
 
312
-    $newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
312
+	$newrules[$location_prefix . '/?$'] = 'index.php?page_id=' . $location_page;
313 313
 
314
-    $rules = array_merge($newrules, $rules);
315
-    return $rules;
314
+	$rules = array_merge($newrules, $rules);
315
+	return $rules;
316 316
 }
317 317
 
318 318
 /**
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function geodir_htaccess_contents($rules)
329 329
 {
330
-    global $wpdb;
331
-    $location_prefix = get_option('geodir_location_prefix');
332
-    // if location page slug changed then add redirect
333
-    if ($location_prefix == 'location') {
334
-        return $rules;
335
-    }
336
-    $my_content = <<<EOD
330
+	global $wpdb;
331
+	$location_prefix = get_option('geodir_location_prefix');
332
+	// if location page slug changed then add redirect
333
+	if ($location_prefix == 'location') {
334
+		return $rules;
335
+	}
336
+	$my_content = <<<EOD
337 337
 \n# BEGIN GeoDirectory Rules
338 338
 #Redirect 301 /location/ /$location_prefix/
339 339
 # END GeoDirectory Rules\n\n
340 340
 EOD;
341
-    return $my_content . $rules;
341
+	return $my_content . $rules;
342 342
 }
343 343
 //add_filter('mod_rewrite_rules', 'geodir_htaccess_contents');
344 344
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
  */
353 353
 function geodir_add_location_var($public_query_vars)
354 354
 {
355
-    $public_query_vars[] = 'gd_country';
356
-    $public_query_vars[] = 'gd_region';
357
-    $public_query_vars[] = 'gd_city';
358
-    return $public_query_vars;
355
+	$public_query_vars[] = 'gd_country';
356
+	$public_query_vars[] = 'gd_region';
357
+	$public_query_vars[] = 'gd_city';
358
+	return $public_query_vars;
359 359
 }
360 360
 
361 361
 /**
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_add_geodir_page_var($public_query_vars)
370 370
 {
371
-    $public_query_vars[] = 'gd_is_geodir_page';
372
-    return $public_query_vars;
371
+	$public_query_vars[] = 'gd_is_geodir_page';
372
+	return $public_query_vars;
373 373
 }
374 374
 
375 375
 /**
@@ -381,20 +381,20 @@  discard block
 block discarded – undo
381 381
  */
382 382
 function geodir_add_page_id_in_query_var()
383 383
 {
384
-    global $wp_query;
384
+	global $wp_query;
385 385
 
386
-    $page_id = $wp_query->get_queried_object_id();
386
+	$page_id = $wp_query->get_queried_object_id();
387 387
 
388
-    if (!get_query_var('page_id') && !is_archive()) {
389
-        // fix for WP tags conflict with enfold theme
390
-        $theme_name = geodir_strtolower(wp_get_theme());
391
-        if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
392
-            return $wp_query;
393
-        }
394
-        $wp_query->set('page_id', $page_id);
395
-    }
388
+	if (!get_query_var('page_id') && !is_archive()) {
389
+		// fix for WP tags conflict with enfold theme
390
+		$theme_name = geodir_strtolower(wp_get_theme());
391
+		if (!geodir_is_geodir_page() && strpos($theme_name, 'enfold') !== false) {
392
+			return $wp_query;
393
+		}
394
+		$wp_query->set('page_id', $page_id);
395
+	}
396 396
 
397
-    return $wp_query;
397
+	return $wp_query;
398 398
 }
399 399
 
400 400
 /**
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 function geodir_set_location_var_in_session_in_core($wp) {
410 410
 	global $gd_session;
411 411
 
412
-    // Fix for WPML removing page_id query var:
413
-    if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
414
-        global $wpdb;
412
+	// Fix for WPML removing page_id query var:
413
+	if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
414
+		global $wpdb;
415 415
 
416
-        $page_for_posts = get_option('page_for_posts');
417
-        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
416
+		$page_for_posts = get_option('page_for_posts');
417
+		$real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
418 418
 
419
-        if (geodir_is_wpml()) {
420
-            $real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421
-        }
422
-        if ($real_page_id && $real_page_id!=$page_for_posts) {
423
-            $wp->query_vars['page_id'] = $real_page_id;
424
-        }
425
-    }
419
+		if (geodir_is_wpml()) {
420
+			$real_page_id = geodir_wpml_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
421
+		}
422
+		if ($real_page_id && $real_page_id!=$page_for_posts) {
423
+			$wp->query_vars['page_id'] = $real_page_id;
424
+		}
425
+	}
426 426
 	// Query Vars will have page_id parameter
427 427
 	// check if query var has page_id and that page id is location page
428
-    geodir_set_is_geodir_page($wp);
428
+	geodir_set_is_geodir_page($wp);
429 429
 	// if is GD homepage set the page ID
430 430
 	if (geodir_is_page('home')) {
431 431
 		$wp->query_vars['page_id'] = get_option('page_on_front');
@@ -434,118 +434,118 @@  discard block
 block discarded – undo
434 434
 	// The location url format (all or country_city or region_city or city).
435 435
 	$geodir_show_location_url = get_option('geodir_show_location_url');
436 436
 
437
-    if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
438
-        $gd_country = '';
439
-        $gd_region = '';
440
-        $gd_city = '';
441
-        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
442
-            $gd_country = urldecode($wp->query_vars['gd_country']);
443
-
444
-        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
445
-            $gd_region = urldecode($wp->query_vars['gd_region']);
446
-
447
-        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
448
-            $gd_city = urldecode($wp->query_vars['gd_city']);
449
-
450
-        if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
451
-            $default_location = geodir_get_default_location();
452
-
453
-            if (get_option('geodir_add_location_url')) {
454
-                if ($geodir_show_location_url != 'all') {
455
-                    if ($gd_region == '') {
456
-                        if ($gd_ses_region = $gd_session->get('gd_region'))
457
-                            $gd_region = $gd_ses_region;
458
-                        else
459
-                            $gd_region = $default_location->region_slug;
460
-                    }
461
-
462
-                    if ($gd_city == '') {
463
-                        if ($gd_ses_city = $gd_session->get('gd_city'))
464
-                            $gd_city = $gd_ses_city;
465
-                        else
466
-                            $gd_city = $default_location->city_slug;
467
-
468
-                        $base_location_link = geodir_get_location_link('base');
469
-                        wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
470
-                        exit();
471
-                    }
472
-                }
473
-            }
474
-
475
-            $args = array(
476
-                'what' => 'city',
477
-                'city_val' => $gd_city,
478
-                'region_val' => $gd_region,
479
-                'country_val' => $gd_country,
480
-                'country_column_name' => 'country_slug',
481
-                'region_column_name' => 'region_slug',
482
-                'city_column_name' => 'city_slug',
483
-                'location_link_part' => false,
484
-                'compare_operator' => ''
485
-            );
486
-
487
-            $location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
488
-            if (!empty($location_array)) {
489
-                $gd_session->set('gd_multi_location', 1);
490
-                $gd_session->set('gd_country', $gd_country);
491
-                $gd_session->set('gd_region', $gd_region);
492
-                $gd_session->set('gd_city', $gd_city);
437
+	if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
438
+		$gd_country = '';
439
+		$gd_region = '';
440
+		$gd_city = '';
441
+		if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
442
+			$gd_country = urldecode($wp->query_vars['gd_country']);
443
+
444
+		if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
445
+			$gd_region = urldecode($wp->query_vars['gd_region']);
446
+
447
+		if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
448
+			$gd_city = urldecode($wp->query_vars['gd_city']);
449
+
450
+		if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
451
+			$default_location = geodir_get_default_location();
452
+
453
+			if (get_option('geodir_add_location_url')) {
454
+				if ($geodir_show_location_url != 'all') {
455
+					if ($gd_region == '') {
456
+						if ($gd_ses_region = $gd_session->get('gd_region'))
457
+							$gd_region = $gd_ses_region;
458
+						else
459
+							$gd_region = $default_location->region_slug;
460
+					}
461
+
462
+					if ($gd_city == '') {
463
+						if ($gd_ses_city = $gd_session->get('gd_city'))
464
+							$gd_city = $gd_ses_city;
465
+						else
466
+							$gd_city = $default_location->city_slug;
467
+
468
+						$base_location_link = geodir_get_location_link('base');
469
+						wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
470
+						exit();
471
+					}
472
+				}
473
+			}
474
+
475
+			$args = array(
476
+				'what' => 'city',
477
+				'city_val' => $gd_city,
478
+				'region_val' => $gd_region,
479
+				'country_val' => $gd_country,
480
+				'country_column_name' => 'country_slug',
481
+				'region_column_name' => 'region_slug',
482
+				'city_column_name' => 'city_slug',
483
+				'location_link_part' => false,
484
+				'compare_operator' => ''
485
+			);
486
+
487
+			$location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
488
+			if (!empty($location_array)) {
489
+				$gd_session->set('gd_multi_location', 1);
490
+				$gd_session->set('gd_country', $gd_country);
491
+				$gd_session->set('gd_region', $gd_region);
492
+				$gd_session->set('gd_city', $gd_city);
493 493
                 
494 494
 				$wp->query_vars['gd_country'] = $gd_country;
495
-                $wp->query_vars['gd_region'] = $gd_region;
496
-                $wp->query_vars['gd_city'] = $gd_city;
497
-            } else {
498
-                $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
499
-            }
500
-        } else {
501
-            $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
502
-        }
503
-
504
-    } else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
505
-        if (!is_admin()) {
506
-            $requested_post_type = $wp->query_vars['post_type'];
507
-            // check if this post type is geodirectory post types
508
-            $post_type_array = geodir_get_posttypes();
495
+				$wp->query_vars['gd_region'] = $gd_region;
496
+				$wp->query_vars['gd_city'] = $gd_city;
497
+			} else {
498
+				$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
499
+			}
500
+		} else {
501
+			$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
502
+		}
503
+
504
+	} else if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
505
+		if (!is_admin()) {
506
+			$requested_post_type = $wp->query_vars['post_type'];
507
+			// check if this post type is geodirectory post types
508
+			$post_type_array = geodir_get_posttypes();
509 509
             
510 510
 			if (in_array($requested_post_type, $post_type_array)) {
511
-                // now u can apply geodirectory related manipulation.
512
-            }
513
-        }
514
-    } else {
515
-        // check if a geodirectory taxonomy is set
516
-        $gd_country = '';
517
-        $gd_region = '';
518
-        $gd_city = '';
511
+				// now u can apply geodirectory related manipulation.
512
+			}
513
+		}
514
+	} else {
515
+		// check if a geodirectory taxonomy is set
516
+		$gd_country = '';
517
+		$gd_region = '';
518
+		$gd_city = '';
519 519
         
520 520
 		$is_geodir_taxonomy = false;
521
-        $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not
522
-        $is_geodir_location_found = false;
521
+		$is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not
522
+		$is_geodir_location_found = false;
523 523
 		
524 524
 		$geodir_taxonomy = '';
525
-        $geodir_post_type = '';
526
-        $geodir_term = '';
527
-        $geodir_set_location_session = true;
528
-        $geodir_taxonomis = geodir_get_taxonomies('', true);
529
-
530
-        if(!empty($geodir_taxonomis)){
531
-            foreach ($geodir_taxonomis as $taxonomy) {
532
-                if (array_key_exists($taxonomy, $wp->query_vars)) {
533
-                    $is_geodir_taxonomy = true;
534
-                    $geodir_taxonomy = $taxonomy;
535
-                    $geodir_post_type = str_replace('category', '', $taxonomy);
536
-                    $geodir_post_type = str_replace('_tags', '', $geodir_post_type);
537
-                    $geodir_term = $wp->query_vars[$geodir_taxonomy];
538
-                    break;
539
-                }
540
-            }
541
-        }
542
-
543
-        // now get an array of all terms seperated by '/'
544
-        $geodir_terms = explode('/', $geodir_term);
545
-        $geodir_last_term = end($geodir_terms);
546
-
547
-        if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
548
-            $wp->query_vars['post_type'] = $geodir_post_type;
525
+		$geodir_post_type = '';
526
+		$geodir_term = '';
527
+		$geodir_set_location_session = true;
528
+		$geodir_taxonomis = geodir_get_taxonomies('', true);
529
+
530
+		if(!empty($geodir_taxonomis)){
531
+			foreach ($geodir_taxonomis as $taxonomy) {
532
+				if (array_key_exists($taxonomy, $wp->query_vars)) {
533
+					$is_geodir_taxonomy = true;
534
+					$geodir_taxonomy = $taxonomy;
535
+					$geodir_post_type = str_replace('category', '', $taxonomy);
536
+					$geodir_post_type = str_replace('_tags', '', $geodir_post_type);
537
+					$geodir_term = $wp->query_vars[$geodir_taxonomy];
538
+					break;
539
+				}
540
+			}
541
+		}
542
+
543
+		// now get an array of all terms seperated by '/'
544
+		$geodir_terms = explode('/', $geodir_term);
545
+		$geodir_last_term = end($geodir_terms);
546
+
547
+		if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
548
+			$wp->query_vars['post_type'] = $geodir_post_type;
549 549
 
550 550
 			// now check if last term is a post of geodirectory post types
551 551
 			$geodir_post = get_posts(array(
@@ -594,196 +594,196 @@  discard block
 block discarded – undo
594 594
 				//return ;
595 595
 			}
596 596
 
597
-            $geodir_location_terms = '';
598
-            // if last term is not a post then check if last term is a term of the specific texonomy or not
599
-            if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
600
-                $is_geodir_taxonomy_term = true;
597
+			$geodir_location_terms = '';
598
+			// if last term is not a post then check if last term is a term of the specific texonomy or not
599
+			if (geodir_term_exists($geodir_last_term, $geodir_taxonomy)) {
600
+				$is_geodir_taxonomy_term = true;
601 601
 
602
-                $geodir_set_location_session = false;
603
-            }
602
+				$geodir_set_location_session = false;
603
+			}
604 604
 
605 605
 
606
-            // now check if there is location parts in the url or not
607
-            if (get_option('geodir_add_location_url')) {				
606
+			// now check if there is location parts in the url or not
607
+			if (get_option('geodir_add_location_url')) {				
608 608
 				$default_location = geodir_get_default_location();
609 609
                 
610 610
 				if ($geodir_show_location_url == 'all') {
611
-                    if (count($geodir_terms) >= 3) {
612
-                        $gd_country = urldecode($geodir_terms[0]);
613
-                        $gd_region = urldecode($geodir_terms[1]);
614
-                        $gd_city = urldecode($geodir_terms[2]);
615
-                    } else if (count($geodir_terms) >= 2) {
616
-                        $gd_country = urldecode($geodir_terms[0]);
617
-                        $gd_region = urldecode($geodir_terms[1]);
618
-                    } else if (count($geodir_terms) >= 1) {
619
-                        $gd_country = urldecode($geodir_terms[0]);
620
-                    }
621
-
622
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623
-                        geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624
-                        geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
-                    )
626
-                        $is_geodir_location_found = true;
627
-
628
-                    // if location has not been found for country , region and city then search for country and region only
629
-
630
-                    if (!$is_geodir_location_found) {
631
-                        $gd_city = '';
632
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633
-                            geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
-                        )
635
-                            $is_geodir_location_found = true;
636
-
637
-                    }
638
-
639
-                    // if location has not been found for country , region  then search for country only
640
-                    if (!$is_geodir_location_found) {
641
-                        $gd_city = '';
642
-                        $gd_region = '';
643
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
-                            $is_geodir_location_found = true;
645
-                    }
646
-                } else if ($geodir_show_location_url == 'country_city') {
647
-                    if (count($geodir_terms) >= 2) {
648
-                        $gd_country = urldecode($geodir_terms[0]);
649
-                        $gd_city = urldecode($geodir_terms[1]);
650
-                    } else if (count($geodir_terms) >= 1) {
651
-                        $gd_country = urldecode($geodir_terms[0]);
652
-                    }
653
-
654
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
-                        $is_geodir_location_found = true;
656
-
657
-                    // if location has not been found for country and city  then search for country only
658
-                    if (!$is_geodir_location_found) {
659
-                        $gd_city = '';
611
+					if (count($geodir_terms) >= 3) {
612
+						$gd_country = urldecode($geodir_terms[0]);
613
+						$gd_region = urldecode($geodir_terms[1]);
614
+						$gd_city = urldecode($geodir_terms[2]);
615
+					} else if (count($geodir_terms) >= 2) {
616
+						$gd_country = urldecode($geodir_terms[0]);
617
+						$gd_region = urldecode($geodir_terms[1]);
618
+					} else if (count($geodir_terms) >= 1) {
619
+						$gd_country = urldecode($geodir_terms[0]);
620
+					}
621
+
622
+					if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623
+						geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624
+						geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
+					)
626
+						$is_geodir_location_found = true;
627
+
628
+					// if location has not been found for country , region and city then search for country and region only
629
+
630
+					if (!$is_geodir_location_found) {
631
+						$gd_city = '';
632
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633
+							geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
+						)
635
+							$is_geodir_location_found = true;
636
+
637
+					}
638
+
639
+					// if location has not been found for country , region  then search for country only
640
+					if (!$is_geodir_location_found) {
641
+						$gd_city = '';
642
+						$gd_region = '';
643
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
+							$is_geodir_location_found = true;
645
+					}
646
+				} else if ($geodir_show_location_url == 'country_city') {
647
+					if (count($geodir_terms) >= 2) {
648
+						$gd_country = urldecode($geodir_terms[0]);
649
+						$gd_city = urldecode($geodir_terms[1]);
650
+					} else if (count($geodir_terms) >= 1) {
651
+						$gd_country = urldecode($geodir_terms[0]);
652
+					}
653
+
654
+					if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
+						$is_geodir_location_found = true;
656
+
657
+					// if location has not been found for country and city  then search for country only
658
+					if (!$is_geodir_location_found) {
659
+						$gd_city = '';
660 660
                         
661 661
 						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662
-                            $is_geodir_location_found = true;
663
-                    }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
665
-                    if (count($geodir_terms) >= 2) {
666
-                        $gd_region = urldecode($geodir_terms[0]);
667
-                        $gd_city = urldecode($geodir_terms[1]);
668
-                    } else if (count($geodir_terms) >= 1) {
669
-                        $gd_region = urldecode($geodir_terms[0]);
670
-                    }
671
-
672
-                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
-                        $is_geodir_location_found = true;
674
-
675
-                    // if location has not been found for region and city  then search for region only
676
-                    if (!$is_geodir_location_found) {
677
-                        $gd_city = '';
662
+							$is_geodir_location_found = true;
663
+					}
664
+				}  else if ($geodir_show_location_url == 'region_city') {
665
+					if (count($geodir_terms) >= 2) {
666
+						$gd_region = urldecode($geodir_terms[0]);
667
+						$gd_city = urldecode($geodir_terms[1]);
668
+					} else if (count($geodir_terms) >= 1) {
669
+						$gd_region = urldecode($geodir_terms[0]);
670
+					}
671
+
672
+					if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
+						$is_geodir_location_found = true;
674
+
675
+					// if location has not been found for region and city  then search for region only
676
+					if (!$is_geodir_location_found) {
677
+						$gd_city = '';
678 678
                         
679 679
 						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
680
-                            $is_geodir_location_found = true;
681
-                    }
682
-                } else {
683
-                    $gd_city = $geodir_terms[0];
684
-
685
-                    if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
686
-                        $is_geodir_location_found = true;
687
-                        $gd_region = $default_location->region_slug;
688
-                        $gd_country = $default_location->country_slug;
689
-                    }
690
-                }
691
-                // if location still not found then clear location related session variables
692
-                if ($is_geodir_location_found && $geodir_set_location_session) {
693
-                    $gd_session->set('gd_multi_location', 1);
694
-                    $gd_session->set('gd_country', $gd_country);
695
-                    $gd_session->set('gd_region', $gd_region);
696
-                    $gd_session->set('gd_city', $gd_city);
697
-                }
698
-
699
-                if ($geodir_show_location_url == 'all') {
680
+							$is_geodir_location_found = true;
681
+					}
682
+				} else {
683
+					$gd_city = $geodir_terms[0];
684
+
685
+					if (geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
686
+						$is_geodir_location_found = true;
687
+						$gd_region = $default_location->region_slug;
688
+						$gd_country = $default_location->country_slug;
689
+					}
690
+				}
691
+				// if location still not found then clear location related session variables
692
+				if ($is_geodir_location_found && $geodir_set_location_session) {
693
+					$gd_session->set('gd_multi_location', 1);
694
+					$gd_session->set('gd_country', $gd_country);
695
+					$gd_session->set('gd_region', $gd_region);
696
+					$gd_session->set('gd_city', $gd_city);
697
+				}
698
+
699
+				if ($geodir_show_location_url == 'all') {
700 700
 				} else if ($geodir_show_location_url == 'country_city') {
701 701
 					$gd_region = '';
702 702
 				} else if ($geodir_show_location_url == 'region_city') {
703 703
 					$gd_country = '';
704 704
 				} else {
705 705
 					$gd_country = '';
706
-                    $gd_region = '';
706
+					$gd_region = '';
707 707
 				}
708 708
 
709
-                if ($is_geodir_location_found) {
710
-                    $wp->query_vars['gd_country'] = $gd_country;
711
-                    $wp->query_vars['gd_region'] = $gd_region;
712
-                    $wp->query_vars['gd_city'] = $gd_city;
713
-                } else {
714
-                    $gd_country = '';
715
-                    $gd_region = '';
716
-                    $gd_city = '';
717
-                }
718
-            }
719
-
720
-            $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721
-            // eliminate location related terms from taxonomy term
722
-            if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
724
-
725
-            if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
727
-
728
-            if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
730
-
731
-
732
-            $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
733
-            $wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
734
-
735
-            $wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');
736
-
737
-            if ($wp->query_vars[$geodir_taxonomy] == '') {
738
-                unset($wp->query_vars[$geodir_taxonomy]);
739
-            } else {
740
-                if (!$is_geodir_taxonomy_term) {
741
-                    foreach ($wp->query_vars as $key => $vars) {
742
-                        unset($wp->query_vars[$key]);
743
-                    }
744
-                    $wp->query_vars['error'] = '404';
745
-                }
746
-            }
747
-        }
748
-    }
709
+				if ($is_geodir_location_found) {
710
+					$wp->query_vars['gd_country'] = $gd_country;
711
+					$wp->query_vars['gd_region'] = $gd_region;
712
+					$wp->query_vars['gd_city'] = $gd_city;
713
+				} else {
714
+					$gd_country = '';
715
+					$gd_region = '';
716
+					$gd_city = '';
717
+				}
718
+			}
719
+
720
+			$wp->query_vars[$geodir_taxonomy] = $geodir_term;
721
+			// eliminate location related terms from taxonomy term
722
+			if ($gd_country != '')
723
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
724
+
725
+			if ($gd_region != '')
726
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
727
+
728
+			if ($gd_city != '')
729
+				$wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
730
+
731
+
732
+			$wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
733
+			$wp->query_vars[$geodir_taxonomy] = str_replace('//', '', $wp->query_vars[$geodir_taxonomy]);
734
+
735
+			$wp->query_vars[$geodir_taxonomy] = trim($wp->query_vars[$geodir_taxonomy], '/');
736
+
737
+			if ($wp->query_vars[$geodir_taxonomy] == '') {
738
+				unset($wp->query_vars[$geodir_taxonomy]);
739
+			} else {
740
+				if (!$is_geodir_taxonomy_term) {
741
+					foreach ($wp->query_vars as $key => $vars) {
742
+						unset($wp->query_vars[$key]);
743
+					}
744
+					$wp->query_vars['error'] = '404';
745
+				}
746
+			}
747
+		}
748
+	}
749 749
 	
750 750
 	// Unset location session if gd page and location not set.
751 751
 	if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
752 752
 		$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
753 753
 	}
754 754
 
755
-    if ($gd_session->get('gd_multi_location') == 1) {
756
-        $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
757
-        $wp->query_vars['gd_region'] = $gd_session->get('gd_region');
758
-        $wp->query_vars['gd_city'] = $gd_session->get('gd_city');
759
-    }
755
+	if ($gd_session->get('gd_multi_location') == 1) {
756
+		$wp->query_vars['gd_country'] = $gd_session->get('gd_country');
757
+		$wp->query_vars['gd_region'] = $gd_session->get('gd_region');
758
+		$wp->query_vars['gd_city'] = $gd_session->get('gd_city');
759
+	}
760 760
 
761
-    // now check if there is location parts in the url or not
762
-    if (get_option('geodir_add_location_url')) {        
761
+	// now check if there is location parts in the url or not
762
+	if (get_option('geodir_add_location_url')) {        
763 763
 		if ($geodir_show_location_url == 'all') {
764 764
 		} else if ($geodir_show_location_url == 'country_city') {
765 765
 			 if (isset($wp->query_vars['gd_region']))
766
-                $wp->query_vars['gd_region'] = '';
766
+				$wp->query_vars['gd_region'] = '';
767 767
 		} else if ($geodir_show_location_url == 'region_city') {
768 768
 			if (isset($wp->query_vars['gd_country']))
769
-                $wp->query_vars['gd_country'] = '';
769
+				$wp->query_vars['gd_country'] = '';
770 770
 		} else {
771 771
 			if (isset($wp->query_vars['gd_country']))
772
-                $wp->query_vars['gd_country'] = '';
772
+				$wp->query_vars['gd_country'] = '';
773 773
 
774
-            if (isset($wp->query_vars['gd_region']))
775
-                $wp->query_vars['gd_region'] = '';
774
+			if (isset($wp->query_vars['gd_region']))
775
+				$wp->query_vars['gd_region'] = '';
776 776
 		}
777
-    } else {
778
-        if (isset($wp->query_vars['gd_country']))
779
-            $wp->query_vars['gd_country'] = '';
777
+	} else {
778
+		if (isset($wp->query_vars['gd_country']))
779
+			$wp->query_vars['gd_country'] = '';
780 780
 
781
-        if (isset($wp->query_vars['gd_region']))
782
-            $wp->query_vars['gd_region'] = '';
781
+		if (isset($wp->query_vars['gd_region']))
782
+			$wp->query_vars['gd_region'] = '';
783 783
 
784
-        if (isset($wp->query_vars['gd_city']))
785
-            $wp->query_vars['gd_city'] = '';
786
-    }
784
+		if (isset($wp->query_vars['gd_city']))
785
+			$wp->query_vars['gd_city'] = '';
786
+	}
787 787
 }
788 788
 
789 789
 /**
@@ -797,24 +797,24 @@  discard block
 block discarded – undo
797 797
  */
798 798
 function geodir_custom_post_status()
799 799
 {
800
-    // Virtual Page Status
801
-    register_post_status('virtual', array(
802
-        'label' => _x('Virtual', 'page', 'geodirectory'),
803
-        'public' => true,
804
-        'exclude_from_search' => true,
805
-        'show_in_admin_all_list' => true,
806
-        'show_in_admin_status_list' => true,
807
-        'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
808
-    ));
809
-
810
-    /**
811
-     * Called after we register the custom post status 'Virtual'.
812
-     *
813
-     * Can be use to add more post statuses.
814
-     *
815
-     * @since 1.0.0
816
-     */
817
-    do_action('geodir_custom_post_status');
800
+	// Virtual Page Status
801
+	register_post_status('virtual', array(
802
+		'label' => _x('Virtual', 'page', 'geodirectory'),
803
+		'public' => true,
804
+		'exclude_from_search' => true,
805
+		'show_in_admin_all_list' => true,
806
+		'show_in_admin_status_list' => true,
807
+		'label_count' => _n_noop('Virtual <span class="count">(%s)</span>', 'Virtual <span class="count">(%s)</span>', 'geodirectory'),
808
+	));
809
+
810
+	/**
811
+	 * Called after we register the custom post status 'Virtual'.
812
+	 *
813
+	 * Can be use to add more post statuses.
814
+	 *
815
+	 * @since 1.0.0
816
+	 */
817
+	do_action('geodir_custom_post_status');
818 818
 }
819 819
 
820 820
 /**
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
  */
830 830
 function geodir_get_term_link($termlink, $term, $taxonomy)
831 831
 {
832
-    return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php
832
+	return geodir_term_link($termlink, $term, $taxonomy); // taxonomy_functions.php
833 833
 }
834 834
 
835 835
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
  */
844 844
 function geodir_get_posttype_link($link, $post_type)
845 845
 {
846
-    return geodir_posttype_link($link, $post_type); // taxonomy_functions.php
846
+	return geodir_posttype_link($link, $post_type); // taxonomy_functions.php
847 847
 }
848 848
 
849 849
 /**
@@ -858,13 +858,13 @@  discard block
 block discarded – undo
858 858
  */
859 859
 function exclude_from_wp_list_pages($exclude_array)
860 860
 {
861
-    $pages_ids = array();
862
-    $pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
863
-    foreach ($pages_array as $page) {
864
-        $pages_ids[] = $page->ID;
865
-    }
866
-    $exclude_array = $exclude_array + $pages_ids;
867
-    return $exclude_array;
861
+	$pages_ids = array();
862
+	$pages_array = get_posts(array('post_type' => 'page', 'post_status' => 'virtual'));
863
+	foreach ($pages_array as $page) {
864
+		$pages_ids[] = $page->ID;
865
+	}
866
+	$exclude_array = $exclude_array + $pages_ids;
867
+	return $exclude_array;
868 868
 }
869 869
 
870 870
 /**
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_exclude_page($query)
879 879
 {
880
-    add_filter('posts_where', 'geodir_exclude_page_where', 100);
881
-    return $query;
880
+	add_filter('posts_where', 'geodir_exclude_page_where', 100);
881
+	return $query;
882 882
 }
883 883
 
884 884
 /**
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
  */
894 894
 function geodir_exclude_page_where($where)
895 895
 {
896
-    global $wpdb;
897
-    if (is_admin())
898
-        $where .= " AND $wpdb->posts.post_status != 'virtual'";
896
+	global $wpdb;
897
+	if (is_admin())
898
+		$where .= " AND $wpdb->posts.post_status != 'virtual'";
899 899
 
900
-    return $where;
900
+	return $where;
901 901
 }
902 902
 
903 903
 /**
@@ -912,20 +912,20 @@  discard block
 block discarded – undo
912 912
  * @return mixed The taxonomy option value.
913 913
  */
914 914
 function geodir_wpseo_taxonomy_meta( $value, $option = '' ) {
915
-    global $wp_query;
915
+	global $wp_query;
916 916
     
917
-    if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
918
-        $term = $wp_query->get_queried_object();
917
+	if ( !empty( $value ) && ( is_category() || is_tax() ) ) {
918
+		$term = $wp_query->get_queried_object();
919 919
         
920
-        if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
-            $image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
920
+		if ( !empty( $term->term_id ) && !empty( $term->taxonomy ) && isset( $value[$term->taxonomy][$term->term_id] ) && in_array( str_replace( 'category', '', $term->taxonomy ), geodir_get_posttypes() ) ) {
921
+			$image  = geodir_get_default_catimage( $term->term_id, str_replace( 'category', '', $term->taxonomy ) );
922 922
             
923
-            if ( !empty( $image['src'] ) ) {
924
-                $value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925
-                $value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926
-            }
927
-        }
928
-    }
929
-    return $value;
923
+			if ( !empty( $image['src'] ) ) {
924
+				$value[$term->taxonomy][$term->term_id]['wpseo_twitter-image'] = $image['src'];
925
+				$value[$term->taxonomy][$term->term_id]['wpseo_opengraph-image'] = $image['src'];
926
+			}
927
+		}
928
+	}
929
+	return $value;
930 930
 }
931 931
 add_filter( 'option_wpseo_taxonomy_meta', 'geodir_wpseo_taxonomy_meta', 10, 2 );
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/cat_meta.php 2 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -11,146 +11,146 @@  discard block
 block discarded – undo
11 11
 //include the main class file
12 12
 require_once("Tax-meta-class.php");
13 13
 function geodir_set_tax_meta_fields() {
14
-    /*
14
+	/*
15 15
      * prefix of meta keys, optional
16 16
      * use underscore (_) at the beginning to make keys hidden, for example $prefix = '_ba_';
17 17
      *  you also can make prefix empty to disable it
18 18
      *
19 19
      */
20 20
 
21
-    $prefix = 'ct_';
22
-    /*
21
+	$prefix = 'ct_';
22
+	/*
23 23
      * configure your meta box
24 24
      */
25 25
 
26
-    $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
-        'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
-    );
26
+	$config = array(
27
+		'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
+		'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
+		'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
+		'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
+		'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
+		'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
+		'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
+	);
35 35
 
36 36
 
37
-    /*
37
+	/*
38 38
      * Initiate your meta box
39 39
      */
40
-    $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
-    /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
40
+	$my_meta = new Geodir_Tax_Meta_Class($config);
41
+	$my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+	$my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+	$my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
+	/*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45 45
 
46
-    $my_meta->addSelect($prefix . 'cat_schema',
47
-    /*
46
+	$my_meta->addSelect($prefix . 'cat_schema',
47
+	/*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-    apply_filters('geodir_cat_schemas',array(
53
-        '' => __('Default (LocalBusiness)', 'geodirectory'),
54
-        'AccountingService' => 'AccountingService',
55
-        'Attorney' => 'Attorney',
56
-        'AutoBodyShop' => 'AutoBodyShop',
57
-        'AutoDealer' => 'AutoDealer',
58
-        'AutoPartsStore' => 'AutoPartsStore',
59
-        'AutoRental' => 'AutoRental',
60
-        'AutoRepair' => 'AutoRepair',
61
-        'AutoWash' => 'AutoWash',
62
-        'Bakery' => 'Bakery',
63
-        'BarOrPub' => 'BarOrPub',
64
-        'BeautySalon' => 'BeautySalon',
65
-        'BedAndBreakfast' => 'BedAndBreakfast',
66
-        'BikeStore' => 'BikeStore',
67
-        'BookStore' => 'BookStore',
68
-        'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
-        'Campground' => 'Campground',
70
-        'ChildCare' => 'ChildCare',
71
-        'ClothingStore' => 'ClothingStore',
72
-        'ComputerStore' => 'ComputerStore',
73
-        'DaySpa' => 'DaySpa',
74
-        'Dentist' => 'Dentist',
75
-        'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
-        'Electrician' => 'Electrician',
77
-        'ElectronicsStore' => 'ElectronicsStore',
78
-        'EmergencyService' => 'EmergencyService',
79
-        'EntertainmentBusiness' => 'EntertainmentBusiness',
80
-        'Event' => 'Event',
81
-        'EventVenue' => 'EventVenue',
82
-        'ExerciseGym' => 'ExerciseGym',
83
-        'FinancialService' => 'FinancialService',
84
-        'Florist' => 'Florist',
85
-        'FoodEstablishment' => 'FoodEstablishment',
86
-        'FurnitureStore' => 'FurnitureStore',
87
-        'GardenStore' => 'GardenStore',
88
-        'GeneralContractor' => 'GeneralContractor',
89
-        'GolfCourse' => 'GolfCourse',
90
-        'HairSalon' => 'HairSalon',
91
-        'HardwareStore' => 'HardwareStore',
92
-        'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
-        'HobbyShop' => 'HobbyShop',
94
-        'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
-        'HomeGoodsStore' => 'HomeGoodsStore',
96
-        'Hospital' => 'Hospital',
97
-        'Hostel' => 'Hostel',
98
-        'Hotel' => 'Hotel',
99
-        'HousePainter' => 'HousePainter',
100
-        'HVACBusiness' => 'HVACBusiness',
101
-        'InsuranceAgency' => 'InsuranceAgency',
102
-        'JewelryStore' => 'JewelryStore',
103
-        'LiquorStore' => 'LiquorStore',
104
-        'Locksmith' => 'Locksmith',
105
-        'LodgingBusiness' => 'LodgingBusiness',
106
-        'MedicalClinic' => 'MedicalClinic',
107
-        'MensClothingStore' => 'MensClothingStore',
108
-        'MobilePhoneStore' => 'MobilePhoneStore',
109
-        'Motel' => 'Motel',
110
-        'MotorcycleDealer' => 'MotorcycleDealer',
111
-        'MotorcycleRepair' => 'MotorcycleRepair',
112
-        'MovingCompany' => 'MovingCompany',
113
-        'MusicStore' => 'MusicStore',
114
-        'NailSalon' => 'NailSalon',
115
-        'NightClub' => 'NightClub',
116
-        'Notary' => 'Notary',
117
-        'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
-        'Optician' => 'Optician',
119
-        'PetStore' => 'PetStore',
120
-        'Physician' => 'Physician',
121
-        'Plumber' => 'Plumber',
122
-        'ProfessionalService' => 'ProfessionalService',
123
-        'RealEstateAgent' => 'RealEstateAgent',
124
-        'Residence' => 'Residence',
125
-        'Restaurant' => 'Restaurant',
126
-        'RoofingContractor' => 'RoofingContractor',
127
-        'RVPark' => 'RVPark',
128
-        'School' => 'School',
129
-        'SelfStorage' => 'SelfStorage',
130
-        'ShoeStore' => 'ShoeStore',
131
-        'SkiResort' => 'SkiResort',
132
-        'SportingGoodsStore' => 'SportingGoodsStore',
133
-        'SportsClub' => 'SportsClub',
134
-        'Store' => 'Store',
135
-        'TattooParlor' => 'TattooParlor',
136
-        'Taxi' => 'Taxi',
137
-        'TennisComplex' => 'TennisComplex',
138
-        'TireShop' => 'TireShop',
139
-        'TouristAttraction' => 'TouristAttraction',
140
-        'ToyStore' => 'ToyStore',
141
-        'TravelAgency' => 'TravelAgency',
142
-        //'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
-        'VeterinaryCare' => 'VeterinaryCare',
144
-        'WholesaleStore' => 'WholesaleStore',
145
-        'Winery' => 'Winery'
146
-    )),
147
-    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
52
+	apply_filters('geodir_cat_schemas',array(
53
+		'' => __('Default (LocalBusiness)', 'geodirectory'),
54
+		'AccountingService' => 'AccountingService',
55
+		'Attorney' => 'Attorney',
56
+		'AutoBodyShop' => 'AutoBodyShop',
57
+		'AutoDealer' => 'AutoDealer',
58
+		'AutoPartsStore' => 'AutoPartsStore',
59
+		'AutoRental' => 'AutoRental',
60
+		'AutoRepair' => 'AutoRepair',
61
+		'AutoWash' => 'AutoWash',
62
+		'Bakery' => 'Bakery',
63
+		'BarOrPub' => 'BarOrPub',
64
+		'BeautySalon' => 'BeautySalon',
65
+		'BedAndBreakfast' => 'BedAndBreakfast',
66
+		'BikeStore' => 'BikeStore',
67
+		'BookStore' => 'BookStore',
68
+		'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
+		'Campground' => 'Campground',
70
+		'ChildCare' => 'ChildCare',
71
+		'ClothingStore' => 'ClothingStore',
72
+		'ComputerStore' => 'ComputerStore',
73
+		'DaySpa' => 'DaySpa',
74
+		'Dentist' => 'Dentist',
75
+		'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
+		'Electrician' => 'Electrician',
77
+		'ElectronicsStore' => 'ElectronicsStore',
78
+		'EmergencyService' => 'EmergencyService',
79
+		'EntertainmentBusiness' => 'EntertainmentBusiness',
80
+		'Event' => 'Event',
81
+		'EventVenue' => 'EventVenue',
82
+		'ExerciseGym' => 'ExerciseGym',
83
+		'FinancialService' => 'FinancialService',
84
+		'Florist' => 'Florist',
85
+		'FoodEstablishment' => 'FoodEstablishment',
86
+		'FurnitureStore' => 'FurnitureStore',
87
+		'GardenStore' => 'GardenStore',
88
+		'GeneralContractor' => 'GeneralContractor',
89
+		'GolfCourse' => 'GolfCourse',
90
+		'HairSalon' => 'HairSalon',
91
+		'HardwareStore' => 'HardwareStore',
92
+		'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
+		'HobbyShop' => 'HobbyShop',
94
+		'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
+		'HomeGoodsStore' => 'HomeGoodsStore',
96
+		'Hospital' => 'Hospital',
97
+		'Hostel' => 'Hostel',
98
+		'Hotel' => 'Hotel',
99
+		'HousePainter' => 'HousePainter',
100
+		'HVACBusiness' => 'HVACBusiness',
101
+		'InsuranceAgency' => 'InsuranceAgency',
102
+		'JewelryStore' => 'JewelryStore',
103
+		'LiquorStore' => 'LiquorStore',
104
+		'Locksmith' => 'Locksmith',
105
+		'LodgingBusiness' => 'LodgingBusiness',
106
+		'MedicalClinic' => 'MedicalClinic',
107
+		'MensClothingStore' => 'MensClothingStore',
108
+		'MobilePhoneStore' => 'MobilePhoneStore',
109
+		'Motel' => 'Motel',
110
+		'MotorcycleDealer' => 'MotorcycleDealer',
111
+		'MotorcycleRepair' => 'MotorcycleRepair',
112
+		'MovingCompany' => 'MovingCompany',
113
+		'MusicStore' => 'MusicStore',
114
+		'NailSalon' => 'NailSalon',
115
+		'NightClub' => 'NightClub',
116
+		'Notary' => 'Notary',
117
+		'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
+		'Optician' => 'Optician',
119
+		'PetStore' => 'PetStore',
120
+		'Physician' => 'Physician',
121
+		'Plumber' => 'Plumber',
122
+		'ProfessionalService' => 'ProfessionalService',
123
+		'RealEstateAgent' => 'RealEstateAgent',
124
+		'Residence' => 'Residence',
125
+		'Restaurant' => 'Restaurant',
126
+		'RoofingContractor' => 'RoofingContractor',
127
+		'RVPark' => 'RVPark',
128
+		'School' => 'School',
129
+		'SelfStorage' => 'SelfStorage',
130
+		'ShoeStore' => 'ShoeStore',
131
+		'SkiResort' => 'SkiResort',
132
+		'SportingGoodsStore' => 'SportingGoodsStore',
133
+		'SportsClub' => 'SportsClub',
134
+		'Store' => 'Store',
135
+		'TattooParlor' => 'TattooParlor',
136
+		'Taxi' => 'Taxi',
137
+		'TennisComplex' => 'TennisComplex',
138
+		'TireShop' => 'TireShop',
139
+		'TouristAttraction' => 'TouristAttraction',
140
+		'ToyStore' => 'ToyStore',
141
+		'TravelAgency' => 'TravelAgency',
142
+		//'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
+		'VeterinaryCare' => 'VeterinaryCare',
144
+		'WholesaleStore' => 'WholesaleStore',
145
+		'Winery' => 'Winery'
146
+	)),
147
+	array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148 148
 
149
-    // Finish Meta Box Declaration
150
-    $my_meta->Finish();
149
+	// Finish Meta Box Declaration
150
+	$my_meta->Finish();
151 151
 }
152 152
 if ( is_admin() ) {
153
-    add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
153
+	add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
154 154
 }
155 155
 
156 156
 
@@ -159,86 +159,86 @@  discard block
 block discarded – undo
159 159
 ##############################################################
160 160
 $gd_taxonomies = geodir_get_taxonomies();
161 161
 if (!empty($gd_taxonomies)) {
162
-    foreach ($gd_taxonomies as $gd_taxonomy) {
162
+	foreach ($gd_taxonomies as $gd_taxonomy) {
163 163
 
164
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
164
+		add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
+		add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
166 166
 
167
-    }
167
+	}
168 168
 }
169 169
 
170 170
 function addCat_column($columns)
171 171
 {
172
-    if (isset($columns['description']) && $posts = $columns['description']) {
173
-        unset($columns['description']);
174
-    }
172
+	if (isset($columns['description']) && $posts = $columns['description']) {
173
+		unset($columns['description']);
174
+	}
175 175
 
176
-    $columns['cat_icon'] = 'Icon';
177
-    $columns['cat_default_img'] = __('Default Image', 'geodirectory');
178
-    $columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
179
-    return $columns;
176
+	$columns['cat_icon'] = 'Icon';
177
+	$columns['cat_default_img'] = __('Default Image', 'geodirectory');
178
+	$columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
179
+	return $columns;
180 180
 }
181 181
 
182 182
 #############################################################
183 183
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
184 184
 {
185
-    if ($column_name == 'cat_ID_num')
186
-        echo $term_id;
185
+	if ($column_name == 'cat_ID_num')
186
+		echo $term_id;
187 187
 
188
-    if ($column_name == 'cat_icon') {
189
-        $term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
188
+	if ($column_name == 'cat_icon') {
189
+		$term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
190 190
 
191
-        if ($term_icon_url != '') {
192
-            $file_info = pathinfo($term_icon_url['src']);
191
+		if ($term_icon_url != '') {
192
+			$file_info = pathinfo($term_icon_url['src']);
193 193
 
194
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195
-                $sub_dir = $file_info['dirname'];
196
-            } else {
197
-                $sub_dir = '';
198
-            }
194
+			if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195
+				$sub_dir = $file_info['dirname'];
196
+			} else {
197
+				$sub_dir = '';
198
+			}
199 199
 
200
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
201
-            $uploads_baseurl = $uploads['baseurl'];
202
-            $uploads_path = $uploads['path'];
200
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
201
+			$uploads_baseurl = $uploads['baseurl'];
202
+			$uploads_path = $uploads['path'];
203 203
 
204
-            $file_name = $file_info['basename'];
204
+			$file_name = $file_info['basename'];
205 205
 
206
-            if (strpos($sub_dir, 'https://') !== false) {
207
-                $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
208
-            } else {
209
-                $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
210
-            }
211
-            $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
206
+			if (strpos($sub_dir, 'https://') !== false) {
207
+				$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
208
+			} else {
209
+				$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
210
+			}
211
+			$sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
212 212
 
213
-            $uploads_url = $uploads_baseurl . $sub_dir;
213
+			$uploads_url = $uploads_baseurl . $sub_dir;
214 214
 
215
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
-            echo '<img src="' . $term_icon_url['src'] . '" />';
217
-        }
218
-    }
215
+			$term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
+			echo '<img src="' . $term_icon_url['src'] . '" />';
217
+		}
218
+	}
219 219
 
220
-    if ($column_name == 'cat_default_img') {
221
-        $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222
-        if ($cat_default_img != '')
223
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
220
+	if ($column_name == 'cat_default_img') {
221
+		$cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222
+		if ($cat_default_img != '')
223
+			echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
224 224
 
225
-    }
225
+	}
226 226
 }
227 227
 
228 228
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
229 229
 {
230 230
 
231
-    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
232
-        return $cat_default_img;
233
-    else
234
-        return false;
231
+	if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
232
+		return $cat_default_img;
233
+	else
234
+		return false;
235 235
 }
236 236
 
237 237
 //Clear custom fields
238 238
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
239 239
 function geodir_tax_meta_clear_custom_field() {
240
-    if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
241
-        ?>
240
+	if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
241
+		?>
242 242
         <script type="text/javascript">
243 243
             jQuery(document).ready(function () {
244 244
                 jQuery('#addtag #submit').click(function () {
@@ -267,5 +267,5 @@  discard block
 block discarded – undo
267 267
             });
268 268
         </script>
269 269
     <?php
270
-    endif;
270
+	endif;
271 271
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
 
26 26
     $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
27
+        'id' => 'demo_meta_box', // meta box id, unique per meta box
28
+        'title' => __('Demo Meta Box', 'geodirectory'), // meta box title
29
+        'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies
30
+        'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
31
+        'fields' => array(), // list of meta fields (can be added by field arrays)
32
+        'local_images' => false, // Use local or hosted images (meta box images for add/remove)
33 33
         'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34 34
     );
35 35
 
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
      * Initiate your meta box
39 39
      */
40 40
     $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
41
+    $my_meta->addWysiwyg($prefix.'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+    $my_meta->addImage($prefix.'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+    $my_meta->addImage($prefix.'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44 44
     /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45 45
 
46
-    $my_meta->addSelect($prefix . 'cat_schema',
46
+    $my_meta->addSelect($prefix.'cat_schema',
47 47
     /*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-    apply_filters('geodir_cat_schemas',array(
52
+    apply_filters('geodir_cat_schemas', array(
53 53
         '' => __('Default (LocalBusiness)', 'geodirectory'),
54 54
         'AccountingService' => 'AccountingService',
55 55
         'Attorney' => 'Attorney',
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         'WholesaleStore' => 'WholesaleStore',
145 145
         'Winery' => 'Winery'
146 146
     )),
147
-    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
147
+    array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory')."", 'std' => array('selectkey2')));
148 148
 
149 149
     // Finish Meta Box Declaration
150 150
     $my_meta->Finish();
151 151
 }
152
-if ( is_admin() ) {
153
-    add_action( 'init', 'geodir_set_tax_meta_fields', 10 );
152
+if (is_admin()) {
153
+    add_action('init', 'geodir_set_tax_meta_fields', 10);
154 154
 }
155 155
 
156 156
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 if (!empty($gd_taxonomies)) {
162 162
     foreach ($gd_taxonomies as $gd_taxonomy) {
163 163
 
164
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
165
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
164
+        add_filter('manage_edit-'.$gd_taxonomy.'_columns', 'addCat_column', 10, 2);
165
+        add_action('manage_'.$gd_taxonomy.'_custom_column', 'manage_category_custom_fields', 10, 3);
166 166
 
167 167
     }
168 168
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         if ($term_icon_url != '') {
192 192
             $file_info = pathinfo($term_icon_url['src']);
193 193
 
194
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
194
+            if (isset($file_info['dirname']) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
195 195
                 $sub_dir = $file_info['dirname'];
196 196
             } else {
197 197
                 $sub_dir = '';
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
             }
211 211
             $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
212 212
 
213
-            $uploads_url = $uploads_baseurl . $sub_dir;
213
+            $uploads_url = $uploads_baseurl.$sub_dir;
214 214
 
215
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
216
-            echo '<img src="' . $term_icon_url['src'] . '" />';
215
+            $term_icon_url['src'] = $uploads_url.'/'.$file_name;
216
+            echo '<img src="'.$term_icon_url['src'].'" />';
217 217
         }
218 218
     }
219 219
 
220 220
     if ($column_name == 'cat_default_img') {
221 221
         $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
222 222
         if ($cat_default_img != '')
223
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
223
+            echo '<img src="'.$cat_default_img['src'].'" style="max-height:60px;max-width:60px;"/>';
224 224
 
225 225
     }
226 226
 }
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
                             jQuery("#addtag iframe").contents().find("body").html('');
259 259
                             jQuery('#addtag [rel="ct_cat_default_img"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
260 260
                             jQuery('#addtag [rel="ct_cat_icon"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
261
-                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image','geodirectory');?>');
262
-                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image','geodirectory');?>');
261
+                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
262
+                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
263 263
                         }
264 264
                     }, 1000);
265 265
 
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 2 patches
Indentation   +408 added lines, -408 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -215,37 +215,37 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_add_new_location($location_info = array())
217 217
 {
218
-    global $wpdb;
219
-
220
-    if (!empty($location_info)) {
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
218
+	global $wpdb;
219
+
220
+	if (!empty($location_info)) {
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
         
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
247
-
248
-        /* // Not allowed to create country in DB : 2016-12-09
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247
+
248
+		/* // Not allowed to create country in DB : 2016-12-09
249 249
         if ($geodir_location->country) {
250 250
 
251 251
             $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         }
260 260
         */
261 261
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
262
+		if ($geodir_location->is_default)
263
+			update_option('geodir_default_location', $geodir_location);
264 264
 
265
-        return $geodir_location->location_id;
265
+		return $geodir_location->location_id;
266 266
 
267
-    } else {
268
-        return false;
269
-    }
267
+	} else {
268
+		return false;
269
+	}
270 270
 }
271 271
 
272 272
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
283
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
284 284
 }
285 285
 
286 286
 /**
@@ -294,22 +294,22 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
-
299
-    $ch = curl_init();
300
-    curl_setopt($ch, CURLOPT_URL, $url);
301
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
-    $response = curl_exec($ch);
306
-    curl_close($ch);
307
-    $data = json_decode($response);
308
-    $status = $data->status;
309
-    if ($status == "OK") {
310
-        return $data->results[0]->address_components;
311
-    } else
312
-        return false;
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
+
299
+	$ch = curl_init();
300
+	curl_setopt($ch, CURLOPT_URL, $url);
301
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
+	$response = curl_exec($ch);
306
+	curl_close($ch);
307
+	$data = json_decode($response);
308
+	$status = $data->status;
309
+	if ($status == "OK") {
310
+		return $data->results[0]->address_components;
311
+	} else
312
+		return false;
313 313
 }
314 314
 
315 315
 /**
@@ -326,71 +326,71 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
328 328
 {
329
-    global $wp, $gd_session;
330
-    $location_array = array();
331
-    if ($location_array_from == 'session') {
332
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
-            return $location_array;
334
-        }
329
+	global $wp, $gd_session;
330
+	$location_array = array();
331
+	if ($location_array_from == 'session') {
332
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
+			return $location_array;
334
+		}
335 335
 
336
-        $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
347
-    } else {
348
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
-            return $location_array;
350
-        }
344
+		$city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
345
+		if ($city != '' && $city)
346
+			$location_array['gd_city'] = urldecode($city);
347
+	} else {
348
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
+			return $location_array;
350
+		}
351 351
 
352
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353 353
 
354
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355 355
 
356
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 357
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
358
+		if ($country != '')
359
+			$location_array['gd_country'] = urldecode($country);
360 360
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
361
+		if ($region != '')
362
+			$location_array['gd_region'] = urldecode($region);
363 363
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
364
+		if ($city != '')
365
+			$location_array['gd_city'] = urldecode($city);
366 366
 			
367 367
 		// Fix category link in ajax popular category widget on change post type
368 368
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
369 369
 			$location_array = geodir_get_current_location_terms('session');
370 370
 		}
371
-    }
371
+	}
372 372
 
373 373
 
374 374
 	/**
375 375
 	 * Filter the location terms.
376 376
 	 *
377 377
 	 * @since 1.4.6
378
-     * @package GeoDirectory
378
+	 * @package GeoDirectory
379
+	 *
380
+	 * @param array $location_array {
381
+	 *    Attributes of the location_array.
382
+	 *
383
+	 *    @type string $gd_country The country slug.
384
+	 *    @type string $gd_region The region slug.
385
+	 *    @type string $gd_city The city slug.
379 386
 	 *
380
-     * @param array $location_array {
381
-     *    Attributes of the location_array.
382
-     *
383
-     *    @type string $gd_country The country slug.
384
-     *    @type string $gd_region The region slug.
385
-     *    @type string $gd_city The city slug.
386
-     *
387
-     * }
387
+	 * }
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391 391
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
392 392
 
393
-    return $location_array;
393
+	return $location_array;
394 394
 
395 395
 }
396 396
 
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
  * @return bool|string
404 404
  */
405 405
 function geodir_get_location_link($which_location = 'current') {
406
-    $location_link = get_permalink(geodir_location_page_id());
407
-
408
-    if ($which_location == 'base') {
409
-        return $location_link;
410
-    } else {
411
-        $location_terms = geodir_get_current_location_terms();
412
-
413
-        if (!empty($location_terms)) {
414
-            if (get_option('permalink_structure') != '') {
415
-                $location_terms = implode("/", $location_terms);
416
-                $location_terms = rtrim($location_terms, '/');
417
-                $location_link .= $location_terms;
418
-            } else {
419
-                $location_link = geodir_getlink($location_link, $location_terms);
420
-            }
421
-        }
422
-    }
423
-    return $location_link;
406
+	$location_link = get_permalink(geodir_location_page_id());
407
+
408
+	if ($which_location == 'base') {
409
+		return $location_link;
410
+	} else {
411
+		$location_terms = geodir_get_current_location_terms();
412
+
413
+		if (!empty($location_terms)) {
414
+			if (get_option('permalink_structure') != '') {
415
+				$location_terms = implode("/", $location_terms);
416
+				$location_terms = rtrim($location_terms, '/');
417
+				$location_link .= $location_terms;
418
+			} else {
419
+				$location_link = geodir_getlink($location_link, $location_terms);
420
+			}
421
+		}
422
+	}
423
+	return $location_link;
424 424
 }
425 425
 
426 426
 /**
@@ -433,34 +433,34 @@  discard block
 block discarded – undo
433 433
  * @return array|bool Returns address on success.
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436
-    $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
-
439
-    $ch = curl_init();
440
-    curl_setopt($ch, CURLOPT_URL, $url);
441
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
-    $response = curl_exec($ch);
446
-    curl_close($ch);
447
-    $data = json_decode($response);
436
+	$url = is_ssl() ? 'https:' : 'http:';
437
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
+
439
+	$ch = curl_init();
440
+	curl_setopt($ch, CURLOPT_URL, $url);
441
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
+	$response = curl_exec($ch);
446
+	curl_close($ch);
447
+	$data = json_decode($response);
448 448
     
449
-    if (!empty($data) && !empty($data->address)) {
450
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
449
+	if (!empty($data) && !empty($data->address)) {
450
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
+		$formatted_address = (array)$data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
454
-            if (!in_array($key, $address_fields)) {
455
-                unset($formatted_address[$key]);
456
-            }
457
-        }
458
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
453
+		foreach ( $data->address as $key => $value ) {
454
+			if (!in_array($key, $address_fields)) {
455
+				unset($formatted_address[$key]);
456
+			}
457
+		}
458
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
459 459
         
460
-        return $data;
461
-    } else {
462
-        return false;
463
-    }
460
+		return $data;
461
+	} else {
462
+		return false;
463
+	}
464 464
 }
465 465
 
466 466
 /**
@@ -474,51 +474,51 @@  discard block
 block discarded – undo
474 474
  * @return string Returns the country.
475 475
  */
476 476
 function geodir_get_normal_country($country, $default = '1') {
477
-    global $wpdb;
478
-    if ($result = geodir_get_country_by_name($country)) {
479
-        return $result;
480
-    }
477
+	global $wpdb;
478
+	if ($result = geodir_get_country_by_name($country)) {
479
+		return $result;
480
+	}
481 481
     
482
-    if (defined('POST_LOCATION_TABLE')) {
483
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484
-        if (!empty($rows)) {
485
-            foreach ($rows as $row) {
486
-                $translated = __($row->country, 'geodirectory');
487
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
488
-                    return $result;
489
-                }
490
-            }
491
-        }
482
+	if (defined('POST_LOCATION_TABLE')) {
483
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484
+		if (!empty($rows)) {
485
+			foreach ($rows as $row) {
486
+				$translated = __($row->country, 'geodirectory');
487
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
488
+					return $result;
489
+				}
490
+			}
491
+		}
492 492
         
493
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
494
-        if (!empty($rows)) {
495
-            foreach ($rows as $row) {
496
-                $translated = __($row->country, 'geodirectory');
497
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
498
-                    return $result;
499
-                }
500
-            }
501
-        }
502
-    }
493
+		$rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
494
+		if (!empty($rows)) {
495
+			foreach ($rows as $row) {
496
+				$translated = __($row->country, 'geodirectory');
497
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
498
+					return $result;
499
+				}
500
+			}
501
+		}
502
+	}
503 503
     
504
-    if ( $default === '0' ) {
505
-        return NULL;
506
-    }
504
+	if ( $default === '0' ) {
505
+		return NULL;
506
+	}
507 507
     
508
-    $default_location = geodir_get_default_location();
509
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
510
-        return $result;
511
-    }
508
+	$default_location = geodir_get_default_location();
509
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
510
+		return $result;
511
+	}
512 512
     
513
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
514
-        return $result;
515
-    }
513
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
514
+		return $result;
515
+	}
516 516
     
517
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
518
-        return $result;
519
-    }
517
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
518
+		return $result;
519
+	}
520 520
     
521
-    return $country;
521
+	return $country;
522 522
 }
523 523
 
524 524
 /**
@@ -530,16 +530,16 @@  discard block
 block discarded – undo
530 530
  * @return string Country ISO2 code.
531 531
  */
532 532
 function geodir_get_country_iso2($country) {
533
-    global $wpdb;
533
+	global $wpdb;
534 534
     
535
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
536
-        return $result;
537
-    }
538
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539
-        return $result;
540
-    }
535
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
536
+		return $result;
537
+	}
538
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539
+		return $result;
540
+	}
541 541
     
542
-    return $country;
542
+	return $country;
543 543
 }
544 544
 
545 545
 /**
@@ -552,16 +552,16 @@  discard block
 block discarded – undo
552 552
  * @return string|null Country ISO2 code.
553 553
  */
554 554
 function geodir_get_country_by_name($country, $iso2 = false) {
555
-    global $wpdb;
555
+	global $wpdb;
556 556
     
557
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
558
-        return $result;
559
-    }
560
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
561
-        return $result;
562
-    }
557
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
558
+		return $result;
559
+	}
560
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
561
+		return $result;
562
+	}
563 563
     
564
-    return NULL;
564
+	return NULL;
565 565
 }
566 566
 
567 567
 
@@ -581,158 +581,158 @@  discard block
 block discarded – undo
581 581
  */
582 582
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
583 583
 
584
-    if (empty($content)) {
585
-        return $content;
586
-    }
584
+	if (empty($content)) {
585
+		return $content;
586
+	}
587 587
 
588 588
 
589
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
589
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
590 590
 
591
-    if (!empty($location_replace_vars)) {
592
-        foreach ($location_replace_vars as $search => $replace) {
593
-            if (!empty($search) && strpos($content, $search) !== false) {
594
-                $content = str_replace($search, $replace, $content);
595
-            }
596
-        }
597
-    }
591
+	if (!empty($location_replace_vars)) {
592
+		foreach ($location_replace_vars as $search => $replace) {
593
+			if (!empty($search) && strpos($content, $search) !== false) {
594
+				$content = str_replace($search, $replace, $content);
595
+			}
596
+		}
597
+	}
598 598
 
599
-    return $content;
599
+	return $content;
600 600
 }
601 601
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
602 602
 
603 603
 
604 604
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
605 605
 
606
-    global $wp;
606
+	global $wp;
607 607
     
608
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
609
-
610
-    if (empty($location_array)) {
611
-        $location_array = geodir_get_current_location_terms('query_vars');
612
-    }
613
-
614
-    $location_terms = array();
615
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
616
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
617
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
618
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
619
-
620
-    $location_names = array();
621
-    foreach ($location_terms as $type => $location) {
622
-        $location_name = $location;
623
-
624
-        if (!empty($location_name)) {
625
-            if ($location_manager) {
626
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627
-                $location_name = get_actual_location_name($location_type, $location, true);
628
-            } else {
629
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
631
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
632
-            }
633
-        }
634
-
635
-        $location_names[$type] = $location_name;
636
-    }
637
-
638
-    $location_single = '';
639
-    foreach ($location_terms as $type => $location) {
640
-        if (!empty($location)) {
641
-            if (!empty($location_names[$type])) {
642
-                $location_single = $location_names[$type];
643
-            } else {
644
-                if ($location_manager) {
645
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646
-                    $location_single = get_actual_location_name($location_type, $location, true);
647
-                } else {
648
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
649
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
650
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
651
-                }
652
-            }
653
-            break;
654
-        }
655
-    }
656
-
657
-    $full_location = array();
658
-    if (!empty($location_array)) {
659
-        $location_array = array_reverse($location_array);
660
-
661
-        foreach ($location_array as $type => $location) {
662
-            if (!empty($location_names[$type])) {
663
-                $location_name = $location_names[$type];
664
-            } else {
665
-                if ($location_manager) {
666
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667
-                    $location_name = get_actual_location_name($location_type, $location, true);
668
-                } else {
669
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
670
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
671
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
672
-                }
673
-            }
608
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
609
+
610
+	if (empty($location_array)) {
611
+		$location_array = geodir_get_current_location_terms('query_vars');
612
+	}
613
+
614
+	$location_terms = array();
615
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
616
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
617
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
618
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
619
+
620
+	$location_names = array();
621
+	foreach ($location_terms as $type => $location) {
622
+		$location_name = $location;
623
+
624
+		if (!empty($location_name)) {
625
+			if ($location_manager) {
626
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627
+				$location_name = get_actual_location_name($location_type, $location, true);
628
+			} else {
629
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
631
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
632
+			}
633
+		}
674 634
 
675
-            $full_location[] = $location_name;
676
-        }
635
+		$location_names[$type] = $location_name;
636
+	}
637
+
638
+	$location_single = '';
639
+	foreach ($location_terms as $type => $location) {
640
+		if (!empty($location)) {
641
+			if (!empty($location_names[$type])) {
642
+				$location_single = $location_names[$type];
643
+			} else {
644
+				if ($location_manager) {
645
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646
+					$location_single = get_actual_location_name($location_type, $location, true);
647
+				} else {
648
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
649
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
650
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
651
+				}
652
+			}
653
+			break;
654
+		}
655
+	}
656
+
657
+	$full_location = array();
658
+	if (!empty($location_array)) {
659
+		$location_array = array_reverse($location_array);
660
+
661
+		foreach ($location_array as $type => $location) {
662
+			if (!empty($location_names[$type])) {
663
+				$location_name = $location_names[$type];
664
+			} else {
665
+				if ($location_manager) {
666
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667
+					$location_name = get_actual_location_name($location_type, $location, true);
668
+				} else {
669
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
670
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
671
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
672
+				}
673
+			}
674
+
675
+			$full_location[] = $location_name;
676
+		}
677 677
 
678
-        if (!empty($full_location)) {
679
-            $full_location = array_unique($full_location);
680
-        }
681
-    }
682
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
678
+		if (!empty($full_location)) {
679
+			$full_location = array_unique($full_location);
680
+		}
681
+	}
682
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
683 683
     
684
-    if ( empty( $full_location ) ) {
685
-        /**
686
-         * Filter the text in meta description in full location is empty.
687
-         *
688
-         * @since 1.6.22
689
-         * 
690
-         * @param string $full_location Default: Empty.
691
-         * @param array  $location_array The array of location variables.
692
-         * @param string $gd_page       The page being filtered.
693
-         * @param string $sep           The separator.
694
-         */
695
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
696
-    }
684
+	if ( empty( $full_location ) ) {
685
+		/**
686
+		 * Filter the text in meta description in full location is empty.
687
+		 *
688
+		 * @since 1.6.22
689
+		 * 
690
+		 * @param string $full_location Default: Empty.
691
+		 * @param array  $location_array The array of location variables.
692
+		 * @param string $gd_page       The page being filtered.
693
+		 * @param string $sep           The separator.
694
+		 */
695
+		 $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
696
+	}
697 697
     
698
-    if ( empty( $location_single ) ) {
699
-        /**
700
-         * Filter the text in meta description in single location is empty.
701
-         *
702
-         * @since 1.6.22
703
-         * 
704
-         * @param string $location_single Default: Empty.
705
-         * @param array $location_array The array of location variables.
706
-         * @param string $gd_page       The page being filtered.
707
-         * @param string $sep           The separator.
708
-         */
709
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
710
-    }
711
-
712
-    $location_replace_vars = array();
713
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714
-    $location_replace_vars['%%location%%'] = $full_location;
715
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
716
-    $location_replace_vars['%%location_single%%'] = $location_single;
717
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
718
-
719
-    foreach ($location_names as $type => $name) {
720
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721
-
722
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
724
-    }
725
-
726
-    /**
727
-     * Filter the location terms variables to search & replace.
728
-     *
729
-     * @since   1.6.16
730
-     * @package GeoDirectory
731
-     *
732
-     * @param array $location_replace_vars The array of search & replace variables.
733
-     * @param array $location_array The array of location variables.
734
-     * @param string $gd_page       The page being filtered.
735
-     * @param string $sep           The separator.
736
-     */
737
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
698
+	if ( empty( $location_single ) ) {
699
+		/**
700
+		 * Filter the text in meta description in single location is empty.
701
+		 *
702
+		 * @since 1.6.22
703
+		 * 
704
+		 * @param string $location_single Default: Empty.
705
+		 * @param array $location_array The array of location variables.
706
+		 * @param string $gd_page       The page being filtered.
707
+		 * @param string $sep           The separator.
708
+		 */
709
+		 $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
710
+	}
711
+
712
+	$location_replace_vars = array();
713
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714
+	$location_replace_vars['%%location%%'] = $full_location;
715
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
716
+	$location_replace_vars['%%location_single%%'] = $location_single;
717
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
718
+
719
+	foreach ($location_names as $type => $name) {
720
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721
+
722
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
724
+	}
725
+
726
+	/**
727
+	 * Filter the location terms variables to search & replace.
728
+	 *
729
+	 * @since   1.6.16
730
+	 * @package GeoDirectory
731
+	 *
732
+	 * @param array $location_replace_vars The array of search & replace variables.
733
+	 * @param array $location_array The array of location variables.
734
+	 * @param string $gd_page       The page being filtered.
735
+	 * @param string $sep           The separator.
736
+	 */
737
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
738 738
 }
739 739
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
391
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
392 392
 
393 393
     return $location_array;
394 394
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436 436
     $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
438 438
 
439 439
     $ch = curl_init();
440 440
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
     
449 449
     if (!empty($data) && !empty($data->address)) {
450 450
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
451
+        $formatted_address = (array) $data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
453
+        foreach ($data->address as $key => $value) {
454 454
             if (!in_array($key, $address_fields)) {
455 455
                 unset($formatted_address[$key]);
456 456
             }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     }
481 481
     
482 482
     if (defined('POST_LOCATION_TABLE')) {
483
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
483
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
484 484
         if (!empty($rows)) {
485 485
             foreach ($rows as $row) {
486 486
                 $translated = __($row->country, 'geodirectory');
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             }
491 491
         }
492 492
         
493
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
493
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
494 494
         if (!empty($rows)) {
495 495
             foreach ($rows as $row) {
496 496
                 $translated = __($row->country, 'geodirectory');
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         }
502 502
     }
503 503
     
504
-    if ( $default === '0' ) {
504
+    if ($default === '0') {
505 505
         return NULL;
506 506
     }
507 507
     
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 function geodir_get_country_iso2($country) {
533 533
     global $wpdb;
534 534
     
535
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
535
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
536 536
         return $result;
537 537
     }
538
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
538
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
539 539
         return $result;
540 540
     }
541 541
     
@@ -554,10 +554,10 @@  discard block
 block discarded – undo
554 554
 function geodir_get_country_by_name($country, $iso2 = false) {
555 555
     global $wpdb;
556 556
     
557
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
557
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
558 558
         return $result;
559 559
     }
560
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
560
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
561 561
         return $result;
562 562
     }
563 563
     
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
602 602
 
603 603
 
604
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
604
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
605 605
 
606 606
     global $wp;
607 607
     
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
627 627
                 $location_name = get_actual_location_name($location_type, $location, true);
628 628
             } else {
629
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
630
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
629
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
630
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
631 631
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
632 632
             }
633 633
         }
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
646 646
                     $location_single = get_actual_location_name($location_type, $location, true);
647 647
                 } else {
648
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
649
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
648
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
649
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
650 650
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
651 651
                 }
652 652
             }
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
667 667
                     $location_name = get_actual_location_name($location_type, $location, true);
668 668
                 } else {
669
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
670
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
669
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
670
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
671 671
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
672 672
                 }
673 673
             }
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
             $full_location = array_unique($full_location);
680 680
         }
681 681
     }
682
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
682
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
683 683
     
684
-    if ( empty( $full_location ) ) {
684
+    if (empty($full_location)) {
685 685
         /**
686 686
          * Filter the text in meta description in full location is empty.
687 687
          *
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
          * @param string $gd_page       The page being filtered.
693 693
          * @param string $sep           The separator.
694 694
          */
695
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
695
+         $full_location = apply_filters('geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep);
696 696
     }
697 697
     
698
-    if ( empty( $location_single ) ) {
698
+    if (empty($location_single)) {
699 699
         /**
700 700
          * Filter the text in meta description in single location is empty.
701 701
          *
@@ -706,21 +706,21 @@  discard block
 block discarded – undo
706 706
          * @param string $gd_page       The page being filtered.
707 707
          * @param string $sep           The separator.
708 708
          */
709
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
709
+         $location_single = apply_filters('geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep);
710 710
     }
711 711
 
712 712
     $location_replace_vars = array();
713 713
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
714 714
     $location_replace_vars['%%location%%'] = $full_location;
715
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
715
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $full_location) : '';
716 716
     $location_replace_vars['%%location_single%%'] = $location_single;
717
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
717
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf(_x('in %s', 'in location', 'geodirectory'), $location_single) : '';
718 718
 
719 719
     foreach ($location_names as $type => $name) {
720 720
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
721 721
 
722
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
723
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
722
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
723
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? sprintf(_x('in %s', 'in location', 'geodirectory'), $name) : '';
724 724
     }
725 725
 
726 726
     /**
@@ -734,5 +734,5 @@  discard block
 block discarded – undo
734 734
      * @param string $gd_page       The page being filtered.
735 735
      * @param string $sep           The separator.
736 736
      */
737
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
737
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
738 738
 }
739 739
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 2 patches
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (geodir_is_wpml()) {
20
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (geodir_is_wpml()) {
37
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (geodir_is_wpml()) {
54
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (geodir_is_wpml()) {
71
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (geodir_is_wpml()) {
88
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (geodir_is_wpml()) {
105
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (geodir_is_wpml()) {
122
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-
147
-    if (geodir_is_wpml()){
148
-        $home_url = icl_get_home_url();
149
-    }else{
150
-        $home_url = home_url();
151
-    }
152
-
153
-    if (function_exists('geodir_location_geo_home_link')) {
154
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
-    }
156
-
157
-    if($gd_page_id){
158
-        $post = get_post($gd_page_id);
159
-        $slug = $post->post_name;
160
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
-        $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
163
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
164
-    }
165
-
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
168
-    }
169
-
170
-    /**
171
-     * Filter the GeoDirectory login page url.
172
-     *
173
-     * This filter can be used to change the GeoDirectory page url.
174
-     *
175
-     * @since 1.5.3
176
-     * @package GeoDirectory
177
-     * @param string $login_url The url of the login page.
178
-     * @param array $args The array of query args used.
179
-     * @param int $gd_page_id The page id of the GD login page.
180
-     */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (geodir_is_wpml()) {
140
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+
147
+	if (geodir_is_wpml()){
148
+		$home_url = icl_get_home_url();
149
+	}else{
150
+		$home_url = home_url();
151
+	}
152
+
153
+	if (function_exists('geodir_location_geo_home_link')) {
154
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
+	}
156
+
157
+	if($gd_page_id){
158
+		$post = get_post($gd_page_id);
159
+		$slug = $post->post_name;
160
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
+		$login_url = trailingslashit($home_url)."$slug/";
162
+	}else{
163
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
164
+	}
165
+
166
+	if($args){
167
+		$login_url = add_query_arg($args,$login_url );
168
+	}
169
+
170
+	/**
171
+	 * Filter the GeoDirectory login page url.
172
+	 *
173
+	 * This filter can be used to change the GeoDirectory page url.
174
+	 *
175
+	 * @since 1.5.3
176
+	 * @package GeoDirectory
177
+	 * @param string $login_url The url of the login page.
178
+	 * @param array $args The array of query args used.
179
+	 * @param int $gd_page_id The page id of the GD login page.
180
+	 */
181
+		return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -190,40 +190,40 @@  discard block
 block discarded – undo
190 190
  * @return string Info page url.
191 191
  */
192 192
 function geodir_info_url($args=array()){
193
-    $gd_page_id = get_option('geodir_info_page');
194
-
195
-    if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
-    }
198
-
199
-    if (function_exists('geodir_location_geo_home_link')) {
200
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
-    }
202
-
203
-    if (geodir_is_wpml()){
204
-        $home_url = icl_get_home_url();
205
-    }else{
206
-        $home_url = home_url();
207
-    }
208
-
209
-    if (function_exists('geodir_location_geo_home_link')) {
210
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
-    }
212
-
213
-    if($gd_page_id){
214
-        $post = get_post($gd_page_id);
215
-        $slug = $post->post_name;
216
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
-        $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
219
-        $info_url = trailingslashit($home_url);
220
-    }
221
-
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
224
-    }
225
-
226
-    return $info_url;
193
+	$gd_page_id = get_option('geodir_info_page');
194
+
195
+	if (geodir_is_wpml()) {
196
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
+	}
198
+
199
+	if (function_exists('geodir_location_geo_home_link')) {
200
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
+	}
202
+
203
+	if (geodir_is_wpml()){
204
+		$home_url = icl_get_home_url();
205
+	}else{
206
+		$home_url = home_url();
207
+	}
208
+
209
+	if (function_exists('geodir_location_geo_home_link')) {
210
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
+	}
212
+
213
+	if($gd_page_id){
214
+		$post = get_post($gd_page_id);
215
+		$slug = $post->post_name;
216
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
+		$info_url = trailingslashit($home_url)."$slug/";
218
+	}else{
219
+		$info_url = trailingslashit($home_url);
220
+	}
221
+
222
+	if($args){
223
+		$info_url = add_query_arg($args,$info_url );
224
+	}
225
+
226
+	return $info_url;
227 227
 }
228 228
 
229 229
 /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
  * @return string Returns converted string.
240 240
  */
241 241
 function geodir_ucwords($string, $charset='UTF-8') {
242
-    if (function_exists('mb_convert_case')) {
243
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
-    } else {
245
-        return ucwords($string);
246
-    }
242
+	if (function_exists('mb_convert_case')) {
243
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
+	} else {
245
+		return ucwords($string);
246
+	}
247 247
 }
248 248
 
249 249
 /**
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @return string Returns converted string.
260 260
  */
261 261
 function geodir_strtolower($string, $charset='UTF-8') {
262
-    if (function_exists('mb_convert_case')) {
263
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
-    } else {
265
-        return strtolower($string);
266
-    }
262
+	if (function_exists('mb_convert_case')) {
263
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
+	} else {
265
+		return strtolower($string);
266
+	}
267 267
 }
268 268
 
269 269
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @return string Returns converted string.
280 280
  */
281 281
 function geodir_strtoupper($string, $charset='UTF-8') {
282
-    if (function_exists('mb_convert_case')) {
283
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
-    } else {
285
-        return strtoupper($string);
286
-    }
282
+	if (function_exists('mb_convert_case')) {
283
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
+	} else {
285
+		return strtoupper($string);
286
+	}
287 287
 }
288 288
 
289 289
 /**
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
466
-        return '_gd_die_handler';
467
-    } else {
468
-        die();
469
-    }
465
+	if ( defined( 'GD_TESTING_MODE' ) ) {
466
+		return '_gd_die_handler';
467
+	} else {
468
+		die();
469
+	}
470 470
 }
471 471
 
472 472
 /**
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483 483
 function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
484
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
+	wp_die( $message, $title, array( 'response' => $status ));
487 487
 }
488 488
 
489 489
 /*
@@ -660,44 +660,44 @@  discard block
 block discarded – undo
660 660
  * @return string The formatted date.
661 661
  */
662 662
 function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
664
-        return NULL;
665
-    }
663
+	if ( empty( $date_input ) || empty( $date_to ) ) {
664
+		return NULL;
665
+	}
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+	$date_input = geodir_maybe_untranslate_date( $date_input );
668 668
     
669
-    $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
673
-            $timestamp = $datetime->getTimestamp();
674
-        }
675
-    }
669
+	$timestamp = 0;
670
+	if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
+		$datetime = date_create_from_format( $date_from, $date_input );
672
+		if ( !empty( $datetime ) ) {
673
+			$timestamp = $datetime->getTimestamp();
674
+		}
675
+	}
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
680
-    }
677
+	if ( empty( $timestamp ) ) {
678
+		$date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
+		$timestamp = strtotime( $date );
680
+	}
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+	$date = date_i18n( $date_to, $timestamp );
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
686
-    }
684
+	if ( !$locale ) {
685
+		$date = geodir_maybe_untranslate_date( $date );
686
+	}
687 687
     
688
-    /**
689
-     * Filter the the date format conversion.
690
-     *
691
-     * @since 1.6.7
692
-     * @package GeoDirectory
693
-     *
694
-     * @param string $date The date string.
695
-     * @param string $date_input The date input.
696
-     * @param string $date_to The destination date format.
697
-     * @param string $date_from The source date format.
698
-     * @param bool $locale True to retrieve the date in localized format.
699
-     */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
688
+	/**
689
+	 * Filter the the date format conversion.
690
+	 *
691
+	 * @since 1.6.7
692
+	 * @package GeoDirectory
693
+	 *
694
+	 * @param string $date The date string.
695
+	 * @param string $date_input The date input.
696
+	 * @param string $date_to The destination date format.
697
+	 * @param string $date_from The source date format.
698
+	 * @param bool $locale True to retrieve the date in localized format.
699
+	 */
700
+	return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
701 701
 }
702 702
 
703 703
 /**
@@ -722,91 +722,91 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
726
-        return $text;
727
-    }
728
-    $default = array(
729
-        'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
725
+	if (!(int)$length > 0) {
726
+		return $text;
727
+	}
728
+	$default = array(
729
+		'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
730 730
 	);
731
-    if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
-        $default['ellipsis'] = "";
733
-    }
734
-    $options += $default;
735
-
736
-    $prefix = '';
737
-    $suffix = $options['ellipsis'];
738
-
739
-    if ($options['html']) {
740
-        $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
-
742
-        $truncateLength = 0;
743
-        $totalLength = 0;
744
-        $openTags = array();
745
-        $truncate = '';
746
-
747
-        preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
-        foreach ($tags as $tag) {
749
-            $contentLength = geodir_strlen($tag[3], $options);
750
-
751
-            if ($truncate === '') {
752
-                if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
-                    if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
-                        array_unshift($openTags, $tag[2]);
755
-                    } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
-                        $pos = array_search($closeTag[1], $openTags);
757
-                        if ($pos !== false) {
758
-                            array_splice($openTags, $pos, 1);
759
-                        }
760
-                    }
761
-                }
762
-
763
-                $prefix .= $tag[1];
764
-
765
-                if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
-                    $truncate = $tag[3];
767
-                    $truncateLength = $length - $totalLength;
768
-                } else {
769
-                    $prefix .= $tag[3];
770
-                }
771
-            }
772
-
773
-            $totalLength += $contentLength;
774
-            if ($totalLength > $length) {
775
-                break;
776
-            }
777
-        }
778
-
779
-        if ($totalLength <= $length) {
780
-            return $text;
781
-        }
782
-
783
-        $text = $truncate;
784
-        $length = $truncateLength;
785
-
786
-        foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
788
-        }
789
-    } else {
790
-        if (geodir_strlen($text, $options) <= $length) {
791
-            return $text;
792
-        }
793
-        $ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
-    }
795
-
796
-    $result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
-
798
-    if (!$options['exact']) {
799
-        if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
-            $result = geodir_remove_last_word($result);
801
-        }
802
-
803
-        // Do not need to count ellipsis in the cut, if result is empty.
804
-        if (!strlen($result)) {
805
-            $result = geodir_substr($text, 0, $length, $options);
806
-        }
807
-    }
808
-
809
-    return $prefix . $result . $suffix;
731
+	if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
+		$default['ellipsis'] = "";
733
+	}
734
+	$options += $default;
735
+
736
+	$prefix = '';
737
+	$suffix = $options['ellipsis'];
738
+
739
+	if ($options['html']) {
740
+		$ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
+
742
+		$truncateLength = 0;
743
+		$totalLength = 0;
744
+		$openTags = array();
745
+		$truncate = '';
746
+
747
+		preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
+		foreach ($tags as $tag) {
749
+			$contentLength = geodir_strlen($tag[3], $options);
750
+
751
+			if ($truncate === '') {
752
+				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
+					if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
+						array_unshift($openTags, $tag[2]);
755
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
+						$pos = array_search($closeTag[1], $openTags);
757
+						if ($pos !== false) {
758
+							array_splice($openTags, $pos, 1);
759
+						}
760
+					}
761
+				}
762
+
763
+				$prefix .= $tag[1];
764
+
765
+				if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
+					$truncate = $tag[3];
767
+					$truncateLength = $length - $totalLength;
768
+				} else {
769
+					$prefix .= $tag[3];
770
+				}
771
+			}
772
+
773
+			$totalLength += $contentLength;
774
+			if ($totalLength > $length) {
775
+				break;
776
+			}
777
+		}
778
+
779
+		if ($totalLength <= $length) {
780
+			return $text;
781
+		}
782
+
783
+		$text = $truncate;
784
+		$length = $truncateLength;
785
+
786
+		foreach ($openTags as $tag) {
787
+			$suffix .= '</' . $tag . '>';
788
+		}
789
+	} else {
790
+		if (geodir_strlen($text, $options) <= $length) {
791
+			return $text;
792
+		}
793
+		$ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
+	}
795
+
796
+	$result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
+
798
+	if (!$options['exact']) {
799
+		if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
+			$result = geodir_remove_last_word($result);
801
+		}
802
+
803
+		// Do not need to count ellipsis in the cut, if result is empty.
804
+		if (!strlen($result)) {
805
+			$result = geodir_substr($text, 0, $length, $options);
806
+		}
807
+	}
808
+
809
+	return $prefix . $result . $suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -830,28 +830,28 @@  discard block
 block discarded – undo
830 830
  * @return int
831 831
  */
832 832
 function geodir_strlen($text, array $options) {
833
-    if (empty($options['trimWidth'])) {
834
-        $strlen = 'geodir_utf8_strlen';
835
-    } else {
836
-        $strlen = 'geodir_utf8_strwidth';
837
-    }
838
-
839
-    if (empty($options['html'])) {
840
-        return $strlen($text);
841
-    }
842
-
843
-    $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
-    $replace = preg_replace_callback(
845
-        $pattern,
846
-        function ($match) use ($strlen) {
847
-            $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
-
849
-            return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
-        },
851
-        $text
852
-    );
853
-
854
-    return $strlen($replace);
833
+	if (empty($options['trimWidth'])) {
834
+		$strlen = 'geodir_utf8_strlen';
835
+	} else {
836
+		$strlen = 'geodir_utf8_strwidth';
837
+	}
838
+
839
+	if (empty($options['html'])) {
840
+		return $strlen($text);
841
+	}
842
+
843
+	$pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
+	$replace = preg_replace_callback(
845
+		$pattern,
846
+		function ($match) use ($strlen) {
847
+			$utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
+
849
+			return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
+		},
851
+		$text
852
+	);
853
+
854
+	return $strlen($replace);
855 855
 }
856 856
 
857 857
 /**
@@ -872,80 +872,80 @@  discard block
 block discarded – undo
872 872
  * @return string
873 873
  */
874 874
 function geodir_substr($text, $start, $length, array $options) {
875
-    if (empty($options['trimWidth'])) {
876
-        $substr = 'geodir_utf8_substr';
877
-    } else {
878
-        $substr = 'geodir_utf8_strimwidth';
879
-    }
880
-
881
-    $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
-    if ($start < 0) {
883
-        $start += $maxPosition;
884
-        if ($start < 0) {
885
-            $start = 0;
886
-        }
887
-    }
888
-    if ($start >= $maxPosition) {
889
-        return '';
890
-    }
891
-
892
-    if ($length === null) {
893
-        $length = geodir_strlen($text, $options);
894
-    }
895
-
896
-    if ($length < 0) {
897
-        $text = geodir_substr($text, $start, null, $options);
898
-        $start = 0;
899
-        $length += geodir_strlen($text, $options);
900
-    }
901
-
902
-    if ($length <= 0) {
903
-        return '';
904
-    }
905
-
906
-    if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
908
-    }
909
-
910
-    $totalOffset = 0;
911
-    $totalLength = 0;
912
-    $result = '';
913
-
914
-    $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
-    $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
-    foreach ($parts as $part) {
917
-        $offset = 0;
918
-
919
-        if ($totalOffset < $start) {
920
-            $len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
-            if ($totalOffset + $len <= $start) {
922
-                $totalOffset += $len;
923
-                continue;
924
-            }
925
-
926
-            $offset = $start - $totalOffset;
927
-            $totalOffset = $start;
928
-        }
929
-
930
-        $len = geodir_strlen($part, $options);
931
-        if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
-                // Entities cannot be passed substr.
934
-                continue;
935
-            }
936
-
937
-            $part = $substr($part, $offset, $length - $totalLength);
938
-            $len = geodir_strlen($part, $options);
939
-        }
940
-
941
-        $result .= $part;
942
-        $totalLength += $len;
943
-        if ($totalLength >= $length) {
944
-            break;
945
-        }
946
-    }
947
-
948
-    return $result;
875
+	if (empty($options['trimWidth'])) {
876
+		$substr = 'geodir_utf8_substr';
877
+	} else {
878
+		$substr = 'geodir_utf8_strimwidth';
879
+	}
880
+
881
+	$maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
+	if ($start < 0) {
883
+		$start += $maxPosition;
884
+		if ($start < 0) {
885
+			$start = 0;
886
+		}
887
+	}
888
+	if ($start >= $maxPosition) {
889
+		return '';
890
+	}
891
+
892
+	if ($length === null) {
893
+		$length = geodir_strlen($text, $options);
894
+	}
895
+
896
+	if ($length < 0) {
897
+		$text = geodir_substr($text, $start, null, $options);
898
+		$start = 0;
899
+		$length += geodir_strlen($text, $options);
900
+	}
901
+
902
+	if ($length <= 0) {
903
+		return '';
904
+	}
905
+
906
+	if (empty($options['html'])) {
907
+		return (string)$substr($text, $start, $length);
908
+	}
909
+
910
+	$totalOffset = 0;
911
+	$totalLength = 0;
912
+	$result = '';
913
+
914
+	$pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
+	$parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
+	foreach ($parts as $part) {
917
+		$offset = 0;
918
+
919
+		if ($totalOffset < $start) {
920
+			$len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
+			if ($totalOffset + $len <= $start) {
922
+				$totalOffset += $len;
923
+				continue;
924
+			}
925
+
926
+			$offset = $start - $totalOffset;
927
+			$totalOffset = $start;
928
+		}
929
+
930
+		$len = geodir_strlen($part, $options);
931
+		if ($offset !== 0 || $totalLength + $len > $length) {
932
+			if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
+				// Entities cannot be passed substr.
934
+				continue;
935
+			}
936
+
937
+			$part = $substr($part, $offset, $length - $totalLength);
938
+			$len = geodir_strlen($part, $options);
939
+		}
940
+
941
+		$result .= $part;
942
+		$totalLength += $len;
943
+		if ($totalLength >= $length) {
944
+			break;
945
+		}
946
+	}
947
+
948
+	return $result;
949 949
 }
950 950
 
951 951
 /**
@@ -958,21 +958,21 @@  discard block
 block discarded – undo
958 958
  * @return string
959 959
  */
960 960
 function geodir_remove_last_word($text) {
961
-    $spacepos = geodir_utf8_strrpos($text, ' ');
961
+	$spacepos = geodir_utf8_strrpos($text, ' ');
962 962
 
963
-    if ($spacepos !== false) {
964
-        $lastWord = geodir_utf8_strrpos($text, $spacepos);
963
+	if ($spacepos !== false) {
964
+		$lastWord = geodir_utf8_strrpos($text, $spacepos);
965 965
 
966
-        // Some languages are written without word separation.
967
-        // We recognize a string as a word if it does not contain any full-width characters.
968
-        if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
-            $text = geodir_utf8_substr($text, 0, $spacepos);
970
-        }
966
+		// Some languages are written without word separation.
967
+		// We recognize a string as a word if it does not contain any full-width characters.
968
+		if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
+			$text = geodir_utf8_substr($text, 0, $spacepos);
970
+		}
971 971
 
972
-        return $text;
973
-    }
972
+		return $text;
973
+	}
974 974
 
975
-    return '';
975
+	return '';
976 976
 }
977 977
 
978 978
 function geodir_tool_restore_cpt_from_taxonomies(){
@@ -1090,11 +1090,11 @@  discard block
 block discarded – undo
1090 1090
  * @return string
1091 1091
  */
1092 1092
 function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
-    }
1093
+	if ( function_exists( 'mb_strimwidth' ) ) {
1094
+		return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
+	}
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+	return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1108,11 +1108,11 @@  discard block
 block discarded – undo
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110 1110
 function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1113
-    }
1111
+	if ( function_exists( 'mb_strlen' ) ) {
1112
+		return mb_strlen( $str, $encoding );
1113
+	}
1114 1114
         
1115
-    return strlen( $str );
1115
+	return strlen( $str );
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130 1130
 function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1133
-    }
1131
+	if ( function_exists( 'mb_strpos' ) ) {
1132
+		return mb_strpos( $str, $find, $offset, $encoding );
1133
+	}
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+	return strpos( $str, $find, $offset );
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150 1150
 function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1153
-    }
1151
+	if ( function_exists( 'mb_strrpos' ) ) {
1152
+		return mb_strrpos( $str, $find, $offset, $encoding );
1153
+	}
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+	return strrpos( $str, $find, $offset );
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1169,15 +1169,15 @@  discard block
 block discarded – undo
1169 1169
  * @return string
1170 1170
  */
1171 1171
 function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
-        } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1177
-        }
1178
-    }
1172
+	if ( function_exists( 'mb_substr' ) ) {
1173
+		if ( $length === null ) {
1174
+			return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
+		} else {
1176
+			return mb_substr( $str, $start, $length, $encoding );
1177
+		}
1178
+	}
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+	return substr( $str, $start, $length );
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1210,20 +1210,20 @@  discard block
 block discarded – undo
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212 1212
 function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
-        $str_end = "";
1213
+	if ( function_exists( 'mb_strlen' ) ) {
1214
+		$first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
+		$str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
-        } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
-        }
1217
+		if ( $lower_str_end ) {
1218
+			$str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
+		} else {
1220
+			$str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
+		}
1222 1222
         
1223
-        return $first_letter . $str_end;
1224
-    }
1223
+		return $first_letter . $str_end;
1224
+	}
1225 1225
 
1226
-    return ucfirst( $str );
1226
+	return ucfirst( $str );
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+	    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		'December',
592 592
 	);
593 593
 
594
-	$non_english_long_months  = array(
594
+	$non_english_long_months = array(
595 595
 		__('January'),
596 596
 		__('February'),
597 597
 		__('March'),
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
 		__('November'),
606 606
 		__('December'),
607 607
 	);
608
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
608
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
609 609
     
610
-	if ( !empty( $wp_locale ) ) {
611
-		$date = str_replace( array_values( $wp_locale->month_genitive ), $english_long_months, $date );
610
+	if (!empty($wp_locale)) {
611
+		$date = str_replace(array_values($wp_locale->month_genitive), $english_long_months, $date);
612 612
 	}
613 613
 
614 614
 	$english_short_months = array(
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 	);
628 628
 
629 629
 	$non_english_short_months = array(
630
-		' '._x( 'Jan', 'January abbreviation' ).' ',
631
-		' '._x( 'Feb', 'February abbreviation' ).' ',
632
-		' '._x( 'Mar', 'March abbreviation' ).' ',
633
-		' '._x( 'Apr', 'April abbreviation' ).' ',
634
-		' '._x( 'May', 'May abbreviation' ).' ',
635
-		' '._x( 'Jun', 'June abbreviation' ).' ',
636
-		' '._x( 'Jul', 'July abbreviation' ).' ',
637
-		' '._x( 'Aug', 'August abbreviation' ).' ',
638
-		' '._x( 'Sep', 'September abbreviation' ).' ',
639
-		' '._x( 'Oct', 'October abbreviation' ).' ',
640
-		' '._x( 'Nov', 'November abbreviation' ).' ',
641
-		' '._x( 'Dec', 'December abbreviation' ).' ',
630
+		' '._x('Jan', 'January abbreviation').' ',
631
+		' '._x('Feb', 'February abbreviation').' ',
632
+		' '._x('Mar', 'March abbreviation').' ',
633
+		' '._x('Apr', 'April abbreviation').' ',
634
+		' '._x('May', 'May abbreviation').' ',
635
+		' '._x('Jun', 'June abbreviation').' ',
636
+		' '._x('Jul', 'July abbreviation').' ',
637
+		' '._x('Aug', 'August abbreviation').' ',
638
+		' '._x('Sep', 'September abbreviation').' ',
639
+		' '._x('Oct', 'October abbreviation').' ',
640
+		' '._x('Nov', 'November abbreviation').' ',
641
+		' '._x('Dec', 'December abbreviation').' ',
642 642
 	);
643 643
 
644
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
644
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
645 645
 
646 646
 
647 647
 	return $date;
@@ -659,30 +659,30 @@  discard block
 block discarded – undo
659 659
  * @param bool $locale True to retrieve the date in localized format. Default false.
660 660
  * @return string The formatted date.
661 661
  */
662
-function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
662
+function geodir_date($date_input, $date_to, $date_from = '', $locale = false) {
663
+    if (empty($date_input) || empty($date_to)) {
664 664
         return NULL;
665 665
     }
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+    $date_input = geodir_maybe_untranslate_date($date_input);
668 668
     
669 669
     $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
670
+    if (!empty($date_from) && function_exists('date_create_from_format')) {
671
+        $datetime = date_create_from_format($date_from, $date_input);
672
+        if (!empty($datetime)) {
673 673
             $timestamp = $datetime->getTimestamp();
674 674
         }
675 675
     }
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
677
+    if (empty($timestamp)) {
678
+        $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
679
+        $timestamp = strtotime($date);
680 680
     }
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+    $date = date_i18n($date_to, $timestamp);
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
684
+    if (!$locale) {
685
+        $date = geodir_maybe_untranslate_date($date);
686 686
     }
687 687
     
688 688
     /**
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
      * @param string $date_from The source date format.
698 698
      * @param bool $locale True to retrieve the date in localized format.
699 699
      */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
700
+    return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from, $locale);
701 701
 }
702 702
 
703 703
 /**
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
725
+    if (!(int) $length > 0) {
726 726
         return $text;
727 727
     }
728 728
     $default = array(
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
         $length = $truncateLength;
785 785
 
786 786
         foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
787
+            $suffix .= '</'.$tag.'>';
788 788
         }
789 789
     } else {
790 790
         if (geodir_strlen($text, $options) <= $length) {
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         }
807 807
     }
808 808
 
809
-    return $prefix . $result . $suffix;
809
+    return $prefix.$result.$suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844 844
     $replace = preg_replace_callback(
845 845
         $pattern,
846
-        function ($match) use ($strlen) {
846
+        function($match) use ($strlen) {
847 847
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848 848
 
849 849
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
     }
905 905
 
906 906
     if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
907
+        return (string) $substr($text, $start, $length);
908 908
     }
909 909
 
910 910
     $totalOffset = 0;
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
         $len = geodir_strlen($part, $options);
931 931
         if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
932
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
933 933
                 // Entities cannot be passed substr.
934 934
                 continue;
935 935
             }
@@ -975,39 +975,39 @@  discard block
 block discarded – undo
975 975
     return '';
976 976
 }
977 977
 
978
-function geodir_tool_restore_cpt_from_taxonomies(){
978
+function geodir_tool_restore_cpt_from_taxonomies() {
979 979
 
980 980
 	$cpts = get_option('geodir_post_types');
981 981
 
982
-	if(!empty($cpts)){return;}
982
+	if (!empty($cpts)) {return; }
983 983
 
984 984
 	$taxonomies = get_option('geodir_taxonomies');
985 985
 
986
-	if(empty($taxonomies)){return;}
986
+	if (empty($taxonomies)) {return; }
987 987
 
988 988
 	$cpts = array();
989 989
 
990
-	foreach($taxonomies as $key => $val){
990
+	foreach ($taxonomies as $key => $val) {
991 991
 
992
-		if(strpos($val['listing_slug'], '/') === false) {
993
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
992
+		if (strpos($val['listing_slug'], '/') === false) {
993
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
994 994
 		}
995 995
 
996 996
 	}
997 997
 
998
-	if(empty($cpts)){return;}
998
+	if (empty($cpts)) {return; }
999 999
 
1000 1000
 
1001 1001
 	$cpts_restore = $cpts;
1002 1002
 
1003
-	foreach($cpts as $cpt){
1003
+	foreach ($cpts as $cpt) {
1004 1004
 
1005 1005
 
1006
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
1006
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
1007 1007
 
1008
-		$cpts_restore[$cpt['cpt']] = array (
1008
+		$cpts_restore[$cpt['cpt']] = array(
1009 1009
 				'labels' =>
1010
-					array (
1010
+					array(
1011 1011
 						'name' => $cpt['slug'],
1012 1012
 						'singular_name' => $cpt['slug'],
1013 1013
 						'add_new' => 'Add New',
@@ -1035,14 +1035,14 @@  discard block
 block discarded – undo
1035 1035
 				'public' => true,
1036 1036
 				'query_var' => true,
1037 1037
 				'rewrite' =>
1038
-					array (
1038
+					array(
1039 1039
 						'slug' => $cpt['slug'],
1040 1040
 						'with_front' => false,
1041 1041
 						'hierarchical' => true,
1042 1042
 						'feeds' => true,
1043 1043
 					),
1044 1044
 				'supports' =>
1045
-					array (
1045
+					array(
1046 1046
 						0 => 'title',
1047 1047
 						1 => 'editor',
1048 1048
 						2 => 'author',
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
1052 1052
 						6 => 'comments',
1053 1053
 					),
1054 1054
 				'taxonomies' =>
1055
-					array (
1055
+					array(
1056 1056
 						0 => $cpt['cpt'].'category',
1057 1057
 						1 => $cpt['cpt'].'_tags',
1058 1058
 					),
1059 1059
 				'is_custom' => $is_custom,
1060 1060
 				'listing_order' => '1',
1061 1061
 				'seo' =>
1062
-					array (
1062
+					array(
1063 1063
 						'meta_keyword' => '',
1064 1064
 						'meta_description' => '',
1065 1065
 					),
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 	}
1072 1072
 
1073 1073
 
1074
-	update_option('geodir_post_types',$cpts_restore);
1074
+	update_option('geodir_post_types', $cpts_restore);
1075 1075
 
1076 1076
 }
1077 1077
 
@@ -1089,12 +1089,12 @@  discard block
 block discarded – undo
1089 1089
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1090 1090
  * @return string
1091 1091
  */
1092
-function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1092
+function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
1093
+    if (function_exists('mb_strimwidth')) {
1094
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
1095 1095
     }
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+    return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110
-function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1110
+function geodir_utf8_strlen($str, $encoding = 'UTF-8') {
1111
+    if (function_exists('mb_strlen')) {
1112
+        return mb_strlen($str, $encoding);
1113 1113
     }
1114 1114
         
1115
-    return strlen( $str );
1115
+    return strlen($str);
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1127,12 +1127,12 @@  discard block
 block discarded – undo
1127 1127
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130
-function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1130
+function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1131
+    if (function_exists('mb_strpos')) {
1132
+        return mb_strpos($str, $find, $offset, $encoding);
1133 1133
     }
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+    return strpos($str, $find, $offset);
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150
-function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1150
+function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1151
+    if (function_exists('mb_strrpos')) {
1152
+        return mb_strrpos($str, $find, $offset, $encoding);
1153 1153
     }
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+    return strrpos($str, $find, $offset);
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1168,16 +1168,16 @@  discard block
 block discarded – undo
1168 1168
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1169 1169
  * @return string
1170 1170
  */
1171
-function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1171
+function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
1172
+    if (function_exists('mb_substr')) {
1173
+        if ($length === null) {
1174
+            return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding);
1175 1175
         } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1176
+            return mb_substr($str, $start, $length, $encoding);
1177 1177
         }
1178 1178
     }
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+    return substr($str, $start, $length);
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1190,12 +1190,12 @@  discard block
 block discarded – undo
1190 1190
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1191 1191
  * @return string The width of string.
1192 1192
  */
1193
-function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1194
-	if ( function_exists( 'mb_strwidth' ) ) {
1195
-		return mb_strwidth( $str, $encoding );
1193
+function geodir_utf8_strwidth($str, $encoding = 'UTF-8') {
1194
+	if (function_exists('mb_strwidth')) {
1195
+		return mb_strwidth($str, $encoding);
1196 1196
 	}
1197 1197
 
1198
-	return geodir_utf8_strlen( $str, $encoding );
1198
+	return geodir_utf8_strlen($str, $encoding);
1199 1199
 }
1200 1200
 
1201 1201
 /**
@@ -1209,21 +1209,21 @@  discard block
 block discarded – undo
1209 1209
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212
-function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1212
+function geodir_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
1213
+    if (function_exists('mb_strlen')) {
1214
+        $first_letter = geodir_strtoupper(geodir_utf8_substr($str, 0, 1, $encoding), $encoding);
1215 1215
         $str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1217
+        if ($lower_str_end) {
1218
+            $str_end = geodir_strtolower(geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding), $encoding);
1219 1219
         } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1220
+            $str_end = geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding);
1221 1221
         }
1222 1222
         
1223
-        return $first_letter . $str_end;
1223
+        return $first_letter.$str_end;
1224 1224
     }
1225 1225
 
1226
-    return ucfirst( $str );
1226
+    return ucfirst($str);
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
@@ -1233,13 +1233,13 @@  discard block
 block discarded – undo
1233 1233
 	$count = 0;
1234 1234
 	
1235 1235
 	if ($post_type) {
1236
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1236
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1237 1237
 	} else {
1238 1238
 		$all_postypes = geodir_get_posttypes();
1239 1239
 
1240 1240
 		if (!empty($all_postypes)) {
1241 1241
 			foreach ($all_postypes as $key) {
1242
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1242
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1243 1243
 			}
1244 1244
 		}	
1245 1245
 	}
Please login to merge, or discard this patch.