Test Failed
Push — master ( 719561...da1b26 )
by Stiofan
04:38
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1206 added lines, -1206 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,27 +2355,27 @@  discard block
 block discarded – undo
2355 2355
  */
2356 2356
 function geodir_user_post_listing_count($user_id=null)
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
-    $user_id = $current_user->ID;
2364
-    $all_postypes = geodir_get_posttypes();
2365
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2363
+	$user_id = $current_user->ID;
2364
+	$all_postypes = geodir_get_posttypes();
2365
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2366 2366
 
2367
-    $user_listing = array();
2368
-    if (is_array($all_posts) && !empty($all_posts)) {
2369
-        foreach ($all_posts as $ptype) {
2370
-            $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' )");
2367
+	$user_listing = array();
2368
+	if (is_array($all_posts) && !empty($all_posts)) {
2369
+		foreach ($all_posts as $ptype) {
2370
+			$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' )");
2371 2371
 
2372
-            if ($total_posts > 0) {
2373
-                $user_listing[$ptype] = $total_posts;
2374
-            }
2375
-        }
2376
-    }
2372
+			if ($total_posts > 0) {
2373
+				$user_listing[$ptype] = $total_posts;
2374
+			}
2375
+		}
2376
+	}
2377 2377
 
2378
-    return $user_listing;
2378
+	return $user_listing;
2379 2379
 }
2380 2380
 
2381 2381
 
@@ -2395,189 +2395,189 @@  discard block
 block discarded – undo
2395 2395
  */
2396 2396
 function geodir_detail_page_custom_field_tab($tabs_arr)
2397 2397
 {
2398
-    global $post;
2399
-
2400
-    $post_type = geodir_get_current_posttype();
2401
-    $all_postypes = geodir_get_posttypes();
2402
-
2403
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2404
-        $package_info = array();
2405
-        $package_info = geodir_post_package_info($package_info, $post);
2406
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2407
-        $fields_location = 'owntab';
2408
-
2409
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2410
-        //remove video and special offers if it is already set to show
2411
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2412
-            $unset_video = true;
2413
-        }
2414
-
2415
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2416
-            $unset_special_offers = true;
2417
-        }
2418
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2419
-            foreach($custom_fields as $key => $custom_field){
2420
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2421
-                    unset($custom_fields[$key]);
2422
-                }
2423
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2424
-                    unset($custom_fields[$key]);
2425
-                }
2426
-            }
2427
-        }
2428
-
2429
-
2430
-        if (!empty($custom_fields)) {
2431
-            $parse_custom_fields = array();
2432
-            foreach ($custom_fields as $field) {
2433
-                $field = stripslashes_deep($field); // strip slashes
2434
-                $type = $field;
2435
-                $field_name = $field['htmlvar_name'];
2436
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2437
-                    $post->{$field_name} = $_REQUEST[$field_name];
2438
-                }
2398
+	global $post;
2439 2399
 
2440
-                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'))) {
2441
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2442
-                        continue;
2443
-                    }
2400
+	$post_type = geodir_get_current_posttype();
2401
+	$all_postypes = geodir_get_posttypes();
2444 2402
 
2445
-                    $parse_custom_fields[] = $field;
2446
-                }
2447
-            }
2448
-            $custom_fields = $parse_custom_fields;
2449
-        }
2450
-        //print_r($custom_fields);
2451
-        if (!empty($custom_fields)) {
2403
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2404
+		$package_info = array();
2405
+		$package_info = geodir_post_package_info($package_info, $post);
2406
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2407
+		$fields_location = 'owntab';
2452 2408
 
2453
-            global $field_set_start;
2409
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2410
+		//remove video and special offers if it is already set to show
2411
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2412
+			$unset_video = true;
2413
+		}
2454 2414
 
