Test Failed
Push — master ( 2bd85f...d29c03 )
by Stiofan
24:57 queued 04:43
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1210 added lines, -1210 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,42 +249,42 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
-    }
265
+	if ( isset( $_REQUEST['geodir_search'] ) ) {
266
+		add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
+		add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
+	}
269 269
 }
270 270
 
271 271
 
272 272
 if (!function_exists('geodir_init_defaults')) {
273
-    /**
274
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
-     *
276
-     * @since 1.0.0
277
-     * @package GeoDirectory
278
-     */
279
-    function geodir_init_defaults()
280
-    {
281
-        if (function_exists('geodir_register_defaults')) {
273
+	/**
274
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
+	 *
276
+	 * @since 1.0.0
277
+	 * @package GeoDirectory
278
+	 */
279
+	function geodir_init_defaults()
280
+	{
281
+		if (function_exists('geodir_register_defaults')) {
282 282
 
283
-            geodir_register_defaults();
283
+			geodir_register_defaults();
284 284
 
285
-        }
285
+		}
286 286
 
287
-    }
287
+	}
288 288
 }
289 289
 
290 290
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
 // CALLED ON 'sidebars_widgets' FILTER
307 307
 
308 308
 if (!function_exists('geodir_restrict_widget')) {
309
-    /**
310
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
-     *
312
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
-     * @since 1.0.0
315
-     * @package GeoDirectory
316
-     */
317
-    function geodir_restrict_widget()
318
-    {
319
-        global $is_listing, $is_single_place;
309
+	/**
310
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
+	 *
312
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
+	 * @since 1.0.0
315
+	 * @package GeoDirectory
316
+	 */
317
+	function geodir_restrict_widget()
318
+	{
319
+		global $is_listing, $is_single_place;
320 320
 
321
-        // set is listing	
322
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
321
+		// set is listing	
322
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
323 323
 
324
-        // set is single place
325
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
324
+		// set is single place
325
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
326 326
 
327 327
 
328
-    }
328
+	}
329 329
 }
330 330
 
331 331
 
@@ -346,31 +346,31 @@  discard block
 block discarded – undo
346 346
  */
347 347
 function geodir_detail_page_sidebar_content_sorting()
348 348
 {
349
-    $arr_detail_page_sidebar_content =
350
-        /**
351
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
352
-         *
353
-         * This filter can be used to remove sections of the details page sidebar,
354
-         * add new sections or rearrange the order of the sections.
355
-         *
356
-         * @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.
357
-         * @since 1.0.0
358
-         */
359
-        apply_filters('geodir_detail_page_sidebar_content',
360
-            array('geodir_social_sharing_buttons',
361
-                'geodir_detail_page_google_analytics',
362
-                'geodir_edit_post_link',
363
-                'geodir_detail_page_review_rating',
364
-                'geodir_detail_page_more_info'
365
-            ) // end of array 
366
-        ); // end of apply filter
367
-    if (!empty($arr_detail_page_sidebar_content)) {
368
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
369
-            if (function_exists($content_function)) {
370
-                add_action('geodir_detail_page_sidebar', $content_function);
371
-            }
372
-        }
373
-    }
349
+	$arr_detail_page_sidebar_content =
350
+		/**
351
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
352
+		 *
353
+		 * This filter can be used to remove sections of the details page sidebar,
354
+		 * add new sections or rearrange the order of the sections.
355
+		 *
356
+		 * @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.
357
+		 * @since 1.0.0
358
+		 */
359
+		apply_filters('geodir_detail_page_sidebar_content',
360
+			array('geodir_social_sharing_buttons',
361
+				'geodir_detail_page_google_analytics',
362
+				'geodir_edit_post_link',
363
+				'geodir_detail_page_review_rating',
364
+				'geodir_detail_page_more_info'
365
+			) // end of array 
366
+		); // end of apply filter
367
+	if (!empty($arr_detail_page_sidebar_content)) {
368
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
369
+			if (function_exists($content_function)) {
370
+				add_action('geodir_detail_page_sidebar', $content_function);
371
+			}
372
+		}
373
+	}
374 374
 }
375 375
 
376 376
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_add_to_favourite_link()
387 387
 {
388
-    global $post, $preview;
389
-    if (!$preview && geodir_is_page('detail')) {
390
-        ?>
388
+	global $post, $preview;
389
+	if (!$preview && geodir_is_page('detail')) {
390
+		?>
391 391
         <p class="edit_link">
392 392
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
393 393
         </p>
394 394
     <?php
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 /**
@@ -406,41 +406,41 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function geodir_social_sharing_buttons()
408 408
 {
409
-    global $preview;
410
-    ob_start(); // Start  buffering;
411
-    /**
412
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
-     *
414
-     * @since 1.0.0
415
-     */
416
-    do_action('geodir_before_social_sharing_buttons');
417
-    if (!$preview) {
418
-        ?>
409
+	global $preview;
410
+	ob_start(); // Start  buffering;
411
+	/**
412
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
+	 *
414
+	 * @since 1.0.0
415
+	 */
416
+	do_action('geodir_before_social_sharing_buttons');
417
+	if (!$preview) {
418
+		?>
419 419
         <div class="likethis">
420 420
             <?php geodir_twitter_tweet_button(); ?>
421 421
             <?php geodir_fb_like_button(); ?>
422 422
             <?php geodir_google_plus_button(); ?>
423 423
         </div>
424 424
     <?php
425
-    }// end of if, if its a preview or not
426
-
427
-    /**
428
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
-     *
430
-     * @since 1.0.0
431
-     */
432
-    do_action('geodir_after_social_sharing_buttons');
433
-    $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
-        /**
438
-         * Filter the geodir_social_sharing_buttons() function content.
439
-         *
440
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
-         */
442
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
-    }
425
+	}// end of if, if its a preview or not
426
+
427
+	/**
428
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
+	 *
430
+	 * @since 1.0.0
431
+	 */
432
+	do_action('geodir_after_social_sharing_buttons');
433
+	$content_html = ob_get_clean();
434
+	if (trim($content_html) != '')
435
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
+		/**
438
+		 * Filter the geodir_social_sharing_buttons() function content.
439
+		 *
440
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
+		 */
442
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
+	}
444 444
 
445 445
 
446 446
 }
@@ -458,46 +458,46 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_edit_post_link()
460 460
 {
461
-    global $post, $preview;
462
-    ob_start(); // Start buffering;
463
-    /**
464
-     * This is called before the edit post link html in the function geodir_edit_post_link()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_before_edit_post_link');
469
-    if (!$preview) {
470
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
461
+	global $post, $preview;
462
+	ob_start(); // Start buffering;
463
+	/**
464
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_before_edit_post_link');
469
+	if (!$preview) {
470
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
471 471
         
472
-        if ($is_current_user_owner) {
473
-            $post_id = $post->ID;
472
+		if ($is_current_user_owner) {
473
+			$post_id = $post->ID;
474 474
             
475
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
477
-            }
475
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
+				$post_id = (int)$_REQUEST['pid'];
477
+			}
478 478
 
479
-            $postlink = get_permalink(geodir_add_listing_page_id());
480
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
-        }
483
-    }// end of if, if its a preview or not
484
-    /**
485
-     * This is called after the edit post link html in the function geodir_edit_post_link()
486
-     *
487
-     * @since 1.0.0
488
-     */
489
-    do_action('geodir_after_edit_post_link');
490
-    $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
-        /**
495
-         * Filter the geodir_edit_post_link() function content.
496
-         *
497
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
498
-         */
499
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
-    }
479
+			$postlink = get_permalink(geodir_add_listing_page_id());
480
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
+		}
483
+	}// end of if, if its a preview or not
484
+	/**
485
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
486
+	 *
487
+	 * @since 1.0.0
488
+	 */
489
+	do_action('geodir_after_edit_post_link');
490
+	$content_html = ob_get_clean();
491
+	if (trim($content_html) != '')
492
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
+		/**
495
+		 * Filter the geodir_edit_post_link() function content.
496
+		 *
497
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
498
+		 */
499
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
+	}
501 501
 }
502 502
 
503 503
 /**
@@ -511,42 +511,42 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    global $post,$preview;
515
-    if($preview){return '';}
516
-    $package_info = array();
517
-    $package_info = geodir_post_package_info($package_info, $post);
514
+	global $post,$preview;
515
+	if($preview){return '';}
516
+	$package_info = array();
517
+	$package_info = geodir_post_package_info($package_info, $post);
518 518
 
519
-    $id = trim(get_option('geodir_ga_account_id'));
519
+	$id = trim(get_option('geodir_ga_account_id'));
520 520
 
521
-    if (!$id) {
522
-        return; //if no Google Analytics ID then bail.
523
-    }
521
+	if (!$id) {
522
+		return; //if no Google Analytics ID then bail.
523
+	}
524 524
 
525
-    ob_start(); // Start buffering;
526
-    /**
527
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
528
-     *
529
-     * @since 1.0.0
530
-     */
531
-    do_action('geodir_before_google_analytics');
525
+	ob_start(); // Start buffering;
526
+	/**
527
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
528
+	 *
529
+	 * @since 1.0.0
530
+	 */
531
+	do_action('geodir_before_google_analytics');
532 532
     
533
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
534
-    /**
535
-     * Filter the time interval to check & refresh new users results.
536
-     *
537
-     * @since 1.5.9
538
-     *
539
-     * @param int $refresh_time Time interval to check & refresh new users results.
540
-     */
541
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
542
-    $refresh_time = absint($refresh_time * 1000);
533
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
534
+	/**
535
+	 * Filter the time interval to check & refresh new users results.
536
+	 *
537
+	 * @since 1.5.9
538
+	 *
539
+	 * @param int $refresh_time Time interval to check & refresh new users results.
540
+	 */
541
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
542
+	$refresh_time = absint($refresh_time * 1000);
543 543
     
544
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
544
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
545 545
     
546
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
547
-    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' )) ) {
548
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
549
-        ?>
546
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
547
+	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' )) ) {
548
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
549
+		?>
550 550
         <script type="text/javascript">
551 551
             var gd_gaTimeOut;
552 552
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -798,15 +798,15 @@  discard block
 block discarded – undo
798 798
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
799 799
 
800 800
                     <?php
801
-                    // Here we list the shorthand days of the week so it can be used in translation.
802
-                    __("Mon",'geodirectory');
803
-                    __("Tue",'geodirectory');
804
-                    __("Wed",'geodirectory');
805
-                    __("Thu",'geodirectory');
806
-                    __("Fri",'geodirectory');
807
-                    __("Sat",'geodirectory');
808
-                    __("Sun",'geodirectory');
809
-                    ?>
801
+					// Here we list the shorthand days of the week so it can be used in translation.
802
+					__("Mon",'geodirectory');
803
+					__("Tue",'geodirectory');
804
+					__("Wed",'geodirectory');
805
+					__("Thu",'geodirectory');
806
+					__("Fri",'geodirectory');
807
+					__("Sat",'geodirectory');
808
+					__("Sun",'geodirectory');
809
+					?>
810 810
 
811 811
                     labels = [
812 812
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1055,24 +1055,24 @@  discard block
 block discarded – undo
1055 1055
         </span>
1056 1056
 
1057 1057
     <?php
1058
-    }
1059
-    /**
1060
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1061
-     *
1062
-     * @since 1.0.0
1063
-     */
1064
-    do_action('geodir_after_google_analytics');
1065
-    $content_html = ob_get_clean();
1066
-    if (trim($content_html) != '')
1067
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1068
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069
-        /**
1070
-         * Filter the geodir_edit_post_link() function content.
1071
-         *
1072
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1073
-         */
1074
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1075
-    }
1058
+	}
1059
+	/**
1060
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1061
+	 *
1062
+	 * @since 1.0.0
1063
+	 */
1064
+	do_action('geodir_after_google_analytics');
1065
+	$content_html = ob_get_clean();
1066
+	if (trim($content_html) != '')
1067
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1068
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069
+		/**
1070
+		 * Filter the geodir_edit_post_link() function content.
1071
+		 *
1072
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1073
+		 */
1074
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1075
+	}
1076 1076
 }
1077 1077
 
1078 1078
 /**
@@ -1089,94 +1089,94 @@  discard block
 block discarded – undo
1089 1089
  */
1090 1090
 function geodir_detail_page_review_rating()
