Test Failed
Pull Request — master (#324)
by Kiran
17:53
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1135 added lines, -1135 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 virtural 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 virtural 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
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @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.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @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.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -447,46 +447,46 @@  discard block
 block discarded – undo
447 447
  */
448 448
 function geodir_edit_post_link()
449 449
 {
450
-    global $post, $preview;
451
-    ob_start(); // Start buffering;
452
-    /**
453
-     * This is called before the edit post link html in the function geodir_edit_post_link()
454
-     *
455
-     * @since 1.0.0
456
-     */
457
-    do_action('geodir_before_edit_post_link');
458
-    if (!$preview) {
459
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
450
+	global $post, $preview;
451
+	ob_start(); // Start buffering;
452
+	/**
453
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
454
+	 *
455
+	 * @since 1.0.0
456
+	 */
457
+	do_action('geodir_before_edit_post_link');
458
+	if (!$preview) {
459
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
460 460
         
461
-        if ($is_current_user_owner) {
462
-            $post_id = $post->ID;
461
+		if ($is_current_user_owner) {
462
+			$post_id = $post->ID;
463 463
             
464
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
-                $post_id = (int)$_REQUEST['pid'];
466
-            }
464
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
465
+				$post_id = (int)$_REQUEST['pid'];
466
+			}
467 467
 
468
-            $postlink = get_permalink(geodir_add_listing_page_id());
469
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
-        }
472
-    }// end of if, if its a preview or not
473
-    /**
474
-     * This is called after the edit post link html in the function geodir_edit_post_link()
475
-     *
476
-     * @since 1.0.0
477
-     */
478
-    do_action('geodir_after_edit_post_link');
479
-    $content_html = ob_get_clean();
480
-    if (trim($content_html) != '')
481
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
-        /**
484
-         * Filter the geodir_edit_post_link() function content.
485
-         *
486
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
487
-         */
488
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
-    }
468
+			$postlink = get_permalink(geodir_add_listing_page_id());
469
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
470
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
471
+		}
472
+	}// end of if, if its a preview or not
473
+	/**
474
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
475
+	 *
476
+	 * @since 1.0.0
477
+	 */
478
+	do_action('geodir_after_edit_post_link');
479
+	$content_html = ob_get_clean();
480
+	if (trim($content_html) != '')
481
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
482
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
483
+		/**
484
+		 * Filter the geodir_edit_post_link() function content.
485
+		 *
486
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
487
+		 */
488
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
489
+	}
490 490
 }
491 491
 
492 492
 /**
@@ -500,42 +500,42 @@  discard block
 block discarded – undo
500 500
  */
501 501
 function geodir_detail_page_google_analytics()
502 502
 {
503
-    global $post,$preview;
504
-    if($preview){return '';}
505
-    $package_info = array();
506
-    $package_info = geodir_post_package_info($package_info, $post);
503
+	global $post,$preview;
504
+	if($preview){return '';}
505
+	$package_info = array();
506
+	$package_info = geodir_post_package_info($package_info, $post);
507 507
 
508
-    $id = trim(get_option('geodir_ga_account_id'));
508
+	$id = trim(get_option('geodir_ga_account_id'));
509 509
 
510
-    if (!$id) {
511
-        return; //if no Google Analytics ID then bail.
512
-    }
510
+	if (!$id) {
511
+		return; //if no Google Analytics ID then bail.
512
+	}
513 513
 
514
-    ob_start(); // Start buffering;
515
-    /**
516
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
-     *
518
-     * @since 1.0.0
519
-     */
520
-    do_action('geodir_before_google_analytics');
514
+	ob_start(); // Start buffering;
515
+	/**
516
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
517
+	 *
518
+	 * @since 1.0.0
519
+	 */
520
+	do_action('geodir_before_google_analytics');
521 521
     
522
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
523
-    /**
524
-     * Filter the time interval to check & refresh new users results.
525
-     *
526
-     * @since 1.5.9
527
-     *
528
-     * @param int $refresh_time Time interval to check & refresh new users results.
529
-     */
530
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
-    $refresh_time = absint($refresh_time * 1000);
522
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
523
+	/**
524
+	 * Filter the time interval to check & refresh new users results.
525
+	 *
526
+	 * @since 1.5.9
527
+	 *
528
+	 * @param int $refresh_time Time interval to check & refresh new users results.
529
+	 */
530
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
531
+	$refresh_time = absint($refresh_time * 1000);
532 532
     
533
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
533
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
534 534
     
535
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
-    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' )) ) {
537
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
538
-        ?>
535
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
536
+	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' )) ) {
537
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
538
+		?>
539 539
         <script type="text/javascript">
540 540
             var gd_gaTimeOut;
541 541
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
788 788
 
789 789
                     <?php
790
-                    // Here we list the shorthand days of the week so it can be used in translation.
791
-                    __("Mon",'geodirectory');
792
-                    __("Tue",'geodirectory');
793
-                    __("Wed",'geodirectory');
794
-                    __("Thu",'geodirectory');
795
-                    __("Fri",'geodirectory');
796
-                    __("Sat",'geodirectory');
797
-                    __("Sun",'geodirectory');
798
-                    ?>
790
+					// Here we list the shorthand days of the week so it can be used in translation.
791
+					__("Mon",'geodirectory');
792
+					__("Tue",'geodirectory');
793
+					__("Wed",'geodirectory');
794
+					__("Thu",'geodirectory');
795
+					__("Fri",'geodirectory');
796
+					__("Sat",'geodirectory');
797
+					__("Sun",'geodirectory');
798
+					?>
799 799
 
800 800
                     labels = [
801 801
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1044,24 +1044,24 @@  discard block
 block discarded – undo
1044 1044
         </span>
1045 1045
 
1046 1046
     <?php
1047
-    }
1048
-    /**
1049
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
-     *
1051
-     * @since 1.0.0
1052
-     */
1053
-    do_action('geodir_after_google_analytics');
1054
-    $content_html = ob_get_clean();
1055
-    if (trim($content_html) != '')
1056
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
-        /**
1059
-         * Filter the geodir_edit_post_link() function content.
1060
-         *
1061
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
-         */
1063
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
-    }
1047
+	}
1048
+	/**
1049
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1050
+	 *
1051
+	 * @since 1.0.0
1052
+	 */
1053
+	do_action('geodir_after_google_analytics');
1054
+	$content_html = ob_get_clean();
1055
+	if (trim($content_html) != '')
1056
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1057
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1058
+		/**
1059
+		 * Filter the geodir_edit_post_link() function content.
1060
+		 *
1061
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1062
+		 */
1063
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1064
+	}
1065 1065
 }
1066 1066
 
1067 1067
 /**
@@ -1077,90 +1077,90 @@  discard block
 block discarded – undo
1077 1077
  */
1078 1078
 function geodir_detail_page_review_rating()
1079 1079
 {
1080
-    global $post, $preview, $post_images;
1081
-    ob_start(); // Start  buffering;
1082
-    /**
1083
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
-     *
1085
-     * This is called outside the check for an actual rating and the check for preview page.
1086
-     *
1087
-     * @since 1.0.0
1088
-     */
1089
-    do_action('geodir_before_detail_page_review_rating');
1090
-
1091
-    $comment_count = geodir_get_review_count_total($post->ID);
1092
-    $post_avgratings = geodir_get_post_rating($post->ID);
1093
-
1094
-    if ($post_avgratings != 0 && !$preview) {
1095
-        /**
1096
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
-         *
1098
-         * This is called inside the check for an actual rating and the check for preview page.
1099
-         *
1100
-         * @since 1.0.0
1101
-         * @param float $post_avgratings Average rating for the surrent post.
1102
-         * @param int $post->ID Current post ID.
1103
-         */
1104
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
-
1106
-        $html = '<p style=" float:left;">';
1107
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1080
+	global $post, $preview, $post_images;
1081
+	ob_start(); // Start  buffering;
1082
+	/**
1083
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1084
+	 *
1085
+	 * This is called outside the check for an actual rating and the check for preview page.
1086
+	 *
1087
+	 * @since 1.0.0
1088
+	 */
1089
+	do_action('geodir_before_detail_page_review_rating');
1090
+
1091
+	$comment_count = geodir_get_review_count_total($post->ID);
1092
+	$post_avgratings = geodir_get_post_rating($post->ID);
1093
+
1094
+	if ($post_avgratings != 0 && !$preview) {
1095
+		/**
1096
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1097
+		 *
1098
+		 * This is called inside the check for an actual rating and the check for preview page.
1099
+		 *
1100
+		 * @since 1.0.0
1101
+		 * @param float $post_avgratings Average rating for the surrent post.
1102
+		 * @param int $post->ID Current post ID.
1103
+		 */
1104
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1105
+
1106
+		$html = '<p style=" float:left;">';
1107
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1108
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1109
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1110 1110
        
1111 1111
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1112 1112
 	   
1113 1113
 	   $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 />';
1114 1114
 
1115
-        $html .= '<span class="item">';
1116
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1115
+		$html .= '<span class="item">';
1116
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1117 1117
 
1118
-        if ($post_images) {
1119
-            foreach ($post_images as $img) {
1120
-                $post_img = $img->src;
1121
-                break;
1122
-            }
1123
-        }
1124
-
1125
-        if (isset($post_img) && $post_img) {
1126
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
-        }
1128
-
1129
-        $html .= '</span>';
1130
-
1131
-        echo $html .= '</div>';
1132
-        /**
1133
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
-         *
1135
-         * This is called inside the check for an actual rating and the check for preview page.
1136
-         *
1137
-         * @since 1.0.0
1138
-         * @param float $post_avgratings Average rating for the surrent post.
1139
-         * @param int $post->ID Current post ID.
1140
-         */
1141
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
-    }
1143
-    /**
1144
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
-     *
1146
-     * This is called outside the check for an actual rating and the check for preview page.
1147
-     *
1148
-     * @since 1.0.0
1149
-     */
1150
-    do_action('geodir_after_detail_page_review_rating');
1151
-    $content_html = ob_get_clean();
1152
-    if (trim($content_html) != '') {
1153
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
-    }
1155
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
-        /**
1157
-         * Filter the geodir_detail_page_review_rating() function content.
1158
-         *
1159
-         * @since 1.0.0
1160
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
-         */
1162
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
-    }
1118
+		if ($post_images) {
1119
+			foreach ($post_images as $img) {
1120
+				$post_img = $img->src;
1121
+				break;
1122
+			}
1123
+		}
1124
+
1125
+		if (isset($post_img) && $post_img) {
1126
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1127
+		}
1128
+
1129
+		$html .= '</span>';
1130
+
1131
+		echo $html .= '</div>';
1132
+		/**
1133
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1134
+		 *
1135
+		 * This is called inside the check for an actual rating and the check for preview page.
1136
+		 *
1137
+		 * @since 1.0.0
1138
+		 * @param float $post_avgratings Average rating for the surrent post.
1139
+		 * @param int $post->ID Current post ID.
1140
+		 */
1141
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1142
+	}
1143
+	/**
1144
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1145
+	 *
1146
+	 * This is called outside the check for an actual rating and the check for preview page.
1147
+	 *
1148
+	 * @since 1.0.0
1149
+	 */
1150
+	do_action('geodir_after_detail_page_review_rating');
1151
+	$content_html = ob_get_clean();
1152
+	if (trim($content_html) != '') {
1153
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1154
+	}
1155
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1156
+		/**
1157
+		 * Filter the geodir_detail_page_review_rating() function content.
1158
+		 *
1159
+		 * @since 1.0.0
1160
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1161
+		 */
1162
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1163
+	}
1164 1164
 }