2455
-            $post = stripslashes_deep($post); // strip slashes
2456
-            
2457
-            $field_set_start = 0;
2458
-            $fieldset_count = 0;
2459
-            $fieldset = '';
2460
-            $total_fields = count($custom_fields);
2461
-            $count_field = 0;
2462
-            $fieldset_arr = array();
2463
-            $i = 0;
2464
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2465
-
2466
-            foreach ($custom_fields as $field) {
2467
-                $count_field++;
2468
-                $field_name = $field['htmlvar_name'];
2469
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2470
-                    $post->{$field_name} = $_REQUEST[$field_name];
2471
-                }
2415
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2416
+			$unset_special_offers = true;
2417
+		}
2418
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2419
+			foreach($custom_fields as $key => $custom_field){
2420
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2421
+					unset($custom_fields[$key]);
2422
+				}
2423
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2424
+					unset($custom_fields[$key]);
2425
+				}
2426
+			}
2427
+		}
2472 2428
 
2473
-                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'))) {
2474
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2475
-                    $site_title = trim($field['site_title']);
2476
-                    $type = $field;
2477
-                    $variables_array = array();
2478 2429
 
2479
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2480
-                        continue;
2481
-                    }
2430
+		if (!empty($custom_fields)) {
2431
+			$parse_custom_fields = array();
2432
+			foreach ($custom_fields as $field) {
2433
+				$field = stripslashes_deep($field); // strip slashes
2434
+				$type = $field;
2435
+				$field_name = $field['htmlvar_name'];
2436
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2437
+					$post->{$field_name} = $_REQUEST[$field_name];
2438
+				}
2482 2439
 
2483
-                    if ($type['type'] != 'fieldset') {
2484
-                        $i++;
2485
-                        $variables_array['post_id'] = $post->ID;
2486
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2487
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2488
-
2489
-                    }else{
2490
-                        $i = 0;
2491
-                        $fieldset_count++;
2492
-                        $field_set_start = 1;
2493
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2494
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2495
-                    }
2440
+				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'))) {
2441
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2442
+						continue;
2443
+					}
2496 2444
 
