Test Failed
Push — master ( 256a70...7eb7ae )
by Stiofan
26:02 queued 05:16
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1204 added lines, -1204 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,37 +249,37 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
 }
265 265
 
266 266
 
267 267
 if (!function_exists('geodir_init_defaults')) {
268
-    /**
269
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
270
-     *
271
-     * @since 1.0.0
272
-     * @package GeoDirectory
273
-     */
274
-    function geodir_init_defaults()
275
-    {
276
-        if (function_exists('geodir_register_defaults')) {
268
+	/**
269
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
270
+	 *
271
+	 * @since 1.0.0
272
+	 * @package GeoDirectory
273
+	 */
274
+	function geodir_init_defaults()
275
+	{
276
+		if (function_exists('geodir_register_defaults')) {
277 277
 
278
-            geodir_register_defaults();
278
+			geodir_register_defaults();
279 279
 
280
-        }
280
+		}
281 281
 
282
-    }
282
+	}
283 283
 }
284 284
 
285 285
 
@@ -301,26 +301,26 @@  discard block
 block discarded – undo
301 301
 // CALLED ON 'sidebars_widgets' FILTER
302 302
 
303 303
 if (!function_exists('geodir_restrict_widget')) {
304
-    /**
305
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
306
-     *
307
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
308
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
309
-     * @since 1.0.0
310
-     * @package GeoDirectory
311
-     */
312
-    function geodir_restrict_widget()
313
-    {
314
-        global $is_listing, $is_single_place;
304
+	/**
305
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
306
+	 *
307
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
308
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
309
+	 * @since 1.0.0
310
+	 * @package GeoDirectory
311
+	 */
312
+	function geodir_restrict_widget()
313
+	{
314
+		global $is_listing, $is_single_place;
315 315
 
316
-        // set is listing	
317
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
316
+		// set is listing	
317
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
318 318
 
319
-        // set is single place
320
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
319
+		// set is single place
320
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
321 321
 
322 322
 
323
-    }
323
+	}
324 324
 }
325 325
 
326 326
 
@@ -341,31 +341,31 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function geodir_detail_page_sidebar_content_sorting()
343 343
 {
344
-    $arr_detail_page_sidebar_content =
345
-        /**
346
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
347
-         *
348
-         * This filter can be used to remove sections of the details page sidebar,
349
-         * add new sections or rearrange the order of the sections.
350
-         *
351
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
352
-         * @since 1.0.0
353
-         */
354
-        apply_filters('geodir_detail_page_sidebar_content',
355
-            array('geodir_social_sharing_buttons',
356
-                'geodir_detail_page_google_analytics',
357
-                'geodir_edit_post_link',
358
-                'geodir_detail_page_review_rating',
359
-                'geodir_detail_page_more_info'
360
-            ) // end of array 
361
-        ); // end of apply filter
362
-    if (!empty($arr_detail_page_sidebar_content)) {
363
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
364
-            if (function_exists($content_function)) {
365
-                add_action('geodir_detail_page_sidebar', $content_function);
366
-            }
367
-        }
368
-    }
344
+	$arr_detail_page_sidebar_content =
345
+		/**
346
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
347
+		 *
348
+		 * This filter can be used to remove sections of the details page sidebar,
349
+		 * add new sections or rearrange the order of the sections.
350
+		 *
351
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
352
+		 * @since 1.0.0
353
+		 */
354
+		apply_filters('geodir_detail_page_sidebar_content',
355
+			array('geodir_social_sharing_buttons',
356
+				'geodir_detail_page_google_analytics',
357
+				'geodir_edit_post_link',
358
+				'geodir_detail_page_review_rating',
359
+				'geodir_detail_page_more_info'
360
+			) // end of array 
361
+		); // end of apply filter
362
+	if (!empty($arr_detail_page_sidebar_content)) {
363
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
364
+			if (function_exists($content_function)) {
365
+				add_action('geodir_detail_page_sidebar', $content_function);
366
+			}
367
+		}
368
+	}
369 369
 }
370 370
 
371 371
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
  */
381 381
 function geodir_add_to_favourite_link()
382 382
 {
383
-    global $post, $preview;
384
-    if (!$preview && geodir_is_page('detail')) {
385
-        ?>
383
+	global $post, $preview;
384
+	if (!$preview && geodir_is_page('detail')) {
385
+		?>
386 386
         <p class="edit_link">
387 387
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
388 388
         </p>
389 389
     <?php
390
-    }
390
+	}
391 391
 }
392 392
 
393 393
 /**
@@ -401,41 +401,41 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_social_sharing_buttons()
403 403
 {
404
-    global $preview;
405
-    ob_start(); // Start  buffering;
406
-    /**
407
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
408
-     *
409
-     * @since 1.0.0
410
-     */
411
-    do_action('geodir_before_social_sharing_buttons');
412
-    if (!$preview) {
413
-        ?>
404
+	global $preview;
405
+	ob_start(); // Start  buffering;
406
+	/**
407
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
408
+	 *
409
+	 * @since 1.0.0
410
+	 */
411
+	do_action('geodir_before_social_sharing_buttons');
412
+	if (!$preview) {
413
+		?>
414 414
         <div class="likethis">
415 415
             <?php geodir_twitter_tweet_button(); ?>
416 416
             <?php geodir_fb_like_button(); ?>
417 417
             <?php geodir_google_plus_button(); ?>
418 418
         </div>
419 419
     <?php
420
-    }// end of if, if its a preview or not
421
-
422
-    /**
423
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
424
-     *
425
-     * @since 1.0.0
426
-     */
427
-    do_action('geodir_after_social_sharing_buttons');
428
-    $content_html = ob_get_clean();
429
-    if (trim($content_html) != '')
430
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
432
-        /**
433
-         * Filter the geodir_social_sharing_buttons() function content.
434
-         *
435
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
436
-         */
437
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
438
-    }
420
+	}// end of if, if its a preview or not
421
+
422
+	/**
423
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
424
+	 *
425
+	 * @since 1.0.0
426
+	 */
427
+	do_action('geodir_after_social_sharing_buttons');
428
+	$content_html = ob_get_clean();
429
+	if (trim($content_html) != '')
430
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
431
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
432
+		/**
433
+		 * Filter the geodir_social_sharing_buttons() function content.
434
+		 *
435
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
436
+		 */
437
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
438
+	}
439 439
 
440 440
 
441 441
 }
@@ -453,46 +453,46 @@  discard block
 block discarded – undo
453 453
  */
454 454
 function geodir_edit_post_link()
455 455
 {
456
-    global $post, $preview;
457
-    ob_start(); // Start buffering;
458
-    /**
459
-     * This is called before the edit post link html in the function geodir_edit_post_link()
460
-     *
461
-     * @since 1.0.0
462
-     */
463
-    do_action('geodir_before_edit_post_link');
464
-    if (!$preview) {
465
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
456
+	global $post, $preview;
457
+	ob_start(); // Start buffering;
458
+	/**
459
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
460
+	 *
461
+	 * @since 1.0.0
462
+	 */
463
+	do_action('geodir_before_edit_post_link');
464
+	if (!$preview) {
465
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
466 466
         
467
-        if ($is_current_user_owner) {
468
-            $post_id = $post->ID;
467
+		if ($is_current_user_owner) {
468
+			$post_id = $post->ID;
469 469
             
470
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
-                $post_id = (int)$_REQUEST['pid'];
472
-            }
470
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
471
+				$post_id = (int)$_REQUEST['pid'];
472
+			}
473 473
 
474
-            $postlink = get_permalink(geodir_add_listing_page_id());
475
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
477
-        }
478
-    }// end of if, if its a preview or not
479
-    /**
480
-     * This is called after the edit post link html in the function geodir_edit_post_link()
481
-     *
482
-     * @since 1.0.0
483
-     */
484
-    do_action('geodir_after_edit_post_link');
485
-    $content_html = ob_get_clean();
486
-    if (trim($content_html) != '')
487
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
489
-        /**
490
-         * Filter the geodir_edit_post_link() function content.
491
-         *
492
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
493
-         */
494
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
495
-    }
474
+			$postlink = get_permalink(geodir_add_listing_page_id());
475
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
476
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
477
+		}
478
+	}// end of if, if its a preview or not
479
+	/**
480
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
481
+	 *
482
+	 * @since 1.0.0
483
+	 */
484
+	do_action('geodir_after_edit_post_link');
485
+	$content_html = ob_get_clean();
486
+	if (trim($content_html) != '')
487
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
488
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
489
+		/**
490
+		 * Filter the geodir_edit_post_link() function content.
491
+		 *
492
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
493
+		 */
494
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
495
+	}
496 496
 }
497 497
 
498 498
 /**
@@ -506,42 +506,42 @@  discard block
 block discarded – undo
506 506
  */
507 507
 function geodir_detail_page_google_analytics()
508 508
 {
509
-    global $post,$preview;
510
-    if($preview){return '';}
511
-    $package_info = array();
512
-    $package_info = geodir_post_package_info($package_info, $post);
509
+	global $post,$preview;
510
+	if($preview){return '';}
511
+	$package_info = array();
512
+	$package_info = geodir_post_package_info($package_info, $post);
513 513
 
514
-    $id = trim(get_option('geodir_ga_account_id'));
514
+	$id = trim(get_option('geodir_ga_account_id'));
515 515
 
516
-    if (!$id) {
517
-        return; //if no Google Analytics ID then bail.
518
-    }
516
+	if (!$id) {
517
+		return; //if no Google Analytics ID then bail.
518
+	}
519 519
 
520
-    ob_start(); // Start buffering;
521
-    /**
522
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
523
-     *
524
-     * @since 1.0.0
525
-     */
526
-    do_action('geodir_before_google_analytics');
520
+	ob_start(); // Start buffering;
521
+	/**
522
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
523
+	 *
524
+	 * @since 1.0.0
525
+	 */
526
+	do_action('geodir_before_google_analytics');
527 527
     
528
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
529
-    /**
530
-     * Filter the time interval to check & refresh new users results.
531
-     *
532
-     * @since 1.5.9
533
-     *
534
-     * @param int $refresh_time Time interval to check & refresh new users results.
535
-     */
536
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
537
-    $refresh_time = absint($refresh_time * 1000);
528
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
529
+	/**
530
+	 * Filter the time interval to check & refresh new users results.
531
+	 *
532
+	 * @since 1.5.9
533
+	 *
534
+	 * @param int $refresh_time Time interval to check & refresh new users results.
535
+	 */
536
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
537
+	$refresh_time = absint($refresh_time * 1000);
538 538
     
539
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
539
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
540 540
     
541
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
543
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
544
-        ?>
541
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
542
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
543
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
544
+		?>
545 545
         <script type="text/javascript">
546 546
             var gd_gaTimeOut;
547 547
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -793,15 +793,15 @@  discard block
 block discarded – undo
793 793
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
794 794
 
795 795
                     <?php
796
-                    // Here we list the shorthand days of the week so it can be used in translation.
797
-                    __("Mon",'geodirectory');
798
-                    __("Tue",'geodirectory');
799
-                    __("Wed",'geodirectory');
800
-                    __("Thu",'geodirectory');
801
-                    __("Fri",'geodirectory');
802
-                    __("Sat",'geodirectory');
803
-                    __("Sun",'geodirectory');
804
-                    ?>
796
+					// Here we list the shorthand days of the week so it can be used in translation.
797
+					__("Mon",'geodirectory');
798
+					__("Tue",'geodirectory');
799
+					__("Wed",'geodirectory');
800
+					__("Thu",'geodirectory');
801
+					__("Fri",'geodirectory');
802
+					__("Sat",'geodirectory');
803
+					__("Sun",'geodirectory');
804
+					?>
805 805
 
806 806
                     labels = [
807 807
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1050,24 +1050,24 @@  discard block
 block discarded – undo
1050 1050
         </span>
1051 1051
 
1052 1052
     <?php
1053
-    }
1054
-    /**
1055
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1056
-     *
1057
-     * @since 1.0.0
1058
-     */
1059
-    do_action('geodir_after_google_analytics');
1060
-    $content_html = ob_get_clean();
1061
-    if (trim($content_html) != '')
1062
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1064
-        /**
1065
-         * Filter the geodir_edit_post_link() function content.
1066
-         *
1067
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1068
-         */
1069
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1070
-    }
1053
+	}
1054
+	/**
1055
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1056
+	 *
1057
+	 * @since 1.0.0
1058
+	 */
1059
+	do_action('geodir_after_google_analytics');
1060
+	$content_html = ob_get_clean();
1061
+	if (trim($content_html) != '')
1062
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1063
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1064
+		/**
1065
+		 * Filter the geodir_edit_post_link() function content.
1066
+		 *
1067
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1068
+		 */
1069
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1070
+	}
1071 1071
 }
1072 1072
 
1073 1073
 /**
@@ -1084,94 +1084,94 @@  discard block
 block discarded – undo
1084 1084
  */
1085 1085
 function geodir_detail_page_review_rating()