1165 1165
 
1166 1166
 /**
@@ -1172,35 +1172,35 @@  discard block
 block discarded – undo
1172 1172
  */
1173 1173
 function geodir_detail_page_more_info()
1174 1174
 {
1175
-    ob_start(); // Start  buffering;
1176
-    /**
1177
-     * This is called before the info section html.
1178
-     *
1179
-     * @since 1.0.0
1180
-     */
1181
-    do_action('geodir_before_detail_page_more_info');
1182
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
-        echo $geodir_post_detail_fields;
1184
-    }
1185
-    /**
1186
-     * This is called after the info section html.
1187
-     *
1188
-     * @since 1.0.0
1189
-     */
1190
-    do_action('geodir_after_detail_page_more_info');
1191
-
1192
-    $content_html = ob_get_clean();
1193
-    if (trim($content_html) != '')
1194
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
-        /**
1197
-         * Filter the output html for function geodir_detail_page_more_info().
1198
-         *
1199
-         * @since 1.0.0
1200
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
-         */
1202
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
-    }
1175
+	ob_start(); // Start  buffering;
1176
+	/**
1177
+	 * This is called before the info section html.
1178
+	 *
1179
+	 * @since 1.0.0
1180
+	 */
1181
+	do_action('geodir_before_detail_page_more_info');
1182
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1183
+		echo $geodir_post_detail_fields;
1184
+	}
1185
+	/**
1186
+	 * This is called after the info section html.
1187
+	 *
1188
+	 * @since 1.0.0
1189
+	 */
1190
+	do_action('geodir_after_detail_page_more_info');
1191
+
1192
+	$content_html = ob_get_clean();
1193
+	if (trim($content_html) != '')
1194
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1195
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1196
+		/**
1197
+		 * Filter the output html for function geodir_detail_page_more_info().
1198
+		 *
1199
+		 * @since 1.0.0
1200
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1201
+		 */
1202
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1203
+	}
1204 1204
 }
1205 1205
 
1206 1206
 
@@ -1214,15 +1214,15 @@  discard block
 block discarded – undo
1214 1214
  */
1215 1215
 function geodir_localize_all_js_msg()
1216 1216
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1217
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
-        $ajax_url = admin_url('admin-ajax.php');
1219
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
-        $ajax_url = admin_url('admin-ajax.php');
1221
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
-    }
1217
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1218
+		$ajax_url = admin_url('admin-ajax.php');
1219
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1220
+		$ajax_url = admin_url('admin-ajax.php');
1221
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1222
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1223
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1224
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1225
+	}
1226 1226
 	
1227 1227
 	/**
1228 1228
 	 * Filter the allowed image type extensions for post images.
@@ -1232,60 +1232,60 @@  discard block
 block discarded – undo
1232 1232
 	 */
1233 1233
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1234 1234
 	
1235
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1236
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
-    $default_marker_width = $default_marker_size['w'];
1238
-    $default_marker_height = $default_marker_size['h'];
1235
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1236
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1237
+	$default_marker_width = $default_marker_size['w'];
1238
+	$default_marker_height = $default_marker_size['h'];
1239 1239
     
1240
-    $arr_alert_msg = array(
1241
-        'geodir_plugin_url' => geodir_plugin_url(),
1242
-        'geodir_admin_ajax_url' => $ajax_url,
1243
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
-        //start not show alert msg
1248
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
-        // end not show alert msg
1254
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
-        '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'),
1256
-        //start not show alert msg
1257
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
-        'geodir_default_marker_icon' => $default_marker_icon,
1270
-        'geodir_default_marker_w' => $default_marker_width,
1271
-        'geodir_default_marker_h' => $default_marker_height,
1272
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
-        /* on/off dragging for phone devices */
1281
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1240
+	$arr_alert_msg = array(
1241
+		'geodir_plugin_url' => geodir_plugin_url(),
1242
+		'geodir_admin_ajax_url' => $ajax_url,
1243
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1244
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1245
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1246
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1247
+		//start not show alert msg
1248
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1249
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1250
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1251
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1252
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1253
+		// end not show alert msg
1254
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1255
+		'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'),
1256
+		//start not show alert msg
1257
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1258
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1259
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1260
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1261
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1262
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1263
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1264
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1265
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1266
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1267
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1268
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1269
+		'geodir_default_marker_icon' => $default_marker_icon,
1270
+		'geodir_default_marker_w' => $default_marker_width,
1271
+		'geodir_default_marker_h' => $default_marker_height,
1272
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1273
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1274
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1275
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1276
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1277
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1278
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1279
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1280
+		/* on/off dragging for phone devices */
1281
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1282
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1283
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1284
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1285
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1286
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1287
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1288
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1289 1289
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1290 1290
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1291 1291
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1293,40 +1293,40 @@  discard block
 block discarded – undo
1293 1293
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1294 1294
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1295 1295
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1296
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
-        'geodir_map_name' => geodir_map_name(),
1298
-        'osmStart' => __('Start', 'geodirectory'),
1299
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
-        'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1302
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1303
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1304
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1305
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1306
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1307
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1308
-    );
1309
-
1310
-    /**
1311
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1312
-     *
1313
-     * With this filter you can add, remove or change translated JS strings.
1314
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1315
-     *
1316
-     * @since 1.0.0
1317
-     */
1318
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1319
-
1320
-    foreach ($arr_alert_msg as $key => $value) {
1321
-        if (!is_scalar($value))
1322
-            continue;
1323
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1324
-    }
1296
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1297
+		'geodir_map_name' => geodir_map_name(),
1298
+		'osmStart' => __('Start', 'geodirectory'),
1299
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1300
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1301
+		'ga_delete_check' => __('Are you wish to Deauthorize and break Analytics?', 'geodirectory'),
1302
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1303
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1304
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1305
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1306
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1307
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1308
+	);
1309
+
1310
+	/**
1311
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1312
+	 *
1313
+	 * With this filter you can add, remove or change translated JS strings.
1314
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1315
+	 *
1316
+	 * @since 1.0.0
1317
+	 */
1318
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1325 1319
 
1326
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1327
-    echo '<script>';
1328
-    echo $script;
1329
-    echo '</script>';
1320
+	foreach ($arr_alert_msg as $key => $value) {
1321
+		if (!is_scalar($value))
1322
+			continue;
1323
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1324
+	}
1325
+
1326
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1327
+	echo '<script>';
1328
+	echo $script;
1329
+	echo '</script>';
1330 1330
 }
1331 1331
 
1332 1332
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1342,11 +1342,11 @@  discard block
 block discarded – undo
1342 1342
  */
1343 1343
 function geodir_admin_bar_site_menu($wp_admin_bar)
1344 1344
 {
1345
-    if (get_option("geodir_installed")) {
1346
-        if (current_user_can('manage_options')) {
1347
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1348
-        }
1349
-    }
1345
+	if (get_option("geodir_installed")) {
1346
+		if (current_user_can('manage_options')) {
1347
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1348
+		}
1349
+	}
1350 1350
 }
1351 1351
 
1352 1352
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1372,25 +1372,25 @@  discard block
 block discarded – undo
1372 1372
  */
1373 1373
 function geodir_store_sidebars()
1374 1374
 {
1375
-    global $geodir_sidebars;
1376
-    global $sidebars_widgets;
1377
-
1378
-    if (!is_array($sidebars_widgets))
1379
-        $sidebars_widgets = wp_get_sidebars_widgets();
1380
-    $geodir_old_sidebars = array();
1381
-
1382
-    if (is_array($geodir_sidebars)) {
1383
-        foreach ($geodir_sidebars as $val) {
1384
-            if (is_array($sidebars_widgets)) {
1385
-                if (array_key_exists($val, $sidebars_widgets))
1386
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
-                else
1388
-                    $geodir_old_sidebars[$val] = array();
1389
-            }
1390
-        }
1391
-    }
1392
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1393
-    geodir_option_version_backup('geodir_sidebars');
1375
+	global $geodir_sidebars;
1376
+	global $sidebars_widgets;
1377
+
1378
+	if (!is_array($sidebars_widgets))
1379
+		$sidebars_widgets = wp_get_sidebars_widgets();
1380
+	$geodir_old_sidebars = array();
1381
+
1382
+	if (is_array($geodir_sidebars)) {
1383
+		foreach ($geodir_sidebars as $val) {
1384
+			if (is_array($sidebars_widgets)) {
1385
+				if (array_key_exists($val, $sidebars_widgets))
1386
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1387
+				else
1388
+					$geodir_old_sidebars[$val] = array();
1389
+			}
1390
+		}
1391
+	}
1392
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1393
+	geodir_option_version_backup('geodir_sidebars');
1394 1394
 
1395 1395
 }