2445
+					$parse_custom_fields[] = $field;
2446
+				}
2447
+			}
2448
+			$custom_fields = $parse_custom_fields;
2449
+		}
2450
+		//print_r($custom_fields);
2451
+		if (!empty($custom_fields)) {
2497 2452
 
2498
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2499
-                    $type = stripslashes_deep($type); // strip slashes
2500
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2501
-                    $html = '';
2502
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2503
-                    if($html_var=='post'){$html_var='post_address';}
2504
-                    $field_icon = geodir_field_icon_proccess($type);
2505
-                    $filed_type = $type['type'];
2506
-
2507
-                    /**
2508
-                     * Filter the output for custom fields.
2509
-                     *
2510
-                     * Here we can remove or add new functions depending on the field type.
2511
-                     *
2512
-                     * @param string $html The html to be filtered (blank).
2513
-                     * @param string $fields_location The location the field is to be show.
2514
-                     * @param array $type The array of field values.
2515
-                     */
2516
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2517
-
2518
-
2519
-                    /**
2520
-                     * Filter custom field output in tab.
2521
-                     *
2522
-                     * @since 1.5.6
2523
-                     *
2524
-                     * @param string $html_var The HTML variable name for the field.
2525
-                     * @param string $html Custom field unfiltered HTML.
2526
-                     * @param array $variables_array Custom field variables array.
2527
-                     */
2528
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2529
-
2530
-                    $fieldset_html = '';
2531
-                    if ($field_set_start == 1) {
2532
-                        $add_html = false;
2533
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2534
-                            if ($fieldset != '') {
2535
-                                $add_html = true;
2536
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2537
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2538
-                            }
2539
-                            $fieldset_html = $fieldset;
2540
-                            $fieldset = '';
2541
-                        } else {
2542
-                            $fieldset .= $html;
2543
-                            if ($total_fields == $count_field && $fieldset != '') {
2544
-                                $add_html = true;
2545
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2546
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2547
-                                $fieldset_html = $fieldset;
2548
-                            }
2549
-                        }
2453
+			global $field_set_start;
2550 2454
 
2551
-                        if ($add_html) {
2552
-                            $tabs_arr[$htmlvar_name] = array(
2553
-                                'heading_text' => __($label, 'geodirectory'),
2554
-                                'is_active_tab' => false,
2555
-                                /**
2556
-                                 * Filter if a custom field should be displayed on the details page tab.
2557
-                                 *
2558
-                                 * @since 1.0.0
2559
-                                 * @param string $htmlvar_name The field HTML var name.
2560
-                                 */
2561
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2562
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2563
-                            );
2564
-                        }
2565
-                    } else {
2566
-                        if ($html != '') {
2567
-                            $tabs_arr[$html_var] = array(
2568
-                                'heading_text' => __($label, 'geodirectory'),
2569
-                                'is_active_tab' => false,
2570
-                                /** This action is documented in geodirectory_hooks_actions.php */
2571
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2572
-                                'tab_content' => $html
2573
-                            );
2574
-                        }
2575
-                    }
2576
-                }
2577
-            }
2578
-        }
2579
-    }
2580
-    return $tabs_arr;
2455
+			$post = stripslashes_deep($post); // strip slashes
2456
+            
2457
+			$field_set_start = 0;
2458
+			$fieldset_count = 0;
2459
+			$fieldset = '';
2460
+			$total_fields = count($custom_fields);
2461
+			$count_field = 0;
2462
+			$fieldset_arr = array();
2463
+			$i = 0;
2464
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2465
+
2466
+			foreach ($custom_fields as $field) {
2467
+				$count_field++;
2468
+				$field_name = $field['htmlvar_name'];
2469
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2470
+					$post->{$field_name} = $_REQUEST[$field_name];
2471
+				}
2472
+
2473
+				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'))) {
2474
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2475
+					$site_title = trim($field['site_title']);
2476
+					$type = $field;
2477
+					$variables_array = array();
2478
+
2479
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2480
+						continue;
2481
+					}
2482
+
2483
+					if ($type['type'] != 'fieldset') {
2484
+						$i++;
2485
+						$variables_array['post_id'] = $post->ID;
2486
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2487
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2488
+
2489
+					}else{
2490
+						$i = 0;
2491
+						$fieldset_count++;
2492
+						$field_set_start = 1;
2493
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2494
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2495
+					}
2496
+
2497
+
2498
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2499
+					$type = stripslashes_deep($type); // strip slashes
2500
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2501
+					$html = '';
2502
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2503
+					if($html_var=='post'){$html_var='post_address';}
2504
+					$field_icon = geodir_field_icon_proccess($type);
2505
+					$filed_type = $type['type'];
2506
+
2507
+					/**
2508
+					 * Filter the output for custom fields.
2509
+					 *
2510
+					 * Here we can remove or add new functions depending on the field type.
2511
+					 *
2512
+					 * @param string $html The html to be filtered (blank).
2513
+					 * @param string $fields_location The location the field is to be show.
2514
+					 * @param array $type The array of field values.
2515
+					 */
2516
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2517
+
2518
+
2519
+					/**
2520
+					 * Filter custom field output in tab.
2521
+					 *
2522
+					 * @since 1.5.6
2523
+					 *
2524
+					 * @param string $html_var The HTML variable name for the field.
2525
+					 * @param string $html Custom field unfiltered HTML.
2526
+					 * @param array $variables_array Custom field variables array.
2527
+					 */
2528
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2529
+
2530
+					$fieldset_html = '';
2531
+					if ($field_set_start == 1) {
2532
+						$add_html = false;
2533
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2534
+							if ($fieldset != '') {
2535
+								$add_html = true;
2536
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2537
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2538
+							}
2539
+							$fieldset_html = $fieldset;
2540
+							$fieldset = '';
2541
+						} else {
2542
+							$fieldset .= $html;
2543
+							if ($total_fields == $count_field && $fieldset != '') {
2544
+								$add_html = true;
2545
+								$label = $fieldset_arr[$fieldset_count]['label'];
2546
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2547
+								$fieldset_html = $fieldset;
2548
+							}
2549
+						}
2550
+
2551
+						if ($add_html) {
2552
+							$tabs_arr[$htmlvar_name] = array(
2553
+								'heading_text' => __($label, 'geodirectory'),
2554
+								'is_active_tab' => false,
2555
+								/**
2556
+								 * Filter if a custom field should be displayed on the details page tab.
2557
+								 *
2558
+								 * @since 1.0.0
2559
+								 * @param string $htmlvar_name The field HTML var name.
2560
+								 */
2561
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2562
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2563
+							);
2564
+						}
2565
+					} else {
2566
+						if ($html != '') {
2567
+							$tabs_arr[$html_var] = array(
2568
+								'heading_text' => __($label, 'geodirectory'),
2569
+								'is_active_tab' => false,
2570
+								/** This action is documented in geodirectory_hooks_actions.php */
2571
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2572
+								'tab_content' => $html
2573
+							);
2574
+						}
2575
+					}
2576
+				}
2577
+			}
2578
+		}
2579
+	}
2580
+	return $tabs_arr;
2581 2581
 }