1091 1091
 {
1092
-    global $post, $preview, $post_images;
1092
+	global $post, $preview, $post_images;
1093 1093
     
1094
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1095
-        return;
1096
-    }
1097
-    ob_start(); // Start  buffering;
1098
-    /**
1099
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1100
-     *
1101
-     * This is called outside the check for an actual rating and the check for preview page.
1102
-     *
1103
-     * @since 1.0.0
1104
-     */
1105
-    do_action('geodir_before_detail_page_review_rating');
1106
-
1107
-    $comment_count = geodir_get_review_count_total($post->ID);
1108
-    $post_avgratings = geodir_get_post_rating($post->ID);
1109
-
1110
-    if ($post_avgratings != 0 && !$preview) {
1111
-        /**
1112
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1113
-         *
1114
-         * This is called inside the check for an actual rating and the check for preview page.
1115
-         *
1116
-         * @since 1.0.0
1117
-         * @param float $post_avgratings Average rating for the current post.
1118
-         * @param int $post->ID Current post ID.
1119
-         */
1120
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1121
-
1122
-        $html = '<p style=" float:left;">';
1123
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1124
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1125
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1094
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1095
+		return;
1096
+	}
1097
+	ob_start(); // Start  buffering;
1098
+	/**
1099
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1100
+	 *
1101
+	 * This is called outside the check for an actual rating and the check for preview page.
1102
+	 *
1103
+	 * @since 1.0.0
1104
+	 */
1105
+	do_action('geodir_before_detail_page_review_rating');
1106
+
1107
+	$comment_count = geodir_get_review_count_total($post->ID);
1108
+	$post_avgratings = geodir_get_post_rating($post->ID);
1109
+
1110
+	if ($post_avgratings != 0 && !$preview) {
1111
+		/**
1112
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1113
+		 *
1114
+		 * This is called inside the check for an actual rating and the check for preview page.
1115
+		 *
1116
+		 * @since 1.0.0
1117
+		 * @param float $post_avgratings Average rating for the current post.
1118
+		 * @param int $post->ID Current post ID.
1119
+		 */
1120
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1121
+
1122
+		$html = '<p style=" float:left;">';
1123
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1124
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1125
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126 1126
        
1127 1127
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1128 1128
 	   
1129 1129
 	   $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 />';
1130 1130
 
1131
-        $html .= '<span class="item">';
1132
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1131
+		$html .= '<span class="item">';
1132
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1133 1133
 
1134
-        if ($post_images) {
1135
-            foreach ($post_images as $img) {
1136
-                $post_img = $img->src;
1137
-                break;
1138
-            }
1139
-        }
1140
-
1141
-        if (isset($post_img) && $post_img) {
1142
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1143
-        }
1144
-
1145
-        $html .= '</span>';
1146
-
1147
-        echo $html .= '</div>';
1148
-        /**
1149
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1150
-         *
1151
-         * This is called inside the check for an actual rating and the check for preview page.
1152
-         *
1153
-         * @since 1.0.0
1154
-         * @param float $post_avgratings Average rating for the current post.
1155
-         * @param int $post->ID Current post ID.
1156
-         */
1157
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1158
-    }
1159
-    /**
1160
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1161
-     *
1162
-     * This is called outside the check for an actual rating and the check for preview page.
1163
-     *
1164
-     * @since 1.0.0
1165
-     */
1166
-    do_action('geodir_after_detail_page_review_rating');
1167
-    $content_html = ob_get_clean();
1168
-    if (trim($content_html) != '') {
1169
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1170
-    }
1171
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1172
-        /**
1173
-         * Filter the geodir_detail_page_review_rating() function content.
1174
-         *
1175
-         * @since 1.0.0
1176
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1177
-         */
1178
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1179
-    }
1134
+		if ($post_images) {
1135
+			foreach ($post_images as $img) {
1136
+				$post_img = $img->src;
1137
+				break;
1138
+			}
1139
+		}
1140
+
1141
+		if (isset($post_img) && $post_img) {
1142
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1143
+		}
1144
+
1145
+		$html .= '</span>';
1146
+
1147
+		echo $html .= '</div>';
1148
+		/**
1149
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1150
+		 *
1151
+		 * This is called inside the check for an actual rating and the check for preview page.
1152
+		 *
1153
+		 * @since 1.0.0
1154
+		 * @param float $post_avgratings Average rating for the current post.
1155
+		 * @param int $post->ID Current post ID.
1156
+		 */
1157
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1158
+	}
1159
+	/**
1160
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1161
+	 *
1162
+	 * This is called outside the check for an actual rating and the check for preview page.
1163
+	 *
1164
+	 * @since 1.0.0
1165
+	 */
1166
+	do_action('geodir_after_detail_page_review_rating');
1167
+	$content_html = ob_get_clean();
1168
+	if (trim($content_html) != '') {
1169
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1170
+	}
1171
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1172
+		/**
1173
+		 * Filter the geodir_detail_page_review_rating() function content.
1174
+		 *
1175
+		 * @since 1.0.0
1176
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1177
+		 */
1178
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1179
+	}
1180 1180
 }
1181 1181
 
1182 1182
 /**
@@ -1188,35 +1188,35 @@  discard block
 block discarded – undo
1188 1188
  */
1189 1189
 function geodir_detail_page_more_info()
1190 1190
 {
1191
-    ob_start(); // Start  buffering;
1192
-    /**
1193
-     * This is called before the info section html.
1194
-     *
1195
-     * @since 1.0.0
1196
-     */
1197
-    do_action('geodir_before_detail_page_more_info');
1198
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1199
-        echo $geodir_post_detail_fields;
1200
-    }
1201
-    /**
1202
-     * This is called after the info section html.
1203
-     *
1204
-     * @since 1.0.0
1205
-     */
1206
-    do_action('geodir_after_detail_page_more_info');
1207
-
1208
-    $content_html = ob_get_clean();
1209
-    if (trim($content_html) != '')
1210
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1211
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212
-        /**
1213
-         * Filter the output html for function geodir_detail_page_more_info().
1214
-         *
1215
-         * @since 1.0.0
1216
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1217
-         */
1218
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1219
-    }
1191
+	ob_start(); // Start  buffering;
1192
+	/**
1193
+	 * This is called before the info section html.
1194
+	 *
1195
+	 * @since 1.0.0
1196
+	 */
1197
+	do_action('geodir_before_detail_page_more_info');
1198
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1199
+		echo $geodir_post_detail_fields;
1200
+	}
1201
+	/**
1202
+	 * This is called after the info section html.
1203
+	 *
1204
+	 * @since 1.0.0
1205
+	 */
1206
+	do_action('geodir_after_detail_page_more_info');
1207
+
1208
+	$content_html = ob_get_clean();
1209
+	if (trim($content_html) != '')
1210
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1211
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212
+		/**
1213
+		 * Filter the output html for function geodir_detail_page_more_info().
1214
+		 *
1215
+		 * @since 1.0.0
1216
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1217
+		 */
1218
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1219
+	}
1220 1220
 }
1221 1221
 
1222 1222
 
@@ -1230,15 +1230,15 @@  discard block
 block discarded – undo
1230 1230
  */
1231 1231
 function geodir_localize_all_js_msg()
1232 1232
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1233
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1234
-        $ajax_url = admin_url('admin-ajax.php');
1235
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1236
-        $ajax_url = admin_url('admin-ajax.php');
1237
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1238
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1239
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1240
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1241
-    }
1233
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1234
+		$ajax_url = admin_url('admin-ajax.php');
1235
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1236
+		$ajax_url = admin_url('admin-ajax.php');
1237
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1238
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1239
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1240
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1241
+	}
1242 1242
 	
1243 1243
 	/**
1244 1244
 	 * Filter the allowed image type extensions for post images.
@@ -1248,60 +1248,60 @@  discard block
 block discarded – undo
1248 1248
 	 */
1249 1249
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1250 1250
 	
1251
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1252
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1253
-    $default_marker_width = $default_marker_size['w'];
1254
-    $default_marker_height = $default_marker_size['h'];
1251
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1252
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1253
+	$default_marker_width = $default_marker_size['w'];
1254
+	$default_marker_height = $default_marker_size['h'];
1255 1255
     
1256
-    $arr_alert_msg = array(
1257
-        'geodir_plugin_url' => geodir_plugin_url(),
1258
-        'geodir_admin_ajax_url' => $ajax_url,
1259
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1260
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1261
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1262
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1263
-        //start not show alert msg
1264
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1265
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1266
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1267
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1268
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1269
-        // end not show alert msg
1270
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1271
-        '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'),
1272
-        //start not show alert msg
1273
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1274
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1275
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1276
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1277
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1278
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1279
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1280
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1281
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1282
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1283
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1284
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1285
-        'geodir_default_marker_icon' => $default_marker_icon,
1286
-        'geodir_default_marker_w' => $default_marker_width,
1287
-        'geodir_default_marker_h' => $default_marker_height,
1288
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1289
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1290
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1291
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1292
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1293
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1294
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1295
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1296
-        /* on/off dragging for phone devices */
1297
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1298
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1299
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1300
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1301
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1302
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1303
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1304
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1256
+	$arr_alert_msg = array(
1257
+		'geodir_plugin_url' => geodir_plugin_url(),
1258
+		'geodir_admin_ajax_url' => $ajax_url,
1259
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1260
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1261
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1262
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1263
+		//start not show alert msg
1264
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1265
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1266
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1267
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1268
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1269
+		// end not show alert msg
1270
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1271
+		'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'),
1272
+		//start not show alert msg
1273
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1274
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1275
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1276
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1277
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1278
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1279
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1280
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1281
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1282
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1283
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1284
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1285
+		'geodir_default_marker_icon' => $default_marker_icon,
1286
+		'geodir_default_marker_w' => $default_marker_width,
1287
+		'geodir_default_marker_h' => $default_marker_height,
1288
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1289
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1290
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1291
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1292
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1293
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1294
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1295
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1296
+		/* on/off dragging for phone devices */
1297
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1298
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1299
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1300
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1301
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1302
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1303
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1304
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1305 1305
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1306 1306
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1307 1307
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1309,40 +1309,40 @@  discard block
 block discarded – undo
1309 1309
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1310 1310
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1311 1311
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1312
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1313
-        'geodir_map_name' => geodir_map_name(),
1314
-        'osmStart' => __('Start', 'geodirectory'),
1315
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1316
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1317
-        'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1318
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1319
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1320
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1321
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1322
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1323
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1324
-    );
1325
-
1326
-    /**
1327
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1328
-     *
1329
-     * With this filter you can add, remove or change translated JS strings.
1330
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1331
-     *
1332
-     * @since 1.0.0
1333
-     */
1334
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335
-
1336
-    foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1339
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340
-    }
1312
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1313
+		'geodir_map_name' => geodir_map_name(),
1314
+		'osmStart' => __('Start', 'geodirectory'),
1315
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1316
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1317
+		'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1318
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1319
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1320
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1321
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1322
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1323
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1324
+	);
1325
+
1326
+	/**
1327
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1328
+	 *
1329
+	 * With this filter you can add, remove or change translated JS strings.
1330
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1331
+	 *
1332
+	 * @since 1.0.0
1333
+	 */
1334
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1341 1335
 
1342
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1343
-    echo '<script>';
1344
-    echo $script;
1345
-    echo '</script>';
1336
+	foreach ($arr_alert_msg as $key => $value) {
1337
+		if (!is_scalar($value))
1338
+			continue;
1339
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340
+	}
1341
+
1342
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1343
+	echo '<script>';
1344
+	echo $script;
1345
+	echo '</script>';
1346 1346
 }
1347 1347
 
1348 1348
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1358,11 +1358,11 @@  discard block
 block discarded – undo
1358 1358
  */
1359 1359
 function geodir_admin_bar_site_menu($wp_admin_bar)
1360 1360
 {
1361
-    if (get_option("geodir_installed")) {
1362
-        if (current_user_can('manage_options')) {
1363
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1364
-        }
1365
-    }
1361
+	if (get_option("geodir_installed")) {
1362
+		if (current_user_can('manage_options')) {
1363
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1364
+		}
1365
+	}
1366 1366
 }
1367 1367
 
1368 1368
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1388,25 +1388,25 @@  discard block
 block discarded – undo
1388 1388
  */
1389 1389
 function geodir_store_sidebars()
1390 1390
 {
1391
-    global $geodir_sidebars;
1392
-    global $sidebars_widgets;
1393
-
1394
-    if (!is_array($sidebars_widgets))
1395
-        $sidebars_widgets = wp_get_sidebars_widgets();
1396
-    $geodir_old_sidebars = array();
1397
-
1398
-    if (is_array($geodir_sidebars)) {
1399
-        foreach ($geodir_sidebars as $val) {
1400
-            if (is_array($sidebars_widgets)) {
1401
-                if (array_key_exists($val, $sidebars_widgets))
1402
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1403
-                else
1404
-                    $geodir_old_sidebars[$val] = array();
1405
-            }
1406
-        }
1407
-    }
1408
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1409
-    geodir_option_version_backup('geodir_sidebars');
1391
+	global $geodir_sidebars;
1392
+	global $sidebars_widgets;
1393
+
1394
+	if (!is_array($sidebars_widgets))
1395
+		$sidebars_widgets = wp_get_sidebars_widgets();
1396
+	$geodir_old_sidebars = array();
1397
+
1398
+	if (is_array($geodir_sidebars)) {
1399
+		foreach ($geodir_sidebars as $val) {
1400
+			if (is_array($sidebars_widgets)) {
1401
+				if (array_key_exists($val, $sidebars_widgets))
1402
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1403
+				else
1404
+					$geodir_old_sidebars[$val] = array();
1405
+			}
1406
+		}
1407
+	}
1408
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1409
+	geodir_option_version_backup('geodir_sidebars');
1410 1410
 
1411 1411
 }
1412 1412
 
@@ -1420,28 +1420,28 @@  discard block
 block discarded – undo
1420 1420
  */
1421 1421
 function geodir_restore_sidebars()
1422 1422
 {
1423
-    global $sidebars_widgets;
1424
-
1425
-    if (!is_array($sidebars_widgets))
1426
-        $sidebars_widgets = wp_get_sidebars_widgets();
1427
-
1428
-    if (is_array($sidebars_widgets)) {
1429
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1430
-        if (is_array($geodir_old_sidebars)) {
1431
-            foreach ($geodir_old_sidebars as $key => $val) {
1432
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1433
-                {
1434
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1435
-                }
1423
+	global $sidebars_widgets;
1436 1424
 
1425
+	if (!is_array($sidebars_widgets))
1426
+		$sidebars_widgets = wp_get_sidebars_widgets();
1437 1427
 
1438
-            }
1439
-        }
1428
+	if (is_array($sidebars_widgets)) {
1429
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1430
+		if (is_array($geodir_old_sidebars)) {
1431
+			foreach ($geodir_old_sidebars as $key => $val) {
1432
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1433
+				{
1434
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1435
+				}
1440 1436
 
1441
-    }
1442 1437
 
1443
-    update_option('sidebars_widgets', $sidebars_widgets);
1444
-    update_option('geodir_sidebars', '');
1438
+			}
1439
+		}
1440
+
1441
+	}
1442
+
1443
+	update_option('sidebars_widgets', $sidebars_widgets);
1444
+	update_option('geodir_sidebars', '');
1445 1445
 }
1446 1446
 
1447 1447
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
  */
1455 1455
 function geodir_after_listing_post_gridview()
1456 1456
 {
1457
-    global $gridview_columns;
1457
+	global $gridview_columns;
1458 1458
 
1459
-    $gridview_columns = '';
1459
+	$gridview_columns = '';
1460 1460
 
1461 1461
 }
1462 1462
 
@@ -1484,11 +1484,11 @@  discard block
 block discarded – undo
1484 1484
  */
1485 1485
 function so_handle_038($url, $original_url, $_context)
1486 1486
 {
1487
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1488
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1489
-    }
1487
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1488
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1489
+	}
1490 1490
 
1491
-    return $url;
1491
+	return $url;
1492 1492
 }
1493 1493
 
1494 1494
 
@@ -1504,34 +1504,34 @@  discard block
 block discarded – undo