1396 1396
 
@@ -1404,28 +1404,28 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_restore_sidebars()
1406 1406
 {
1407
-    global $sidebars_widgets;
1408
-
1409
-    if (!is_array($sidebars_widgets))
1410
-        $sidebars_widgets = wp_get_sidebars_widgets();
1411
-
1412
-    if (is_array($sidebars_widgets)) {
1413
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1414
-        if (is_array($geodir_old_sidebars)) {
1415
-            foreach ($geodir_old_sidebars as $key => $val) {
1416
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1417
-                {
1418
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1419
-                }
1407
+	global $sidebars_widgets;
1420 1408
 
1409
+	if (!is_array($sidebars_widgets))
1410
+		$sidebars_widgets = wp_get_sidebars_widgets();
1421 1411
 
1422
-            }
1423
-        }
1412
+	if (is_array($sidebars_widgets)) {
1413
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1414
+		if (is_array($geodir_old_sidebars)) {
1415
+			foreach ($geodir_old_sidebars as $key => $val) {
1416
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1417
+				{
1418
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1419
+				}
1424 1420
 
1425
-    }
1426 1421
 
1427
-    update_option('sidebars_widgets', $sidebars_widgets);
1428
-    update_option('geodir_sidebars', '');
1422
+			}
1423
+		}
1424
+
1425
+	}
1426
+
1427
+	update_option('sidebars_widgets', $sidebars_widgets);
1428
+	update_option('geodir_sidebars', '');
1429 1429
 }
1430 1430
 
1431 1431
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1438,9 +1438,9 @@  discard block
 block discarded – undo
1438 1438
  */
1439 1439
 function geodir_after_listing_post_gridview()
1440 1440
 {
1441
-    global $gridview_columns;
1441
+	global $gridview_columns;
1442 1442
 
1443
-    $gridview_columns = '';
1443
+	$gridview_columns = '';
1444 1444
 
1445 1445
 }
1446 1446
 
@@ -1468,11 +1468,11 @@  discard block
 block discarded – undo
1468 1468
  */
1469 1469
 function so_handle_038($url, $original_url, $_context)
1470 1470
 {
1471
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1472
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1473
-    }
1471
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1472
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1473
+	}
1474 1474
 
1475
-    return $url;
1475
+	return $url;
1476 1476
 }
1477 1477
 
1478 1478
 
@@ -1488,34 +1488,34 @@  discard block
 block discarded – undo
1488 1488
 function geodir_after_main_form_fields() {
1489 1489
 	global $gd_session;
1490 1490
 	
1491
-    if (get_option('geodir_accept_term_condition')) {
1492
-        global $post;
1493
-        $term_condition = '';
1494
-        if (isset($_REQUEST['backandedit'])) {
1495
-            $post = (object)$gd_session->get('listing');
1496
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1497
-        }
1498
-
1499
-        ?>
1491
+	if (get_option('geodir_accept_term_condition')) {
1492
+		global $post;
1493
+		$term_condition = '';
1494
+		if (isset($_REQUEST['backandedit'])) {
1495
+			$post = (object)$gd_session->get('listing');
1496
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1497
+		}
1498
+
1499
+		?>
1500 1500
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1501 1501
             <label>&nbsp;</label>
1502 1502
 
1503 1503
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1504 1504
 				<span style="display:block"> 
1505 1505
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1506
-                    echo 'checked="checked"';
1507
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1506
+					echo 'checked="checked"';
1507
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1508 1508
                        class="geodir_textfield" value="1"
1509 1509
                        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>
1510 1510
 				</span>
1511 1511
             </div>
1512 1512
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1513
-                    _e($required_msg, 'geodirectory');
1514
-                } ?></span>
1513
+					_e($required_msg, 'geodirectory');
1514
+				} ?></span>
1515 1515
         </div>
1516 1516
     <?php
1517 1517
 
1518
-    }
1518
+	}
1519 1519
 }
1520 1520
 
1521 1521
 
@@ -1540,42 +1540,42 @@  discard block
 block discarded – undo
1540 1540
  */
1541 1541
 function geodir_detail_page_tab_is_display($is_display, $tab)
1542 1542
 {
1543
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1543
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1544 1544
 
1545
-    if ($tab == 'post_profile') {
1546
-        /** This action is documented in geodirectory_template_actions.php */
1547
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1545
+	if ($tab == 'post_profile') {
1546
+		/** This action is documented in geodirectory_template_actions.php */
1547
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1548 1548
         
1549
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1550
-            $is_display = false;
1551
-        }
1552
-    }
1549
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1550
+			$is_display = false;
1551
+		}
1552
+	}
1553 1553
     
1554
-    if ($tab == 'post_info')
1555
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1554
+	if ($tab == 'post_info')
1555
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1556 1556
     
1557
-    if ($tab == 'post_images')
1558
-        $is_display = (!empty($post_images)) ? true : false;
1557
+	if ($tab == 'post_images')
1558
+		$is_display = (!empty($post_images)) ? true : false;
1559 1559
 
1560
-    if ($tab == 'post_video')
1561
-        $is_display = (!empty($video)) ? true : false;
1560
+	if ($tab == 'post_video')
1561
+		$is_display = (!empty($video)) ? true : false;
1562 1562
 
1563
-    if ($tab == 'special_offers')
1564
-        $is_display = (!empty($special_offers)) ? true : false;
1563
+	if ($tab == 'special_offers')
1564
+		$is_display = (!empty($special_offers)) ? true : false;
1565 1565
 
1566
-    if ($tab == 'reviews')
1567
-        $is_display = (geodir_is_page('detail')) ? true : false;
1566
+	if ($tab == 'reviews')
1567
+		$is_display = (geodir_is_page('detail')) ? true : false;
1568 1568
 
1569
-    if ($tab == 'related_listing') {
1570
-       $message = __('No listings found which match your selection.', 'geodirectory');
1569
+	if ($tab == 'related_listing') {
1570
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1571 1571
        
1572
-       /** This action is documented in geodirectory-functions/template_functions.php */
1573
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1572
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1573
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1574 1574
        
1575
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1576
-    }
1575
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1576
+	}
1577 1577
 
1578
-    return $is_display;
1578
+	return $is_display;
1579 1579
 }
1580 1580
 
1581 1581
 
@@ -1591,69 +1591,69 @@  discard block
 block discarded – undo
1591 1591
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1592 1592
  */
1593 1593
 function geodir_changes_in_custom_fields_table() {
1594
-    global $wpdb, $plugin_prefix;
1594
+	global $wpdb, $plugin_prefix;
1595 1595
 	
1596 1596
 	// Remove unused virtual page
1597 1597
 	$listings_page_id = (int)get_option('geodir_listing_page');
1598 1598
 	if ($listings_page_id) {
1599 1599
 		$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')));
1600
-        delete_option('geodir_listing_page');
1600
+		delete_option('geodir_listing_page');
1601 1601
 	}
1602 1602
 
1603
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1604
-        $wpdb->query(
1605
-            $wpdb->prepare(
1606
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
-                array('1', '1', 'admin')
1608
-            )
1609
-        );
1603
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1604
+		$wpdb->query(
1605
+			$wpdb->prepare(
1606
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
+				array('1', '1', 'admin')
1608
+			)
1609
+		);
1610 1610
 
1611 1611
 
1612
-        /* --- terms meta value set --- */
1612
+		/* --- terms meta value set --- */
1613 1613
 
1614
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1614
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1615 1615
 
1616
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1616
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1617 1617
 
1618
-        if (!empty($options_data)) {
1618
+		if (!empty($options_data)) {
1619 1619
 
1620
-            foreach ($options_data as $optobj) {
1620
+			foreach ($options_data as $optobj) {
1621 1621
 
1622
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1622
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1623 1623
 
1624
-                $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)));
1624
+				$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)));
1625 1625
 
1626
-                if (!empty($taxonomies_data)) {
1626
+				if (!empty($taxonomies_data)) {
1627 1627
 
1628
-                    foreach ($taxonomies_data as $taxobj) {
1628
+					foreach ($taxonomies_data as $taxobj) {
1629 1629
 
1630
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1631
-                        $post_type = $taxObject->object_type[0];
1630
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1631
+						$post_type = $taxObject->object_type[0];
1632 1632
 
1633
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1633
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1634 1634
 
1635
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1635
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1636 1636
 
1637
-                        if ($duplicate_data) {
1637
+						if ($duplicate_data) {
1638 1638
 
1639
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1639
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1640 1640
 
1641
-                        } else {
1641
+						} else {
1642 1642
 
1643
-                            $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)));
1643
+							$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)));
1644 1644
 
1645
-                        }
1645
+						}
1646 1646
 
1647
-                    }
1647
+					}
1648 1648
 
1649
-                }
1649
+				}
1650 1650
 
1651
-            }
1652
-        }
1651
+			}
1652
+		}
1653 1653
 
1654
-        update_option('geodir_changes_in_custom_fields_table', '1');
1654
+		update_option('geodir_changes_in_custom_fields_table', '1');
1655 1655
 
1656
-    }
1656
+	}
1657 1657
 
1658 1658
 }
1659 1659
 
@@ -1672,24 +1672,24 @@  discard block
 block discarded – undo
1672 1672
 function geodir_location_slug_check($slug)