1086 1086
 {
1087
-    global $post, $preview, $post_images;
1087
+	global $post, $preview, $post_images;
1088 1088
     
1089
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1090
-        return;
1091
-    }
1092
-    ob_start(); // Start  buffering;
1093
-    /**
1094
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1095
-     *
1096
-     * This is called outside the check for an actual rating and the check for preview page.
1097
-     *
1098
-     * @since 1.0.0
1099
-     */
1100
-    do_action('geodir_before_detail_page_review_rating');
1101
-
1102
-    $comment_count = geodir_get_review_count_total($post->ID);
1103
-    $post_avgratings = geodir_get_post_rating($post->ID);
1104
-
1105
-    if ($post_avgratings != 0 && !$preview) {
1106
-        /**
1107
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1108
-         *
1109
-         * This is called inside the check for an actual rating and the check for preview page.
1110
-         *
1111
-         * @since 1.0.0
1112
-         * @param float $post_avgratings Average rating for the current post.
1113
-         * @param int $post->ID Current post ID.
1114
-         */
1115
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1116
-
1117
-        $html = '<p style=" float:left;">';
1118
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1119
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1120
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1089
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1090
+		return;
1091
+	}
1092
+	ob_start(); // Start  buffering;
1093
+	/**
1094
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1095
+	 *
1096
+	 * This is called outside the check for an actual rating and the check for preview page.
1097
+	 *
1098
+	 * @since 1.0.0
1099
+	 */
1100
+	do_action('geodir_before_detail_page_review_rating');
1101
+
1102
+	$comment_count = geodir_get_review_count_total($post->ID);
1103
+	$post_avgratings = geodir_get_post_rating($post->ID);
1104
+
1105
+	if ($post_avgratings != 0 && !$preview) {
1106
+		/**
1107
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1108
+		 *
1109
+		 * This is called inside the check for an actual rating and the check for preview page.
1110
+		 *
1111
+		 * @since 1.0.0
1112
+		 * @param float $post_avgratings Average rating for the current post.
1113
+		 * @param int $post->ID Current post ID.
1114
+		 */
1115
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1116
+
1117
+		$html = '<p style=" float:left;">';
1118
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1119
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1120
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1121 1121
        
1122 1122
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1123 1123
 	   
1124 1124
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1125 1125
 
1126
-        $html .= '<span class="item">';
1127
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1126
+		$html .= '<span class="item">';
1127
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1128 1128
 
1129
-        if ($post_images) {
1130
-            foreach ($post_images as $img) {
1131
-                $post_img = $img->src;
1132
-                break;
1133
-            }
1134
-        }
1135
-
1136
-        if (isset($post_img) && $post_img) {
1137
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1138
-        }
1139
-
1140
-        $html .= '</span>';
1141
-
1142
-        echo $html .= '</div>';
1143
-        /**
1144
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1145
-         *
1146
-         * This is called inside the check for an actual rating and the check for preview page.
1147
-         *
1148
-         * @since 1.0.0
1149
-         * @param float $post_avgratings Average rating for the current post.
1150
-         * @param int $post->ID Current post ID.
1151
-         */
1152
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1153
-    }
1154
-    /**
1155
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1156
-     *
1157
-     * This is called outside the check for an actual rating and the check for preview page.
1158
-     *
1159
-     * @since 1.0.0
1160
-     */
1161
-    do_action('geodir_after_detail_page_review_rating');
1162
-    $content_html = ob_get_clean();
1163
-    if (trim($content_html) != '') {
1164
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1165
-    }
1166
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1167
-        /**
1168
-         * Filter the geodir_detail_page_review_rating() function content.
1169
-         *
1170
-         * @since 1.0.0
1171
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1172
-         */
1173
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1174
-    }
1129
+		if ($post_images) {
1130
+			foreach ($post_images as $img) {
1131
+				$post_img = $img->src;
1132
+				break;
1133
+			}
1134
+		}
1135
+
1136
+		if (isset($post_img) && $post_img) {
1137
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1138
+		}
1139
+
1140
+		$html .= '</span>';
1141
+
1142
+		echo $html .= '</div>';
1143
+		/**
1144
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1145
+		 *
1146
+		 * This is called inside the check for an actual rating and the check for preview page.
1147
+		 *
1148
+		 * @since 1.0.0
1149
+		 * @param float $post_avgratings Average rating for the current post.
1150
+		 * @param int $post->ID Current post ID.
1151
+		 */
1152
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1153
+	}
1154
+	/**
1155
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1156
+	 *
1157
+	 * This is called outside the check for an actual rating and the check for preview page.
1158
+	 *
1159
+	 * @since 1.0.0
1160
+	 */
1161
+	do_action('geodir_after_detail_page_review_rating');
1162
+	$content_html = ob_get_clean();
1163
+	if (trim($content_html) != '') {
1164
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1165
+	}
1166
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1167
+		/**
1168
+		 * Filter the geodir_detail_page_review_rating() function content.
1169
+		 *
1170
+		 * @since 1.0.0
1171
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1172
+		 */
1173
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1174
+	}
1175 1175
 }
1176 1176
 
1177 1177
 /**
@@ -1183,35 +1183,35 @@  discard block
 block discarded – undo
1183 1183
  */
1184 1184
 function geodir_detail_page_more_info()
1185 1185
 {
1186
-    ob_start(); // Start  buffering;
1187
-    /**
1188
-     * This is called before the info section html.
1189
-     *
1190
-     * @since 1.0.0
1191
-     */
1192
-    do_action('geodir_before_detail_page_more_info');
1193
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1194
-        echo $geodir_post_detail_fields;
1195
-    }
1196
-    /**
1197
-     * This is called after the info section html.
1198
-     *
1199
-     * @since 1.0.0
1200
-     */
1201
-    do_action('geodir_after_detail_page_more_info');
1202
-
1203
-    $content_html = ob_get_clean();
1204
-    if (trim($content_html) != '')
1205
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1207
-        /**
1208
-         * Filter the output html for function geodir_detail_page_more_info().
1209
-         *
1210
-         * @since 1.0.0
1211
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1212
-         */
1213
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1214
-    }
1186
+	ob_start(); // Start  buffering;
1187
+	/**
1188
+	 * This is called before the info section html.
1189
+	 *
1190
+	 * @since 1.0.0
1191
+	 */
1192
+	do_action('geodir_before_detail_page_more_info');
1193
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1194
+		echo $geodir_post_detail_fields;
1195
+	}
1196
+	/**
1197
+	 * This is called after the info section html.
1198
+	 *
1199
+	 * @since 1.0.0
1200
+	 */
1201
+	do_action('geodir_after_detail_page_more_info');
1202
+
1203
+	$content_html = ob_get_clean();
1204
+	if (trim($content_html) != '')
1205
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1206
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1207
+		/**
1208
+		 * Filter the output html for function geodir_detail_page_more_info().
1209
+		 *
1210
+		 * @since 1.0.0
1211
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1212
+		 */
1213
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1214
+	}
1215 1215
 }
1216 1216
 
1217 1217
 
@@ -1225,15 +1225,15 @@  discard block
 block discarded – undo
1225 1225
  */
1226 1226
 function geodir_localize_all_js_msg()
1227 1227
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1228
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
-        $ajax_url = admin_url('admin-ajax.php');
1230
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1231
-        $ajax_url = admin_url('admin-ajax.php');
1232
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1233
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1234
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1235
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1236
-    }
1228
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1229
+		$ajax_url = admin_url('admin-ajax.php');
1230
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1231
+		$ajax_url = admin_url('admin-ajax.php');
1232
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1233
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1234
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1235
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1236
+	}
1237 1237
 	
1238 1238
 	/**
1239 1239
 	 * Filter the allowed image type extensions for post images.
@@ -1243,60 +1243,60 @@  discard block
 block discarded – undo
1243 1243
 	 */
1244 1244
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1245 1245
 	
1246
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1247
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1248
-    $default_marker_width = $default_marker_size['w'];
1249
-    $default_marker_height = $default_marker_size['h'];
1246
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1247
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1248
+	$default_marker_width = $default_marker_size['w'];
1249
+	$default_marker_height = $default_marker_size['h'];
1250 1250
     
1251
-    $arr_alert_msg = array(
1252
-        'geodir_plugin_url' => geodir_plugin_url(),
1253
-        'geodir_admin_ajax_url' => $ajax_url,
1254
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1255
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1256
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1257
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1258
-        //start not show alert msg
1259
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1260
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1261
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1262
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1263
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1264
-        // end not show alert msg
1265
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1266
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1267
-        //start not show alert msg
1268
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1269
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1270
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1271
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1272
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1273
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1274
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1275
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1276
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1277
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1278
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1279
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1280
-        'geodir_default_marker_icon' => $default_marker_icon,
1281
-        'geodir_default_marker_w' => $default_marker_width,
1282
-        'geodir_default_marker_h' => $default_marker_height,
1283
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1284
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1285
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1286
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1287
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1288
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1289
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1290
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1291
-        /* on/off dragging for phone devices */
1292
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1293
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1294
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1295
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1296
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1297
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1298
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1299
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1251
+	$arr_alert_msg = array(
1252
+		'geodir_plugin_url' => geodir_plugin_url(),
1253
+		'geodir_admin_ajax_url' => $ajax_url,
1254
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1255
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1256
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1257
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1258
+		//start not show alert msg
1259
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1260
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1261
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1262
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1263
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1264
+		// end not show alert msg
1265
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1266
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1267
+		//start not show alert msg
1268
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1269
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1270
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1271
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1272
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1273
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1274
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1275
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1276
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1277
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1278
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1279
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1280
+		'geodir_default_marker_icon' => $default_marker_icon,
1281
+		'geodir_default_marker_w' => $default_marker_width,
1282
+		'geodir_default_marker_h' => $default_marker_height,
1283
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1284
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1285
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1286
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1287
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1288
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1289
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1290
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1291
+		/* on/off dragging for phone devices */
1292
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1293
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1294
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1295
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1296
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1297
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1298
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1299
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1300 1300
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1301 1301
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1302 1302
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1304,40 +1304,40 @@  discard block
 block discarded – undo
1304 1304
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1305 1305
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1306 1306
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1307
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308
-        'geodir_map_name' => geodir_map_name(),
1309
-        'osmStart' => __('Start', 'geodirectory'),
1310
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1311
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1312
-        'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1313
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1314
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1315
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1316
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1317
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1318
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1319
-    );
1320
-
1321
-    /**
1322
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1323
-     *
1324
-     * With this filter you can add, remove or change translated JS strings.
1325
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1326
-     *
1327
-     * @since 1.0.0
1328
-     */
1329
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1330
-
1331
-    foreach ($arr_alert_msg as $key => $value) {
1332
-        if (!is_scalar($value))
1333
-            continue;
1334
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1335
-    }
1307
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1308
+		'geodir_map_name' => geodir_map_name(),
1309
+		'osmStart' => __('Start', 'geodirectory'),
1310
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1311
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1312
+		'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1313
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1314
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1315
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1316
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1317
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1318
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1319
+	);
1320
+
1321
+	/**
1322
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1323
+	 *
1324
+	 * With this filter you can add, remove or change translated JS strings.
1325
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1326
+	 *
1327
+	 * @since 1.0.0
1328
+	 */
1329
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1330
+
1331
+	foreach ($arr_alert_msg as $key => $value) {
1332
+		if (!is_scalar($value))
1333
+			continue;
1334
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1335
+	}
1336 1336
 
1337
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1338
-    echo '<script>';
1339
-    echo $script;
1340
-    echo '</script>';
1337
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1338
+	echo '<script>';
1339
+	echo $script;
1340
+	echo '</script>';
1341 1341
 }
1342 1342
 
1343 1343
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1353,11 +1353,11 @@  discard block
 block discarded – undo
1353 1353
  */
1354 1354
 function geodir_admin_bar_site_menu($wp_admin_bar)
1355 1355
 {
1356
-    if (get_option("geodir_installed")) {
1357
-        if (current_user_can('manage_options')) {
1358
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1359
-        }
1360
-    }
1356
+	if (get_option("geodir_installed")) {
1357
+		if (current_user_can('manage_options')) {
1358
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1359
+		}
1360
+	}
1361 1361
 }
1362 1362
 
1363 1363
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1383,25 +1383,25 @@  discard block
 block discarded – undo
1383 1383
  */
1384 1384
 function geodir_store_sidebars()
1385 1385
 {
1386
-    global $geodir_sidebars;
1387
-    global $sidebars_widgets;
1388
-
1389
-    if (!is_array($sidebars_widgets))
1390
-        $sidebars_widgets = wp_get_sidebars_widgets();
1391
-    $geodir_old_sidebars = array();
1392
-
1393
-    if (is_array($geodir_sidebars)) {
1394
-        foreach ($geodir_sidebars as $val) {
1395
-            if (is_array($sidebars_widgets)) {
1396
-                if (array_key_exists($val, $sidebars_widgets))
1397
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1398
-                else
1399
-                    $geodir_old_sidebars[$val] = array();
1400
-            }
1401
-        }
1402
-    }
1403
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1404
-    geodir_option_version_backup('geodir_sidebars');
1386
+	global $geodir_sidebars;
1387
+	global $sidebars_widgets;
1388
+
1389
+	if (!is_array($sidebars_widgets))
1390
+		$sidebars_widgets = wp_get_sidebars_widgets();
1391
+	$geodir_old_sidebars = array();
1392
+
1393
+	if (is_array($geodir_sidebars)) {
1394
+		foreach ($geodir_sidebars as $val) {
1395
+			if (is_array($sidebars_widgets)) {
1396
+				if (array_key_exists($val, $sidebars_widgets))
1397
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1398
+				else
1399
+					$geodir_old_sidebars[$val] = array();
1400
+			}
1401
+		}
1402
+	}
1403
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1404
+	geodir_option_version_backup('geodir_sidebars');
1405 1405
 
1406 1406
 }