1504 1504
 function geodir_after_main_form_fields() {
1505 1505
 	global $gd_session;
1506 1506
 	
1507
-    if (get_option('geodir_accept_term_condition')) {
1508
-        global $post;
1509
-        $term_condition = '';
1510
-        if (isset($_REQUEST['backandedit'])) {
1511
-            $post = (object)$gd_session->get('listing');
1512
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1513
-        }
1514
-
1515
-        ?>
1507
+	if (get_option('geodir_accept_term_condition')) {
1508
+		global $post;
1509
+		$term_condition = '';
1510
+		if (isset($_REQUEST['backandedit'])) {
1511
+			$post = (object)$gd_session->get('listing');
1512
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1513
+		}
1514
+
1515
+		?>
1516 1516
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1517 1517
             <label>&nbsp;</label>
1518 1518
 
1519 1519
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1520 1520
 				<span style="display:block"> 
1521 1521
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1522
-                    echo 'checked="checked"';
1523
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1522
+					echo 'checked="checked"';
1523
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1524 1524
                        class="geodir_textfield" value="1"
1525 1525
                        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>
1526 1526
 				</span>
1527 1527
             </div>
1528 1528
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1529
-                    _e($required_msg, 'geodirectory');
1530
-                } ?></span>
1529
+					_e($required_msg, 'geodirectory');
1530
+				} ?></span>
1531 1531
         </div>
1532 1532
     <?php
1533 1533
 
1534
-    }
1534
+	}
1535 1535
 }
1536 1536
 
1537 1537
 
@@ -1556,42 +1556,42 @@  discard block
 block discarded – undo
1556 1556
  */
1557 1557
 function geodir_detail_page_tab_is_display($is_display, $tab)
1558 1558
 {
1559
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1559
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1560 1560
 
1561
-    if ($tab == 'post_profile') {
1562
-        /** This action is documented in geodirectory_template_actions.php */
1563
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1561
+	if ($tab == 'post_profile') {
1562
+		/** This action is documented in geodirectory_template_actions.php */
1563
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1564 1564
         
1565
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1566
-            $is_display = false;
1567
-        }
1568
-    }
1565
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1566
+			$is_display = false;
1567
+		}
1568
+	}
1569 1569
     
1570
-    if ($tab == 'post_info')
1571
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1570
+	if ($tab == 'post_info')
1571
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1572 1572
     
1573
-    if ($tab == 'post_images')
1574
-        $is_display = (!empty($post_images)) ? true : false;
1573
+	if ($tab == 'post_images')
1574
+		$is_display = (!empty($post_images)) ? true : false;
1575 1575
 
1576
-    if ($tab == 'post_video')
1577
-        $is_display = (!empty($video)) ? true : false;
1576
+	if ($tab == 'post_video')
1577
+		$is_display = (!empty($video)) ? true : false;
1578 1578
 
1579
-    if ($tab == 'special_offers')
1580
-        $is_display = (!empty($special_offers)) ? true : false;
1579
+	if ($tab == 'special_offers')
1580
+		$is_display = (!empty($special_offers)) ? true : false;
1581 1581
 
1582
-    if ($tab == 'reviews')
1583
-        $is_display = (geodir_is_page('detail')) ? true : false;
1582
+	if ($tab == 'reviews')
1583
+		$is_display = (geodir_is_page('detail')) ? true : false;
1584 1584
 
1585
-    if ($tab == 'related_listing') {
1586
-       $message = __('No listings found which match your selection.', 'geodirectory');
1585
+	if ($tab == 'related_listing') {
1586
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1587 1587
        
1588
-       /** This action is documented in geodirectory-functions/template_functions.php */
1589
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1588
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1589
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1590 1590
        
1591
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1592
-    }
1591
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1592
+	}
1593 1593
 
1594
-    return $is_display;
1594
+	return $is_display;
1595 1595
 }
1596 1596
 
1597 1597
 
@@ -1607,69 +1607,69 @@  discard block
 block discarded – undo
1607 1607
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1608 1608
  */
1609 1609
 function geodir_changes_in_custom_fields_table() {
1610
-    global $wpdb, $plugin_prefix;
1610
+	global $wpdb, $plugin_prefix;
1611 1611
 	
1612 1612
 	// Remove unused virtual page
1613 1613
 	$listings_page_id = (int)get_option('geodir_listing_page');
1614 1614
 	if ($listings_page_id) {
1615 1615
 		$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')));
1616
-        delete_option('geodir_listing_page');
1616
+		delete_option('geodir_listing_page');
1617 1617
 	}
1618 1618
 
1619
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1620
-        $wpdb->query(
1621
-            $wpdb->prepare(
1622
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1623
-                array('1', '1', 'admin')
1624
-            )
1625
-        );
1619
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1620
+		$wpdb->query(
1621
+			$wpdb->prepare(
1622
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1623
+				array('1', '1', 'admin')
1624
+			)
1625
+		);
1626 1626
 
1627 1627
 
1628
-        /* --- terms meta value set --- */
1628
+		/* --- terms meta value set --- */
1629 1629
 
1630
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1630
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1631 1631
 
1632
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1632
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1633 1633
 
1634
-        if (!empty($options_data)) {
1634
+		if (!empty($options_data)) {
1635 1635
 
1636
-            foreach ($options_data as $optobj) {
1636
+			foreach ($options_data as $optobj) {
1637 1637
 
1638
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1638
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1639 1639
 
1640
-                $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)));
1640
+				$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)));
1641 1641
 
1642
-                if (!empty($taxonomies_data)) {
1642
+				if (!empty($taxonomies_data)) {
1643 1643
 
1644
-                    foreach ($taxonomies_data as $taxobj) {
1644
+					foreach ($taxonomies_data as $taxobj) {
1645 1645
 
1646
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1647
-                        $post_type = $taxObject->object_type[0];
1646
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1647
+						$post_type = $taxObject->object_type[0];
1648 1648
 
1649
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1649
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1650 1650
 
1651
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1651
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1652 1652
 
1653
-                        if ($duplicate_data) {
1653
+						if ($duplicate_data) {
1654 1654
 
1655
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1655
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1656 1656
 
1657
-                        } else {
1657
+						} else {
1658 1658
 
1659
-                            $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)));
1659
+							$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)));
1660 1660
 
1661
-                        }
1661
+						}
1662 1662
 
1663
-                    }
1663
+					}
1664 1664
 
1665
-                }
1665
+				}
1666 1666
 
1667
-            }
1668
-        }
1667
+			}
1668
+		}
1669 1669
 
1670
-        update_option('geodir_changes_in_custom_fields_table', '1');
1670
+		update_option('geodir_changes_in_custom_fields_table', '1');
1671 1671
 
1672
-    }
1672
+	}
1673 1673
 
1674 1674
 }
1675 1675
 
@@ -1688,24 +1688,24 @@  discard block
 block discarded – undo
1688 1688
 function geodir_location_slug_check($slug)
1689 1689
 {
1690 1690
 
1691
-    global $wpdb, $table_prefix;
1691
+	global $wpdb, $table_prefix;
1692 1692
 
1693
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1693
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1694 1694
 
1695
-    if ($slug_exists) {
1695
+	if ($slug_exists) {
1696 1696
 
1697
-        $suffix = 1;
1698
-        do {
1699
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1700
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1701
-            $suffix++;
1702
-        } while ($location_slug_check && $suffix < 100);
1697
+		$suffix = 1;
1698
+		do {
1699
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1700
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1701
+			$suffix++;
1702
+		} while ($location_slug_check && $suffix < 100);
1703 1703
 
1704
-        $slug = $alt_location_name;
1704
+		$slug = $alt_location_name;
1705 1705
 
1706
-    }
1706
+	}
1707 1707
 
1708
-    return $slug;
1708
+	return $slug;
1709 1709
 
1710 1710
 }
1711 1711
 
@@ -1730,42 +1730,42 @@  discard block
 block discarded – undo
1730 1730
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1731 1731
 {
1732 1732
 
1733
-    global $wpdb, $plugin_prefix, $table_prefix;
1733
+	global $wpdb, $plugin_prefix, $table_prefix;
1734 1734
 
1735
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1735
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1736 1736
 
1737
-    $slug = $tern_data->slug;
1737
+	$slug = $tern_data->slug;
1738 1738
 
1739
-    /**
1740
-     * Filter if a term slug exists.
1741
-     *
1742
-     * @since 1.0.0
1743
-     * @package GeoDirectory
1744
-     * @param bool $bool Default: false.
1745
-     * @param string $slug The term slug.
1746
-     * @param int $term_id The term ID.
1747
-     */
1748
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1739
+	/**
1740
+	 * Filter if a term slug exists.
1741
+	 *
1742
+	 * @since 1.0.0
1743
+	 * @package GeoDirectory
1744
+	 * @param bool $bool Default: false.
1745
+	 * @param string $slug The term slug.
1746
+	 * @param int $term_id The term ID.
1747
+	 */
1748
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1749 1749
 
1750
-    if ($slug_exists) {
1750
+	if ($slug_exists) {
1751 1751
 
1752
-        $suffix = 1;
1753
-        do {
1754
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1752
+		$suffix = 1;
1753
+		do {
1754
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1755 1755
 
1756
-            /** This action is documented in geodirectory_hooks_actions.php */
1757
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1756
+			/** This action is documented in geodirectory_hooks_actions.php */
1757
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1758 1758
 
1759
-            $suffix++;
1760
-        } while ($term_slug_check && $suffix < 100);
1759
+			$suffix++;
1760
+		} while ($term_slug_check && $suffix < 100);
1761 1761
 
1762
-        $slug = $new_slug;
1762
+		$slug = $new_slug;
1763 1763
 
1764
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1764
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1765 1765
 
1766
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1766
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1767 1767
 
1768
-    }
1768
+	}
1769 1769
 	
1770 1770
 	// Update tag in detail table.
1771 1771
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1806,21 +1806,21 @@  discard block
 block discarded – undo
1806 1806
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1807 1807
 {
1808 1808
 
1809
-    global $wpdb, $table_prefix;
1809
+	global $wpdb, $table_prefix;
1810 1810
 
1811
-    $default_location = geodir_get_default_location();
1811
+	$default_location = geodir_get_default_location();
1812 1812
 
1813
-    $country_slug = $default_location->country_slug;
1814
-    $region_slug = $default_location->region_slug;
1815
-    $city_slug = $default_location->city_slug;
1813
+	$country_slug = $default_location->country_slug;
1814
+	$region_slug = $default_location->region_slug;
1815
+	$city_slug = $default_location->city_slug;
1816 1816
 
1817
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1818
-        return $slug_exists = true;
1817
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1818
+		return $slug_exists = true;
1819 1819
 
1820
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1821
-        return $slug_exists = true;
1820
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1821
+		return $slug_exists = true;
1822 1822
 
1823
-    return $slug_exists;
1823
+	return $slug_exists;
1824 1824
 }
1825 1825
 
1826 1826
 
@@ -1840,75 +1840,75 @@  discard block
 block discarded – undo
1840 1840
  */
1841 1841
 function geodir_custom_page_title($title = '', $sep = '')
1842 1842
 {
1843
-    global $wp;
1844
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1845
-        return $title;
1846
-    }
1843
+	global $wp;
1844
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1845
+		return $title;
1846
+	}
1847 1847
 
1848
-    if ($sep == '') {
1849
-        /**
1850
-         * Filter the page title separator.
1851
-         *
1852
-         * @since 1.0.0
1853
-         * @package GeoDirectory
1854
-         * @param string $sep The separator, default: `|`.
1855
-         */
1856
-        $sep = apply_filters('geodir_page_title_separator', '|');
1857
-    }
1848
+	if ($sep == '') {
1849
+		/**
1850
+		 * Filter the page title separator.
1851
+		 *
1852
+		 * @since 1.0.0
1853
+		 * @package GeoDirectory
1854
+		 * @param string $sep The separator, default: `|`.
1855
+		 */
1856
+		$sep = apply_filters('geodir_page_title_separator', '|');
1857
+	}
1858 1858
 
1859 1859
 
1860
-    $gd_page = '';
1861
-    if(geodir_is_page('home')){
1862
-        $gd_page = 'home';
1863
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('detail')){
1866
-        $gd_page = 'detail';
1867
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('pt')){
1870
-        $gd_page = 'pt';
1871
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing')){
1874
-        $gd_page = 'listing';
1875
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('location')){
1878
-        $gd_page = 'location';
1879
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('search')){
1882
-        $gd_page = 'search';
1883
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('add-listing')){
1886
-        $gd_page = 'add-listing';
1887
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1888
-    }
1889
-    elseif(geodir_is_page('author')){
1890
-        $gd_page = 'author';
1891
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1892
-    }
1893
-    elseif(geodir_is_page('login')){
1894
-        $gd_page = 'login';
1895
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1896
-    }
1897
-    elseif(geodir_is_page('listing-success')){
1898
-        $gd_page = 'listing-success';
1899
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1900
-    }
1860
+	$gd_page = '';
1861
+	if(geodir_is_page('home')){
1862
+		$gd_page = 'home';
1863
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1864
+	}
1865
+	elseif(geodir_is_page('detail')){
1866
+		$gd_page = 'detail';
1867
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1868
+	}
1869
+	elseif(geodir_is_page('pt')){
1870
+		$gd_page = 'pt';
1871
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1872
+	}
1873
+	elseif(geodir_is_page('listing')){
1874
+		$gd_page = 'listing';
1875
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1876
+	}
1877
+	elseif(geodir_is_page('location')){
1878
+		$gd_page = 'location';
1879
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1880
+	}
1881
+	elseif(geodir_is_page('search')){
1882
+		$gd_page = 'search';
1883
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1884
+	}
1885
+	elseif(geodir_is_page('add-listing')){
1886
+		$gd_page = 'add-listing';
1887
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1888
+	}
1889
+	elseif(geodir_is_page('author')){
1890
+		$gd_page = 'author';
1891
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1892
+	}
1893
+	elseif(geodir_is_page('login')){
1894
+		$gd_page = 'login';
1895
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1896
+	}
1897
+	elseif(geodir_is_page('listing-success')){
1898
+		$gd_page = 'listing-success';
1899
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1900
+	}
1901 1901
 
1902 1902
 
1903
-    /**
1904
-     * Filter page meta title to replace variables.
1905
-     *
1906
-     * @since 1.5.4
1907
-     * @param string $title The page title including variables.
1908
-     * @param string $gd_page The GeoDirectory page type if any.
1909
-     * @param string $sep The title separator symbol.
1910
-     */
1911
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1903
+	/**
1904
+	 * Filter page meta title to replace variables.
1905
+	 *
1906
+	 * @since 1.5.4
1907
+	 * @param string $title The page title including variables.
1908
+	 * @param string $gd_page The GeoDirectory page type if any.
1909
+	 * @param string $sep The title separator symbol.
1910
+	 */
1911
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1912 1912
 