1673 1673
 {
1674 1674
 
1675
-    global $wpdb, $table_prefix;
1675
+	global $wpdb, $table_prefix;
1676 1676
 
1677
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1677
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1678 1678
 
1679
-    if ($slug_exists) {
1679
+	if ($slug_exists) {
1680 1680
 
1681
-        $suffix = 1;
1682
-        do {
1683
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
-            $suffix++;
1686
-        } while ($location_slug_check && $suffix < 100);
1681
+		$suffix = 1;
1682
+		do {
1683
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
+			$suffix++;
1686
+		} while ($location_slug_check && $suffix < 100);
1687 1687
 
1688
-        $slug = $alt_location_name;
1688
+		$slug = $alt_location_name;
1689 1689
 
1690
-    }
1690
+	}
1691 1691
 
1692
-    return $slug;
1692
+	return $slug;
1693 1693
 
1694 1694
 }
1695 1695
 
@@ -1714,42 +1714,42 @@  discard block
 block discarded – undo
1714 1714
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1715 1715
 {
1716 1716
 
1717
-    global $wpdb, $plugin_prefix, $table_prefix;
1717
+	global $wpdb, $plugin_prefix, $table_prefix;
1718 1718
 
1719
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1719
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1720 1720
 
1721
-    $slug = $tern_data->slug;
1721
+	$slug = $tern_data->slug;
1722 1722
 
1723
-    /**
1724
-     * Filter if a term slug exists.
1725
-     *
1726
-     * @since 1.0.0
1727
-     * @package GeoDirectory
1728
-     * @param bool $bool Default: false.
1729
-     * @param string $slug The term slug.
1730
-     * @param int $term_id The term ID.
1731
-     */
1732
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1723
+	/**
1724
+	 * Filter if a term slug exists.
1725
+	 *
1726
+	 * @since 1.0.0
1727
+	 * @package GeoDirectory
1728
+	 * @param bool $bool Default: false.
1729
+	 * @param string $slug The term slug.
1730
+	 * @param int $term_id The term ID.
1731
+	 */
1732
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1733 1733
 
1734
-    if ($slug_exists) {
1734
+	if ($slug_exists) {
1735 1735
 
1736
-        $suffix = 1;
1737
-        do {
1738
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1736
+		$suffix = 1;
1737
+		do {
1738
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1739 1739
 
1740
-            /** This action is documented in geodirectory_hooks_actions.php */
1741
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1740
+			/** This action is documented in geodirectory_hooks_actions.php */
1741
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1742 1742
 
1743
-            $suffix++;
1744
-        } while ($term_slug_check && $suffix < 100);
1743
+			$suffix++;
1744
+		} while ($term_slug_check && $suffix < 100);
1745 1745
 
1746
-        $slug = $new_slug;
1746
+		$slug = $new_slug;
1747 1747
 
1748
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1748
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1749 1749
 
1750
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1750
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1751 1751
 
1752
-    }
1752
+	}
1753 1753
 	
1754 1754
 	// Update tag in detail table.
1755 1755
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1790,21 +1790,21 @@  discard block
 block discarded – undo
1790 1790
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1791 1791
 {
1792 1792
 
1793
-    global $wpdb, $table_prefix;
1793
+	global $wpdb, $table_prefix;
1794 1794
 
1795
-    $default_location = geodir_get_default_location();
1795
+	$default_location = geodir_get_default_location();
1796 1796
 
1797
-    $country_slug = $default_location->country_slug;
1798
-    $region_slug = $default_location->region_slug;
1799
-    $city_slug = $default_location->city_slug;
1797
+	$country_slug = $default_location->country_slug;
1798
+	$region_slug = $default_location->region_slug;
1799
+	$city_slug = $default_location->city_slug;
1800 1800
 
1801
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
-        return $slug_exists = true;
1801
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
+		return $slug_exists = true;
1803 1803
 
1804
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
-        return $slug_exists = true;
1804
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
+		return $slug_exists = true;
1806 1806
 
1807
-    return $slug_exists;
1807
+	return $slug_exists;
1808 1808
 }
1809 1809
 
1810 1810
 
@@ -1823,75 +1823,75 @@  discard block
 block discarded – undo
1823 1823
  */
1824 1824
 function geodir_custom_page_title($title = '', $sep = '')
1825 1825
 {
1826
-    global $wp;
1827
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
-        return $title;
1829
-    }
1826
+	global $wp;
1827
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
+		return $title;
1829
+	}
1830 1830
 
1831
-    if ($sep == '') {
1832
-        /**
1833
-         * Filter the page title separator.
1834
-         *
1835
-         * @since 1.0.0
1836
-         * @package GeoDirectory
1837
-         * @param string $sep The separator, default: `|`.
1838
-         */
1839
-        $sep = apply_filters('geodir_page_title_separator', '|');
1840
-    }
1831
+	if ($sep == '') {
1832
+		/**
1833
+		 * Filter the page title separator.
1834
+		 *
1835
+		 * @since 1.0.0
1836
+		 * @package GeoDirectory
1837
+		 * @param string $sep The separator, default: `|`.
1838
+		 */
1839
+		$sep = apply_filters('geodir_page_title_separator', '|');
1840
+	}
1841 1841
 
1842 1842
 
1843
-    $gd_page = '';
1844
-    if(geodir_is_page('home')){
1845
-        $gd_page = 'home';
1846
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
-    }
1848
-    elseif(geodir_is_page('detail')){
1849
-        $gd_page = 'detail';
1850
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
-    }
1852
-    elseif(geodir_is_page('pt')){
1853
-        $gd_page = 'pt';
1854
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
-    }
1856
-    elseif(geodir_is_page('listing')){
1857
-        $gd_page = 'listing';
1858
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
-    }
1860
-    elseif(geodir_is_page('location')){
1861
-        $gd_page = 'location';
1862
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
-    }
1864
-    elseif(geodir_is_page('search')){
1865
-        $gd_page = 'search';
1866
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('add-listing')){
1869
-        $gd_page = 'add-listing';
1870
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('author')){
1873
-        $gd_page = 'author';
1874
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('login')){
1877
-        $gd_page = 'login';
1878
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('listing-success')){
1881
-        $gd_page = 'listing-success';
1882
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
-    }
1843
+	$gd_page = '';
1844
+	if(geodir_is_page('home')){
1845
+		$gd_page = 'home';
1846
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
+	}
1848
+	elseif(geodir_is_page('detail')){
1849
+		$gd_page = 'detail';
1850
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
+	}
1852
+	elseif(geodir_is_page('pt')){
1853
+		$gd_page = 'pt';
1854
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
+	}
1856
+	elseif(geodir_is_page('listing')){
1857
+		$gd_page = 'listing';
1858
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
+	}
1860
+	elseif(geodir_is_page('location')){
1861
+		$gd_page = 'location';
1862
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
+	}
1864
+	elseif(geodir_is_page('search')){
1865
+		$gd_page = 'search';
1866
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('add-listing')){
1869
+		$gd_page = 'add-listing';
1870
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('author')){
1873
+		$gd_page = 'author';
1874
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('login')){
1877
+		$gd_page = 'login';
1878
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('listing-success')){
1881
+		$gd_page = 'listing-success';
1882
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
+	}
1884 1884
 
1885 1885
 
1886
-    /**
1887
-     * Filter page meta title to replace variables.
1888
-     *
1889
-     * @since 1.5.4
1890
-     * @param string $title The page title including variables.
1891
-     * @param string $gd_page The GeoDirectory page type if any.
1892
-     * @param string $sep The title separator symbol.
1893
-     */
1894
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1886
+	/**
1887
+	 * Filter page meta title to replace variables.
1888
+	 *
1889
+	 * @since 1.5.4
1890
+	 * @param string $title The page title including variables.
1891
+	 * @param string $gd_page The GeoDirectory page type if any.
1892
+	 * @param string $sep The title separator symbol.
1893
+	 */
1894
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1895 1895
 
1896 1896
 }
1897 1897
 
@@ -1907,36 +1907,36 @@  discard block
 block discarded – undo
1907 1907
 function geodir_set_post_attachment()
1908 1908
 {
1909 1909
 
1910
-    if (!get_option('geodir_set_post_attachments')) {
1910
+	if (!get_option('geodir_set_post_attachments')) {
1911 1911
 
1912
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1912
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1914 1914
 
1915
-        $all_postypes = geodir_get_posttypes();
1915
+		$all_postypes = geodir_get_posttypes();
1916 1916
 
1917
-        foreach($all_postypes as $post_type){
1918
-            $args = array(
1919
-                'posts_per_page' => -1,
1920
-                'post_type' => $post_type,
1921
-                'post_status' => 'publish');
1917
+		foreach($all_postypes as $post_type){
1918
+			$args = array(
1919
+				'posts_per_page' => -1,
1920
+				'post_type' => $post_type,
1921
+				'post_status' => 'publish');
1922 1922
 
1923
-            $posts_array = get_posts($args);
1923
+			$posts_array = get_posts($args);
1924 1924
 
1925
-            if (!empty($posts_array)) {
1925
+			if (!empty($posts_array)) {
1926 1926
 
1927
-                foreach ($posts_array as $post) {
1927
+				foreach ($posts_array as $post) {
1928 1928
 
1929
-                    geodir_set_wp_featured_image($post->ID);
1929
+					geodir_set_wp_featured_image($post->ID);
1930 1930
 
1931
-                }
1931
+				}
1932 1932
 
1933
-            }
1934
-        }
1933
+			}
1934
+		}
1935 1935
 
1936 1936
 
1937
-        update_option('geodir_set_post_attachments', '1');
1937
+		update_option('geodir_set_post_attachments', '1');
1938 1938
 
1939
-    }
1939
+	}
1940 1940
 
1941 1941
 }
1942 1942
 
@@ -1953,19 +1953,19 @@  discard block
 block discarded – undo
1953 1953
 function geodir_remove_url_seperator()