1407 1407
 
@@ -1415,28 +1415,28 @@  discard block
 block discarded – undo
1415 1415
  */
1416 1416
 function geodir_restore_sidebars()
1417 1417
 {
1418
-    global $sidebars_widgets;
1419
-
1420
-    if (!is_array($sidebars_widgets))
1421
-        $sidebars_widgets = wp_get_sidebars_widgets();
1422
-
1423
-    if (is_array($sidebars_widgets)) {
1424
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1425
-        if (is_array($geodir_old_sidebars)) {
1426
-            foreach ($geodir_old_sidebars as $key => $val) {
1427
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1428
-                {
1429
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430
-                }
1418
+	global $sidebars_widgets;
1431 1419
 
1420
+	if (!is_array($sidebars_widgets))
1421
+		$sidebars_widgets = wp_get_sidebars_widgets();
1432 1422
 
1433
-            }
1434
-        }
1423
+	if (is_array($sidebars_widgets)) {
1424
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1425
+		if (is_array($geodir_old_sidebars)) {
1426
+			foreach ($geodir_old_sidebars as $key => $val) {
1427
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1428
+				{
1429
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1430
+				}
1435 1431
 
1436
-    }
1437 1432
 
1438
-    update_option('sidebars_widgets', $sidebars_widgets);
1439
-    update_option('geodir_sidebars', '');
1433
+			}
1434
+		}
1435
+
1436
+	}
1437
+
1438
+	update_option('sidebars_widgets', $sidebars_widgets);
1439
+	update_option('geodir_sidebars', '');
1440 1440
 }
1441 1441
 
1442 1442
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1449,9 +1449,9 @@  discard block
 block discarded – undo
1449 1449
  */
1450 1450
 function geodir_after_listing_post_gridview()
1451 1451
 {
1452
-    global $gridview_columns;
1452
+	global $gridview_columns;
1453 1453
 
1454
-    $gridview_columns = '';
1454
+	$gridview_columns = '';
1455 1455
 
1456 1456
 }
1457 1457
 
@@ -1479,11 +1479,11 @@  discard block
 block discarded – undo
1479 1479
  */
1480 1480
 function so_handle_038($url, $original_url, $_context)
1481 1481
 {
1482
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1483
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1484
-    }
1482
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1483
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1484
+	}
1485 1485
 
1486
-    return $url;
1486
+	return $url;
1487 1487
 }
1488 1488
 
1489 1489
 
@@ -1499,34 +1499,34 @@  discard block
 block discarded – undo
1499 1499
 function geodir_after_main_form_fields() {
1500 1500
 	global $gd_session;
1501 1501
 	
1502
-    if (get_option('geodir_accept_term_condition')) {
1503
-        global $post;
1504
-        $term_condition = '';
1505
-        if (isset($_REQUEST['backandedit'])) {
1506
-            $post = (object)$gd_session->get('listing');
1507
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508
-        }
1509
-
1510
-        ?>
1502
+	if (get_option('geodir_accept_term_condition')) {
1503
+		global $post;
1504
+		$term_condition = '';
1505
+		if (isset($_REQUEST['backandedit'])) {
1506
+			$post = (object)$gd_session->get('listing');
1507
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1508
+		}
1509
+
1510
+		?>
1511 1511
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1512 1512
             <label>&nbsp;</label>
1513 1513
 
1514 1514
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1515 1515
 				<span style="display:block"> 
1516 1516
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1517
-                    echo 'checked="checked"';
1518
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1517
+					echo 'checked="checked"';
1518
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1519 1519
                        class="geodir_textfield" value="1"
1520 1520
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1521 1521
 				</span>
1522 1522
             </div>
1523 1523
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1524
-                    _e($required_msg, 'geodirectory');
1525
-                } ?></span>
1524
+					_e($required_msg, 'geodirectory');
1525
+				} ?></span>
1526 1526
         </div>
1527 1527
     <?php
1528 1528
 
1529
-    }
1529
+	}
1530 1530
 }
1531 1531
 
1532 1532
 
@@ -1551,42 +1551,42 @@  discard block
 block discarded – undo
1551 1551
  */
1552 1552
 function geodir_detail_page_tab_is_display($is_display, $tab)
1553 1553
 {
1554
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1554
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1555 1555
 
1556
-    if ($tab == 'post_profile') {
1557
-        /** This action is documented in geodirectory_template_actions.php */
1558
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1556
+	if ($tab == 'post_profile') {
1557
+		/** This action is documented in geodirectory_template_actions.php */
1558
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1559 1559
         
1560
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1561
-            $is_display = false;
1562
-        }
1563
-    }
1560
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1561
+			$is_display = false;
1562
+		}
1563
+	}
1564 1564
     
1565
-    if ($tab == 'post_info')
1566
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1565
+	if ($tab == 'post_info')
1566
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1567 1567
     
1568
-    if ($tab == 'post_images')
1569
-        $is_display = (!empty($post_images)) ? true : false;
1568
+	if ($tab == 'post_images')
1569
+		$is_display = (!empty($post_images)) ? true : false;
1570 1570
 
1571
-    if ($tab == 'post_video')
1572
-        $is_display = (!empty($video)) ? true : false;
1571
+	if ($tab == 'post_video')
1572
+		$is_display = (!empty($video)) ? true : false;
1573 1573
 
1574
-    if ($tab == 'special_offers')
1575
-        $is_display = (!empty($special_offers)) ? true : false;
1574
+	if ($tab == 'special_offers')
1575
+		$is_display = (!empty($special_offers)) ? true : false;
1576 1576
 
1577
-    if ($tab == 'reviews')
1578
-        $is_display = (geodir_is_page('detail')) ? true : false;
1577
+	if ($tab == 'reviews')
1578
+		$is_display = (geodir_is_page('detail')) ? true : false;
1579 1579
 
1580
-    if ($tab == 'related_listing') {
1581
-       $message = __('No listings found which match your selection.', 'geodirectory');
1580
+	if ($tab == 'related_listing') {
1581
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1582 1582
        
1583
-       /** This action is documented in geodirectory-functions/template_functions.php */
1584
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1583
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1584
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1585 1585
        
1586
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1587
-    }
1586
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1587
+	}
1588 1588
 
1589
-    return $is_display;
1589
+	return $is_display;
1590 1590
 }
1591 1591
 
1592 1592
 
@@ -1602,69 +1602,69 @@  discard block
 block discarded – undo
1602 1602
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1603 1603
  */
1604 1604
 function geodir_changes_in_custom_fields_table() {
1605
-    global $wpdb, $plugin_prefix;
1605
+	global $wpdb, $plugin_prefix;
1606 1606
 	
1607 1607
 	// Remove unused virtual page
1608 1608
 	$listings_page_id = (int)get_option('geodir_listing_page');
1609 1609
 	if ($listings_page_id) {
1610 1610
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1611
-        delete_option('geodir_listing_page');
1611
+		delete_option('geodir_listing_page');
1612 1612
 	}
1613 1613
 
1614
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1615
-        $wpdb->query(
1616
-            $wpdb->prepare(
1617
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618
-                array('1', '1', 'admin')
1619
-            )
1620
-        );
1614
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1615
+		$wpdb->query(
1616
+			$wpdb->prepare(
1617
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1618
+				array('1', '1', 'admin')
1619
+			)
1620
+		);
1621 1621
 
1622 1622
 
1623
-        /* --- terms meta value set --- */
1623
+		/* --- terms meta value set --- */
1624 1624
 
1625
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1625
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1626 1626
 
1627
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1627
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1628 1628
 
1629
-        if (!empty($options_data)) {
1629
+		if (!empty($options_data)) {
1630 1630
 
1631
-            foreach ($options_data as $optobj) {
1631
+			foreach ($options_data as $optobj) {
1632 1632
 
1633
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1633
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1634 1634
 
1635
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1635
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1636 1636
 
1637
-                if (!empty($taxonomies_data)) {
1637
+				if (!empty($taxonomies_data)) {
1638 1638
 
1639
-                    foreach ($taxonomies_data as $taxobj) {
1639
+					foreach ($taxonomies_data as $taxobj) {
1640 1640
 
1641
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1642
-                        $post_type = $taxObject->object_type[0];
1641
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1642
+						$post_type = $taxObject->object_type[0];
1643 1643
 
1644
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1644
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1645 1645
 
1646
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1646
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1647 1647
 
1648
-                        if ($duplicate_data) {
1648
+						if ($duplicate_data) {
1649 1649
 
1650
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1650
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1651 1651
 
1652
-                        } else {
1652
+						} else {
1653 1653
 
1654
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1654
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1655 1655
 
1656
-                        }
1656
+						}
1657 1657
 
1658
-                    }
1658
+					}
1659 1659
 
1660
-                }
1660
+				}
1661 1661
 
1662
-            }
1663
-        }
1662
+			}
1663
+		}
1664 1664
 
1665
-        update_option('geodir_changes_in_custom_fields_table', '1');
1665
+		update_option('geodir_changes_in_custom_fields_table', '1');
1666 1666
 
1667
-    }
1667
+	}
1668 1668
 
1669 1669
 }
1670 1670
 
@@ -1683,24 +1683,24 @@  discard block
 block discarded – undo
1683 1683
 function geodir_location_slug_check($slug)
1684 1684
 {
1685 1685
 
1686
-    global $wpdb, $table_prefix;
1686
+	global $wpdb, $table_prefix;
1687 1687
 
1688
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1688
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1689 1689
 
1690
-    if ($slug_exists) {
1690
+	if ($slug_exists) {
1691 1691
 
1692
-        $suffix = 1;
1693
-        do {
1694
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1696
-            $suffix++;
1697
-        } while ($location_slug_check && $suffix < 100);
1692
+		$suffix = 1;
1693
+		do {
1694
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1695
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1696
+			$suffix++;
1697
+		} while ($location_slug_check && $suffix < 100);
1698 1698
 
1699
-        $slug = $alt_location_name;
1699
+		$slug = $alt_location_name;
1700 1700
 
1701
-    }
1701
+	}
1702 1702
 
1703
-    return $slug;
1703
+	return $slug;
1704 1704
 
1705 1705
 }
1706 1706
 
@@ -1725,42 +1725,42 @@  discard block
 block discarded – undo
1725 1725
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1726 1726
 {
1727 1727
 
1728
-    global $wpdb, $plugin_prefix, $table_prefix;
1728
+	global $wpdb, $plugin_prefix, $table_prefix;
1729 1729
 
1730
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1730
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1731 1731
 
1732
-    $slug = $tern_data->slug;
1732
+	$slug = $tern_data->slug;
1733 1733
 
1734
-    /**
1735
-     * Filter if a term slug exists.
1736
-     *
1737
-     * @since 1.0.0
1738
-     * @package GeoDirectory
1739
-     * @param bool $bool Default: false.
1740
-     * @param string $slug The term slug.
1741
-     * @param int $term_id The term ID.
1742
-     */
1743
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1734
+	/**
1735
+	 * Filter if a term slug exists.
1736
+	 *
1737
+	 * @since 1.0.0
1738
+	 * @package GeoDirectory
1739
+	 * @param bool $bool Default: false.
1740
+	 * @param string $slug The term slug.
1741
+	 * @param int $term_id The term ID.
1742
+	 */
1743
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1744 1744
 
1745
-    if ($slug_exists) {
1745
+	if ($slug_exists) {
1746 1746
 
1747
-        $suffix = 1;
1748
-        do {
1749
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1747
+		$suffix = 1;
1748
+		do {
1749
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1750 1750
 
1751
-            /** This action is documented in geodirectory_hooks_actions.php */
1752
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1751
+			/** This action is documented in geodirectory_hooks_actions.php */
1752
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1753 1753
 
1754
-            $suffix++;
1755
-        } while ($term_slug_check && $suffix < 100);
1754
+			$suffix++;
1755
+		} while ($term_slug_check && $suffix < 100);
1756 1756
 
1757
-        $slug = $new_slug;
1757
+		$slug = $new_slug;
1758 1758
 
1759
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1759
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1760 1760
 
1761
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1761
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1762 1762
 
1763
-    }
1763
+	}
1764 1764
 	
1765 1765
 	// Update tag in detail table.
1766 1766
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1801,21 +1801,21 @@  discard block
 block discarded – undo
1801 1801
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1802 1802
 {
1803 1803
 
1804
-    global $wpdb, $table_prefix;
1804
+	global $wpdb, $table_prefix;
1805 1805
 
1806
-    $default_location = geodir_get_default_location();
1806
+	$default_location = geodir_get_default_location();
1807 1807
 
1808
-    $country_slug = $default_location->country_slug;
1809
-    $region_slug = $default_location->region_slug;
1810
-    $city_slug = $default_location->city_slug;
1808
+	$country_slug = $default_location->country_slug;
1809
+	$region_slug = $default_location->region_slug;
1810
+	$city_slug = $default_location->city_slug;
1811 1811
 
1812
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813
-        return $slug_exists = true;
1812
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1813
+		return $slug_exists = true;
1814 1814
 
1815
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816
-        return $slug_exists = true;
1815
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1816
+		return $slug_exists = true;
1817 1817
 
1818
-    return $slug_exists;
1818
+	return $slug_exists;
1819 1819
 }
1820 1820
 
1821 1821
 
@@ -1835,75 +1835,75 @@  discard block
 block discarded – undo
1835 1835
  */
1836 1836
 function geodir_custom_page_title($title = '', $sep = '')
1837 1837
 {
1838
-    global $wp;
1839
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1840
-        return $title;
1841
-    }
1838
+	global $wp;
1839
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1840
+		return $title;
1841
+	}
1842 1842
 