1913 1913
 }
1914 1914
 
@@ -1924,36 +1924,36 @@  discard block
 block discarded – undo
1924 1924
 function geodir_set_post_attachment()
1925 1925
 {
1926 1926
 
1927
-    if (!get_option('geodir_set_post_attachments')) {
1927
+	if (!get_option('geodir_set_post_attachments')) {
1928 1928
 
1929
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1930
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1929
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1930
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1931 1931
 
1932
-        $all_postypes = geodir_get_posttypes();
1932
+		$all_postypes = geodir_get_posttypes();
1933 1933
 
1934
-        foreach($all_postypes as $post_type){
1935
-            $args = array(
1936
-                'posts_per_page' => -1,
1937
-                'post_type' => $post_type,
1938
-                'post_status' => 'publish');
1934
+		foreach($all_postypes as $post_type){
1935
+			$args = array(
1936
+				'posts_per_page' => -1,
1937
+				'post_type' => $post_type,
1938
+				'post_status' => 'publish');
1939 1939
 
1940
-            $posts_array = get_posts($args);
1940
+			$posts_array = get_posts($args);
1941 1941
 
1942
-            if (!empty($posts_array)) {
1942
+			if (!empty($posts_array)) {
1943 1943
 
1944
-                foreach ($posts_array as $post) {
1944
+				foreach ($posts_array as $post) {
1945 1945
 
1946
-                    geodir_set_wp_featured_image($post->ID);
1946
+					geodir_set_wp_featured_image($post->ID);
1947 1947
 
1948
-                }
1948
+				}
1949 1949
 
1950
-            }
1951
-        }
1950
+			}
1951
+		}
1952 1952
 
1953 1953
 
1954
-        update_option('geodir_set_post_attachments', '1');
1954
+		update_option('geodir_set_post_attachments', '1');
1955 1955
 
1956
-    }
1956
+	}
1957 1957
 
1958 1958
 }
1959 1959
 
@@ -1970,19 +1970,19 @@  discard block
 block discarded – undo
1970 1970
 function geodir_remove_url_seperator()
1971 1971
 {
1972 1972
 
1973
-    if (!get_option('geodir_remove_url_seperator')) {
1973
+	if (!get_option('geodir_remove_url_seperator')) {
1974 1974
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1975
+		if (get_option('geodir_listingurl_separator'))
1976
+			delete_option('geodir_listingurl_separator');
1977 1977
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1978
+		if (get_option('geodir_detailurl_separator'))
1979
+			delete_option('geodir_detailurl_separator');
1980 1980
 
1981
-        flush_rewrite_rules(false);
1981
+		flush_rewrite_rules(false);
1982 1982
 
1983
-        update_option('geodir_remove_url_seperator', '1');
1983
+		update_option('geodir_remove_url_seperator', '1');
1984 1984
 
1985
-    }
1985
+	}
1986 1986
 
1987 1987
 }
1988 1988
 
@@ -1998,19 +1998,19 @@  discard block
 block discarded – undo
1998 1998
  */
1999 1999
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2000 2000
 {
2001
-    foreach ($permalink_arr as $key => $value) {
2001
+	foreach ($permalink_arr as $key => $value) {
2002 2002
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2003
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
+			unset($permalink_arr[$key]);
2005 2005
 
2006
-    }
2006
+	}
2007 2007
 
2008
-    return $permalink_arr;
2008
+	return $permalink_arr;
2009 2009
 
2010 2010
 }
2011 2011
 
2012 2012
 if (!is_admin()) {
2013
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2013
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2014 2014
 }
2015 2015
 /**
2016 2016
  * Set status from draft to publish.
@@ -2023,16 +2023,16 @@  discard block
 block discarded – undo
2023 2023
  */
2024 2024
 function geodir_set_status_draft_to_publish_for_own_post($post)
2025 2025
 {
2026
-    $user_id = get_current_user_id();
2026
+	$user_id = get_current_user_id();
2027 2027
 
2028
-    if(!$user_id){return $post;}
2028
+	if(!$user_id){return $post;}
2029 2029
 
2030
-    $gd_post_types = geodir_get_posttypes();
2030
+	$gd_post_types = geodir_get_posttypes();
2031 2031
 
2032
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2033
-        $post[0]->post_status = 'publish';
2034
-    }
2035
-    return $post;
2032
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2033
+		$post[0]->post_status = 'publish';
2034
+	}
2035
+	return $post;
2036 2036
 }
2037 2037
 
2038 2038
 
@@ -2124,33 +2124,33 @@  discard block
 block discarded – undo
2124 2124
  */
2125 2125
 function geodir_detail_page_tab_headings_change($tabs_arr)
2126 2126
 {
2127
-    global $wpdb;
2127
+	global $wpdb;
2128 2128
 
2129
-    $post_type = geodir_get_current_posttype();
2129
+	$post_type = geodir_get_current_posttype();
2130 2130
 
2131
-    $all_postypes = geodir_get_posttypes();
2131
+	$all_postypes = geodir_get_posttypes();
2132 2132
 
2133
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2133
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2134 2134
 
2135
-        if (array_key_exists('post_video', $tabs_arr)) {
2135
+		if (array_key_exists('post_video', $tabs_arr)) {
2136 2136
 
2137
-            $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)));
2137
+			$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)));
2138 2138
 
2139
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2140
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2141
-        }
2139
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2140
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2141
+		}
2142 2142
 
2143
-        if (array_key_exists('special_offers', $tabs_arr)) {
2143
+		if (array_key_exists('special_offers', $tabs_arr)) {
2144 2144
 
2145
-            $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)));
2145
+			$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)));
2146 2146
 
2147
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2148
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2149
-        }
2147
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2148
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2149
+		}
2150 2150
 
2151
-    }
2151
+	}
2152 2152
 
2153
-    return $tabs_arr;
2153
+	return $tabs_arr;
2154 2154
 
2155 2155
 }
2156 2156
 
@@ -2163,10 +2163,10 @@  discard block
 block discarded – undo
2163 2163
  */
2164 2164
 function geodir_remove_template_redirect_actions()
2165 2165
 {
2166
-    if (geodir_is_page('login')){
2167
-        remove_all_actions('template_redirect');
2168
-        remove_action('init', 'avia_modify_front', 10);
2169
-    }
2166
+	if (geodir_is_page('login')){
2167
+		remove_all_actions('template_redirect');
2168
+		remove_action('init', 'avia_modify_front', 10);
2169
+	}
2170 2170
 }
2171 2171
 
2172 2172
 
@@ -2188,51 +2188,51 @@  discard block
 block discarded – undo
2188 2188
 function geodirectory_before_featured_image_delete($attachment_id)
2189 2189
 {
2190 2190
 
2191
-    global $wpdb, $plugin_prefix;
2191
+	global $wpdb, $plugin_prefix;
2192 2192
 
2193
-    $post_id = get_post_field('post_parent', $attachment_id);
2193
+	$post_id = get_post_field('post_parent', $attachment_id);
2194 2194
 
2195
-    $attachment_url = wp_get_attachment_url($attachment_id);
2195
+	$attachment_url = wp_get_attachment_url($attachment_id);
2196 2196
 
2197
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2197
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2198 2198
 
2199
-        $post_type = get_post_type($post_id);
2199
+		$post_type = get_post_type($post_id);
2200 2200
 
2201
-        $all_postypes = geodir_get_posttypes();
2201
+		$all_postypes = geodir_get_posttypes();
2202 2202
 
2203
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2204
-            return false;
2203
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2204
+			return false;
2205 2205
 
2206
-        $uploads = wp_upload_dir();
2206
+		$uploads = wp_upload_dir();
2207 2207
 
2208
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2208
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2209 2209
 
2210
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2210
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2211 2211
 
2212
-        $wpdb->query(
2213
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2214
-                array($post_id, $split_img_file_path)
2215
-            )
2216
-        );
2212
+		$wpdb->query(
2213
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2214
+				array($post_id, $split_img_file_path)
2215
+			)
2216
+		);
2217 2217
 
2218
-        $attachment_data = $wpdb->get_row(
2219
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2220
-                array($post_id)
2221
-            )
2222
-        );
2218
+		$attachment_data = $wpdb->get_row(
2219
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2220
+				array($post_id)
2221
+			)
2222
+		);
2223 2223
 
2224
-        if (!empty($attachment_data)) {
2225
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2226
-        }
2224
+		if (!empty($attachment_data)) {
2225
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2226
+		}
2227 2227
 
2228 2228
 
2229
-        $table_name = $plugin_prefix . $post_type . '_detail';
2229
+		$table_name = $plugin_prefix . $post_type . '_detail';
2230 2230
 
2231
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2231
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2232 2232
 
2233
-        geodir_set_wp_featured_image($post_id);
2233
+		geodir_set_wp_featured_image($post_id);
2234 2234
 
2235
-    }
2235
+	}
2236 2236
 
2237 2237
 }
2238 2238
 
@@ -2250,79 +2250,79 @@  discard block
 block discarded – undo
2250 2250
 function geodir_temp_set_post_attachment()
2251 2251
 {
2252 2252
 
2253
-    global $wpdb, $plugin_prefix;
2253
+	global $wpdb, $plugin_prefix;
2254 2254
 
2255
-    $all_postypes = geodir_get_posttypes();
2255
+	$all_postypes = geodir_get_posttypes();
2256 2256
 
2257
-    foreach ($all_postypes as $posttype) {
2257
+	foreach ($all_postypes as $posttype) {
2258 2258
 
2259
-        $tablename = $plugin_prefix . $posttype . '_detail';
2259
+		$tablename = $plugin_prefix . $posttype . '_detail';
2260 2260
 
2261
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2261
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2262 2262
 
2263
-        if (!empty($get_post_data)) {
2263
+		if (!empty($get_post_data)) {
2264 2264
 
2265
-            foreach ($get_post_data as $data) {
2265
+			foreach ($get_post_data as $data) {
2266 2266
 
2267
-                $post_id = $data->post_id;
2267
+				$post_id = $data->post_id;
2268 2268
 
2269
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2269
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2270 2270
 
2271
-                if (!empty($attachment_data)) {
2271
+				if (!empty($attachment_data)) {
2272 2272
 
2273
-                    foreach ($attachment_data as $attach) {
2273
+					foreach ($attachment_data as $attach) {
2274 2274
 
2275
-                        $file_info = pathinfo($attach->file);
2275
+						$file_info = pathinfo($attach->file);
2276 2276
 
2277
-                        $sub_dir = '';
2278
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2279
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2277
+						$sub_dir = '';
2278
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2279
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2280 2280
 
2281
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2282
-                        $uploads_path = $uploads['basedir'];
2281
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2282
+						$uploads_path = $uploads['basedir'];
2283 2283
 
2284
-                        $file_name = $file_info['basename'];
2284
+						$file_name = $file_info['basename'];
2285 2285
 
2286
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2286
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2287 2287
 
2288
-                        if (!file_exists($img_arr['path'])) {
2288
+						if (!file_exists($img_arr['path'])) {
2289 2289
 
2290
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2290
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2291 2291
 
2292
-                        }
2292
+						}
2293 2293
 
2294
-                    }
2294
+					}
2295 2295
 
2296
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2296
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2297 2297
 
2298
-                    if (!empty($attachment_data)) {
2298
+					if (!empty($attachment_data)) {
2299 2299
 
2300
-                        if ($attachment_data->ID)
2301
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2300
+						if ($attachment_data->ID)
2301
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2302 2302
 
2303
-                    } else {
2303
+					} else {
2304 2304
 
2305
-                        if (has_post_thumbnail($post_id)) {
2305
+						if (has_post_thumbnail($post_id)) {
2306 2306
 
2307
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2307
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2308 2308
 
2309
-                            wp_delete_attachment($post_thumbnail_id);
2309
+							wp_delete_attachment($post_thumbnail_id);
2310 2310
 
2311
-                        }
2311
+						}
2312 2312
 
2313
-                    }
2313
+					}
2314 2314
 
2315
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2315
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2316 2316
 
2317
-                    geodir_set_wp_featured_image($post_id);
2317
+					geodir_set_wp_featured_image($post_id);
2318 2318
 
2319
-                }
2319
+				}
2320 2320
 
2321
-            }
2321
+			}
2322 2322
 
2323
-        }
2323
+		}
2324 2324
 
2325
-    }
2325
+	}
2326 2326
 
2327 2327
 }
2328 2328
 
@@ -2340,9 +2340,9 @@  discard block
 block discarded – undo
2340 2340
 function geodir_default_rating_star_icon()
2341 2341
 {
2342 2342
 
2343
-    if (!get_option('geodir_default_rating_star_icon')) {
2344
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2345
-    }
2343
+	if (!get_option('geodir_default_rating_star_icon')) {
2344
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2345
+	}
2346 2346
 
2347 2347
 }
2348 2348
 
@@ -2360,25 +2360,25 @@  discard block
 block discarded – undo
2360 2360
  */
2361 2361
 function geodir_user_post_listing_count($user_id = 0)
2362 2362
 {
2363
-    global $wpdb, $plugin_prefix, $current_user;
2364
-    if(!$user_id){
2365
-        $user_id = $current_user->ID;
2366
-    }
2363
+	global $wpdb, $plugin_prefix, $current_user;
2364
+	if(!$user_id){
2365
+		$user_id = $current_user->ID;
2366
+	}
2367 2367
 
2368
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2368
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2369 2369
 
2370
-    $user_listing = array();
2371
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2372
-        foreach ($all_posts as $ptype) {
2373
-            $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' OR post_status = 'pending' )");
2370
+	$user_listing = array();
2371
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2372
+		foreach ($all_posts as $ptype) {
2373
+			$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' OR post_status = 'pending' )");
2374 2374
 
2375
-            if ($total_posts > 0) {
2376
-                $user_listing[$ptype] = $total_posts;
2377
-            }
2378
-        }
2379
-    }
2375
+			if ($total_posts > 0) {
2376
+				$user_listing[$ptype] = $total_posts;
2377
+			}
2378
+		}
2379
+	}
2380 2380
 
2381
-    return $user_listing;
2381
+	return $user_listing;
2382 2382
 }
2383 2383
 
2384 2384
 
@@ -2398,189 +2398,189 @@  discard block
 block discarded – undo
2398 2398
  */
2399 2399
 function geodir_detail_page_custom_field_tab($tabs_arr)