1954 1954
 {
1955 1955
 
1956
-    if (!get_option('geodir_remove_url_seperator')) {
1956
+	if (!get_option('geodir_remove_url_seperator')) {
1957 1957
 
1958
-        if (get_option('geodir_listingurl_separator'))
1959
-            delete_option('geodir_listingurl_separator');
1958
+		if (get_option('geodir_listingurl_separator'))
1959
+			delete_option('geodir_listingurl_separator');
1960 1960
 
1961
-        if (get_option('geodir_detailurl_separator'))
1962
-            delete_option('geodir_detailurl_separator');
1961
+		if (get_option('geodir_detailurl_separator'))
1962
+			delete_option('geodir_detailurl_separator');
1963 1963
 
1964
-        flush_rewrite_rules(false);
1964
+		flush_rewrite_rules(false);
1965 1965
 
1966
-        update_option('geodir_remove_url_seperator', '1');
1966
+		update_option('geodir_remove_url_seperator', '1');
1967 1967
 
1968
-    }
1968
+	}
1969 1969
 
1970 1970
 }
1971 1971
 
@@ -1981,19 +1981,19 @@  discard block
 block discarded – undo
1981 1981
  */
1982 1982
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1983 1983
 {
1984
-    foreach ($permalink_arr as $key => $value) {
1984
+	foreach ($permalink_arr as $key => $value) {
1985 1985
 
1986
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1987
-            unset($permalink_arr[$key]);
1986
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1987
+			unset($permalink_arr[$key]);
1988 1988
 
1989
-    }
1989
+	}
1990 1990
 
1991
-    return $permalink_arr;
1991
+	return $permalink_arr;
1992 1992
 
1993 1993
 }
1994 1994
 
1995 1995
 if (!is_admin()) {
1996
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1996
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1997 1997
 }
1998 1998
 /**
1999 1999
  * Set status from draft to publish.
@@ -2006,16 +2006,16 @@  discard block
 block discarded – undo
2006 2006
  */
2007 2007
 function geodir_set_status_draft_to_publish_for_own_post($post)
2008 2008
 {
2009
-    $user_id = get_current_user_id();
2009
+	$user_id = get_current_user_id();
2010 2010
 
2011
-    if(!$user_id){return $post;}
2011
+	if(!$user_id){return $post;}
2012 2012
 
2013
-    $gd_post_types = geodir_get_posttypes();
2013
+	$gd_post_types = geodir_get_posttypes();
2014 2014
 
2015
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2016
-        $post[0]->post_status = 'publish';
2017
-    }
2018
-    return $post;
2015
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2016
+		$post[0]->post_status = 'publish';
2017
+	}
2018
+	return $post;
2019 2019
 }
2020 2020
 
2021 2021
 
@@ -2107,33 +2107,33 @@  discard block
 block discarded – undo
2107 2107
  */
2108 2108
 function geodir_detail_page_tab_headings_change($tabs_arr)
2109 2109
 {
2110
-    global $wpdb;
2110
+	global $wpdb;
2111 2111
 
2112
-    $post_type = geodir_get_current_posttype();
2112
+	$post_type = geodir_get_current_posttype();
2113 2113
 
2114
-    $all_postypes = geodir_get_posttypes();
2114
+	$all_postypes = geodir_get_posttypes();
2115 2115
 
2116
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2116
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2117 2117
 
2118
-        if (array_key_exists('post_video', $tabs_arr)) {
2118
+		if (array_key_exists('post_video', $tabs_arr)) {
2119 2119
 
2120
-            $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)));
2120
+			$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)));
2121 2121
 
2122
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2123
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2124
-        }
2122
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2123
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2124
+		}
2125 2125
 
2126
-        if (array_key_exists('special_offers', $tabs_arr)) {
2126
+		if (array_key_exists('special_offers', $tabs_arr)) {
2127 2127
 
2128
-            $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)));
2128
+			$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)));
2129 2129
 
2130
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2131
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2132
-        }
2130
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2131
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2132
+		}
2133 2133
 
2134
-    }
2134
+	}
2135 2135
 
2136
-    return $tabs_arr;
2136
+	return $tabs_arr;
2137 2137
 
2138 2138
 }
2139 2139
 
@@ -2146,10 +2146,10 @@  discard block
 block discarded – undo
2146 2146
  */
2147 2147
 function geodir_remove_template_redirect_actions()
2148 2148
 {
2149
-    if (geodir_is_page('login')){
2150
-        remove_all_actions('template_redirect');
2151
-        remove_action('init', 'avia_modify_front', 10);
2152
-    }
2149
+	if (geodir_is_page('login')){
2150
+		remove_all_actions('template_redirect');
2151
+		remove_action('init', 'avia_modify_front', 10);
2152
+	}
2153 2153
 }
2154 2154
 
2155 2155
 
@@ -2171,51 +2171,51 @@  discard block
 block discarded – undo
2171 2171
 function geodirectory_before_featured_image_delete($attachment_id)
2172 2172
 {
2173 2173
 
2174
-    global $wpdb, $plugin_prefix;
2174
+	global $wpdb, $plugin_prefix;
2175 2175
 
2176
-    $post_id = get_post_field('post_parent', $attachment_id);
2176
+	$post_id = get_post_field('post_parent', $attachment_id);
2177 2177
 
2178
-    $attachment_url = wp_get_attachment_url($attachment_id);
2178
+	$attachment_url = wp_get_attachment_url($attachment_id);
2179 2179
 
2180
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2180
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2181 2181
 
2182
-        $post_type = get_post_type($post_id);
2182
+		$post_type = get_post_type($post_id);
2183 2183
 
2184
-        $all_postypes = geodir_get_posttypes();
2184
+		$all_postypes = geodir_get_posttypes();
2185 2185
 
2186
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2187
-            return false;
2186
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2187
+			return false;
2188 2188
 
2189
-        $uploads = wp_upload_dir();
2189
+		$uploads = wp_upload_dir();
2190 2190
 
2191
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2191
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2192 2192
 
2193
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2193
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2194 2194
 
2195
-        $wpdb->query(
2196
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2197
-                array($post_id, $split_img_file_path)
2198
-            )
2199
-        );
2195
+		$wpdb->query(
2196
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2197
+				array($post_id, $split_img_file_path)
2198
+			)
2199
+		);
2200 2200
 
2201
-        $attachment_data = $wpdb->get_row(
2202
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2203
-                array($post_id)
2204
-            )
2205
-        );
2201
+		$attachment_data = $wpdb->get_row(
2202
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2203
+				array($post_id)
2204
+			)
2205
+		);
2206 2206
 
2207
-        if (!empty($attachment_data)) {
2208
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2209
-        }
2207
+		if (!empty($attachment_data)) {
2208
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2209
+		}
2210 2210
 
2211 2211
 
2212
-        $table_name = $plugin_prefix . $post_type . '_detail';
2212
+		$table_name = $plugin_prefix . $post_type . '_detail';
2213 2213
 
2214
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2214
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2215 2215
 
2216
-        geodir_set_wp_featured_image($post_id);
2216
+		geodir_set_wp_featured_image($post_id);
2217 2217
 
2218
-    }
2218
+	}
2219 2219
 
2220 2220
 }
2221 2221
 
@@ -2233,79 +2233,79 @@  discard block
 block discarded – undo
2233 2233
 function geodir_temp_set_post_attachment()
2234 2234
 {
2235 2235
 
2236
-    global $wpdb, $plugin_prefix;
2236
+	global $wpdb, $plugin_prefix;
2237 2237
 
2238
-    $all_postypes = geodir_get_posttypes();
2238
+	$all_postypes = geodir_get_posttypes();
2239 2239
 
2240
-    foreach ($all_postypes as $posttype) {
2240
+	foreach ($all_postypes as $posttype) {
2241 2241
 
2242
-        $tablename = $plugin_prefix . $posttype . '_detail';
2242
+		$tablename = $plugin_prefix . $posttype . '_detail';
2243 2243
 
2244
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2244
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2245 2245
 
2246
-        if (!empty($get_post_data)) {
2246
+		if (!empty($get_post_data)) {
2247 2247
 
2248
-            foreach ($get_post_data as $data) {
2248
+			foreach ($get_post_data as $data) {
2249 2249
 
2250
-                $post_id = $data->post_id;
2250
+				$post_id = $data->post_id;
2251 2251
 
2252
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2252
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2253 2253
 
2254
-                if (!empty($attachment_data)) {
2254
+				if (!empty($attachment_data)) {
2255 2255
 
2256
-                    foreach ($attachment_data as $attach) {
2256
+					foreach ($attachment_data as $attach) {
2257 2257
 
2258
-                        $file_info = pathinfo($attach->file);
2258
+						$file_info = pathinfo($attach->file);
2259 2259
 
2260
-                        $sub_dir = '';
2261
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2262
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2260
+						$sub_dir = '';
2261
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2262
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2263 2263
 
2264
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2265
-                        $uploads_path = $uploads['basedir'];
2264
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2265
+						$uploads_path = $uploads['basedir'];
2266 2266
 
2267
-                        $file_name = $file_info['basename'];
2267
+						$file_name = $file_info['basename'];
2268 2268
 
2269
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2269
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2270 2270
 
2271
-                        if (!file_exists($img_arr['path'])) {
2271
+						if (!file_exists($img_arr['path'])) {
2272 2272
 
2273
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2273
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2274 2274
 
2275
-                        }
2275
+						}
2276 2276
 
2277
-                    }
2277
+					}
2278 2278
 
2279
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2279
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2280 2280
 
2281
-                    if (!empty($attachment_data)) {
2281
+					if (!empty($attachment_data)) {
2282 2282
 
2283
-                        if ($attachment_data->ID)
2284
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2283
+						if ($attachment_data->ID)
2284
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2285 2285
 
2286
-                    } else {
2286
+					} else {
2287 2287
 
2288
-                        if (has_post_thumbnail($post_id)) {
2288
+						if (has_post_thumbnail($post_id)) {
2289 2289
 
2290
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2290
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2291 2291
 
2292
-                            wp_delete_attachment($post_thumbnail_id);
2292
+							wp_delete_attachment($post_thumbnail_id);
2293 2293
 
2294
-                        }
2294
+						}
2295 2295
 
2296
-                    }
2296
+					}
2297 2297
 
2298
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2298
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2299 2299
 
2300
-                    geodir_set_wp_featured_image($post_id);
2300
+					geodir_set_wp_featured_image($post_id);
2301 2301
 
2302
-                }
2302
+				}
2303 2303
 
2304
-            }
2304
+			}
2305 2305
 
2306
-        }
2306
+		}
2307 2307
 
2308
-    }
2308
+	}
2309 2309
 
2310 2310
 }