1843
-    if ($sep == '') {
1844
-        /**
1845
-         * Filter the page title separator.
1846
-         *
1847
-         * @since 1.0.0
1848
-         * @package GeoDirectory
1849
-         * @param string $sep The separator, default: `|`.
1850
-         */
1851
-        $sep = apply_filters('geodir_page_title_separator', '|');
1852
-    }
1843
+	if ($sep == '') {
1844
+		/**
1845
+		 * Filter the page title separator.
1846
+		 *
1847
+		 * @since 1.0.0
1848
+		 * @package GeoDirectory
1849
+		 * @param string $sep The separator, default: `|`.
1850
+		 */
1851
+		$sep = apply_filters('geodir_page_title_separator', '|');
1852
+	}
1853 1853
 
1854 1854
 
1855
-    $gd_page = '';
1856
-    if(geodir_is_page('home')){
1857
-        $gd_page = 'home';
1858
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859
-    }
1860
-    elseif(geodir_is_page('detail')){
1861
-        $gd_page = 'detail';
1862
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863
-    }
1864
-    elseif(geodir_is_page('pt')){
1865
-        $gd_page = 'pt';
1866
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('listing')){
1869
-        $gd_page = 'listing';
1870
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('location')){
1873
-        $gd_page = 'location';
1874
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('search')){
1877
-        $gd_page = 'search';
1878
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('add-listing')){
1881
-        $gd_page = 'add-listing';
1882
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('author')){
1885
-        $gd_page = 'author';
1886
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('login')){
1889
-        $gd_page = 'login';
1890
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('listing-success')){
1893
-        $gd_page = 'listing-success';
1894
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895
-    }
1855
+	$gd_page = '';
1856
+	if(geodir_is_page('home')){
1857
+		$gd_page = 'home';
1858
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1859
+	}
1860
+	elseif(geodir_is_page('detail')){
1861
+		$gd_page = 'detail';
1862
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1863
+	}
1864
+	elseif(geodir_is_page('pt')){
1865
+		$gd_page = 'pt';
1866
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('listing')){
1869
+		$gd_page = 'listing';
1870
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('location')){
1873
+		$gd_page = 'location';
1874
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('search')){
1877
+		$gd_page = 'search';
1878
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('add-listing')){
1881
+		$gd_page = 'add-listing';
1882
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('author')){
1885
+		$gd_page = 'author';
1886
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('login')){
1889
+		$gd_page = 'login';
1890
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('listing-success')){
1893
+		$gd_page = 'listing-success';
1894
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1895
+	}
1896 1896
 
1897 1897
 
1898
-    /**
1899
-     * Filter page meta title to replace variables.
1900
-     *
1901
-     * @since 1.5.4
1902
-     * @param string $title The page title including variables.
1903
-     * @param string $gd_page The GeoDirectory page type if any.
1904
-     * @param string $sep The title separator symbol.
1905
-     */
1906
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1898
+	/**
1899
+	 * Filter page meta title to replace variables.
1900
+	 *
1901
+	 * @since 1.5.4
1902
+	 * @param string $title The page title including variables.
1903
+	 * @param string $gd_page The GeoDirectory page type if any.
1904
+	 * @param string $sep The title separator symbol.
1905
+	 */
1906
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1907 1907
 
1908 1908
 }
1909 1909
 
@@ -1919,36 +1919,36 @@  discard block
 block discarded – undo
1919 1919
 function geodir_set_post_attachment()
1920 1920
 {
1921 1921
 
1922
-    if (!get_option('geodir_set_post_attachments')) {
1922
+	if (!get_option('geodir_set_post_attachments')) {
1923 1923
 
1924
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1924
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1925
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1926 1926
 
1927
-        $all_postypes = geodir_get_posttypes();
1927
+		$all_postypes = geodir_get_posttypes();
1928 1928
 
1929
-        foreach($all_postypes as $post_type){
1930
-            $args = array(
1931
-                'posts_per_page' => -1,
1932
-                'post_type' => $post_type,
1933
-                'post_status' => 'publish');
1929
+		foreach($all_postypes as $post_type){
1930
+			$args = array(
1931
+				'posts_per_page' => -1,
1932
+				'post_type' => $post_type,
1933
+				'post_status' => 'publish');
1934 1934
 
1935
-            $posts_array = get_posts($args);
1935
+			$posts_array = get_posts($args);
1936 1936
 
1937
-            if (!empty($posts_array)) {
1937
+			if (!empty($posts_array)) {
1938 1938
 
1939
-                foreach ($posts_array as $post) {
1939
+				foreach ($posts_array as $post) {
1940 1940
 
1941
-                    geodir_set_wp_featured_image($post->ID);
1941
+					geodir_set_wp_featured_image($post->ID);
1942 1942
 
1943
-                }
1943
+				}
1944 1944
 
1945
-            }
1946
-        }
1945
+			}
1946
+		}
1947 1947
 
1948 1948
 
1949
-        update_option('geodir_set_post_attachments', '1');
1949
+		update_option('geodir_set_post_attachments', '1');
1950 1950
 
1951
-    }
1951
+	}
1952 1952
 
1953 1953
 }
1954 1954
 
@@ -1965,19 +1965,19 @@  discard block
 block discarded – undo
1965 1965
 function geodir_remove_url_seperator()
1966 1966
 {
1967 1967
 
1968
-    if (!get_option('geodir_remove_url_seperator')) {
1968
+	if (!get_option('geodir_remove_url_seperator')) {
1969 1969
 
1970
-        if (get_option('geodir_listingurl_separator'))
1971
-            delete_option('geodir_listingurl_separator');
1970
+		if (get_option('geodir_listingurl_separator'))
1971
+			delete_option('geodir_listingurl_separator');
1972 1972
 
1973
-        if (get_option('geodir_detailurl_separator'))
1974
-            delete_option('geodir_detailurl_separator');
1973
+		if (get_option('geodir_detailurl_separator'))
1974
+			delete_option('geodir_detailurl_separator');
1975 1975
 
1976
-        flush_rewrite_rules(false);
1976
+		flush_rewrite_rules(false);
1977 1977
 
1978
-        update_option('geodir_remove_url_seperator', '1');
1978
+		update_option('geodir_remove_url_seperator', '1');
1979 1979
 
1980
-    }
1980
+	}
1981 1981
 
1982 1982
 }
1983 1983
 
@@ -1993,19 +1993,19 @@  discard block
 block discarded – undo
1993 1993
  */
1994 1994
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1995 1995
 {
1996
-    foreach ($permalink_arr as $key => $value) {
1996
+	foreach ($permalink_arr as $key => $value) {
1997 1997
 
1998
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1999
-            unset($permalink_arr[$key]);
1998
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1999
+			unset($permalink_arr[$key]);
2000 2000
 
2001
-    }
2001
+	}
2002 2002
 
2003
-    return $permalink_arr;
2003
+	return $permalink_arr;
2004 2004
 
2005 2005
 }
2006 2006
 
2007 2007
 if (!is_admin()) {
2008
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2008
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2009 2009
 }
2010 2010
 /**
2011 2011
  * Set status from draft to publish.
@@ -2018,16 +2018,16 @@  discard block
 block discarded – undo
2018 2018
  */
2019 2019
 function geodir_set_status_draft_to_publish_for_own_post($post)
2020 2020
 {
2021
-    $user_id = get_current_user_id();
2021
+	$user_id = get_current_user_id();
2022 2022
 
2023
-    if(!$user_id){return $post;}
2023
+	if(!$user_id){return $post;}
2024 2024
 
2025
-    $gd_post_types = geodir_get_posttypes();
2025
+	$gd_post_types = geodir_get_posttypes();
2026 2026
 
2027
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2028
-        $post[0]->post_status = 'publish';
2029
-    }
2030
-    return $post;
2027
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2028
+		$post[0]->post_status = 'publish';
2029
+	}
2030
+	return $post;
2031 2031
 }
2032 2032
 
2033 2033
 
@@ -2119,33 +2119,33 @@  discard block
 block discarded – undo
2119 2119
  */
2120 2120
 function geodir_detail_page_tab_headings_change($tabs_arr)
2121 2121
 {
2122
-    global $wpdb;
2122
+	global $wpdb;
2123 2123
 
2124
-    $post_type = geodir_get_current_posttype();
2124
+	$post_type = geodir_get_current_posttype();
2125 2125
 
2126
-    $all_postypes = geodir_get_posttypes();
2126
+	$all_postypes = geodir_get_posttypes();
2127 2127
 
2128
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2128
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2129 2129
 
2130
-        if (array_key_exists('post_video', $tabs_arr)) {
2130
+		if (array_key_exists('post_video', $tabs_arr)) {
2131 2131
 
2132
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2132
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2133 2133
 
2134
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2136
-        }
2134
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2135
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2136
+		}
2137 2137
 
2138
-        if (array_key_exists('special_offers', $tabs_arr)) {
2138
+		if (array_key_exists('special_offers', $tabs_arr)) {
2139 2139
 
2140
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2140
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2141 2141
 
2142
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2144
-        }
2142
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2143
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2144
+		}
2145 2145
 
2146
-    }
2146
+	}
2147 2147
 
2148
-    return $tabs_arr;
2148
+	return $tabs_arr;
2149 2149
 
2150 2150
 }
2151 2151
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
  */
2159 2159
 function geodir_remove_template_redirect_actions()
2160 2160
 {
2161
-    if (geodir_is_page('login')){
2162
-        remove_all_actions('template_redirect');
2163
-        remove_action('init', 'avia_modify_front', 10);
2164
-    }
2161
+	if (geodir_is_page('login')){
2162
+		remove_all_actions('template_redirect');
2163
+		remove_action('init', 'avia_modify_front', 10);
2164
+	}
2165 2165
 }
2166 2166
 
2167 2167
 
@@ -2183,51 +2183,51 @@  discard block
 block discarded – undo
2183 2183
 function geodirectory_before_featured_image_delete($attachment_id)
2184 2184
 {
2185 2185
 
2186
-    global $wpdb, $plugin_prefix;
2186
+	global $wpdb, $plugin_prefix;
2187 2187
 
2188
-    $post_id = get_post_field('post_parent', $attachment_id);
2188
+	$post_id = get_post_field('post_parent', $attachment_id);
2189 2189
 
2190
-    $attachment_url = wp_get_attachment_url($attachment_id);
2190
+	$attachment_url = wp_get_attachment_url($attachment_id);
2191 2191
 
2192
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2192
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2193 2193
 
2194
-        $post_type = get_post_type($post_id);
2194
+		$post_type = get_post_type($post_id);
2195 2195
 
2196
-        $all_postypes = geodir_get_posttypes();
2196
+		$all_postypes = geodir_get_posttypes();
2197 2197
 
2198
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2199
-            return false;
2198
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2199
+			return false;
2200 2200
 
2201
-        $uploads = wp_upload_dir();
2201
+		$uploads = wp_upload_dir();
2202 2202
 
2203
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2203
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2204 2204
 
2205
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2205
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2206 2206
 
2207
-        $wpdb->query(
2208
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2209
-                array($post_id, $split_img_file_path)
2210
-            )
2211
-        );
2207
+		$wpdb->query(
2208
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2209
+				array($post_id, $split_img_file_path)
2210
+			)
2211
+		);
2212 2212
 
2213
-        $attachment_data = $wpdb->get_row(
2214
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2215
-                array($post_id)
2216
-            )
2217
-        );
2213
+		$attachment_data = $wpdb->get_row(
2214
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2215
+				array($post_id)
2216
+			)
2217
+		);
2218 2218
 
2219
-        if (!empty($attachment_data)) {
2220
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2221
-        }
2219
+		if (!empty($attachment_data)) {
2220
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2221
+		}
2222 2222
 
2223 2223
 
2224
-        $table_name = $plugin_prefix . $post_type . '_detail';
2224
+		$table_name = $plugin_prefix . $post_type . '_detail';
2225 2225
 
2226
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2226
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2227 2227
 
2228
-        geodir_set_wp_featured_image($post_id);
2228
+		geodir_set_wp_featured_image($post_id);
2229 2229
 
2230
-    }
2230
+	}
2231 2231
 
2232 2232
 }
2233 2233
 
@@ -2245,79 +2245,79 @@  discard block
 block discarded – undo
2245 2245
 function geodir_temp_set_post_attachment()