2400 2400
 {
2401
-    global $post;
2402
-
2403
-    $post_type = geodir_get_current_posttype();
2404
-    $all_postypes = geodir_get_posttypes();
2405
-
2406
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2407
-        $package_info = array();
2408
-        $package_info = geodir_post_package_info($package_info, $post);
2409
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2410
-        $fields_location = 'owntab';
2411
-
2412
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2413
-        //remove video and special offers if it is already set to show
2414
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2415
-            $unset_video = true;
2416
-        }
2417
-
2418
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2419
-            $unset_special_offers = true;
2420
-        }
2421
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2422
-            foreach($custom_fields as $key => $custom_field){
2423
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2424
-                    unset($custom_fields[$key]);
2425
-                }
2426
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2427
-                    unset($custom_fields[$key]);
2428
-                }
2429
-            }
2430
-        }
2431
-
2432
-
2433
-        if (!empty($custom_fields)) {
2434
-            $parse_custom_fields = array();
2435
-            foreach ($custom_fields as $field) {
2436
-                $field = stripslashes_deep($field); // strip slashes
2437
-                $type = $field;
2438
-                $field_name = $field['htmlvar_name'];
2439
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2440
-                    $post->{$field_name} = $_REQUEST[$field_name];
2441
-                }
2401
+	global $post;
2442 2402
 
2443
-                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'))) {
2444
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2445
-                        continue;
2446
-                    }
2403
+	$post_type = geodir_get_current_posttype();
2404
+	$all_postypes = geodir_get_posttypes();
2447 2405
 
2448
-                    $parse_custom_fields[] = $field;
2449
-                }
2450
-            }
2451
-            $custom_fields = $parse_custom_fields;
2452
-        }
2453
-        //print_r($custom_fields);
2454
-        if (!empty($custom_fields)) {
2406
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2407
+		$package_info = array();
2408
+		$package_info = geodir_post_package_info($package_info, $post);
2409
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2410
+		$fields_location = 'owntab';
2455 2411
 
2456
-            global $field_set_start;
2412
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2413
+		//remove video and special offers if it is already set to show
2414
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2415
+			$unset_video = true;
2416
+		}
2457 2417
 
2458
-            $post = stripslashes_deep($post); // strip slashes
2459
-            
2460
-            $field_set_start = 0;
2461
-            $fieldset_count = 0;
2462
-            $fieldset = '';
2463
-            $total_fields = count($custom_fields);
2464
-            $count_field = 0;
2465
-            $fieldset_arr = array();
2466
-            $i = 0;
2467
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2468
-
2469
-            foreach ($custom_fields as $field) {
2470
-                $count_field++;
2471
-                $field_name = $field['htmlvar_name'];
2472
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2473
-                    $post->{$field_name} = $_REQUEST[$field_name];
2474
-                }
2418
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2419
+			$unset_special_offers = true;
2420
+		}
2421
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2422
+			foreach($custom_fields as $key => $custom_field){
2423
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2424
+					unset($custom_fields[$key]);
2425
+				}
2426
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2427
+					unset($custom_fields[$key]);
2428
+				}
2429
+			}
2430
+		}
2475 2431
 
2476
-                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'))) {
2477
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2478
-                    $site_title = trim($field['site_title']);
2479
-                    $type = $field;
2480
-                    $variables_array = array();
2481 2432
 
2482
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2483
-                        continue;
2484
-                    }
2433
+		if (!empty($custom_fields)) {
2434
+			$parse_custom_fields = array();
2435
+			foreach ($custom_fields as $field) {
2436
+				$field = stripslashes_deep($field); // strip slashes
2437
+				$type = $field;
2438
+				$field_name = $field['htmlvar_name'];
2439
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2440
+					$post->{$field_name} = $_REQUEST[$field_name];
2441
+				}
2485 2442
 
2486
-                    if ($type['type'] != 'fieldset') {
2487
-                        $i++;
2488
-                        $variables_array['post_id'] = $post->ID;
2489
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2490
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2491
-
2492
-                    }else{
2493
-                        $i = 0;
2494
-                        $fieldset_count++;
2495
-                        $field_set_start = 1;
2496
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2497
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2498
-                    }
2443
+				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'))) {
2444
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2445
+						continue;
2446
+					}
2499 2447
 
2448
+					$parse_custom_fields[] = $field;
2449
+				}
2450
+			}
2451
+			$custom_fields = $parse_custom_fields;
2452
+		}
2453
+		//print_r($custom_fields);
2454
+		if (!empty($custom_fields)) {
2500 2455
 
2501
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2502
-                    $type = stripslashes_deep($type); // strip slashes
2503
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2504
-                    $html = '';
2505
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2506
-                    if($html_var=='post'){$html_var='post_address';}
2507
-                    $field_icon = geodir_field_icon_proccess($type);
2508
-                    $filed_type = $type['type'];
2509
-
2510
-                    /**
2511
-                     * Filter the output for custom fields.
2512
-                     *
2513
-                     * Here we can remove or add new functions depending on the field type.
2514
-                     *
2515
-                     * @param string $html The html to be filtered (blank).
2516
-                     * @param string $fields_location The location the field is to be show.
2517
-                     * @param array $type The array of field values.
2518
-                     */
2519
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2520
-
2521
-
2522
-                    /**
2523
-                     * Filter custom field output in tab.
2524
-                     *
2525
-                     * @since 1.5.6
2526
-                     *
2527
-                     * @param string $html_var The HTML variable name for the field.
2528
-                     * @param string $html Custom field unfiltered HTML.
2529
-                     * @param array $variables_array Custom field variables array.
2530
-                     */
2531
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2532
-
2533
-                    $fieldset_html = '';
2534
-                    if ($field_set_start == 1) {
2535
-                        $add_html = false;
2536
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2537
-                            if ($fieldset != '') {
2538
-                                $add_html = true;
2539
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2540
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2541
-                            }
2542
-                            $fieldset_html = $fieldset;
2543
-                            $fieldset = '';
2544
-                        } else {
2545
-                            $fieldset .= $html;
2546
-                            if ($total_fields == $count_field && $fieldset != '') {
2547
-                                $add_html = true;
2548
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2549
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2550
-                                $fieldset_html = $fieldset;
2551
-                            }
2552
-                        }
2456
+			global $field_set_start;
2553 2457
 
2554
-                        if ($add_html) {
2555
-                            $tabs_arr[$htmlvar_name] = array(
2556
-                                'heading_text' => __($label, 'geodirectory'),
2557
-                                'is_active_tab' => false,
2558
-                                /**
2559
-                                 * Filter if a custom field should be displayed on the details page tab.
2560
-                                 *
2561
-                                 * @since 1.0.0
2562
-                                 * @param string $htmlvar_name The field HTML var name.
2563
-                                 */
2564
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2565
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2566
-                            );
2567
-                        }
2568
-                    } else {
2569
-                        if ($html != '') {
2570
-                            $tabs_arr[$html_var] = array(
2571
-                                'heading_text' => __($label, 'geodirectory'),
2572
-                                'is_active_tab' => false,
2573
-                                /** This action is documented in geodirectory_hooks_actions.php */
2574
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2575
-                                'tab_content' => $html
2576
-                            );
2577
-                        }
2578
-                    }
2579
-                }
2580
-            }
2581
-        }
2582
-    }
2583
-    return $tabs_arr;
2458
+			$post = stripslashes_deep($post); // strip slashes
2459
+            
2460
+			$field_set_start = 0;
2461
+			$fieldset_count = 0;
2462
+			$fieldset = '';
2463
+			$total_fields = count($custom_fields);
2464
+			$count_field = 0;
2465
+			$fieldset_arr = array();
2466
+			$i = 0;
2467
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2468
+
2469
+			foreach ($custom_fields as $field) {
2470
+				$count_field++;
2471
+				$field_name = $field['htmlvar_name'];
2472
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2473
+					$post->{$field_name} = $_REQUEST[$field_name];
2474
+				}
2475
+
2476
+				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'))) {
2477
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2478
+					$site_title = trim($field['site_title']);
2479
+					$type = $field;
2480
+					$variables_array = array();
2481
+
2482
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2483
+						continue;
2484
+					}
2485
+
2486
+					if ($type['type'] != 'fieldset') {
2487
+						$i++;
2488
+						$variables_array['post_id'] = $post->ID;
2489
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2490
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2491
+
2492
+					}else{
2493
+						$i = 0;
2494
+						$fieldset_count++;
2495
+						$field_set_start = 1;
2496
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2497
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2498
+					}
2499
+
2500
+
2501
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2502
+					$type = stripslashes_deep($type); // strip slashes
2503
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2504
+					$html = '';
2505
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2506
+					if($html_var=='post'){$html_var='post_address';}
2507
+					$field_icon = geodir_field_icon_proccess($type);
2508
+					$filed_type = $type['type'];
2509
+
2510
+					/**
2511
+					 * Filter the output for custom fields.
2512
+					 *
2513
+					 * Here we can remove or add new functions depending on the field type.
2514
+					 *
2515
+					 * @param string $html The html to be filtered (blank).
2516
+					 * @param string $fields_location The location the field is to be show.
2517
+					 * @param array $type The array of field values.
2518
+					 */
2519
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2520
+
2521
+
2522
+					/**
2523
+					 * Filter custom field output in tab.
2524
+					 *
2525
+					 * @since 1.5.6
2526
+					 *
2527
+					 * @param string $html_var The HTML variable name for the field.
2528
+					 * @param string $html Custom field unfiltered HTML.
2529
+					 * @param array $variables_array Custom field variables array.
2530
+					 */
2531
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2532
+
2533
+					$fieldset_html = '';
2534
+					if ($field_set_start == 1) {
2535
+						$add_html = false;
2536
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2537
+							if ($fieldset != '') {
2538
+								$add_html = true;
2539
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2540
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2541
+							}
2542
+							$fieldset_html = $fieldset;
2543
+							$fieldset = '';
2544
+						} else {
2545
+							$fieldset .= $html;
2546
+							if ($total_fields == $count_field && $fieldset != '') {
2547
+								$add_html = true;
2548
+								$label = $fieldset_arr[$fieldset_count]['label'];
2549
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2550
+								$fieldset_html = $fieldset;
2551
+							}
2552
+						}
2553
+
2554
+						if ($add_html) {
2555
+							$tabs_arr[$htmlvar_name] = array(
2556
+								'heading_text' => __($label, 'geodirectory'),
2557
+								'is_active_tab' => false,
2558
+								/**
2559
+								 * Filter if a custom field should be displayed on the details page tab.
2560
+								 *
2561
+								 * @since 1.0.0
2562
+								 * @param string $htmlvar_name The field HTML var name.
2563
+								 */
2564
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2565
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2566
+							);
2567
+						}
2568
+					} else {
2569
+						if ($html != '') {
2570
+							$tabs_arr[$html_var] = array(
2571
+								'heading_text' => __($label, 'geodirectory'),
2572
+								'is_active_tab' => false,
2573
+								/** This action is documented in geodirectory_hooks_actions.php */
2574
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2575
+								'tab_content' => $html
2576
+							);
2577
+						}
2578
+					}
2579
+				}
2580
+			}
2581
+		}
2582
+	}
2583
+	return $tabs_arr;
2584 2584
 }
2585 2585
 
2586 2586
 /* display add listing page for wpml */
@@ -2604,41 +2604,41 @@  discard block
 block discarded – undo
2604 2604
  */
2605 2605
 function geodir_add_post_status_author_page()
2606 2606
 {
2607
-    global $wpdb, $post;
2608
-
2609
-    $html = '';
2610
-    if (get_current_user_id()) {
2611
-
2612
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2613
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2614
-
2615
-            // 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.
2616
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2617
-            $status = "<strong>(";
2618
-            $status_icon = '<i class="fa fa-play"></i>';
2619
-            if ($real_status == 'publish') {
2620
-                $status .= __('Published', 'geodirectory');
2621
-            }elseif ($real_status == 'pending') {
2622
-                $status .= __('Awaiting Review', 'geodirectory');
2623
-            } else {
2624
-                $status .= __('Not published', 'geodirectory');
2625
-                $status_icon = '<i class="fa fa-pause"></i>';
2626
-            }
2627
-            $status .= ")</strong>";
2607
+	global $wpdb, $post;
2608
+
2609
+	$html = '';
2610
+	if (get_current_user_id()) {
2611
+
2612
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2613
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2614
+
2615
+			// 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.
2616
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2617
+			$status = "<strong>(";
2618
+			$status_icon = '<i class="fa fa-play"></i>';
2619
+			if ($real_status == 'publish') {
2620
+				$status .= __('Published', 'geodirectory');
2621
+			}elseif ($real_status == 'pending') {
2622
+				$status .= __('Awaiting Review', 'geodirectory');
2623
+			} else {
2624
+				$status .= __('Not published', 'geodirectory');
2625
+				$status_icon = '<i class="fa fa-pause"></i>';
2626
+			}
2627
+			$status .= ")</strong>";
2628 2628
 
2629
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2630
-        }
2631
-    }
2629
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2630
+		}
2631
+	}
2632 2632
 
2633
-    if ($html != '') {
2634
-        /**
2635
-         * Filter the post status text on the author page.
2636
-         *
2637
-         * @since 1.0.0
2638
-         * @param string $html The HTML of the status.
2639
-         */
2640
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2641
-    }
2633
+	if ($html != '') {
2634
+		/**
2635
+		 * Filter the post status text on the author page.
2636
+		 *
2637
+		 * @since 1.0.0
2638
+		 * @param string $html The HTML of the status.
2639
+		 */
2640
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2641
+	}
2642 2642
 
2643 2643
 
2644 2644
 }
@@ -2652,9 +2652,9 @@  discard block
 block discarded – undo
2652 2652
  * @package GeoDirectory
2653 2653
  */
2654 2654
 function geodir_init_no_rating() {
2655
-    if (geodir_rating_disabled_post_types()) {
2656
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2657
-    }
2655
+	if (geodir_rating_disabled_post_types()) {
2656
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2657
+	}
2658 2658
 }
2659 2659
 
2660 2660
 /**
@@ -2668,22 +2668,22 @@  discard block
 block discarded – undo
2668 2668
  * @return array Modified sort options array.
2669 2669
  */
2670 2670
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2671
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2672
-        $new_options = array();
2671
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2672
+		$new_options = array();
2673 2673
         