2582 2582
 
2583 2583
 /* display add listing page for wpml */
@@ -2601,39 +2601,39 @@  discard block
 block discarded – undo
2601 2601
  */
2602 2602
 function geodir_add_post_status_author_page()
2603 2603
 {
2604
-    global $wpdb, $post;
2605
-
2606
-    $html = '';
2607
-    if (get_current_user_id()) {
2608
-
2609
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2610
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2611
-
2612
-            // 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.
2613
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2614
-            $status = "<strong>(";
2615
-            $status_icon = '<i class="fa fa-play"></i>';
2616
-            if ($real_status == 'publish') {
2617
-                $status .= __('Published', 'geodirectory');
2618
-            } else {
2619
-                $status .= __('Not published', 'geodirectory');
2620
-                $status_icon = '<i class="fa fa-pause"></i>';
2621
-            }
2622
-            $status .= ")</strong>";
2604
+	global $wpdb, $post;
2605
+
2606
+	$html = '';
2607
+	if (get_current_user_id()) {
2608
+
2609
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2610
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2611
+
2612
+			// 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.
2613
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2614
+			$status = "<strong>(";
2615
+			$status_icon = '<i class="fa fa-play"></i>';
2616
+			if ($real_status == 'publish') {
2617
+				$status .= __('Published', 'geodirectory');
2618
+			} else {
2619
+				$status .= __('Not published', 'geodirectory');
2620
+				$status_icon = '<i class="fa fa-pause"></i>';
2621
+			}
2622
+			$status .= ")</strong>";
2623 2623
 
2624
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2625
-        }
2626
-    }
2624
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2625
+		}
2626
+	}
2627 2627
 
2628
-    if ($html != '') {
2629
-        /**
2630
-         * Filter the post status text on the author page.
2631
-         *
2632
-         * @since 1.0.0
2633
-         * @param string $html The HTML of the status.
2634
-         */
2635
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2636
-    }
2628
+	if ($html != '') {
2629
+		/**
2630
+		 * Filter the post status text on the author page.
2631
+		 *
2632
+		 * @since 1.0.0
2633
+		 * @param string $html The HTML of the status.
2634
+		 */
2635
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2636
+	}
2637 2637
 
2638 2638
 
2639 2639
 }
@@ -2647,9 +2647,9 @@  discard block
 block discarded – undo
2647 2647
  * @package GeoDirectory
2648 2648
  */
2649 2649
 function geodir_init_no_rating() {
2650
-    if (geodir_rating_disabled_post_types()) {
2651
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
-    }
2650
+	if (geodir_rating_disabled_post_types()) {
2651
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
+	}
2653 2653
 }
2654 2654
 
2655 2655
 /**
@@ -2663,22 +2663,22 @@  discard block
 block discarded – undo
2663 2663
  * @return array Modified sort options array.
2664 2664
  */
2665 2665
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2666
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2667
-        $new_options = array();
2666
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2667
+		$new_options = array();
2668 2668
         
2669
-        if (!empty($options)) {
2670
-            foreach ($options as $option) {
2671
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2672
-                    continue;
2673
-                }
2674
-                $new_options[] = $option;
2675
-            }
2669
+		if (!empty($options)) {
2670
+			foreach ($options as $option) {
2671
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2672
+					continue;
2673
+				}
2674
+				$new_options[] = $option;
2675
+			}
2676 2676
 