2311 2311
 
@@ -2323,9 +2323,9 @@  discard block
 block discarded – undo
2323 2323
 function geodir_default_rating_star_icon()
2324 2324
 {
2325 2325
 
2326
-    if (!get_option('geodir_default_rating_star_icon')) {
2327
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2328
-    }
2326
+	if (!get_option('geodir_default_rating_star_icon')) {
2327
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2328
+	}
2329 2329
 
2330 2330
 }
2331 2331
 
@@ -2343,27 +2343,27 @@  discard block
 block discarded – undo
2343 2343
  */
2344 2344
 function geodir_user_post_listing_count($user_id=null)
2345 2345
 {
2346
-    global $wpdb, $plugin_prefix, $current_user;
2347
-    if(!$user_id){
2348
-        $user_id = $current_user->ID;
2349
-    }
2346
+	global $wpdb, $plugin_prefix, $current_user;
2347
+	if(!$user_id){
2348
+		$user_id = $current_user->ID;
2349
+	}
2350 2350
 
2351
-    $user_id = $current_user->ID;
2352
-    $all_postypes = geodir_get_posttypes();
2353
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2351
+	$user_id = $current_user->ID;
2352
+	$all_postypes = geodir_get_posttypes();
2353
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2354 2354
 
2355
-    $user_listing = array();
2356
-    if (is_array($all_posts) && !empty($all_posts)) {
2357
-        foreach ($all_posts as $ptype) {
2358
-            $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' )");
2355
+	$user_listing = array();
2356
+	if (is_array($all_posts) && !empty($all_posts)) {
2357
+		foreach ($all_posts as $ptype) {
2358
+			$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' )");
2359 2359
 
2360
-            if ($total_posts > 0) {
2361
-                $user_listing[$ptype] = $total_posts;
2362
-            }
2363
-        }
2364
-    }
2360
+			if ($total_posts > 0) {
2361
+				$user_listing[$ptype] = $total_posts;
2362
+			}
2363
+		}
2364
+	}
2365 2365
 
2366
-    return $user_listing;
2366
+	return $user_listing;
2367 2367
 }
2368 2368
 
2369 2369
 
@@ -2383,189 +2383,189 @@  discard block
 block discarded – undo
2383 2383
  */
2384 2384
 function geodir_detail_page_custom_field_tab($tabs_arr)
2385 2385
 {
2386
-    global $post;
2387
-
2388
-    $post_type = geodir_get_current_posttype();
2389
-    $all_postypes = geodir_get_posttypes();
2390
-
2391
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2392
-        $package_info = array();
2393
-        $package_info = geodir_post_package_info($package_info, $post);
2394
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2395
-        $fields_location = 'owntab';
2396
-
2397
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2398
-        //remove video and special offers if it is already set to show
2399
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2400
-            $unset_video = true;
2401
-        }
2402
-
2403
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2404
-            $unset_special_offers = true;
2405
-        }
2406
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2407
-            foreach($custom_fields as $key => $custom_field){
2408
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2409
-                    unset($custom_fields[$key]);
2410
-                }
2411
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2412
-                    unset($custom_fields[$key]);
2413
-                }
2414
-            }
2415
-        }
2416
-
2417
-
2418
-        if (!empty($custom_fields)) {
2419
-            $parse_custom_fields = array();
2420
-            foreach ($custom_fields as $field) {
2421
-                $field = stripslashes_deep($field); // strip slashes
2422
-                $type = $field;
2423
-                $field_name = $field['htmlvar_name'];
2424
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2425
-                    $post->{$field_name} = $_REQUEST[$field_name];
2426
-                }
2386
+	global $post;
2427 2387
 
2428
-                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'))) {
2429
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2430
-                        continue;
2431
-                    }
2388
+	$post_type = geodir_get_current_posttype();
2389
+	$all_postypes = geodir_get_posttypes();
2432 2390
 
2433
-                    $parse_custom_fields[] = $field;
2434
-                }
2435
-            }
2436
-            $custom_fields = $parse_custom_fields;
2437
-        }
2438
-        //print_r($custom_fields);
2439
-        if (!empty($custom_fields)) {
2391
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2392
+		$package_info = array();
2393
+		$package_info = geodir_post_package_info($package_info, $post);
2394
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2395
+		$fields_location = 'owntab';
2440 2396
 
2441
-            global $field_set_start;
2397
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2398
+		//remove video and special offers if it is already set to show
2399
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2400
+			$unset_video = true;
2401
+		}
2442 2402
 
2443
-            $post = stripslashes_deep($post); // strip slashes
2444
-            
2445
-            $field_set_start = 0;
2446
-            $fieldset_count = 0;
2447
-            $fieldset = '';
2448
-            $total_fields = count($custom_fields);
2449
-            $count_field = 0;
2450
-            $fieldset_arr = array();
2451
-            $i = 0;
2452
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2453
-
2454
-            foreach ($custom_fields as $field) {
2455
-                $count_field++;
2456
-                $field_name = $field['htmlvar_name'];
2457
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2458
-                    $post->{$field_name} = $_REQUEST[$field_name];
2459
-                }
2403
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2404
+			$unset_special_offers = true;
2405
+		}
2406
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2407
+			foreach($custom_fields as $key => $custom_field){
2408
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2409
+					unset($custom_fields[$key]);
2410
+				}
2411
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2412
+					unset($custom_fields[$key]);
2413
+				}
2414
+			}
2415
+		}
2460 2416
 
2461
-                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'))) {
2462
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2463
-                    $site_title = trim($field['site_title']);
2464
-                    $type = $field;
2465
-                    $variables_array = array();
2466 2417
 
2467
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2468
-                        continue;
2469
-                    }
2418
+		if (!empty($custom_fields)) {
2419
+			$parse_custom_fields = array();
2420
+			foreach ($custom_fields as $field) {
2421
+				$field = stripslashes_deep($field); // strip slashes
2422
+				$type = $field;
2423
+				$field_name = $field['htmlvar_name'];
2424
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2425
+					$post->{$field_name} = $_REQUEST[$field_name];
2426
+				}
2470 2427
 
2471
-                    if ($type['type'] != 'fieldset') {
2472
-                        $i++;
2473
-                        $variables_array['post_id'] = $post->ID;
2474
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2475
-                        $variables_array['value'] = '';
2476
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2477
-                    }else{
2478
-                        $i = 0;
2479
-                        $fieldset_count++;
2480
-                        $field_set_start = 1;
2481
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2482
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2483
-                    }
2428
+				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'))) {
2429
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2430
+						continue;
2431
+					}
2484 2432
 