2674
-        if (!empty($options)) {
2675
-            foreach ($options as $option) {
2676
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2677
-                    continue;
2678
-                }
2679
-                $new_options[] = $option;
2680
-            }
2674
+		if (!empty($options)) {
2675
+			foreach ($options as $option) {
2676
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2677
+					continue;
2678
+				}
2679
+				$new_options[] = $option;
2680
+			}
2681 2681
 
2682
-            $options = $new_options;
2683
-        }
2684
-    }
2682
+			$options = $new_options;
2683
+		}
2684
+	}
2685 2685
 
2686
-    return $options;
2686
+	return $options;
2687 2687
 }
2688 2688
 
2689 2689
 /**
@@ -2695,9 +2695,9 @@  discard block
 block discarded – undo
2695 2695
  * @return array Modified class array.
2696 2696
  */
2697 2697
 function geodir_body_class_active_map($classes = array()) {
2698
-    $classes[] = 'gd-map-' . geodir_map_name();
2698
+	$classes[] = 'gd-map-' . geodir_map_name();
2699 2699
 
2700
-    return $classes;
2700
+	return $classes;
2701 2701
 }
2702 2702
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2703 2703
 
@@ -2710,9 +2710,9 @@  discard block
 block discarded – undo
2710 2710
  * @return string Modified class string.
2711 2711
  */
2712 2712
 function geodir_admin_body_class_active_map($class = '') {    
2713
-    $class .= ' gd-map-' . geodir_map_name();
2713
+	$class .= ' gd-map-' . geodir_map_name();
2714 2714
 
2715
-    return $class;
2715
+	return $class;
2716 2716
 }
2717 2717
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2718 2718
 
@@ -2730,36 +2730,36 @@  discard block
 block discarded – undo
2730 2730
  * @return array Translation texts.
2731 2731
  */
2732 2732
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2733
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2734
-
2735
-    $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');
2736
-
2737
-    /**
2738
-     * Filters the geodirectory option names that requires to add for translation.
2739
-     *
2740
-     * @since 1.5.7
2741
-     * @package GeoDirectory
2742
-     *
2743
-     * @param  array $gd_options Array of option names.
2744
-     */
2745
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2746
-    $gd_options = array_unique($gd_options);
2747
-
2748
-    if (!empty($gd_options)) {
2749
-        foreach ($gd_options as $gd_option) {
2750
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2751
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2733
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2734
+
2735
+	$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');
2736
+
2737
+	/**
2738
+	 * Filters the geodirectory option names that requires to add for translation.
2739
+	 *
2740
+	 * @since 1.5.7
2741
+	 * @package GeoDirectory
2742
+	 *
2743
+	 * @param  array $gd_options Array of option names.
2744
+	 */
2745
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2746
+	$gd_options = array_unique($gd_options);
2747
+
2748
+	if (!empty($gd_options)) {
2749
+		foreach ($gd_options as $gd_option) {
2750
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2751
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2752 2752
                 
2753
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2754
-                    $translation_texts[] = stripslashes_deep($option_value);
2755
-                }
2756
-            }
2757
-        }
2758
-    }
2753
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2754
+					$translation_texts[] = stripslashes_deep($option_value);
2755
+				}
2756
+			}
2757
+		}
2758
+	}
2759 2759
 
2760
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2760
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2761 2761
 
2762
-    return $translation_texts;
2762
+	return $translation_texts;
2763 2763
 }
2764 2764
 
2765 2765
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2773,15 +2773,15 @@  discard block
 block discarded – undo
2773 2773
 
2774 2774
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2775 2775
 function gd_get_comments_link($comments_link, $post_id) {
2776
-    $post_type = get_post_type($post_id);
2776
+	$post_type = get_post_type($post_id);
2777 2777
 
2778
-    $all_postypes = geodir_get_posttypes();
2779
-    if (in_array($post_type, $all_postypes)) {
2780
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2781
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2782
-    }
2778
+	$all_postypes = geodir_get_posttypes();
2779
+	if (in_array($post_type, $all_postypes)) {
2780
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2781
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2782
+	}
2783 2783
 
2784
-    return $comments_link;
2784
+	return $comments_link;
2785 2785
 }
2786 2786
 
2787 2787
 
@@ -2799,11 +2799,11 @@  discard block
 block discarded – undo
2799 2799
 function geodir_add_nav_menu_class( $args )
2800 2800
 {
2801 2801
 
2802
-        if(isset($args['menu_class'])){
2803
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2804
-        }
2802
+		if(isset($args['menu_class'])){
2803
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2804
+		}
2805 2805
     
2806
-    return $args;
2806
+	return $args;
2807 2807
 }
2808 2808
 
2809 2809
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2820,15 +2820,15 @@  discard block
 block discarded – undo
2820 2820
  * @return string Filtered locale ID.
2821 2821
  */
2822 2822
 function geodir_wpml_filter_locale($locale) {
2823
-    global $sitepress;
2823
+	global $sitepress;
2824 2824
     
2825
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2825
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2826 2826
     
2827
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2828
-        $locale = $sitepress->get_locale($current_lang);
2829
-    }
2827
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2828
+		$locale = $sitepress->get_locale($current_lang);
2829
+	}
2830 2830
     
2831
-    return $locale;
2831
+	return $locale;
2832 2832
 }
2833 2833
 
2834 2834
 /**
@@ -2838,19 +2838,19 @@  discard block
 block discarded – undo
2838 2838
  * @package GeoDirectory
2839 2839
  */
2840 2840
 function geodir_wpml_set_filter() {
2841
-    if (geodir_is_wpml()) {
2842
-        global $sitepress;
2841
+	if (geodir_is_wpml()) {
2842
+		global $sitepress;
2843 2843
         
2844
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2845
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2846
-        }
2844
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2845
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2846
+		}
2847 2847
         
2848
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2849
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2850
-        if (is_admin()) {
2851
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2852
-        }
2853
-    }
2848
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2849
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2850
+		if (is_admin()) {
2851
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2852
+		}
2853
+	}
2854 2854
 }
2855 2855
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2856 2856
 
@@ -2863,38 +2863,38 @@  discard block
 block discarded – undo
2863 2863
  * @return array Filtered languages.
2864 2864
  */
2865 2865
 function geodir_wpml_filter_ls_languages($languages) {    
2866
-    if (geodir_is_geodir_page()) {        
2867
-        $keep_vars = array();
2866
+	if (geodir_is_geodir_page()) {        
2867
+		$keep_vars = array();
2868 2868
         
2869
-        if (geodir_is_page('add-listing')) {
2870
-            $keep_vars = array('listing_type', 'package_id');
2871
-        } else if (geodir_is_page('search')) {
2872
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2873
-        } else if (geodir_is_page('author')) {
2874
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2875
-        } else if (geodir_is_page('login')) {
2876
-            $keep_vars = array('forgot', 'signup');
2877
-        }        
2869
+		if (geodir_is_page('add-listing')) {
2870
+			$keep_vars = array('listing_type', 'package_id');
2871
+		} else if (geodir_is_page('search')) {
2872
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2873
+		} else if (geodir_is_page('author')) {
2874
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2875
+		} else if (geodir_is_page('login')) {
2876
+			$keep_vars = array('forgot', 'signup');
2877
+		}        
2878 2878
         
2879
-        if (!empty($keep_vars)) {
2880
-            foreach ( $languages as $code => $url) {
2881
-                $filter_url = $url['url'];
2879
+		if (!empty($keep_vars)) {
2880
+			foreach ( $languages as $code => $url) {
2881
+				$filter_url = $url['url'];
2882 2882
                 
2883
-                foreach ($keep_vars as $var) {
2884
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2885
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2886
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2887
-                    }
2888
-                }
2883
+				foreach ($keep_vars as $var) {
2884
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2885
+						$filter_url = remove_query_arg(array($var), $filter_url);
2886
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2887
+					}
2888
+				}
2889 2889
                 
2890
-                if ($filter_url != $url['url']) {
2891
-                    $languages[$code]['url'] = $filter_url;
2892
-                }
2893
-            }
2894
-        }
2895
-    }
2890
+				if ($filter_url != $url['url']) {
2891
+					$languages[$code]['url'] = $filter_url;
2892
+				}
2893
+			}
2894
+		}
2895
+	}
2896 2896
 
2897
-    return $languages;
2897
+	return $languages;
2898 2898
 }
2899 2899
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2900 2900
 
@@ -2905,18 +2905,18 @@  discard block
 block discarded – undo
2905 2905
  *
2906 2906
  */
2907 2907
 function geodir_remove_yoast_seo_metas(){
2908
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2909
-        $wpseo = WPSEO_Frontend::get_instance();
2908
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2909
+		$wpseo = WPSEO_Frontend::get_instance();
2910 2910
         
2911
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2912
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2913
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2914
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2915
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2916
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2911
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2912
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2913
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2914
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2915
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2916
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2917 2917
         
2918
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2919
-    }
2918
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2919
+	}
2920 2920
 }
2921 2921
 
2922 2922
 /**
@@ -2930,20 +2930,20 @@  discard block
 block discarded – undo
2930 2930
  *
2931 2931
  */
2932 2932
  function geodir_wpml_ajax_set_guest_lang() {    
2933
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2934
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2935
-            global $sitepress;
2933
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2934
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2935
+			global $sitepress;
2936 2936
             
2937
-            $referer = wp_get_referer();
2937
+			$referer = wp_get_referer();
2938 2938
             
2939
-            $current_lang = $sitepress->get_current_language();
2940
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2939
+			$current_lang = $sitepress->get_current_language();
2940
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2941 2941
             
2942
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2943
-                $_GET['lang'] = $referrer_lang;
2944
-            }
2945
-        }
2946
-    }
2942
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2943
+				$_GET['lang'] = $referrer_lang;
2944
+			}
2945
+		}
2946
+	}
2947 2947
 }
2948 2948
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2949 2949
 
@@ -2955,36 +2955,36 @@  discard block
 block discarded – undo
2955 2955
  * @param object $wp The WordPress object.
2956 2956
  */
2957 2957
 function geodir_check_redirect($wp) {
2958
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2959
-        $current_url = geodir_curPageURL();
2960
-        $search = 'czech-republic';
2961
-        $replace = 'czechia';        
2958
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2959
+		$current_url = geodir_curPageURL();
2960
+		$search = 'czech-republic';
2961
+		$replace = 'czechia';        
2962 2962
         
2963
-        $has_slash = substr($current_url, -1);
2964
-        if ($has_slash != "/") {
2965
-            $current_url .= '/';
2966
-        }
2963
+		$has_slash = substr($current_url, -1);
2964
+		if ($has_slash != "/") {
2965
+			$current_url .= '/';
2966
+		}
2967 2967
         
2968
-        $redirect = false;
2969
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2970
-            $redirect = true;
2971
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2972
-        }
2968
+		$redirect = false;
2969
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2970
+			$redirect = true;
2971
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2972
+		}
2973 2973
         
2974
-        if ($has_slash != "/") {
2975
-            $current_url = trim($current_url, '/');
2976
-        }
2974
+		if ($has_slash != "/") {
2975
+			$current_url = trim($current_url, '/');
2976
+		}
2977 2977
         
2978
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2979
-            $redirect = true;
2980
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2981
-        }
2982
-
2983
-        if ($redirect) {
2984
-            wp_redirect($current_url);
2985
-            exit;
2986
-        }
2987
-    }
2978
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2979
+			$redirect = true;
2980
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2981
+		}
2982
+
2983
+		if ($redirect) {
2984
+			wp_redirect($current_url);
2985
+			exit;
2986
+		}
2987
+	}
2988 2988
 }
2989 2989
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2990 2990
 
@@ -3004,50 +3004,50 @@  discard block
 block discarded – undo
3004 3004
  * @param string $original_slug The original post slug.
3005 3005
  */
3006 3006
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3007
-    global $wpdb, $sitepress;
3007
+	global $wpdb, $sitepress;
3008 3008
     
3009
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3010
-        $wpml_post_join = "";
3011
-        $wpml_post_where = "";
3012
-        $wpml_term_join = "";
3013
-        $wpml_term_where = "";
3009
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3010
+		$wpml_post_join = "";
3011
+		$wpml_post_where = "";
3012
+		$wpml_term_join = "";
3013
+		$wpml_term_where = "";
3014 3014
         
3015
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3016
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3017
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3018
-            if (!$post_language) {
3019
-                $post_language = $sitepress->get_current_language();
3020
-            }
3015
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3016
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3017
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3018
+			if (!$post_language) {
3019
+				$post_language = $sitepress->get_current_language();
3020
+			}
3021 3021
             
3022
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3023
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3022
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3023
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3024 3024
             
3025
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3026
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3027
-        }
3025
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3026
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3027
+		}
3028 3028
 
3029
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3029
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3030 3030
 
3031
-        if ( $term_slug_check ) {
3032
-            $suffix = 1;
3031
+		if ( $term_slug_check ) {
3032
+			$suffix = 1;
3033 3033
             
3034
-            do {
3035
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3034
+			do {
3035
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3036 3036
                 
3037
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3037
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3038 3038
                 
3039
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3039
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3040 3040
                 
3041
-                $term_slug_check = $term_check || $post_check;
3041
+				$term_slug_check = $term_check || $post_check;
3042 3042
                 
3043
-                $suffix++;
3044
-            } while ( $term_slug_check );
3043
+				$suffix++;
3044
+			} while ( $term_slug_check );
3045 3045
             
3046
-            $slug = $alt_slug;
3047
-        }
3048
-    }
3046
+			$slug = $alt_slug;
3047
+		}
3048
+	}
3049 3049
     
3050
-    return $slug;
3050
+	return $slug;
3051 3051
 }
3052 3052
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3053 3053
 
@@ -3067,47 +3067,47 @@  discard block
 block discarded – undo
3067 3067
  * @return bool true when exists. false when not exists.
3068 3068
  */
3069 3069
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3070
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3070
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3071 3071
     
3072
-    if ( $slug_exists ) {
3073
-        return $slug_exists;
3074
-    }
3072
+	if ( $slug_exists ) {
3073
+		return $slug_exists;
3074
+	}
3075 3075
     
3076
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3077
-        $taxonomy = $gd_term_taxonomy[$term_id];
3078
-    } else {
3079
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3080
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3081
-    }
3076
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3077
+		$taxonomy = $gd_term_taxonomy[$term_id];
3078
+	} else {
3079
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3080
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3081
+	}
3082 3082
     
3083
-    if ( empty($taxonomy) ) {
3084
-        return $slug_exists;
3085
-    }
3083
+	if ( empty($taxonomy) ) {
3084
+		return $slug_exists;
3085
+	}
3086 3086
     