2246 2246
 {
2247 2247
 
2248
-    global $wpdb, $plugin_prefix;
2248
+	global $wpdb, $plugin_prefix;
2249 2249
 
2250
-    $all_postypes = geodir_get_posttypes();
2250
+	$all_postypes = geodir_get_posttypes();
2251 2251
 
2252
-    foreach ($all_postypes as $posttype) {
2252
+	foreach ($all_postypes as $posttype) {
2253 2253
 
2254
-        $tablename = $plugin_prefix . $posttype . '_detail';
2254
+		$tablename = $plugin_prefix . $posttype . '_detail';
2255 2255
 
2256
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2256
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2257 2257
 
2258
-        if (!empty($get_post_data)) {
2258
+		if (!empty($get_post_data)) {
2259 2259
 
2260
-            foreach ($get_post_data as $data) {
2260
+			foreach ($get_post_data as $data) {
2261 2261
 
2262
-                $post_id = $data->post_id;
2262
+				$post_id = $data->post_id;
2263 2263
 
2264
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2264
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2265 2265
 
2266
-                if (!empty($attachment_data)) {
2266
+				if (!empty($attachment_data)) {
2267 2267
 
2268
-                    foreach ($attachment_data as $attach) {
2268
+					foreach ($attachment_data as $attach) {
2269 2269
 
2270
-                        $file_info = pathinfo($attach->file);
2270
+						$file_info = pathinfo($attach->file);
2271 2271
 
2272
-                        $sub_dir = '';
2273
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2274
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2272
+						$sub_dir = '';
2273
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2274
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2275 2275
 
2276
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2277
-                        $uploads_path = $uploads['basedir'];
2276
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2277
+						$uploads_path = $uploads['basedir'];
2278 2278
 
2279
-                        $file_name = $file_info['basename'];
2279
+						$file_name = $file_info['basename'];
2280 2280
 
2281
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2281
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2282 2282
 
2283
-                        if (!file_exists($img_arr['path'])) {
2283
+						if (!file_exists($img_arr['path'])) {
2284 2284
 
2285
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2285
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2286 2286
 
2287
-                        }
2287
+						}
2288 2288
 
2289
-                    }
2289
+					}
2290 2290
 
2291
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2291
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2292 2292
 
2293
-                    if (!empty($attachment_data)) {
2293
+					if (!empty($attachment_data)) {
2294 2294
 
2295
-                        if ($attachment_data->ID)
2296
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2295
+						if ($attachment_data->ID)
2296
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2297 2297
 
2298
-                    } else {
2298
+					} else {
2299 2299
 
2300
-                        if (has_post_thumbnail($post_id)) {
2300
+						if (has_post_thumbnail($post_id)) {
2301 2301
 
2302
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2302
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2303 2303
 
2304
-                            wp_delete_attachment($post_thumbnail_id);
2304
+							wp_delete_attachment($post_thumbnail_id);
2305 2305
 
2306
-                        }
2306
+						}
2307 2307
 
2308
-                    }
2308
+					}
2309 2309
 
2310
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2310
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2311 2311
 
2312
-                    geodir_set_wp_featured_image($post_id);
2312
+					geodir_set_wp_featured_image($post_id);
2313 2313
 
2314
-                }
2314
+				}
2315 2315
 
2316
-            }
2316
+			}
2317 2317
 
2318
-        }
2318
+		}
2319 2319
 
2320
-    }
2320
+	}
2321 2321
 
2322 2322
 }
2323 2323
 
@@ -2335,9 +2335,9 @@  discard block
 block discarded – undo
2335 2335
 function geodir_default_rating_star_icon()
2336 2336
 {
2337 2337
 
2338
-    if (!get_option('geodir_default_rating_star_icon')) {
2339
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2340
-    }
2338
+	if (!get_option('geodir_default_rating_star_icon')) {
2339
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2340
+	}
2341 2341
 
2342 2342
 }
2343 2343
 
@@ -2355,25 +2355,25 @@  discard block
 block discarded – undo
2355 2355
  */
2356 2356
 function geodir_user_post_listing_count($user_id = 0)
2357 2357
 {
2358
-    global $wpdb, $plugin_prefix, $current_user;
2359
-    if(!$user_id){
2360
-        $user_id = $current_user->ID;
2361
-    }
2358
+	global $wpdb, $plugin_prefix, $current_user;
2359
+	if(!$user_id){
2360
+		$user_id = $current_user->ID;
2361
+	}
2362 2362
 
2363
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2363
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2364 2364
 
2365
-    $user_listing = array();
2366
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2367
-        foreach ($all_posts as $ptype) {
2368
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2365
+	$user_listing = array();
2366
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2367
+		foreach ($all_posts as $ptype) {
2368
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2369 2369
 
2370
-            if ($total_posts > 0) {
2371
-                $user_listing[$ptype] = $total_posts;
2372
-            }
2373
-        }
2374
-    }
2370
+			if ($total_posts > 0) {
2371
+				$user_listing[$ptype] = $total_posts;
2372
+			}
2373
+		}
2374
+	}
2375 2375
 
2376
-    return $user_listing;
2376
+	return $user_listing;
2377 2377
 }
2378 2378
 
2379 2379
 
@@ -2393,189 +2393,189 @@  discard block
 block discarded – undo
2393 2393
  */
2394 2394
 function geodir_detail_page_custom_field_tab($tabs_arr)
2395 2395
 {
2396
-    global $post;
2397
-
2398
-    $post_type = geodir_get_current_posttype();
2399
-    $all_postypes = geodir_get_posttypes();
2400
-
2401
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2402
-        $package_info = array();
2403
-        $package_info = geodir_post_package_info($package_info, $post);
2404
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2405
-        $fields_location = 'owntab';
2406
-
2407
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2408
-        //remove video and special offers if it is already set to show
2409
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2410
-            $unset_video = true;
2411
-        }
2412
-
2413
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2414
-            $unset_special_offers = true;
2415
-        }
2416
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2417
-            foreach($custom_fields as $key => $custom_field){
2418
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2419
-                    unset($custom_fields[$key]);
2420
-                }
2421
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2422
-                    unset($custom_fields[$key]);
2423
-                }
2424
-            }
2425
-        }
2426
-
2427
-
2428
-        if (!empty($custom_fields)) {
2429
-            $parse_custom_fields = array();
2430
-            foreach ($custom_fields as $field) {
2431
-                $field = stripslashes_deep($field); // strip slashes
2432
-                $type = $field;
2433
-                $field_name = $field['htmlvar_name'];
2434
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2435
-                    $post->{$field_name} = $_REQUEST[$field_name];
2436
-                }
2396
+	global $post;
2437 2397
 
2438
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2439
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2440
-                        continue;
2441
-                    }
2398
+	$post_type = geodir_get_current_posttype();
2399
+	$all_postypes = geodir_get_posttypes();
2442 2400
 
2443
-                    $parse_custom_fields[] = $field;
2444
-                }
2445
-            }
2446
-            $custom_fields = $parse_custom_fields;
2447
-        }
2448
-        //print_r($custom_fields);
2449
-        if (!empty($custom_fields)) {
2401
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2402
+		$package_info = array();
2403
+		$package_info = geodir_post_package_info($package_info, $post);
2404
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2405
+		$fields_location = 'owntab';
2450 2406
 
2451
-            global $field_set_start;
2407
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2408
+		//remove video and special offers if it is already set to show
2409
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2410
+			$unset_video = true;
2411
+		}
2452 2412
 
2453
-            $post = stripslashes_deep($post); // strip slashes
2454
-            
2455
-            $field_set_start = 0;
2456
-            $fieldset_count = 0;
2457
-            $fieldset = '';
2458
-            $total_fields = count($custom_fields);
2459
-            $count_field = 0;
2460
-            $fieldset_arr = array();
2461
-            $i = 0;
2462
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2463
-
2464
-            foreach ($custom_fields as $field) {
2465
-                $count_field++;
2466
-                $field_name = $field['htmlvar_name'];
2467
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2468
-                    $post->{$field_name} = $_REQUEST[$field_name];
2469
-                }
2413
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2414
+			$unset_special_offers = true;
2415
+		}
2416
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2417
+			foreach($custom_fields as $key => $custom_field){
2418
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2419
+					unset($custom_fields[$key]);
2420
+				}
2421
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2422
+					unset($custom_fields[$key]);
2423
+				}
2424
+			}
2425
+		}
2470 2426
 
2471
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2472
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2473
-                    $site_title = trim($field['site_title']);
2474
-                    $type = $field;
2475
-                    $variables_array = array();
2476 2427
 
2477
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2478
-                        continue;
2479
-                    }
2428
+		if (!empty($custom_fields)) {
2429
+			$parse_custom_fields = array();
2430
+			foreach ($custom_fields as $field) {
2431
+				$field = stripslashes_deep($field); // strip slashes
2432
+				$type = $field;
2433
+				$field_name = $field['htmlvar_name'];
2434
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2435
+					$post->{$field_name} = $_REQUEST[$field_name];
2436
+				}
2480 2437
 
2481
-                    if ($type['type'] != 'fieldset') {
2482
-                        $i++;
2483
-                        $variables_array['post_id'] = $post->ID;
2484
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2485
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2486
-
2487
-                    }else{
2488
-                        $i = 0;
2489
-                        $fieldset_count++;
2490
-                        $field_set_start = 1;
2491
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2492
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2493
-                    }
2438
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2439
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2440
+						continue;
2441
+					}
2494 2442
 
2443
+					$parse_custom_fields[] = $field;
2444
+				}
2445
+			}
2446
+			$custom_fields = $parse_custom_fields;
2447
+		}
2448
+		//print_r($custom_fields);
2449
+		if (!empty($custom_fields)) {
2495 2450
 
2496
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2497
-                    $type = stripslashes_deep($type); // strip slashes
2498
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2499
-                    $html = '';
2500
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2501
-                    if($html_var=='post'){$html_var='post_address';}
2502
-                    $field_icon = geodir_field_icon_proccess($type);
2503
-                    $filed_type = $type['type'];
2504
-
2505
-                    /**
2506
-                     * Filter the output for custom fields.
2507
-                     *
2508
-                     * Here we can remove or add new functions depending on the field type.
2509
-                     *
2510
-                     * @param string $html The html to be filtered (blank).
2511
-                     * @param string $fields_location The location the field is to be show.
2512
-                     * @param array $type The array of field values.
2513
-                     */
2514
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2515
-
2516
-
2517
-                    /**
2518
-                     * Filter custom field output in tab.
2519
-                     *
2520
-                     * @since 1.5.6
2521
-                     *
2522
-                     * @param string $html_var The HTML variable name for the field.
2523
-                     * @param string $html Custom field unfiltered HTML.
2524
-                     * @param array $variables_array Custom field variables array.
2525
-                     */
2526
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2527
-
2528
-                    $fieldset_html = '';
2529
-                    if ($field_set_start == 1) {
2530
-                        $add_html = false;
2531
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2532
-                            if ($fieldset != '') {
2533
-                                $add_html = true;
2534
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2535
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2536
-                            }
2537
-                            $fieldset_html = $fieldset;
2538
-                            $fieldset = '';
2539
-                        } else {
2540
-                            $fieldset .= $html;
2541
-                            if ($total_fields == $count_field && $fieldset != '') {
2542
-                                $add_html = true;
2543
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2544
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2545
-                                $fieldset_html = $fieldset;
2546
-                            }
2547
-                        }
2451
+			global $field_set_start;
2548 2452
 
2549
-                        if ($add_html) {
2550
-                            $tabs_arr[$htmlvar_name] = array(
2551
-                                'heading_text' => __($label, 'geodirectory'),
2552
-                                'is_active_tab' => false,
2553
-                                /**
2554
-                                 * Filter if a custom field should be displayed on the details page tab.
2555
-                                 *
2556
-                                 * @since 1.0.0
2557
-                                 * @param string $htmlvar_name The field HTML var name.
2558
-                                 */
2559
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2560
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2561
-                            );
2562
-                        }
2563
-                    } else {
2564
-                        if ($html != '') {
2565
-                            $tabs_arr[$html_var] = array(
2566
-                                'heading_text' => __($label, 'geodirectory'),
2567
-                                'is_active_tab' => false,
2568
-                                /** This action is documented in geodirectory_hooks_actions.php */
2569
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2570
-                                'tab_content' => $html
2571
-                            );
2572
-                        }
2573
-                    }
2574
-                }
2575
-            }
2576
-        }
2577
-    }
2578
-    return $tabs_arr;
2453
+			$post = stripslashes_deep($post); // strip slashes
2454
+            
2455
+			$field_set_start = 0;
2456
+			$fieldset_count = 0;
2457
+			$fieldset = '';
2458
+			$total_fields = count($custom_fields);
2459
+			$count_field = 0;
2460
+			$fieldset_arr = array();
2461
+			$i = 0;
2462
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2463
+
2464
+			foreach ($custom_fields as $field) {
2465
+				$count_field++;
2466
+				$field_name = $field['htmlvar_name'];
2467
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2468
+					$post->{$field_name} = $_REQUEST[$field_name];
2469
+				}
2470
+
2471
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2472
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2473
+					$site_title = trim($field['site_title']);
2474
+					$type = $field;
2475
+					$variables_array = array();
2476
+
2477
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2478
+						continue;
2479
+					}
2480
+
2481
+					if ($type['type'] != 'fieldset') {
2482
+						$i++;
2483
+						$variables_array['post_id'] = $post->ID;
2484
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2485
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2486
+
2487
+					}else{
2488
+						$i = 0;
2489
+						$fieldset_count++;
2490
+						$field_set_start = 1;
2491
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2492
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2493
+					}
2494
+
2495
+
2496
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2497
+					$type = stripslashes_deep($type); // strip slashes
2498
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2499
+					$html = '';
2500
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2501
+					if($html_var=='post'){$html_var='post_address';}
2502
+					$field_icon = geodir_field_icon_proccess($type);
2503
+					$filed_type = $type['type'];
2504
+
2505
+					/**
2506
+					 * Filter the output for custom fields.
2507
+					 *
2508
+					 * Here we can remove or add new functions depending on the field type.
2509
+					 *
2510
+					 * @param string $html The html to be filtered (blank).
2511
+					 * @param string $fields_location The location the field is to be show.
2512
+					 * @param array $type The array of field values.
2513
+					 */
2514
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2515
+
2516
+
2517
+					/**
2518
+					 * Filter custom field output in tab.
2519
+					 *
2520
+					 * @since 1.5.6
2521
+					 *
2522
+					 * @param string $html_var The HTML variable name for the field.
2523
+					 * @param string $html Custom field unfiltered HTML.
2524
+					 * @param array $variables_array Custom field variables array.
2525
+					 */
2526
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2527
+
2528
+					$fieldset_html = '';
2529
+					if ($field_set_start == 1) {
2530
+						$add_html = false;
2531
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2532
+							if ($fieldset != '') {
2533
+								$add_html = true;
2534
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2535
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2536
+							}
2537
+							$fieldset_html = $fieldset;
2538
+							$fieldset = '';
2539
+						} else {
2540
+							$fieldset .= $html;
2541
+							if ($total_fields == $count_field && $fieldset != '') {
2542
+								$add_html = true;
2543
+								$label = $fieldset_arr[$fieldset_count]['label'];
2544
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2545
+								$fieldset_html = $fieldset;
2546
+							}
2547
+						}
2548
+
2549
+						if ($add_html) {
2550
+							$tabs_arr[$htmlvar_name] = array(
2551
+								'heading_text' => __($label, 'geodirectory'),
2552
+								'is_active_tab' => false,
2553
+								/**
2554
+								 * Filter if a custom field should be displayed on the details page tab.
2555
+								 *
2556
+								 * @since 1.0.0
2557
+								 * @param string $htmlvar_name The field HTML var name.
2558
+								 */
2559
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2560
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2561
+							);
2562
+						}
2563
+					} else {
2564
+						if ($html != '') {
2565
+							$tabs_arr[$html_var] = array(
2566
+								'heading_text' => __($label, 'geodirectory'),
2567
+								'is_active_tab' => false,
2568
+								/** This action is documented in geodirectory_hooks_actions.php */
2569
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2570
+								'tab_content' => $html
2571
+							);
2572
+						}
2573
+					}
2574
+				}
2575
+			}
2576
+		}
2577
+	}
2578
+	return $tabs_arr;
2579 2579
 }