2433
+					$parse_custom_fields[] = $field;
2434
+				}
2435
+			}
2436
+			$custom_fields = $parse_custom_fields;
2437
+		}
2438
+		//print_r($custom_fields);
2439
+		if (!empty($custom_fields)) {
2485 2440
 
2486
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2487
-                    $type = stripslashes_deep($type); // strip slashes
2488
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2489
-                    $html = '';
2490
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2491
-                    if($html_var=='post'){$html_var='post_address';}
2492
-                    $field_icon = geodir_field_icon_proccess($type);
2493
-                    $filed_type = $type['type'];
2494
-
2495
-                    /**
2496
-                     * Filter the output for custom fields.
2497
-                     *
2498
-                     * Here we can remove or add new functions depending on the field type.
2499
-                     *
2500
-                     * @param string $html The html to be filtered (blank).
2501
-                     * @param string $fields_location The location the field is to be show.
2502
-                     * @param array $type The array of field values.
2503
-                     */
2504
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2505
-
2506
-
2507
-                    /**
2508
-                     * Filter custom field output in tab.
2509
-                     *
2510
-                     * @since 1.5.6
2511
-                     *
2512
-                     * @param string $html_var The HTML variable name for the field.
2513
-                     * @param string $html Custom field unfiltered HTML.
2514
-                     * @param array $variables_array Custom field variables array.
2515
-                     */
2516
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2517
-
2518
-                    $fieldset_html = '';
2519
-                    if ($field_set_start == 1) {
2520
-                        $add_html = false;
2521
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2522
-                            if ($fieldset != '') {
2523
-                                $add_html = true;
2524
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2525
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2526
-                            }
2527
-                            $fieldset_html = $fieldset;
2528
-                            $fieldset = '';
2529
-                        } else {
2530
-                            $fieldset .= $html;
2531
-                            if ($total_fields == $count_field && $fieldset != '') {
2532
-                                $add_html = true;
2533
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2534
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2535
-                                $fieldset_html = $fieldset;
2536
-                            }
2537
-                        }
2441
+			global $field_set_start;
2538 2442
 
2539
-                        if ($add_html) {
2540
-                            $tabs_arr[$htmlvar_name] = array(
2541
-                                'heading_text' => __($label, 'geodirectory'),
2542
-                                'is_active_tab' => false,
2543
-                                /**
2544
-                                 * Filter if a custom field should be displayed on the details page tab.
2545
-                                 *
2546
-                                 * @since 1.0.0
2547
-                                 * @param string $htmlvar_name The field HTML var name.
2548
-                                 */
2549
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2550
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2551
-                            );
2552
-                        }
2553
-                    } else {
2554
-                        if ($html != '') {
2555
-                            $tabs_arr[$html_var] = array(
2556
-                                'heading_text' => __($label, 'geodirectory'),
2557
-                                'is_active_tab' => false,
2558
-                                /** This action is documented in geodirectory_hooks_actions.php */
2559
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2560
-                                'tab_content' => $html
2561
-                            );
2562
-                        }
2563
-                    }
2564
-                }
2565
-            }
2566
-        }
2567
-    }
2568
-    return $tabs_arr;
2443
+			$post = stripslashes_deep($post); // strip slashes
2444
+            
2445
+			$field_set_start = 0;
2446
+			$fieldset_count = 0;
2447
+			$fieldset = '';
2448
+			$total_fields = count($custom_fields);
2449
+			$count_field = 0;
2450
+			$fieldset_arr = array();
2451
+			$i = 0;
2452
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2453
+
2454
+			foreach ($custom_fields as $field) {
2455
+				$count_field++;
2456
+				$field_name = $field['htmlvar_name'];
2457
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2458
+					$post->{$field_name} = $_REQUEST[$field_name];
2459
+				}
2460
+
2461
+				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'))) {
2462
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2463
+					$site_title = trim($field['site_title']);
2464
+					$type = $field;
2465
+					$variables_array = array();
2466
+
2467
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2468
+						continue;
2469
+					}
2470
+
2471
+					if ($type['type'] != 'fieldset') {
2472
+						$i++;
2473
+						$variables_array['post_id'] = $post->ID;
2474
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2475
+						$variables_array['value'] = '';
2476
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2477
+					}else{
2478
+						$i = 0;
2479
+						$fieldset_count++;
2480
+						$field_set_start = 1;
2481
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2482
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2483
+					}
2484
+
2485
+
2486
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2487
+					$type = stripslashes_deep($type); // strip slashes
2488
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2489
+					$html = '';
2490
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2491
+					if($html_var=='post'){$html_var='post_address';}
2492
+					$field_icon = geodir_field_icon_proccess($type);
2493
+					$filed_type = $type['type'];
2494
+
2495
+					/**
2496
+					 * Filter the output for custom fields.
2497
+					 *
2498
+					 * Here we can remove or add new functions depending on the field type.
2499
+					 *
2500
+					 * @param string $html The html to be filtered (blank).
2501
+					 * @param string $fields_location The location the field is to be show.
2502
+					 * @param array $type The array of field values.
2503
+					 */
2504
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2505
+
2506
+
2507
+					/**
2508
+					 * Filter custom field output in tab.
2509
+					 *
2510
+					 * @since 1.5.6
2511
+					 *
2512
+					 * @param string $html_var The HTML variable name for the field.
2513
+					 * @param string $html Custom field unfiltered HTML.
2514
+					 * @param array $variables_array Custom field variables array.
2515
+					 */
2516
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2517
+
2518
+					$fieldset_html = '';
2519
+					if ($field_set_start == 1) {
2520
+						$add_html = false;
2521
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2522
+							if ($fieldset != '') {
2523
+								$add_html = true;
2524
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2525
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2526
+							}
2527
+							$fieldset_html = $fieldset;
2528
+							$fieldset = '';
2529
+						} else {
2530
+							$fieldset .= $html;
2531
+							if ($total_fields == $count_field && $fieldset != '') {
2532
+								$add_html = true;
2533
+								$label = $fieldset_arr[$fieldset_count]['label'];
2534
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2535
+								$fieldset_html = $fieldset;
2536
+							}
2537
+						}
2538
+
2539
+						if ($add_html) {
2540
+							$tabs_arr[$htmlvar_name] = array(
2541
+								'heading_text' => __($label, 'geodirectory'),
2542
+								'is_active_tab' => false,
2543
+								/**
2544
+								 * Filter if a custom field should be displayed on the details page tab.
2545
+								 *
2546
+								 * @since 1.0.0
2547
+								 * @param string $htmlvar_name The field HTML var name.
2548
+								 */
2549
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2550
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2551
+							);
2552
+						}
2553
+					} else {
2554
+						if ($html != '') {
2555
+							$tabs_arr[$html_var] = array(
2556
+								'heading_text' => __($label, 'geodirectory'),
2557
+								'is_active_tab' => false,
2558
+								/** This action is documented in geodirectory_hooks_actions.php */
2559
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2560
+								'tab_content' => $html
2561
+							);
2562
+						}
2563
+					}
2564
+				}
2565
+			}
2566
+		}
2567
+	}
2568
+	return $tabs_arr;
2569 2569
 }
2570 2570
 
2571 2571
 /* display add listing page for wpml */
@@ -2589,39 +2589,39 @@  discard block
 block discarded – undo
2589 2589
  */
2590 2590
 function geodir_add_post_status_author_page()
2591 2591
 {
2592
-    global $wpdb, $post;
2593
-
2594
-    $html = '';
2595
-    if (get_current_user_id()) {
2596
-
2597
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2598
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2599
-
2600
-            // 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.
2601
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2602
-            $status = "<strong>(";
2603
-            $status_icon = '<i class="fa fa-play"></i>';
2604
-            if ($real_status == 'publish') {
2605
-                $status .= __('Published', 'geodirectory');
2606
-            } else {
2607
-                $status .= __('Not published', 'geodirectory');
2608
-                $status_icon = '<i class="fa fa-pause"></i>';
2609
-            }
2610
-            $status .= ")</strong>";
2592
+	global $wpdb, $post;
2593
+
2594
+	$html = '';
2595
+	if (get_current_user_id()) {
2596
+
2597
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2598
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2599
+
2600
+			// 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.
2601
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2602
+			$status = "<strong>(";
2603
+			$status_icon = '<i class="fa fa-play"></i>';
2604
+			if ($real_status == 'publish') {
2605
+				$status .= __('Published', 'geodirectory');
2606
+			} else {
2607
+				$status .= __('Not published', 'geodirectory');
2608
+				$status_icon = '<i class="fa fa-pause"></i>';
2609
+			}
2610
+			$status .= ")</strong>";
2611 2611
 
2612
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2613
-        }
2614
-    }
2612
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2613
+		}
2614
+	}
2615 2615
 
2616
-    if ($html != '') {
2617
-        /**
2618
-         * Filter the post status text on the author page.
2619
-         *
2620
-         * @since 1.0.0
2621
-         * @param string $html The HTML of the status.
2622
-         */
2623
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2624
-    }
2616
+	if ($html != '') {
2617
+		/**
2618
+		 * Filter the post status text on the author page.
2619
+		 *
2620
+		 * @since 1.0.0
2621
+		 * @param string $html The HTML of the status.
2622
+		 */
2623
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2624
+	}
2625 2625
 
2626 2626
 
2627 2627
 }
@@ -2635,21 +2635,21 @@  discard block
 block discarded – undo
2635 2635
  */
2636 2636
 function geodir_init_no_rating()
2637 2637
 {
2638
-    if (get_option('geodir_disable_rating')) {
2639
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2640
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2641
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2642
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2643
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2644
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2645
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2646
-
2647
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2648
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2649
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2650
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2651
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
-    }
2638
+	if (get_option('geodir_disable_rating')) {
2639
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
2640
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
2641
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
2642
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
2643
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
2644
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
2645
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
2646
+
2647
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
2648
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
2649
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
2650
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
2651
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2652
+	}
2653 2653
 }
2654 2654
 
2655 2655
 /**
@@ -2661,24 +2661,24 @@  discard block
 block discarded – undo
2661 2661
  */
2662 2662
 function geodir_no_rating_rating_fields()
2663 2663
 {
2664
-    global $post;
2664
+	global $post;
2665 2665
 
2666
-    $post_types = geodir_get_posttypes();
2666
+	$post_types = geodir_get_posttypes();
2667 2667
 
2668
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2669
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2670
-            if (get_option('geodir_reviewrating_enable_rating')) {
2671
-                echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2672
-            } else {
2673
-                echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2674
-            }
2675
-            if (get_option('geodir_reviewrating_enable_images')) {
2676
-                geodir_reviewrating_rating_img_html();
2677
-            }
2678
-        } else {
2679
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2680
-        }
2681
-    }
2668
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
2669
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
2670
+			if (get_option('geodir_reviewrating_enable_rating')) {
2671
+				echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
2672
+			} else {
2673
+				echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2674
+			}
2675
+			if (get_option('geodir_reviewrating_enable_images')) {
2676
+				geodir_reviewrating_rating_img_html();
2677
+			}
2678
+		} else {
2679
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
2680
+		}
2681
+	}
2682 2682
 }
2683 2683
 
2684 2684
 /**
@@ -2692,11 +2692,11 @@  discard block
 block discarded – undo
2692 2692
  */
2693 2693
 function geodir_no_rating_comment_text($content, $comment = '')
2694 2694
 {
2695
-    if (!is_admin()) {
2696
-        return '<div class="description">' . $content . '</div>';
2697
-    } else {
2698
-        return $content;
2699
-    }
2695
+	if (!is_admin()) {
2696
+		return '<div class="description">' . $content . '</div>';
2697
+	} else {
2698
+		return $content;
2699
+	}
2700 2700
 }
2701 2701
 
2702 2702
 /**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
  */
2710 2710
 function geodir_no_rating_review_rating_html($content = '')
2711 2711
 {
2712
-    return NULL;
2712
+	return NULL;
2713 2713
 }
2714 2714
 
2715 2715
 /**
@@ -2723,19 +2723,19 @@  discard block
 block discarded – undo
2723 2723
  */
2724 2724
 function geodir_no_rating_get_sort_options($options, $post_type = '')
2725 2725
 {
2726
-    $new_options = array();
2727
-    if (!empty($options)) {
2728
-        foreach ($options as $option) {
2729
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2730
-                continue;
2731
-            }
2732
-            $new_options[] = $option;
2733
-        }
2726
+	$new_options = array();
2727
+	if (!empty($options)) {
2728
+		foreach ($options as $option) {
2729
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2730
+				continue;
2731
+			}
2732
+			$new_options[] = $option;
2733
+		}
2734 2734
 
2735
-        $options = $new_options;
2736
-    }
2735
+		$options = $new_options;
2736
+	}
2737 2737
 