3087
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3088
-        $post_type = $gd_term_post_type[$term_id];
3089
-    } else {
3090
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3091
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3092
-    }
3087
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3088
+		$post_type = $gd_term_post_type[$term_id];
3089
+	} else {
3090
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3091
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3092
+	}
3093 3093
     
3094
-    $wpml_post_join = "";
3095
-    $wpml_post_where = "";
3094
+	$wpml_post_join = "";
3095
+	$wpml_post_where = "";
3096 3096
     
3097
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3098
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3099
-        if (!$term_language) {
3100
-            $term_language = $sitepress->get_current_language();
3101
-        }
3097
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3098
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3099
+		if (!$term_language) {
3100
+			$term_language = $sitepress->get_current_language();
3101
+		}
3102 3102
         
3103
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3104
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3105
-    }
3103
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3104
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3105
+	}
3106 3106
     
3107
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3108
-        $slug_exists = true;
3109
-    }
3107
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3108
+		$slug_exists = true;
3109
+	}
3110 3110
 
3111
-    return $slug_exists;
3111
+	return $slug_exists;
3112 3112
 }
3113 3113
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3114 3114
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 1 patch
Indentation   +445 added lines, -445 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Enable map cache if set
10 10
 if(get_option('geodir_enable_map_cache')){
11
-    add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
-    add_filter('geodir_markers_json','geodir_save_map_cache',10);
11
+	add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
+	add_filter('geodir_markers_json','geodir_save_map_cache',10);
13 13
 }
14 14
 
15 15
 
@@ -23,56 +23,56 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function geodir_get_map_cache($cache){
25 25
 
26
-    // if a search is going on then dont even try to check for cache.
27
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
-        return $cache;
29
-    }
26
+	// if a search is going on then dont even try to check for cache.
27
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
+		return $cache;
29
+	}
30 30
 
31
-    $url_params = array();
32
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
31
+	$url_params = array();
32
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
45 45
 
46
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
46
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
47 47
 
48
-    $blog_id = get_current_blog_id();
49
-    if($blog_id>1){
50
-        $file_name = $blog_id."_".$file_name;
51
-    }
48
+	$blog_id = get_current_blog_id();
49
+	if($blog_id>1){
50
+		$file_name = $blog_id."_".$file_name;
51
+	}
52 52
 
53
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
53
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
54 54
 
55 55
 
56
-    if(file_exists($file_path.$file_name.".json")){
56
+	if(file_exists($file_path.$file_name.".json")){
57 57
 
58 58
 
59
-        // do the cache delete stuff
60
-        $cache_time = get_option('geodir_map_cache');
61
-        if(!$cache_time){
62
-            $cache_time = time();
63
-            update_option('geodir_map_cache', $cache_time);
64
-        }
59
+		// do the cache delete stuff
60
+		$cache_time = get_option('geodir_map_cache');
61
+		if(!$cache_time){
62
+			$cache_time = time();
63
+			update_option('geodir_map_cache', $cache_time);
64
+		}
65 65
 
66
-        if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
67
-            geodir_delete_map_cache();
68
-        }
66
+		if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
67
+			geodir_delete_map_cache();
68
+		}
69 69
 
70
-        ob_start();
71
-        readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
72
-        return ob_get_clean();
73
-    }
70
+		ob_start();
71
+		readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
72
+		return ob_get_clean();
73
+	}
74 74
 
75
-    return $cache;
75
+	return $cache;
76 76
 }
77 77
 
78 78
 
@@ -85,109 +85,109 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_save_map_cache($map_json){
87 87
 
88
-    // if a search is going on then dont even try to check for cache.
89
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
90
-        return $map_json;
91
-    }
92
-
93
-    $url_params = array();
94
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
95
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
96
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
97
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
98
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
99
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
100
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
101
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
102
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
103
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
104
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
105
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
106
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
107
-
108
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
109
-
110
-    $blog_id = get_current_blog_id();
111
-    if($blog_id>1){
112
-        $file_name = $blog_id."_".$file_name;
113
-    }
114
-
115
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
116
-
117
-
118
-    global $wp_filesystem;
119
-    if (empty($wp_filesystem)) {
120
-        require_once (ABSPATH . '/wp-admin/includes/file.php');
121
-        WP_Filesystem();
122
-    }
123
-    $wp_filesystem->put_contents(
124
-        $file_path.$file_name.".json",
125
-        $map_json,
126
-        FS_CHMOD_FILE // predefined mode settings for WP files
127
-    );
128
-
129
-
130
-    return $map_json;
88
+	// if a search is going on then dont even try to check for cache.
89
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
90
+		return $map_json;
91
+	}
92
+
93
+	$url_params = array();
94
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
95
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
96
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
97
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
98
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
99
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
100
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
101
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
102
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
103
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
104
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
105
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
106
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
107
+
108
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
109
+
110
+	$blog_id = get_current_blog_id();
111
+	if($blog_id>1){
112
+		$file_name = $blog_id."_".$file_name;
113
+	}
114
+
115
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
116
+
117
+
118
+	global $wp_filesystem;
119
+	if (empty($wp_filesystem)) {
120
+		require_once (ABSPATH . '/wp-admin/includes/file.php');
121
+		WP_Filesystem();
122
+	}
123
+	$wp_filesystem->put_contents(
124
+		$file_path.$file_name.".json",
125
+		$map_json,
126
+		FS_CHMOD_FILE // predefined mode settings for WP files
127
+	);
128
+
129
+
130
+	return $map_json;
131 131
 
132 132
 }
133 133
 
134 134
 
135 135
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
136
-    global $gd_session;
137
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
138
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
139
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
140
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
141
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
142
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
143
-    die;
136
+	global $gd_session;
137
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
138
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
139
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
140
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
141
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
142
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
143
+	die;
144 144
 }
145 145
 
146 146
 // Send the content-type header with correct encoding
147 147
 header("Content-type: text/javascript; charset=utf-8");
148 148
 
149 149
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
150
-    echo get_markers();
151
-    exit;
150
+	echo get_markers();
151
+	exit;
152 152
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
153
-    /**
154
-     * @global object $wpdb WordPress Database object.
155
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
156
-     * @global object $gd_session GeoDirectory Session object.
157
-     */
158
-    global $wpdb, $plugin_prefix, $gd_session;
159
-
160
-    if ($_REQUEST['m_id'] != '') {
161
-        $pid = (int)$_REQUEST['m_id'];
162
-    } else {
163
-        echo __('No marker data found', 'geodirectory');
164
-        exit;
165
-    }
166
-
167
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
168
-        $post = (object)$gd_ses_listing;
169
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
170
-    } else {
171
-        $geodir_post_type = get_post_type($pid);
172
-
173
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
174
-
175
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
176
-
177
-        $postinfo = $wpdb->get_results($sql);
178
-
179
-        $data_arr = array();
180
-
181
-        if ($postinfo) {
182
-            $srcharr = array("'", "/", "-", '"', '\\');
183
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
184
-
185
-            foreach ($postinfo as $postinfo_obj) {
186
-                echo geodir_get_infowindow_html($postinfo_obj);
187
-            }
188
-        }
189
-    }
190
-    exit;
153
+	/**
154
+	 * @global object $wpdb WordPress Database object.
155
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
156
+	 * @global object $gd_session GeoDirectory Session object.
157
+	 */
158
+	global $wpdb, $plugin_prefix, $gd_session;
159
+
160
+	if ($_REQUEST['m_id'] != '') {
161
+		$pid = (int)$_REQUEST['m_id'];
162
+	} else {
163
+		echo __('No marker data found', 'geodirectory');
164
+		exit;
165
+	}
166
+
167
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
168
+		$post = (object)$gd_ses_listing;
169
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
170
+	} else {
171
+		$geodir_post_type = get_post_type($pid);
172
+
173
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
174
+
175
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
176
+
177
+		$postinfo = $wpdb->get_results($sql);
178
+
179
+		$data_arr = array();
180
+
181
+		if ($postinfo) {
182
+			$srcharr = array("'", "/", "-", '"', '\\');
183
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
184
+
185
+			foreach ($postinfo as $postinfo_obj) {
186
+				echo geodir_get_infowindow_html($postinfo_obj);
187
+			}
188
+		}
189
+	}
190
+	exit;
191 191
 }
192 192
 
193 193
 /**
@@ -206,93 +206,93 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function get_markers() {
208 208
     
209
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
209
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
210 210
 
211 211
 
212
-    /**
213
-     * Filter to allow for any map caching to be output before queries.
214
-     *
215
-     * @since 1.6.22
216
-     */
217
-    $map_cache = apply_filters('geodir_get_markers_cache','');
218
-    if($map_cache){
219
-        return $map_cache;
220
-        wp_die();
221
-    }
212
+	/**
213
+	 * Filter to allow for any map caching to be output before queries.
214
+	 *
215
+	 * @since 1.6.22
216
+	 */
217
+	$map_cache = apply_filters('geodir_get_markers_cache','');
218
+	if($map_cache){
219
+		return $map_cache;
220
+		wp_die();
221
+	}
222 222
 
223 223
 
224 224
 
225
-    $search = '';
225
+	$search = '';
226 226
 
227
-    $srcharr = array("'", "/", "-", '"', '\\', '&#39;');
228
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
227
+	$srcharr = array("'", "/", "-", '"', '\\', '&#39;');
228
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
229 229
 
230
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
230
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
231 231
 
232
-    $map_cat_ids_array = array('0');
233
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
232
+	$map_cat_ids_array = array('0');
233
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
234 234
 
235 235
 
236
-    $field_default_cat = '';
237
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
238
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
236
+	$field_default_cat = '';
237
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
238
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
239 239
 
240
-        if (!empty($map_cat_arr)) {
241
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
240
+		if (!empty($map_cat_arr)) {
241
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
242 242
 
243
-            $map_cat_ids_array = explode(',', $map_cat_arr);
244
-            $cat_find_array = array();
245
-            foreach ($map_cat_ids_array as $cat_id) {
246
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
247
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
248
-                $main_query_array[] = $cat_id;
249
-            }
243
+			$map_cat_ids_array = explode(',', $map_cat_arr);
244
+			$cat_find_array = array();
245
+			foreach ($map_cat_ids_array as $cat_id) {
246
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
247
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
248
+				$main_query_array[] = $cat_id;
249
+			}
250 250
 
251
-        }
252
-    }
251
+		}
252
+	}
253 253
 
254
-    if (!empty($field_default_cat))
255
-        $field_default_cat = '';
254
+	if (!empty($field_default_cat))
255
+		$field_default_cat = '';
256 256
 
257
-    if (!empty($cat_find_array))
258
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
257
+	if (!empty($cat_find_array))
258
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
259 259
 
260
-    $main_query_array = $map_cat_ids_array;
260
+	$main_query_array = $map_cat_ids_array;
261 261
   
262
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
263
-        $search .= " AND p.post_title LIKE %s";
264
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
265
-    }
266
-
267
-    /**
268
-     * Filter the marker query search SQL, values are replaces with %s or %d.
269
-     *
270
-     * @since 1.5.3
271
-     *
272
-     * @param string $search The SQL query for search/where.
273
-     */
274
-    $search = apply_filters('geodir_marker_search', $search);
275
-    /**
276
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
277
-     *
278
-     * @since 1.5.3
279
-     *
280
-     * @param array $main_query_array The SQL query values for search/where.
281
-     */
282
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
283
-
284
-    $gd_posttype = '';
285
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
286
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
287
-        $gd_posttype = " AND p.post_type = %s";
288
-        $main_query_array[] = $_REQUEST['gd_posttype'];
289
-
290
-    } else
291
-        $table = $plugin_prefix . 'gd_place_detail';
292
-
293
-    $join = ", " . $table . " AS pd ";
294
-
295
-    /**
262
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
263
+		$search .= " AND p.post_title LIKE %s";
264
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
265
+	}
266
+
267
+	/**
268
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
269
+	 *
270
+	 * @since 1.5.3
271
+	 *
272
+	 * @param string $search The SQL query for search/where.
273
+	 */
274
+	$search = apply_filters('geodir_marker_search', $search);
275
+	/**
276
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
277
+	 *
278
+	 * @since 1.5.3
279
+	 *
280
+	 * @param array $main_query_array The SQL query values for search/where.
281
+	 */
282
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
283
+
284
+	$gd_posttype = '';
285
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
286
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
287
+		$gd_posttype = " AND p.post_type = %s";
288
+		$main_query_array[] = $_REQUEST['gd_posttype'];
289
+
290
+	} else
291
+		$table = $plugin_prefix . 'gd_place_detail';
292
+
293
+	$join = ", " . $table . " AS pd ";
294
+
295
+	/**
296 296
 	 * Filter the SQL JOIN clause for the markers data
297 297
 	 *
298 298
 	 * @since 1.0.0
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
 	 * @param string $search Row of searched fields to use in WHERE clause.
310 310
 	 */
311 311
 	$search = apply_filters('geodir_home_map_listing_where', $search);