2580 2580
 
2581 2581
 /* display add listing page for wpml */
@@ -2599,39 +2599,39 @@  discard block
 block discarded – undo
2599 2599
  */
2600 2600
 function geodir_add_post_status_author_page()
2601 2601
 {
2602
-    global $wpdb, $post;
2603
-
2604
-    $html = '';
2605
-    if (get_current_user_id()) {
2606
-
2607
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2608
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2609
-
2610
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2611
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2612
-            $status = "<strong>(";
2613
-            $status_icon = '<i class="fa fa-play"></i>';
2614
-            if ($real_status == 'publish') {
2615
-                $status .= __('Published', 'geodirectory');
2616
-            } else {
2617
-                $status .= __('Not published', 'geodirectory');
2618
-                $status_icon = '<i class="fa fa-pause"></i>';
2619
-            }
2620
-            $status .= ")</strong>";
2602
+	global $wpdb, $post;
2603
+
2604
+	$html = '';
2605
+	if (get_current_user_id()) {
2606
+
2607
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2608
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2609
+
2610
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2611
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2612
+			$status = "<strong>(";
2613
+			$status_icon = '<i class="fa fa-play"></i>';
2614
+			if ($real_status == 'publish') {
2615
+				$status .= __('Published', 'geodirectory');
2616
+			} else {
2617
+				$status .= __('Not published', 'geodirectory');
2618
+				$status_icon = '<i class="fa fa-pause"></i>';
2619
+			}
2620
+			$status .= ")</strong>";
2621 2621
 
2622
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2623
-        }
2624
-    }
2622
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2623
+		}
2624
+	}
2625 2625
 
2626
-    if ($html != '') {
2627
-        /**
2628
-         * Filter the post status text on the author page.
2629
-         *
2630
-         * @since 1.0.0
2631
-         * @param string $html The HTML of the status.
2632
-         */
2633
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2634
-    }
2626
+	if ($html != '') {
2627
+		/**
2628
+		 * Filter the post status text on the author page.
2629
+		 *
2630
+		 * @since 1.0.0
2631
+		 * @param string $html The HTML of the status.
2632
+		 */
2633
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2634
+	}
2635 2635
 
2636 2636
 
2637 2637
 }
@@ -2645,9 +2645,9 @@  discard block
 block discarded – undo
2645 2645
  * @package GeoDirectory
2646 2646
  */
2647 2647
 function geodir_init_no_rating() {
2648
-    if (geodir_rating_disabled_post_types()) {
2649
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2650
-    }
2648
+	if (geodir_rating_disabled_post_types()) {
2649
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2650
+	}
2651 2651
 }
2652 2652
 
2653 2653
 /**
@@ -2661,22 +2661,22 @@  discard block
 block discarded – undo
2661 2661
  * @return array Modified sort options array.
2662 2662
  */
2663 2663
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2664
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2665
-        $new_options = array();
2664
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2665
+		$new_options = array();
2666 2666
         
2667
-        if (!empty($options)) {
2668
-            foreach ($options as $option) {
2669
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2670
-                    continue;
2671
-                }
2672
-                $new_options[] = $option;
2673
-            }
2667
+		if (!empty($options)) {
2668
+			foreach ($options as $option) {
2669
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2670
+					continue;
2671
+				}
2672
+				$new_options[] = $option;
2673
+			}
2674 2674
 
2675
-            $options = $new_options;
2676
-        }
2677
-    }
2675
+			$options = $new_options;
2676
+		}
2677
+	}
2678 2678
 
2679
-    return $options;
2679
+	return $options;
2680 2680
 }
2681 2681
 
2682 2682
 /**
@@ -2688,9 +2688,9 @@  discard block
 block discarded – undo
2688 2688
  * @return array Modified class array.
2689 2689
  */
2690 2690
 function geodir_body_class_active_map($classes = array()) {
2691
-    $classes[] = 'gd-map-' . geodir_map_name();
2691
+	$classes[] = 'gd-map-' . geodir_map_name();
2692 2692
 
2693
-    return $classes;
2693
+	return $classes;
2694 2694
 }
2695 2695
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2696 2696
 
@@ -2703,9 +2703,9 @@  discard block
 block discarded – undo
2703 2703
  * @return string Modified class string.
2704 2704
  */
2705 2705
 function geodir_admin_body_class_active_map($class = '') {    
2706
-    $class .= ' gd-map-' . geodir_map_name();
2706
+	$class .= ' gd-map-' . geodir_map_name();
2707 2707
 
2708
-    return $class;
2708
+	return $class;
2709 2709
 }
2710 2710
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2711 2711
 
@@ -2723,36 +2723,36 @@  discard block
 block discarded – undo
2723 2723
  * @return array Translation texts.
2724 2724
  */
2725 2725
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2726
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2727
-
2728
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2729
-
2730
-    /**
2731
-     * Filters the geodirectory option names that requires to add for translation.
2732
-     *
2733
-     * @since 1.5.7
2734
-     * @package GeoDirectory
2735
-     *
2736
-     * @param  array $gd_options Array of option names.
2737
-     */
2738
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2739
-    $gd_options = array_unique($gd_options);
2740
-
2741
-    if (!empty($gd_options)) {
2742
-        foreach ($gd_options as $gd_option) {
2743
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2744
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2726
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2727
+
2728
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2729
+
2730
+	/**
2731
+	 * Filters the geodirectory option names that requires to add for translation.
2732
+	 *
2733
+	 * @since 1.5.7
2734
+	 * @package GeoDirectory
2735
+	 *
2736
+	 * @param  array $gd_options Array of option names.
2737
+	 */
2738
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2739
+	$gd_options = array_unique($gd_options);
2740
+
2741
+	if (!empty($gd_options)) {
2742
+		foreach ($gd_options as $gd_option) {
2743
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2744
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2745 2745
                 
2746
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2747
-                    $translation_texts[] = stripslashes_deep($option_value);
2748
-                }
2749
-            }
2750
-        }
2751
-    }
2746
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2747
+					$translation_texts[] = stripslashes_deep($option_value);
2748
+				}
2749
+			}
2750
+		}
2751
+	}
2752 2752
 
2753
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2753
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2754 2754
 
2755
-    return $translation_texts;
2755
+	return $translation_texts;
2756 2756
 }
2757 2757
 
2758 2758
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2766,15 +2766,15 @@  discard block
 block discarded – undo
2766 2766
 
2767 2767
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2768 2768
 function gd_get_comments_link($comments_link, $post_id) {
2769
-    $post_type = get_post_type($post_id);
2769
+	$post_type = get_post_type($post_id);
2770 2770
 
2771
-    $all_postypes = geodir_get_posttypes();
2772
-    if (in_array($post_type, $all_postypes)) {
2773
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2774
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2775
-    }
2771
+	$all_postypes = geodir_get_posttypes();
2772
+	if (in_array($post_type, $all_postypes)) {
2773
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2774
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2775
+	}
2776 2776
 
2777
-    return $comments_link;
2777
+	return $comments_link;
2778 2778
 }
2779 2779
 
2780 2780
 
@@ -2792,11 +2792,11 @@  discard block
 block discarded – undo
2792 2792
 function geodir_add_nav_menu_class( $args )
2793 2793
 {
2794 2794
 
2795
-        if(isset($args['menu_class'])){
2796
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2797
-        }
2795
+		if(isset($args['menu_class'])){
2796
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2797
+		}
2798 2798
     
2799
-    return $args;
2799
+	return $args;
2800 2800
 }
2801 2801
 
2802 2802
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2813,15 +2813,15 @@  discard block
 block discarded – undo
2813 2813
  * @return string Filtered locale ID.
2814 2814
  */
2815 2815
 function geodir_wpml_filter_locale($locale) {
2816
-    global $sitepress;
2816
+	global $sitepress;
2817 2817
     
2818
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2818
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2819 2819
     
2820
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2821
-        $locale = $sitepress->get_locale($current_lang);
2822
-    }
2820
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2821
+		$locale = $sitepress->get_locale($current_lang);
2822
+	}
2823 2823
     
2824
-    return $locale;
2824
+	return $locale;
2825 2825
 }
2826 2826
 
2827 2827
 /**
@@ -2831,19 +2831,19 @@  discard block
 block discarded – undo
2831 2831
  * @package GeoDirectory
2832 2832
  */
2833 2833
 function geodir_wpml_set_filter() {
2834
-    if (geodir_is_wpml()) {
2835
-        global $sitepress;
2834
+	if (geodir_is_wpml()) {
2835
+		global $sitepress;
2836 2836
         
2837
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2838
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2839
-        }
2837
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2838
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2839
+		}
2840 2840
         
2841
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2842
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2843
-        if (is_admin()) {
2844
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2845
-        }
2846
-    }
2841
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2842
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2843
+		if (is_admin()) {
2844
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2845
+		}
2846
+	}
2847 2847
 }
2848 2848
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2849 2849
 
@@ -2856,38 +2856,38 @@  discard block
 block discarded – undo
2856 2856
  * @return array Filtered languages.
2857 2857
  */
2858 2858
 function geodir_wpml_filter_ls_languages($languages) {    
2859
-    if (geodir_is_geodir_page()) {        
2860
-        $keep_vars = array();
2859
+	if (geodir_is_geodir_page()) {        
2860
+		$keep_vars = array();
2861 2861
         
2862
-        if (geodir_is_page('add-listing')) {
2863
-            $keep_vars = array('listing_type', 'package_id');
2864
-        } else if (geodir_is_page('search')) {
2865
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2866
-        } else if (geodir_is_page('author')) {
2867
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2868
-        } else if (geodir_is_page('login')) {
2869
-            $keep_vars = array('forgot', 'signup');
2870
-        }        
2862
+		if (geodir_is_page('add-listing')) {
2863
+			$keep_vars = array('listing_type', 'package_id');
2864
+		} else if (geodir_is_page('search')) {
2865
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2866
+		} else if (geodir_is_page('author')) {
2867
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2868
+		} else if (geodir_is_page('login')) {
2869
+			$keep_vars = array('forgot', 'signup');
2870
+		}        
2871 2871
         
2872
-        if (!empty($keep_vars)) {
2873
-            foreach ( $languages as $code => $url) {
2874
-                $filter_url = $url['url'];
2872
+		if (!empty($keep_vars)) {
2873
+			foreach ( $languages as $code => $url) {
2874
+				$filter_url = $url['url'];
2875 2875
                 
2876
-                foreach ($keep_vars as $var) {
2877
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2878
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2879
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2880
-                    }
2881
-                }
2876
+				foreach ($keep_vars as $var) {
2877
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2878
+						$filter_url = remove_query_arg(array($var), $filter_url);
2879
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2880
+					}
2881
+				}
2882 2882
                 
2883
-                if ($filter_url != $url['url']) {
2884
-                    $languages[$code]['url'] = $filter_url;
2885
-                }
2886
-            }
2887
-        }
2888
-    }
2883
+				if ($filter_url != $url['url']) {
2884
+					$languages[$code]['url'] = $filter_url;
2885
+				}
2886
+			}
2887
+		}
2888
+	}
2889 2889
 