2738
-    return $options;
2738
+	return $options;
2739 2739
 }
2740 2740
 
2741 2741
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -2749,11 +2749,11 @@  discard block
 block discarded – undo
2749 2749
  */
2750 2750
 function geodir_all_js_msg_no_rating($msg = array())
2751 2751
 {
2752
-    if (get_option('geodir_disable_rating')) {
2753
-        $msg['gd_cmt_no_rating'] = true;
2754
-    }
2752
+	if (get_option('geodir_disable_rating')) {
2753
+		$msg['gd_cmt_no_rating'] = true;
2754
+	}
2755 2755
 
2756
-    return $msg;
2756
+	return $msg;
2757 2757
 }
2758 2758
 
2759 2759
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -2767,13 +2767,13 @@  discard block
 block discarded – undo
2767 2767
  */
2768 2768
 function geodir_body_class_no_rating($classes = array())
2769 2769
 {
2770
-    if (get_option('geodir_disable_rating')) {
2771
-        $classes[] = 'gd-no-rating';
2772
-    }
2770
+	if (get_option('geodir_disable_rating')) {
2771
+		$classes[] = 'gd-no-rating';
2772
+	}
2773 2773
     
2774
-    $classes[] = 'gd-map-' . geodir_map_name();
2774
+	$classes[] = 'gd-map-' . geodir_map_name();
2775 2775
 
2776
-    return $classes;
2776
+	return $classes;
2777 2777
 }
2778 2778
 
2779 2779
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -2787,13 +2787,13 @@  discard block
 block discarded – undo
2787 2787
  */
2788 2788
 function geodir_admin_body_class_no_rating($class = '')
2789 2789
 {
2790
-    if (get_option('geodir_disable_rating')) {
2791
-        $class .= ' gd-no-rating';
2792
-    }
2790
+	if (get_option('geodir_disable_rating')) {
2791
+		$class .= ' gd-no-rating';
2792
+	}
2793 2793
     
2794
-    $class .= ' gd-map-' . geodir_map_name();
2794
+	$class .= ' gd-map-' . geodir_map_name();
2795 2795
 
2796
-    return $class;
2796
+	return $class;
2797 2797
 }
2798 2798
 
2799 2799
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -2806,10 +2806,10 @@  discard block
 block discarded – undo
2806 2806
  */
2807 2807
 function geodir_wp_head_no_rating()
2808 2808
 {
2809
-    if (get_option('geodir_disable_rating')) {
2810
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2811
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2812
-    }
2809
+	if (get_option('geodir_disable_rating')) {
2810
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
2811
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
2812
+	}
2813 2813
 }
2814 2814
 
2815 2815
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -2826,36 +2826,36 @@  discard block
 block discarded – undo
2826 2826
  * @return array Translation texts.
2827 2827
  */
2828 2828
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2829
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2830
-
2831
-    $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');
2832
-
2833
-    /**
2834
-     * Filters the geodirectory option names that requires to add for translation.
2835
-     *
2836
-     * @since 1.5.7
2837
-     * @package GeoDirectory
2838
-     *
2839
-     * @param  array $gd_options Array of option names.
2840
-     */
2841
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2842
-    $gd_options = array_unique($gd_options);
2843
-
2844
-    if (!empty($gd_options)) {
2845
-        foreach ($gd_options as $gd_option) {
2846
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2847
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2829
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2830
+
2831
+	$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');
2832
+
2833
+	/**
2834
+	 * Filters the geodirectory option names that requires to add for translation.
2835
+	 *
2836
+	 * @since 1.5.7
2837
+	 * @package GeoDirectory
2838
+	 *
2839
+	 * @param  array $gd_options Array of option names.
2840
+	 */
2841
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2842
+	$gd_options = array_unique($gd_options);
2843
+
2844
+	if (!empty($gd_options)) {
2845
+		foreach ($gd_options as $gd_option) {
2846
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2847
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2848 2848
                 
2849
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2850
-                    $translation_texts[] = stripslashes_deep($option_value);
2851
-                }
2852
-            }
2853
-        }
2854
-    }
2849
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2850
+					$translation_texts[] = stripslashes_deep($option_value);
2851
+				}
2852
+			}
2853
+		}
2854
+	}
2855 2855
 
2856
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2856
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2857 2857
 
2858
-    return $translation_texts;
2858
+	return $translation_texts;
2859 2859
 }
2860 2860
 
2861 2861
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2869,15 +2869,15 @@  discard block
 block discarded – undo
2869 2869
 
2870 2870
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2871 2871
 function gd_get_comments_link($comments_link, $post_id) {
2872
-    $post_type = get_post_type($post_id);
2872
+	$post_type = get_post_type($post_id);
2873 2873
 
2874
-    $all_postypes = geodir_get_posttypes();
2875
-    if (in_array($post_type, $all_postypes)) {
2876
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2877
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2878
-    }
2874
+	$all_postypes = geodir_get_posttypes();
2875
+	if (in_array($post_type, $all_postypes)) {
2876
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2877
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2878
+	}
2879 2879
 
2880
-    return $comments_link;
2880
+	return $comments_link;
2881 2881
 }
2882 2882
 
2883 2883
 
@@ -2895,11 +2895,11 @@  discard block
 block discarded – undo
2895 2895
 function geodir_add_nav_menu_class( $args )
2896 2896
 {
2897 2897
 
2898
-        if(isset($args['menu_class'])){
2899
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2900
-        }
2898
+		if(isset($args['menu_class'])){
2899
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2900
+		}
2901 2901
     
2902
-    return $args;
2902
+	return $args;
2903 2903
 }
2904 2904
 
2905 2905
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2916,15 +2916,15 @@  discard block
 block discarded – undo
2916 2916
  * @return string Filtered locale ID.
2917 2917
  */
2918 2918
 function geodir_wpml_filter_locale($locale) {
2919
-    global $sitepress;
2919
+	global $sitepress;
2920 2920
     
2921
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2921
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2922 2922
     
2923
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2924
-        $locale = $sitepress->get_locale($current_lang);
2925
-    }
2923
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2924
+		$locale = $sitepress->get_locale($current_lang);
2925
+	}
2926 2926
     
2927
-    return $locale;
2927
+	return $locale;
2928 2928
 }
2929 2929
 
2930 2930
 /**
@@ -2934,15 +2934,15 @@  discard block
 block discarded – undo
2934 2934
  * @package GeoDirectory
2935 2935
  */
2936 2936
 function geodir_wpml_set_filter() {
2937
-    if (function_exists('icl_object_id')) {
2938
-        global $sitepress;
2937
+	if (function_exists('icl_object_id')) {
2938
+		global $sitepress;
2939 2939
         
2940
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2941
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2942
-        }
2940
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2941
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2942
+		}
2943 2943
         
2944
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2945
-    }
2944
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2945
+	}
2946 2946
 }
2947 2947
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2948 2948
 
@@ -2955,44 +2955,44 @@  discard block
 block discarded – undo
2955 2955
  * @return array Filtered languages.
2956 2956
  */
2957 2957
 function geodir_wpml_filter_ls_languages($languages) {
2958
-    global $gd_icl_ls_languages;
2958
+	global $gd_icl_ls_languages;
2959 2959
     
2960
-    if (geodir_is_geodir_page()) {
2961
-        if ($gd_icl_ls_languages) {
2962
-            return $languages;
2963
-        }
2960
+	if (geodir_is_geodir_page()) {
2961
+		if ($gd_icl_ls_languages) {
2962
+			return $languages;
2963
+		}
2964 2964
         
2965
-        $keep_vars = array();
2965
+		$keep_vars = array();
2966 2966
         
2967
-        if (geodir_is_page('add-listing')) {
2968
-            $keep_vars = array('listing_type', 'package_id');
2969
-        } else if (geodir_is_page('search')) {
2970
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2971
-        } else if (geodir_is_page('author')) {
2972
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2973
-        } else if (geodir_is_page('login')) {
2974
-            $keep_vars = array('forgot', 'signup');
2975
-        }        
2967
+		if (geodir_is_page('add-listing')) {
2968
+			$keep_vars = array('listing_type', 'package_id');
2969
+		} else if (geodir_is_page('search')) {
2970
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2971
+		} else if (geodir_is_page('author')) {
2972
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2973
+		} else if (geodir_is_page('login')) {
2974
+			$keep_vars = array('forgot', 'signup');
2975
+		}        
2976 2976
         
2977
-        if (!empty($keep_vars)) {
2978
-            foreach ( $languages as $code => $url) {
2979
-                $filter_url = $url['url'];
2977
+		if (!empty($keep_vars)) {
2978
+			foreach ( $languages as $code => $url) {
2979
+				$filter_url = $url['url'];
2980 2980
                 
2981
-                foreach ($keep_vars as $var) {
2982
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2983
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2984
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2985
-                    }
2986
-                }
2981
+				foreach ($keep_vars as $var) {
2982
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2983
+						$filter_url = remove_query_arg(array($var), $filter_url);
2984
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2985
+					}
2986
+				}
2987 2987
                 
2988
-                if ($filter_url != $url['url']) {
2989
-                    $languages[$code]['url'] = $filter_url;
2990
-                }
2991
-            }
2992
-            $gd_icl_ls_languages = true;
2993
-        }
2994
-    }
2988
+				if ($filter_url != $url['url']) {
2989
+					$languages[$code]['url'] = $filter_url;
2990
+				}
2991
+			}
2992
+			$gd_icl_ls_languages = true;
2993
+		}
2994
+	}
2995 2995
 
2996
-    return $languages;
2996
+	return $languages;
2997 2997
 }
2998 2998
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2999 2999
\ No newline at end of file
Please login to merge, or discard this patch.