312
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
313
-    $cat_type = $post_type . 'category';
314
-    if ($post_type == 'gd_event') {
315
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
316
-    } else {
317
-        $event_select = "";
318
-    }
319
-
320
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
321
-    /**
312
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
313
+	$cat_type = $post_type . 'category';
314
+	if ($post_type == 'gd_event') {
315
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
316
+	} else {
317
+		$event_select = "";
318
+	}
319
+
320
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
321
+	/**
322 322
 	 * Filter the SQL SELECT clause to retrive fields data
323 323
 	 *
324 324
 	 * @since 1.0.0
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
339 339
 
340
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
340
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
341 341
     
342 342
 	/**
343 343
 	 * Filter the SQL query to retrive markers data
@@ -353,276 +353,276 @@  discard block
 block discarded – undo
353 353
 //    print_r($gd_session);
354 354
 //    print_r($_SESSION);
355 355
 
356
-    $catinfo = $wpdb->get_results($catsql);
356
+	$catinfo = $wpdb->get_results($catsql);
357 357
 	
358
-    $cat_content_info = array();
359
-    $content_data = array();
360
-    $post_ids = array();
361
-
362
-    /**
363
-     * Called before marker data is processed into JSON.
364
-     *
365
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
366
-     *
367
-     * @since 1.5.3
368
-     * @param object $catinfo The posts object containing all marker data.
369
-     * @see 'geodir_after_marker_post_process'
370
-     */
371
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
372
-
373
-    /**
374
-     * Called before marker data is processed into JSON.
375
-     *
376
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
377
-     *
378
-     * @since 1.4.9
379
-     * @param object $catinfo The posts object containing all marker data.
380
-     * @see 'geodir_after_marker_post_process'
381
-     */
382
-    do_action('geodir_before_marker_post_process_action', $catinfo);
383
-
384
-    // Sort any posts into a ajax array
385
-    if (!empty($catinfo)) {
386
-        $geodir_cat_icons = geodir_get_term_icon();
387
-        global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
388
-
389
-        $today = strtotime(date_i18n('Y-m-d'));
390
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
358
+	$cat_content_info = array();
359
+	$content_data = array();
360
+	$post_ids = array();
361
+
362
+	/**
363
+	 * Called before marker data is processed into JSON.
364
+	 *
365
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
366
+	 *
367
+	 * @since 1.5.3
368
+	 * @param object $catinfo The posts object containing all marker data.
369
+	 * @see 'geodir_after_marker_post_process'
370
+	 */
371
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
372
+
373
+	/**
374
+	 * Called before marker data is processed into JSON.
375
+	 *
376
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
377
+	 *
378
+	 * @since 1.4.9
379
+	 * @param object $catinfo The posts object containing all marker data.
380
+	 * @see 'geodir_after_marker_post_process'
381
+	 */
382
+	do_action('geodir_before_marker_post_process_action', $catinfo);
383
+
384
+	// Sort any posts into a ajax array
385
+	if (!empty($catinfo)) {
386
+		$geodir_cat_icons = geodir_get_term_icon();
387
+		global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
388
+
389
+		$today = strtotime(date_i18n('Y-m-d'));
390
+		$show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
391 391
         
392
-        foreach ($catinfo as $catinfo_obj) {
393
-            $post_title = $catinfo_obj->post_title;
392
+		foreach ($catinfo as $catinfo_obj) {
393
+			$post_title = $catinfo_obj->post_title;
394 394
             
395
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
396
-                $event_dates = '';
397
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
395
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
396
+				$event_dates = '';
397
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
398 398
 
399
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
399
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
400 400
                 
401
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
402
-                    $starttimes = '';
403
-                    $endtimes = '';
404
-                    $astarttimes = array();
405
-                    $aendtimes = array();
406
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
407
-                        $recurring_data['repeat_type'] = 'custom';
408
-                    }
409
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
410
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
401
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
402
+					$starttimes = '';
403
+					$endtimes = '';
404
+					$astarttimes = array();
405
+					$aendtimes = array();
406
+					if ( !isset( $recurring_data['repeat_type'] ) ) {
407
+						$recurring_data['repeat_type'] = 'custom';
408
+					}
409
+					$repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
410
+					$different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
411 411
         
412
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
412
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
413 413
                     
414
-                    if ( !empty( $recurring_dates ) ) {
415
-                        if ( empty( $recurring_data['all_day'] ) ) {
416
-                            if ( $repeat_type == 'custom' && $different_times ) {
417
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
418
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
419
-                            } else {
420
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
421
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
422
-                            }
423
-                        }
414
+					if ( !empty( $recurring_dates ) ) {
415
+						if ( empty( $recurring_data['all_day'] ) ) {
416
+							if ( $repeat_type == 'custom' && $different_times ) {
417
+								$astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
418
+								$aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
419
+							} else {
420
+								$starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
421
+								$endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
422
+							}
423
+						}
424 424
                         
425
-                        $e = 0;
426
-                        foreach( $recurring_dates as $key => $date ) {
427
-                            if ( $repeat_type == 'custom' && $different_times ) {
428
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
429
-                                    $starttimes = $astarttimes[$key];
430
-                                    $endtimes = $aendtimes[$key];
431
-                                } else {
432
-                                    $starttimes = '';
433
-                                    $endtimes = '';
434
-                                }
435
-                            }
425
+						$e = 0;
426
+						foreach( $recurring_dates as $key => $date ) {
427
+							if ( $repeat_type == 'custom' && $different_times ) {
428
+								if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
429
+									$starttimes = $astarttimes[$key];
430
+									$endtimes = $aendtimes[$key];
431
+								} else {
432
+									$starttimes = '';
433
+									$endtimes = '';
434
+								}
435
+							}
436 436
                             
437
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
438
-                            $duration--;
439
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
437
+							$duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
438
+							$duration--;
439
+							$enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
440 440
                             
441
-                            // Hide past dates
442
-                            if ( strtotime( $enddate ) < $today ) {
443
-                                continue;
444
-                            }
441
+							// Hide past dates
442
+							if ( strtotime( $enddate ) < $today ) {
443
+								continue;
444
+							}
445 445
                                     
446
-                            $sdate = strtotime( $date . ' ' . $starttimes );
447
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
446
+							$sdate = strtotime( $date . ' ' . $starttimes );
447
+							$edate = strtotime( $enddate . ' ' . $endtimes );
448 448
                                         
449
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
450
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
449
+							$start_date = date_i18n( $geodir_date_time_format, $sdate );
450
+							$end_date = date_i18n( $geodir_date_time_format, $edate );
451 451
                             
452
-                            $same_day = false;
453
-                            $full_day = false;
454
-                            $same_datetime = false;
452
+							$same_day = false;
453
+							$full_day = false;
454
+							$same_datetime = false;
455 455
                             
456
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
457
-                                $full_day = true;
458
-                            }
456
+							if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
457
+								$full_day = true;
458
+							}
459 459
                             
460
-                            if ( $start_date == $end_date && $full_day ) {
461
-                                $same_datetime = true;
462
-                            }
463
-
464
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
465
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
466
-                            if ( $full_day ) {
467
-                                $start_date = $title_date;
468
-                                $end_date = date_i18n( $geodir_date_format, $edate );
469
-                            }
460
+							if ( $start_date == $end_date && $full_day ) {
461
+								$same_datetime = true;
462
+							}
463
+
464
+							$link_date = date_i18n( 'Y-m-d', $sdate );
465
+							$title_date = date_i18n( $geodir_date_format, $sdate );
466
+							if ( $full_day ) {
467
+								$start_date = $title_date;
468
+								$end_date = date_i18n( $geodir_date_format, $edate );
469
+							}
470 470
                             
471
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
472
-                                $same_day = true;
471
+							if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
472
+								$same_day = true;
473 473
                                 
474
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
475
-                            }
474
+								$start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
475
+							}
476 476
                             
477
-                            $event_dates .= ' :: ' . $start_date;
477
+							$event_dates .= ' :: ' . $start_date;
478 478
                         
479
-                            if ( !$same_day && !$same_datetime ) {
480
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
481
-                            }
479
+							if ( !$same_day && !$same_datetime ) {
480
+								$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
481
+							}
482 482
                             
483
-                            $e++;
483
+							$e++;
484 484
                             
485
-                            if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
486
-                                break;
487
-                            }
488
-                        }
489
-                    }
490
-                } else {
491
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
492
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
493
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
494
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
495
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
485
+							if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
486
+								break;
487
+							}
488
+						}
489
+					}
490
+				} else {
491
+					$start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
492
+					$end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
493
+					$all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
494
+					$starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
495
+					$endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
496 496
                 
497
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
498
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
499
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
497
+					$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
498
+					$starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
499
+					$endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
500 500
                     
501
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
502
-                        $start_date = $event_recurring_dates[0];
503
-                    }
501
+					if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
502
+						$start_date = $event_recurring_dates[0];
503
+					}
504 504
                                 
505
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
506
-                        $end_date = $start_date;
507
-                    }
505
+					if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
506
+						$end_date = $start_date;
507
+					}
508 508
                     
509
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
510
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
511
-                            $starttime = $starttimes[0];
512
-                            $endtime = $endtimes[0];
513
-                        }
509
+					if ($end_date != '' && strtotime($end_date) >= $today) {
510
+						if ( $starttime == '' && !empty( $starttimes ) ) {
511
+							$starttime = $starttimes[0];
512
+							$endtime = $endtimes[0];
513
+						}
514 514
                         
515
-                        $same_day = false;
516
-                        $one_day = false;
517
-                        if ( $start_date == $end_date && $all_day ) {
518
-                            $one_day = true;
519
-                        }
520
-
521
-                        if ( $all_day ) {
522
-                            $start_datetime = strtotime( $start_date );
523
-                            $end_datetime = strtotime( $end_date );
515
+						$same_day = false;
516
+						$one_day = false;
517
+						if ( $start_date == $end_date && $all_day ) {
518
+							$one_day = true;
519
+						}
520
+
521
+						if ( $all_day ) {
522
+							$start_datetime = strtotime( $start_date );
523
+							$end_datetime = strtotime( $end_date );
524 524
                             
525
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
526
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
527
-                            if ( $start_date == $end_date ) {
528
-                                $one_day = true;
529
-                            }
530
-                        } else {
531
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
532
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
533
-                                $one_day = false;
534
-                            }
535
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
536
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
525
+							$start_date = date_i18n( $geodir_date_format, $start_datetime );
526
+							$end_date = date_i18n( $geodir_date_format, $end_datetime );
527
+							if ( $start_date == $end_date ) {
528
+								$one_day = true;
529
+							}
530
+						} else {
531
+							if ( $start_date == $end_date && $starttime == $endtime ) {
532
+								$end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
533
+								$one_day = false;
534
+							}
535
+							$start_datetime = strtotime( $start_date . ' ' . $starttime );
536
+							$end_datetime = strtotime( $end_date . ' ' . $endtime );
537 537
                             
538
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
539
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
540
-                        }
538
+							$start_date = date_i18n( $geodir_date_time_format, $start_datetime );
539
+							$end_date = date_i18n( $geodir_date_time_format, $end_datetime );
540
+						}
541 541
 
542
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
543
-                            $same_day = true;
542
+						if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
543
+							$same_day = true;
544 544
                             
545
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
546
-                        }
545
+							$start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
546
+						}
547 547
                         
548
-                        $event_dates .= ' :: ' . $start_date;
548
+						$event_dates .= ' :: ' . $start_date;
549 549
                         
550
-                        if ( !$same_day && !$one_day ) {
551
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
552
-                        }
553
-                    }
554
-                }
555
-
556
-                if (empty($event_dates)) {
557
-                    continue;
558
-                }
550
+						if ( !$same_day && !$one_day ) {
551
+							$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
552
+						}
553
+					}
554
+				}
555
+
556
+				if (empty($event_dates)) {
557
+					continue;
558
+				}
559 559
                 
560
-                $post_title .= $event_dates;
561
-            }
560
+				$post_title .= $event_dates;
561
+			}
562 562
 
563
-            $map_cat_ids_array;
564
-            $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
563
+			$map_cat_ids_array;
564
+			$default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
565 565
 
566
-            // if single cat lets just show that icon
567
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
568
-                $default_cat = (int)$map_cat_ids_array[0];
569
-            }
566
+			// if single cat lets just show that icon
567
+			if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
568
+				$default_cat = (int)$map_cat_ids_array[0];
569
+			}
570 570
 
571
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
572
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
573
-            $title = str_replace($srcharr, $replarr, $post_title);
571
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
572
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
573
+			$title = str_replace($srcharr, $replarr, $post_title);
574 574
             
575
-            if ($icon != '') {
576
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
575
+			if ($icon != '') {
576
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
577 577
                 
578
-                if (isset($gd_marker_sizes[$icon])) {
579
-                    $icon_size = $gd_marker_sizes[$icon];
580
-                } else {
581
-                    $icon_size = geodir_get_marker_size($icon);
582
-                    $gd_marker_sizes[$icon] = $icon_size;
583
-                }               
584
-            } else {
585
-                $icon_size = array('w' => 36, 'h' => 45);
586
-            }
587
-
588
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
589
-            $post_ids[] = $catinfo_obj->post_id;
590
-        }
591
-    }
592
-
593
-    /**
594
-     * Called after marker data is processed into JSON.
595
-     *
596
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
597
-     *
598
-     * @since 1.4.9
599
-     * @param array $content_data The array containing all markers in JSON format.
600
-     * @param object $catinfo The posts object containing all marker data.
601
-     * @see 'geodir_before_marker_post_process'
602
-     */
603
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
604
-
605
-    if (!empty($content_data)) {
606
-        $cat_content_info[] = implode(',', $content_data);
607
-    }
608
-
609
-    $totalcount = count(array_unique($post_ids));
610
-
611
-    if (!empty($cat_content_info)) {
612
-        $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
613
-    }
614
-    else {
615
-        $map_json =  '[{"totalcount":"0"}]';
616
-    }
617
-
618
-
619
-    /**
620
-     * Filter the marker json return.
621
-     *
622
-     * @since 1.6.22
623
-     * @param string $map_json The JSON string of the map markers results.
624
-     */
625
-    return apply_filters('geodir_markers_json',$map_json);
578
+				if (isset($gd_marker_sizes[$icon])) {
579
+					$icon_size = $gd_marker_sizes[$icon];
580
+				} else {
581
+					$icon_size = geodir_get_marker_size($icon);
582
+					$gd_marker_sizes[$icon] = $icon_size;
583
+				}               
584
+			} else {
585
+				$icon_size = array('w' => 36, 'h' => 45);
586
+			}
587
+
588
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
589
+			$post_ids[] = $catinfo_obj->post_id;
590
+		}
591
+	}
592
+
593
+	/**
594
+	 * Called after marker data is processed into JSON.
595
+	 *
596
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
597
+	 *
598
+	 * @since 1.4.9
599
+	 * @param array $content_data The array containing all markers in JSON format.
600
+	 * @param object $catinfo The posts object containing all marker data.
601
+	 * @see 'geodir_before_marker_post_process'
602
+	 */
603
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
604
+
605
+	if (!empty($content_data)) {
606
+		$cat_content_info[] = implode(',', $content_data);
607
+	}
608
+
609
+	$totalcount = count(array_unique($post_ids));
610
+
611
+	if (!empty($cat_content_info)) {
612
+		$map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
613
+	}
614
+	else {
615
+		$map_json =  '[{"totalcount":"0"}]';
616
+	}
617
+
618
+
619
+	/**
620
+	 * Filter the marker json return.
621
+	 *
622
+	 * @since 1.6.22
623
+	 * @param string $map_json The JSON string of the map markers results.
624
+	 */
625
+	return apply_filters('geodir_markers_json',$map_json);
626 626
 }
627 627
 
628 628
 
Please login to merge, or discard this patch.