2677
-            $options = $new_options;
2678
-        }
2679
-    }
2677
+			$options = $new_options;
2678
+		}
2679
+	}
2680 2680
 
2681
-    return $options;
2681
+	return $options;
2682 2682
 }
2683 2683
 
2684 2684
 /**
@@ -2690,9 +2690,9 @@  discard block
 block discarded – undo
2690 2690
  * @return array Modified class array.
2691 2691
  */
2692 2692
 function geodir_body_class_active_map($classes = array()) {
2693
-    $classes[] = 'gd-map-' . geodir_map_name();
2693
+	$classes[] = 'gd-map-' . geodir_map_name();
2694 2694
 
2695
-    return $classes;
2695
+	return $classes;
2696 2696
 }
2697 2697
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2698 2698
 
@@ -2705,9 +2705,9 @@  discard block
 block discarded – undo
2705 2705
  * @return string Modified class string.
2706 2706
  */
2707 2707
 function geodir_admin_body_class_active_map($class = '') {    
2708
-    $class .= ' gd-map-' . geodir_map_name();
2708
+	$class .= ' gd-map-' . geodir_map_name();
2709 2709
 
2710
-    return $class;
2710
+	return $class;
2711 2711
 }
2712 2712
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2713 2713
 
@@ -2725,36 +2725,36 @@  discard block
 block discarded – undo
2725 2725
  * @return array Translation texts.
2726 2726
  */
2727 2727
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2728
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2729
-
2730
-    $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');
2731
-
2732
-    /**
2733
-     * Filters the geodirectory option names that requires to add for translation.
2734
-     *
2735
-     * @since 1.5.7
2736
-     * @package GeoDirectory
2737
-     *
2738
-     * @param  array $gd_options Array of option names.
2739
-     */
2740
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2741
-    $gd_options = array_unique($gd_options);
2742
-
2743
-    if (!empty($gd_options)) {
2744
-        foreach ($gd_options as $gd_option) {
2745
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2746
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2728
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2729
+
2730
+	$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');
2731
+
2732
+	/**
2733
+	 * Filters the geodirectory option names that requires to add for translation.
2734
+	 *
2735
+	 * @since 1.5.7
2736
+	 * @package GeoDirectory
2737
+	 *
2738
+	 * @param  array $gd_options Array of option names.
2739
+	 */
2740
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2741
+	$gd_options = array_unique($gd_options);
2742
+
2743
+	if (!empty($gd_options)) {
2744
+		foreach ($gd_options as $gd_option) {
2745
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2746
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2747 2747
                 
2748
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2749
-                    $translation_texts[] = stripslashes_deep($option_value);
2750
-                }
2751
-            }
2752
-        }
2753
-    }
2748
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2749
+					$translation_texts[] = stripslashes_deep($option_value);
2750
+				}
2751
+			}
2752
+		}
2753
+	}
2754 2754
 
2755
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2755
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2756 2756
 
2757
-    return $translation_texts;
2757
+	return $translation_texts;
2758 2758
 }
2759 2759
 
2760 2760
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2768,15 +2768,15 @@  discard block
 block discarded – undo
2768 2768
 
2769 2769
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2770 2770
 function gd_get_comments_link($comments_link, $post_id) {
2771
-    $post_type = get_post_type($post_id);
2771
+	$post_type = get_post_type($post_id);
2772 2772
 
2773
-    $all_postypes = geodir_get_posttypes();
2774
-    if (in_array($post_type, $all_postypes)) {
2775
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2776
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2777
-    }
2773
+	$all_postypes = geodir_get_posttypes();
2774
+	if (in_array($post_type, $all_postypes)) {
2775
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2776
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2777
+	}
2778 2778
 
2779
-    return $comments_link;
2779
+	return $comments_link;
2780 2780
 }
2781 2781
 
2782 2782
 
@@ -2794,11 +2794,11 @@  discard block
 block discarded – undo