2890
-    return $languages;
2890
+	return $languages;
2891 2891
 }
2892 2892
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2893 2893
 
@@ -2898,18 +2898,18 @@  discard block
 block discarded – undo
2898 2898
  *
2899 2899
  */
2900 2900
 function geodir_remove_yoast_seo_metas(){
2901
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2902
-        $wpseo = WPSEO_Frontend::get_instance();
2901
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2902
+		$wpseo = WPSEO_Frontend::get_instance();
2903 2903
         
2904
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2905
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2906
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2907
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2908
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2909
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2904
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2905
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2906
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2907
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2908
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2909
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2910 2910
         
2911
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2912
-    }
2911
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2912
+	}
2913 2913
 }
2914 2914
 
2915 2915
 /**
@@ -2923,20 +2923,20 @@  discard block
 block discarded – undo
2923 2923
  *
2924 2924
  */
2925 2925
  function geodir_wpml_ajax_set_guest_lang() {    
2926
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2927
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2928
-            global $sitepress;
2926
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2927
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2928
+			global $sitepress;
2929 2929
             
2930
-            $referer = wp_get_referer();
2930
+			$referer = wp_get_referer();
2931 2931
             
2932
-            $current_lang = $sitepress->get_current_language();
2933
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2932
+			$current_lang = $sitepress->get_current_language();
2933
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2934 2934
             
2935
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2936
-                $_GET['lang'] = $referrer_lang;
2937
-            }
2938
-        }
2939
-    }
2935
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2936
+				$_GET['lang'] = $referrer_lang;
2937
+			}
2938
+		}
2939
+	}
2940 2940
 }
2941 2941
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2942 2942
 
@@ -2948,36 +2948,36 @@  discard block
 block discarded – undo
2948 2948
  * @param object $wp The WordPress object.
2949 2949
  */
2950 2950
 function geodir_check_redirect($wp) {
2951
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2952
-        $current_url = geodir_curPageURL();
2953
-        $search = 'czech-republic';
2954
-        $replace = 'czechia';        
2951
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2952
+		$current_url = geodir_curPageURL();
2953
+		$search = 'czech-republic';
2954
+		$replace = 'czechia';        
2955 2955
         
2956
-        $has_slash = substr($current_url, -1);
2957
-        if ($has_slash != "/") {
2958
-            $current_url .= '/';
2959
-        }
2956
+		$has_slash = substr($current_url, -1);
2957
+		if ($has_slash != "/") {
2958
+			$current_url .= '/';
2959
+		}
2960 2960
         
2961
-        $redirect = false;
2962
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2963
-            $redirect = true;
2964
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2965
-        }
2961
+		$redirect = false;
2962
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2963
+			$redirect = true;
2964
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2965
+		}
2966 2966
         
2967
-        if ($has_slash != "/") {
2968
-            $current_url = trim($current_url, '/');
2969
-        }
2967
+		if ($has_slash != "/") {
2968
+			$current_url = trim($current_url, '/');
2969
+		}
2970 2970
         
2971
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2972
-            $redirect = true;
2973
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2974
-        }
2975
-
2976
-        if ($redirect) {
2977
-            wp_redirect($current_url);
2978
-            exit;
2979
-        }
2980
-    }
2971
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2972
+			$redirect = true;
2973
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2974
+		}
2975
+
2976
+		if ($redirect) {
2977
+			wp_redirect($current_url);
2978
+			exit;
2979
+		}
2980
+	}
2981 2981
 }
2982 2982
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2983 2983
 
@@ -2997,50 +2997,50 @@  discard block
 block discarded – undo
2997 2997
  * @param string $original_slug The original post slug.
2998 2998
  */
2999 2999
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3000
-    global $wpdb, $sitepress;
3000
+	global $wpdb, $sitepress;
3001 3001
     
3002
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3003
-        $wpml_post_join = "";
3004
-        $wpml_post_where = "";
3005
-        $wpml_term_join = "";
3006
-        $wpml_term_where = "";
3002
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3003
+		$wpml_post_join = "";
3004
+		$wpml_post_where = "";
3005
+		$wpml_term_join = "";
3006
+		$wpml_term_where = "";
3007 3007
         
3008
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3009
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3010
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3011
-            if (!$post_language) {
3012
-                $post_language = $sitepress->get_current_language();
3013
-            }
3008
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3009
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3010
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3011
+			if (!$post_language) {
3012
+				$post_language = $sitepress->get_current_language();
3013
+			}
3014 3014
             
3015
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3016
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3015
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3016
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3017 3017
             
3018
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3019
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3020
-        }
3018
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3019
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3020
+		}
3021 3021
 
3022
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3022
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3023 3023
 
3024
-        if ( $term_slug_check ) {
3025
-            $suffix = 1;
3024
+		if ( $term_slug_check ) {
3025
+			$suffix = 1;
3026 3026
             
3027
-            do {
3028
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3027
+			do {
3028
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3029 3029
                 
3030
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3030
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3031 3031
                 
3032
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3032
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3033 3033
                 
3034
-                $term_slug_check = $term_check || $post_check;
3034
+				$term_slug_check = $term_check || $post_check;
3035 3035
                 
3036
-                $suffix++;
3037
-            } while ( $term_slug_check );
3036
+				$suffix++;
3037
+			} while ( $term_slug_check );
3038 3038
             
3039
-            $slug = $alt_slug;
3040
-        }
3041
-    }
3039
+			$slug = $alt_slug;
3040
+		}
3041
+	}
3042 3042
     
3043
-    return $slug;
3043
+	return $slug;
3044 3044
 }
3045 3045
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3046 3046
 
@@ -3060,47 +3060,47 @@  discard block
 block discarded – undo
3060 3060
  * @return bool true when exists. false when not exists.
3061 3061
  */
3062 3062
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3063
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3063
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3064 3064
     
3065
-    if ( $slug_exists ) {
3066
-        return $slug_exists;
3067
-    }
3065
+	if ( $slug_exists ) {
3066
+		return $slug_exists;
3067
+	}
3068 3068
     
3069
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3070
-        $taxonomy = $gd_term_taxonomy[$term_id];
3071
-    } else {
3072
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3073
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3074
-    }
3069
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3070
+		$taxonomy = $gd_term_taxonomy[$term_id];
3071
+	} else {
3072
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3073
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3074
+	}
3075 3075
     
3076
-    if ( empty($taxonomy) ) {
3077
-        return $slug_exists;
3078
-    }
3076
+	if ( empty($taxonomy) ) {
3077
+		return $slug_exists;
3078
+	}
3079 3079
     
3080
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3081
-        $post_type = $gd_term_post_type[$term_id];
3082
-    } else {
3083
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3084
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3085
-    }
3080
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3081
+		$post_type = $gd_term_post_type[$term_id];
3082
+	} else {
3083
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3084
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3085
+	}
3086 3086
     
3087
-    $wpml_post_join = "";
3088
-    $wpml_post_where = "";
3087
+	$wpml_post_join = "";
3088
+	$wpml_post_where = "";
3089 3089
     
3090
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3091
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3092
-        if (!$term_language) {
3093
-            $term_language = $sitepress->get_current_language();
3094
-        }
3090
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3091
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3092
+		if (!$term_language) {
3093
+			$term_language = $sitepress->get_current_language();
3094
+		}
3095 3095
         
3096
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3097
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3098
-    }
3096
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3097
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3098
+	}
3099 3099
     
3100
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3101
-        $slug_exists = true;
3102
-    }
3100
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3101
+		$slug_exists = true;
3102
+	}
3103 3103
 
3104
-    return $slug_exists;
3104
+	return $slug_exists;
3105 3105
 }
3106 3106
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3107 3107
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 1 patch
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,23 +294,23 @@  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) . "&key=" . geodir_get_map_api_key();
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);
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) . "&key=" . geodir_get_map_api_key();
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 307
     
308
-    $data = json_decode($response);
309
-    $status = $data->status;
310
-    if ($status == "OK") {
311
-        return $data->results[0]->address_components;
312
-    } else
313
-        return false;
308
+	$data = json_decode($response);
309
+	$status = $data->status;
310
+	if ($status == "OK") {
311
+		return $data->results[0]->address_components;
312
+	} else
313
+		return false;
314 314
 }
315 315
 
316 316
 /**
@@ -327,71 +327,71 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
329 329
 {
330
-    global $wp, $gd_session;
331
-    $location_array = array();
332
-    if ($location_array_from == 'session') {
333
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
334
-            return $location_array;
335
-        }
330
+	global $wp, $gd_session;
331
+	$location_array = array();
332
+	if ($location_array_from == 'session') {
333
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
334
+			return $location_array;
335
+		}
336 336
 
337
-        $country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
338
-        if ($country != '' && $country)
339
-            $location_array['gd_country'] = urldecode($country);
337
+		$country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
338
+		if ($country != '' && $country)
339
+			$location_array['gd_country'] = urldecode($country);
340 340
 
341
-        $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
342
-        if ($region != '' && $region)
343
-            $location_array['gd_region'] = urldecode($region);
341
+		$region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
342
+		if ($region != '' && $region)
343
+			$location_array['gd_region'] = urldecode($region);
344 344
 
345
-        $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
346
-        if ($city != '' && $city)
347
-            $location_array['gd_city'] = urldecode($city);
348
-    } else {
349
-        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')) {
350
-            return $location_array;
351
-        }
345
+		$city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : $gd_session->get('gd_city');
346
+		if ($city != '' && $city)
347
+			$location_array['gd_city'] = urldecode($city);
348
+	} else {
349
+		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')) {
350
+			return $location_array;
351
+		}
352 352
 
353
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
354 354
 
355
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
356 356
 
357
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
358 358
 
359
-        if ($country != '')
360
-            $location_array['gd_country'] = urldecode($country);
359
+		if ($country != '')
360
+			$location_array['gd_country'] = urldecode($country);
361 361
 
362
-        if ($region != '')
363
-            $location_array['gd_region'] = urldecode($region);
362
+		if ($region != '')
363
+			$location_array['gd_region'] = urldecode($region);
364 364
 
365
-        if ($city != '')
366
-            $location_array['gd_city'] = urldecode($city);
365
+		if ($city != '')
366
+			$location_array['gd_city'] = urldecode($city);
367 367
 			
368 368
 		// Fix category link in ajax popular category widget on change post type
369 369
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
370 370
 			$location_array = geodir_get_current_location_terms('session');
371 371
 		}
372
-    }
372
+	}
373 373
 
374 374
 
375 375
 	/**
376 376
 	 * Filter the location terms.
377 377
 	 *
378 378
 	 * @since 1.4.6
379
-     * @package GeoDirectory
379
+	 * @package GeoDirectory
380
+	 *
381
+	 * @param array $location_array {
382
+	 *    Attributes of the location_array.
383
+	 *
384
+	 *    @type string $gd_country The country slug.
385
+	 *    @type string $gd_region The region slug.
386
+	 *    @type string $gd_city The city slug.
380 387
 	 *
381
-     * @param array $location_array {
382
-     *    Attributes of the location_array.
383
-     *
384
-     *    @type string $gd_country The country slug.
385
-     *    @type string $gd_region The region slug.
386
-     *    @type string $gd_city The city slug.
387
-     *
388
-     * }
388
+	 * }
389 389
 	 * @param string $location_array_from Source type of location terms. Default session.
390 390
 	 * @param string $gd_post_type WP post type.
391 391
 	 */
392 392
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
393 393
 
394
-    return $location_array;
394
+	return $location_array;
395 395
 
396 396
 }
397 397
 
@@ -404,24 +404,24 @@  discard block
 block discarded – undo
404 404
  * @return bool|string
405 405
  */
406 406
 function geodir_get_location_link($which_location = 'current') {
407
-    $location_link = get_permalink(geodir_location_page_id());
408
-
409
-    if ($which_location == 'base') {
410
-        return $location_link;
411
-    } else {
412
-        $location_terms = geodir_get_current_location_terms();
413
-
414
-        if (!empty($location_terms)) {
415
-            if (get_option('permalink_structure') != '') {
416
-                $location_terms = implode("/", $location_terms);
417
-                $location_terms = rtrim($location_terms, '/');
418
-                $location_link .= $location_terms;
419
-            } else {
420
-                $location_link = geodir_getlink($location_link, $location_terms);
421
-            }
422
-        }
423
-    }
424
-    return $location_link;
407
+	$location_link = get_permalink(geodir_location_page_id());
408
+
409
+	if ($which_location == 'base') {
410
+		return $location_link;
411
+	} else {
412
+		$location_terms = geodir_get_current_location_terms();
413
+
414
+		if (!empty($location_terms)) {
415
+			if (get_option('permalink_structure') != '') {
416
+				$location_terms = implode("/", $location_terms);
417
+				$location_terms = rtrim($location_terms, '/');
418
+				$location_link .= $location_terms;
419
+			} else {
420
+				$location_link = geodir_getlink($location_link, $location_terms);
421
+			}
422
+		}
423
+	}
424
+	return $location_link;
425 425
 }
426 426
 
427 427
 /**
@@ -434,34 +434,34 @@  discard block
 block discarded – undo
434 434
  * @return array|bool Returns address on success.
435 435
  */