2794 2794
 function geodir_add_nav_menu_class( $args )
2795 2795
 {
2796 2796
 
2797
-        if(isset($args['menu_class'])){
2798
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2799
-        }
2797
+		if(isset($args['menu_class'])){
2798
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2799
+		}
2800 2800
     
2801
-    return $args;
2801
+	return $args;
2802 2802
 }
2803 2803
 
2804 2804
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2815,15 +2815,15 @@  discard block
 block discarded – undo
2815 2815
  * @return string Filtered locale ID.
2816 2816
  */
2817 2817
 function geodir_wpml_filter_locale($locale) {
2818
-    global $sitepress;
2818
+	global $sitepress;
2819 2819
     
2820
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2820
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2821 2821
     
2822
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2823
-        $locale = $sitepress->get_locale($current_lang);
2824
-    }
2822
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2823
+		$locale = $sitepress->get_locale($current_lang);
2824
+	}
2825 2825
     
2826
-    return $locale;
2826
+	return $locale;
2827 2827
 }
2828 2828
 
2829 2829
 /**
@@ -2833,19 +2833,19 @@  discard block
 block discarded – undo
2833 2833
  * @package GeoDirectory
2834 2834
  */
2835 2835
 function geodir_wpml_set_filter() {
2836
-    if (geodir_is_wpml()) {
2837
-        global $sitepress;
2836
+	if (geodir_is_wpml()) {
2837
+		global $sitepress;
2838 2838
         
2839
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2840
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2841
-        }
2839
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2840
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2841
+		}
2842 2842
         
2843
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2844
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2845
-        if (is_admin()) {
2846
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2847
-        }
2848
-    }
2843
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2844
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2845
+		if (is_admin()) {
2846
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2847
+		}
2848
+	}
2849 2849
 }
2850 2850
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2851 2851
 
@@ -2858,38 +2858,38 @@  discard block
 block discarded – undo
2858 2858
  * @return array Filtered languages.
2859 2859
  */
2860 2860
 function geodir_wpml_filter_ls_languages($languages) {    
2861
-    if (geodir_is_geodir_page()) {        
2862
-        $keep_vars = array();
2861
+	if (geodir_is_geodir_page()) {        
2862
+		$keep_vars = array();
2863 2863
         
2864
-        if (geodir_is_page('add-listing')) {
2865
-            $keep_vars = array('listing_type', 'package_id');
2866
-        } else if (geodir_is_page('search')) {
2867
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2868
-        } else if (geodir_is_page('author')) {
2869
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2870
-        } else if (geodir_is_page('login')) {
2871
-            $keep_vars = array('forgot', 'signup');
2872
-        }        
2864
+		if (geodir_is_page('add-listing')) {
2865
+			$keep_vars = array('listing_type', 'package_id');
2866
+		} else if (geodir_is_page('search')) {
2867
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2868
+		} else if (geodir_is_page('author')) {
2869
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2870
+		} else if (geodir_is_page('login')) {
2871
+			$keep_vars = array('forgot', 'signup');
2872
+		}        
2873 2873
         
2874
-        if (!empty($keep_vars)) {
2875
-            foreach ( $languages as $code => $url) {
2876
-                $filter_url = $url['url'];
2874
+		if (!empty($keep_vars)) {
2875
+			foreach ( $languages as $code => $url) {
2876
+				$filter_url = $url['url'];
2877 2877
                 
2878
-                foreach ($keep_vars as $var) {
2879
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2880
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2881
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2882
-                    }
2883
-                }
2878
+				foreach ($keep_vars as $var) {
2879
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2880
+						$filter_url = remove_query_arg(array($var), $filter_url);
2881
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2882
+					}
2883
+				}
2884 2884
                 
2885
-                if ($filter_url != $url['url']) {
2886
-                    $languages[$code]['url'] = $filter_url;
2887
-                }
2888
-            }
2889
-        }
2890
-    }
2885
+				if ($filter_url != $url['url']) {
2886
+					$languages[$code]['url'] = $filter_url;
2887
+				}
2888
+			}
2889
+		}
2890
+	}
2891 2891
 
2892
-    return $languages;
2892
+	return $languages;
2893 2893
 }
2894 2894
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2895 2895
 
@@ -2900,18 +2900,18 @@  discard block
 block discarded – undo
2900 2900
  *
2901 2901
  */
2902 2902
 function geodir_remove_yoast_seo_metas(){
2903
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2904
-        $wpseo = WPSEO_Frontend::get_instance();
2903
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2904
+		$wpseo = WPSEO_Frontend::get_instance();
2905 2905
         
2906
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2907
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2908
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2909
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2910
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2911
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2906
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2907
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2908
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2909
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2910
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2911
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2912 2912
         
2913
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2914
-    }
2913
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2914
+	}
2915 2915
 }
2916 2916
 
2917 2917
 /**
@@ -2925,20 +2925,20 @@  discard block
 block discarded – undo
2925 2925
  *
2926 2926
  */
2927 2927
  function geodir_wpml_ajax_set_guest_lang() {    
2928
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2929
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2930
-            global $sitepress;
2928
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2929
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2930
+			global $sitepress;
2931 2931
             
2932
-            $referer = wp_get_referer();
2932
+			$referer = wp_get_referer();
2933 2933
             
2934
-            $current_lang = $sitepress->get_current_language();
2935
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2934
+			$current_lang = $sitepress->get_current_language();
2935
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2936 2936
             
2937
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2938
-                $_GET['lang'] = $referrer_lang;
2939
-            }
2940
-        }
2941
-    }
2937
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2938
+				$_GET['lang'] = $referrer_lang;
2939
+			}
2940
+		}
2941
+	}
2942 2942
 }
2943 2943
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2944 2944
 
@@ -2950,36 +2950,36 @@  discard block
 block discarded – undo
2950 2950
  * @param object $wp The WordPress object.
2951 2951
  */
2952 2952
 function geodir_check_redirect($wp) {
2953
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2954
-        $current_url = geodir_curPageURL();
2955
-        $search = 'czech-republic';
2956
-        $replace = 'czechia';        
2953
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2954
+		$current_url = geodir_curPageURL();
2955
+		$search = 'czech-republic';
2956
+		$replace = 'czechia';        
2957 2957
         
2958
-        $has_slash = substr($current_url, -1);
2959
-        if ($has_slash != "/") {
2960
-            $current_url .= '/';
2961
-        }
2958
+		$has_slash = substr($current_url, -1);
2959
+		if ($has_slash != "/") {
2960
+			$current_url .= '/';
2961
+		}
2962 2962
         
2963
-        $redirect = false;
2964
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2965
-            $redirect = true;
2966
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2967
-        }
2963
+		$redirect = false;
2964
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2965
+			$redirect = true;
2966
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2967
+		}
2968 2968
         
2969
-        if ($has_slash != "/") {
2970
-            $current_url = trim($current_url, '/');
2971
-        }
2969
+		if ($has_slash != "/") {
2970
+			$current_url = trim($current_url, '/');
2971
+		}
2972 2972
         
2973
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2974
-            $redirect = true;
2975
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2976
-        }
2977
-
2978
-        if ($redirect) {
2979
-            wp_redirect($current_url);
2980
-            exit;
2981
-        }
2982
-    }
2973
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2974
+			$redirect = true;
2975
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2976
+		}
2977
+
2978
+		if ($redirect) {
2979
+			wp_redirect($current_url);
2980
+			exit;
2981
+		}
2982
+	}
2983 2983
 }
2984 2984
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2985 2985
 
@@ -2999,50 +2999,50 @@  discard block
 block discarded – undo
2999 2999
  * @param string $original_slug The original post slug.
3000 3000
  */
3001 3001
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3002
-    global $wpdb, $sitepress;
3002
+	global $wpdb, $sitepress;
3003 3003
     
3004
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3005
-        $wpml_post_join = "";
3006
-        $wpml_post_where = "";
3007
-        $wpml_term_join = "";
3008
-        $wpml_term_where = "";
3004
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3005
+		$wpml_post_join = "";
3006
+		$wpml_post_where = "";
3007
+		$wpml_term_join = "";
3008
+		$wpml_term_where = "";
3009 3009
         