436 436
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
437
-    $url = is_ssl() ? 'https:' : 'http:';
438
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
439
-
440
-    $ch = curl_init();
441
-    curl_setopt($ch, CURLOPT_URL, $url);
442
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
443
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
444
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
445
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
446
-    $response = curl_exec($ch);
447
-    curl_close($ch);
448
-    $data = json_decode($response);
437
+	$url = is_ssl() ? 'https:' : 'http:';
438
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
439
+
440
+	$ch = curl_init();
441
+	curl_setopt($ch, CURLOPT_URL, $url);
442
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
443
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
444
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
445
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
446
+	$response = curl_exec($ch);
447
+	curl_close($ch);
448
+	$data = json_decode($response);
449 449
     
450
-    if (!empty($data) && !empty($data->address)) {
451
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
452
-        $formatted_address = (array)$data->address;
450
+	if (!empty($data) && !empty($data->address)) {
451
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
452
+		$formatted_address = (array)$data->address;
453 453
         
454
-        foreach ( $data->address as $key => $value ) {
455
-            if (!in_array($key, $address_fields)) {
456
-                unset($formatted_address[$key]);
457
-            }
458
-        }
459
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
454
+		foreach ( $data->address as $key => $value ) {
455
+			if (!in_array($key, $address_fields)) {
456
+				unset($formatted_address[$key]);
457
+			}
458
+		}
459
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
460 460
         
461
-        return $data;
462
-    } else {
463
-        return false;
464
-    }
461
+		return $data;
462
+	} else {
463
+		return false;
464
+	}
465 465
 }
466 466
 
467 467
 /**
@@ -475,51 +475,51 @@  discard block
 block discarded – undo
475 475
  * @return string Returns the country.
476 476
  */
477 477
 function geodir_get_normal_country($country, $default = '1') {
478
-    global $wpdb;
479
-    if ($result = geodir_get_country_by_name($country)) {
480
-        return $result;
481
-    }
478
+	global $wpdb;
479
+	if ($result = geodir_get_country_by_name($country)) {
480
+		return $result;
481
+	}
482 482
     
483
-    if (defined('POST_LOCATION_TABLE')) {
484
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
485
-        if (!empty($rows)) {
486
-            foreach ($rows as $row) {
487
-                $translated = __($row->country, 'geodirectory');
488
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
489
-                    return $result;
490
-                }
491
-            }
492
-        }
483
+	if (defined('POST_LOCATION_TABLE')) {
484
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
485
+		if (!empty($rows)) {
486
+			foreach ($rows as $row) {
487
+				$translated = __($row->country, 'geodirectory');
488
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
489
+					return $result;
490
+				}
491
+			}
492
+		}
493 493
         
494
-        $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 ) );
495
-        if (!empty($rows)) {
496
-            foreach ($rows as $row) {
497
-                $translated = __($row->country, 'geodirectory');
498
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
499
-                    return $result;
500
-                }
501
-            }
502
-        }
503
-    }
494
+		$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 ) );
495
+		if (!empty($rows)) {
496
+			foreach ($rows as $row) {
497
+				$translated = __($row->country, 'geodirectory');
498
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
499
+					return $result;
500
+				}
501
+			}
502
+		}
503
+	}
504 504
     
505
-    if ( $default === '0' ) {
506
-        return NULL;
507
-    }
505
+	if ( $default === '0' ) {
506
+		return NULL;
507
+	}
508 508
     
509
-    $default_location = geodir_get_default_location();
510
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
511
-        return $result;
512
-    }
509
+	$default_location = geodir_get_default_location();
510
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
511
+		return $result;
512
+	}
513 513
     
514
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
515
-        return $result;
516
-    }
514
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
515
+		return $result;
516
+	}
517 517
     
518
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
519
-        return $result;
520
-    }
518
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
519
+		return $result;
520
+	}
521 521
     
522
-    return $country;
522
+	return $country;
523 523
 }
524 524
 
525 525
 /**
@@ -531,16 +531,16 @@  discard block
 block discarded – undo
531 531
  * @return string Country ISO2 code.
532 532
  */
533 533
 function geodir_get_country_iso2($country) {
534
-    global $wpdb;
534
+	global $wpdb;
535 535
     
536
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
537
-        return $result;
538
-    }
539
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
540
-        return $result;
541
-    }
536
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
537
+		return $result;
538
+	}
539
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
540
+		return $result;
541
+	}
542 542
     
543
-    return $country;
543
+	return $country;
544 544
 }
545 545
 
546 546
 /**
@@ -553,16 +553,16 @@  discard block
 block discarded – undo
553 553
  * @return string|null Country ISO2 code.
554 554
  */
555 555
 function geodir_get_country_by_name($country, $iso2 = false) {
556
-    global $wpdb;
556
+	global $wpdb;
557 557
     
558
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
559
-        return $result;
560
-    }
561
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
562
-        return $result;
563
-    }
558
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
559
+		return $result;
560
+	}
561
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
562
+		return $result;
563
+	}
564 564
     
565
-    return NULL;
565
+	return NULL;
566 566
 }
567 567
 
568 568
 
@@ -582,158 +582,158 @@  discard block
 block discarded – undo
582 582
  */
583 583
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
584 584
 
585
-    if (empty($content)) {
586
-        return $content;
587
-    }
585
+	if (empty($content)) {
586
+		return $content;
587
+	}
588 588
 
589 589
 
590
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
590
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
591 591
 
592
-    if (!empty($location_replace_vars)) {
593
-        foreach ($location_replace_vars as $search => $replace) {
594
-            if (!empty($search) && strpos($content, $search) !== false) {
595
-                $content = str_replace($search, $replace, $content);
596
-            }
597
-        }
598
-    }
592
+	if (!empty($location_replace_vars)) {
593
+		foreach ($location_replace_vars as $search => $replace) {
594
+			if (!empty($search) && strpos($content, $search) !== false) {
595
+				$content = str_replace($search, $replace, $content);
596
+			}
597
+		}
598
+	}
599 599
 
600
-    return $content;
600
+	return $content;
601 601
 }
602 602
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
603 603
 
604 604
 
605 605
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
606 606
 
607
-    global $wp;
607
+	global $wp;
608 608
     
609
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
610
-
611
-    if (empty($location_array)) {
612
-        $location_array = geodir_get_current_location_terms('query_vars');
613
-    }
614
-
615
-    $location_terms = array();
616
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
617
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
618
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
619
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
620
-
621
-    $location_names = array();
622
-    foreach ($location_terms as $type => $location) {
623
-        $location_name = $location;
624
-
625
-        if (!empty($location_name)) {
626
-            if ($location_manager) {
627
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
628
-                $location_name = get_actual_location_name($location_type, $location, true);
629
-            } else {
630
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
631
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
632
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
633
-            }
634
-        }
635
-
636
-        $location_names[$type] = $location_name;
637
-    }
638
-
639
-    $location_single = '';
640
-    foreach ($location_terms as $type => $location) {
641
-        if (!empty($location)) {
642
-            if (!empty($location_names[$type])) {
643
-                $location_single = $location_names[$type];
644
-            } else {
645
-                if ($location_manager) {
646
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
647
-                    $location_single = get_actual_location_name($location_type, $location, true);
648
-                } else {
649
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
650
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
651
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
652
-                }
653
-            }
654
-            break;
655
-        }
656
-    }
657
-
658
-    $full_location = array();
659
-    if (!empty($location_array)) {
660
-        $location_array = array_reverse($location_array);
661
-
662
-        foreach ($location_array as $type => $location) {
663
-            if (!empty($location_names[$type])) {
664
-                $location_name = $location_names[$type];
665
-            } else {
666
-                if ($location_manager) {
667
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
668
-                    $location_name = get_actual_location_name($location_type, $location, true);
669
-                } else {
670
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
671
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
672
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
673
-                }
674
-            }
609
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
610
+
611
+	if (empty($location_array)) {
612
+		$location_array = geodir_get_current_location_terms('query_vars');
613
+	}
614
+
615
+	$location_terms = array();
616
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
617
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
618
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
619
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
620
+
621
+	$location_names = array();
622
+	foreach ($location_terms as $type => $location) {
623
+		$location_name = $location;
624
+
625
+		if (!empty($location_name)) {
626
+			if ($location_manager) {
627
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
628
+				$location_name = get_actual_location_name($location_type, $location, true);
629
+			} else {
630
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
631
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
632
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
633
+			}
634
+		}
675 635
 
676
-            $full_location[] = $location_name;
677
-        }
636
+		$location_names[$type] = $location_name;
637
+	}
638
+
639
+	$location_single = '';
640
+	foreach ($location_terms as $type => $location) {
641
+		if (!empty($location)) {
642
+			if (!empty($location_names[$type])) {
643
+				$location_single = $location_names[$type];
644
+			} else {
645
+				if ($location_manager) {
646
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
647
+					$location_single = get_actual_location_name($location_type, $location, true);
648
+				} else {
649
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
650
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
651
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
652
+				}
653
+			}
654
+			break;
655
+		}
656
+	}
657
+
658
+	$full_location = array();
659
+	if (!empty($location_array)) {
660
+		$location_array = array_reverse($location_array);
661
+
662
+		foreach ($location_array as $type => $location) {
663
+			if (!empty($location_names[$type])) {
664
+				$location_name = $location_names[$type];
665
+			} else {
666
+				if ($location_manager) {
667
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
668
+					$location_name = get_actual_location_name($location_type, $location, true);
669
+				} else {
670
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
671
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
672
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
673
+				}
674
+			}
675
+
676
+			$full_location[] = $location_name;
677
+		}
678 678
 
679
-        if (!empty($full_location)) {
680
-            $full_location = array_unique($full_location);
681
-        }
682
-    }
683
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
679
+		if (!empty($full_location)) {
680
+			$full_location = array_unique($full_location);
681
+		}
682
+	}
683
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
684 684
     
685
-    if ( empty( $full_location ) ) {
686
-        /**
687
-         * Filter the text in meta description in full location is empty.
688
-         *
689
-         * @since 1.6.22
690
-         * 
691
-         * @param string $full_location Default: Empty.
692
-         * @param array  $location_array The array of location variables.
693
-         * @param string $gd_page       The page being filtered.
694
-         * @param string $sep           The separator.
695
-         */
696
-         $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
697
-    }
685
+	if ( empty( $full_location ) ) {
686
+		/**
687
+		 * Filter the text in meta description in full location is empty.
688
+		 *
689
+		 * @since 1.6.22
690
+		 * 
691
+		 * @param string $full_location Default: Empty.
692
+		 * @param array  $location_array The array of location variables.
693
+		 * @param string $gd_page       The page being filtered.
694
+		 * @param string $sep           The separator.
695
+		 */
696
+		 $full_location = apply_filters( 'geodir_meta_description_location_empty_text', '', $location_array, $gd_page, $sep );
697
+	}
698 698
     
699
-    if ( empty( $location_single ) ) {
700
-        /**
701
-         * Filter the text in meta description in single location is empty.
702
-         *
703
-         * @since 1.6.22
704
-         * 
705
-         * @param string $location_single Default: Empty.
706
-         * @param array $location_array The array of location variables.
707
-         * @param string $gd_page       The page being filtered.
708
-         * @param string $sep           The separator.
709
-         */
710
-         $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
711
-    }
712
-
713
-    $location_replace_vars = array();
714
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
715
-    $location_replace_vars['%%location%%'] = $full_location;
716
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
717
-    $location_replace_vars['%%location_single%%'] = $location_single;
718
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
719
-
720
-    foreach ($location_names as $type => $name) {
721
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
722
-
723
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
724
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
725
-    }
726
-
727
-    /**
728
-     * Filter the location terms variables to search & replace.
729
-     *
730
-     * @since   1.6.16
731
-     * @package GeoDirectory
732
-     *
733
-     * @param array $location_replace_vars The array of search & replace variables.
734
-     * @param array $location_array The array of location variables.
735
-     * @param string $gd_page       The page being filtered.
736
-     * @param string $sep           The separator.
737
-     */
738
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
699
+	if ( empty( $location_single ) ) {
700
+		/**
701
+		 * Filter the text in meta description in single location is empty.
702
+		 *
703
+		 * @since 1.6.22
704
+		 * 
705
+		 * @param string $location_single Default: Empty.
706
+		 * @param array $location_array The array of location variables.
707
+		 * @param string $gd_page       The page being filtered.
708
+		 * @param string $sep           The separator.
709
+		 */
710
+		 $location_single = apply_filters( 'geodir_meta_description_single_location_empty_text', '', $location_array, $gd_page, $sep );
711
+	}
712
+
713
+	$location_replace_vars = array();
714
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
715
+	$location_replace_vars['%%location%%'] = $full_location;
716
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $full_location ) : '';
717
+	$location_replace_vars['%%location_single%%'] = $location_single;
718
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? sprintf( _x('in %s','in location', 'geodirectory'), $location_single ) : '';
719
+
720
+	foreach ($location_names as $type => $name) {
721
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
722
+
723
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
724
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? sprintf( _x('in %s','in location', 'geodirectory'), $name ) : '';
725
+	}
726
+
727
+	/**
728
+	 * Filter the location terms variables to search & replace.
729
+	 *
730
+	 * @since   1.6.16
731
+	 * @package GeoDirectory
732
+	 *
733
+	 * @param array $location_replace_vars The array of search & replace variables.
734
+	 * @param array $location_array The array of location variables.
735
+	 * @param string $gd_page       The page being filtered.
736
+	 * @param string $sep           The separator.
737
+	 */
738
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
739 739
 }
740 740
\ No newline at end of file
Please login to merge, or discard this patch.