3010
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3011
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3012
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3013
-            if (!$post_language) {
3014
-                $post_language = $sitepress->get_current_language();
3015
-            }
3010
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3011
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3012
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3013
+			if (!$post_language) {
3014
+				$post_language = $sitepress->get_current_language();
3015
+			}
3016 3016
             
3017
-            $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)";
3018
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3017
+			$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)";
3018
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3019 3019
             
3020
-            $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)";
3021
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3022
-        }
3020
+			$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)";
3021
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3022
+		}
3023 3023
 
3024
-        $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 ) );
3024
+		$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 ) );
3025 3025
 
3026
-        if ( $term_slug_check ) {
3027
-            $suffix = 1;
3026
+		if ( $term_slug_check ) {
3027
+			$suffix = 1;
3028 3028
             
3029
-            do {
3030
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3029
+			do {
3030
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3031 3031
                 
3032
-                $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 ) );
3032
+				$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 ) );
3033 3033
                 
3034
-                $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 ) );
3034
+				$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 ) );
3035 3035
                 
3036
-                $term_slug_check = $term_check || $post_check;
3036
+				$term_slug_check = $term_check || $post_check;
3037 3037
                 
3038
-                $suffix++;
3039
-            } while ( $term_slug_check );
3038
+				$suffix++;
3039
+			} while ( $term_slug_check );
3040 3040
             
3041
-            $slug = $alt_slug;
3042
-        }
3043
-    }
3041
+			$slug = $alt_slug;
3042
+		}
3043
+	}
3044 3044
     
3045
-    return $slug;
3045
+	return $slug;
3046 3046
 }
3047 3047
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3048 3048
 
@@ -3062,47 +3062,47 @@  discard block
 block discarded – undo
3062 3062
  * @return bool true when exists. false when not exists.
3063 3063
  */
3064 3064
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3065
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3065
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3066 3066
     
3067
-    if ( $slug_exists ) {
3068
-        return $slug_exists;
3069
-    }
3067
+	if ( $slug_exists ) {
3068
+		return $slug_exists;
3069
+	}
3070 3070
     
3071
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3072
-        $taxonomy = $gd_term_taxonomy[$term_id];
3073
-    } else {
3074
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3075
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3076
-    }
3071
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3072
+		$taxonomy = $gd_term_taxonomy[$term_id];
3073
+	} else {
3074
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3075
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3076
+	}
3077 3077
     
3078
-    if ( empty($taxonomy) ) {
3079
-        return $slug_exists;
3080
-    }
3078
+	if ( empty($taxonomy) ) {
3079
+		return $slug_exists;
3080
+	}
3081 3081
     
3082
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3083
-        $post_type = $gd_term_post_type[$term_id];
3084
-    } else {
3085
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3086
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3087
-    }
3082
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3083
+		$post_type = $gd_term_post_type[$term_id];
3084
+	} else {
3085
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3086
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3087
+	}
3088 3088
     
3089
-    $wpml_post_join = "";
3090
-    $wpml_post_where = "";
3089
+	$wpml_post_join = "";
3090
+	$wpml_post_where = "";
3091 3091
     
3092
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3093
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3094
-        if (!$term_language) {
3095
-            $term_language = $sitepress->get_current_language();
3096
-        }
3092
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3093
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3094
+		if (!$term_language) {
3095
+			$term_language = $sitepress->get_current_language();
3096
+		}
3097 3097
         
3098
-        $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)";
3099
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3100
-    }
3098
+		$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)";
3099
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3100
+	}
3101 3101
     
3102
-    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 ) ) ) {
3103
-        $slug_exists = true;
3104
-    }
3102
+	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 ) ) ) {
3103
+		$slug_exists = true;
3104
+	}
3105 3105
 
3106
-    return $slug_exists;
3106
+	return $slug_exists;
3107 3107
 }
3108 3108
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3109 3109
\ No newline at end of file
Please login to merge, or discard this patch.